2
0
Эх сурвалжийг харах

Little tweaks and updated builds.

Mr.doob 13 жил өмнө
parent
commit
89bb6b6f02

+ 392 - 402
build/Three.js

@@ -1,8 +1,8 @@
 // Three.js - http://github.com/mrdoob/three.js
-'use strict';var THREE=THREE||{REVISION:"49"};self.Int32Array||(self.Int32Array=Array,self.Float32Array=Array);
+'use strict';var THREE=THREE||{REVISION:"50dev"};self.console||(self.console={info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}});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=Date.now(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
 function(a){clearTimeout(a)}})();THREE.Clock=function(a){this.autoStart=a!==void 0?a:true;this.elapsedTime=this.oldTime=this.startTime=0;this.running=false};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=true};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=false};THREE.Clock.prototype.getElapsedTime=function(){return this.elapsedTime=this.elapsedTime+this.getDelta()};
-THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime=this.elapsedTime+a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
+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=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,e,f;if(c===0)this.r=this.g=this.b=0;else{d=Math.floor(a*6);e=a*6-d;a=c*(1-b);f=c*(1-b*e);b=c*(1-b*(1-e));switch(d){case 1:this.r=f;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=f;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=f;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},lerpSelf:function(a,b){this.r=this.r+(a.r-this.r)*b;this.g=this.g+(a.g-this.g)*b;this.b=this.b+(a.b-this.b)*b;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)}};
@@ -14,53 +14,54 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 a;this.z=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=this.x-a.x;this.y=this.y-a.y;this.z=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=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
 this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else 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=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=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.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],k=d[9],l=d[2],o=d[6],d=d[10];switch(b||"XYZ"){case "YXZ":this.x=Math.asin(-c(k));if(Math.abs(k)<0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,i)}else{this.y=Math.atan2(-l,e);this.z=0}break;case "ZXY":this.x=Math.asin(c(o));if(Math.abs(o)<
-0.99999){this.y=Math.atan2(-l,d);this.z=Math.atan2(-f,i)}else{this.y=0;this.z=Math.atan2(g,e)}break;case "ZYX":this.y=Math.asin(-c(l));if(Math.abs(l)<0.99999){this.x=Math.atan2(o,d);this.z=Math.atan2(h,e)}else{this.x=0;this.z=Math.atan2(-f,i)}break;case "YZX":this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-k,i);this.y=Math.atan2(-l,e)}else{this.x=0;this.y=Math.atan2(l,d)}break;case "XZY":this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(o,i);this.y=Math.atan2(g,e)}else{this.x=
-Math.atan2(-g,d);this.y=0}break;default:this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-k,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(h,i);this.z=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;switch(b){case "YXZ":this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f);break;case "ZXY":this.x=Math.asin(c(2*
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],j=d[9],l=d[2],o=d[6],d=d[10];switch(b||"XYZ"){case "YXZ":this.x=Math.asin(-c(j));if(Math.abs(j)<0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,i)}else{this.y=Math.atan2(-l,e);this.z=0}break;case "ZXY":this.x=Math.asin(c(o));if(Math.abs(o)<
+0.99999){this.y=Math.atan2(-l,d);this.z=Math.atan2(-f,i)}else{this.y=0;this.z=Math.atan2(g,e)}break;case "ZYX":this.y=Math.asin(-c(l));if(Math.abs(l)<0.99999){this.x=Math.atan2(o,d);this.z=Math.atan2(h,e)}else{this.x=0;this.z=Math.atan2(-f,i)}break;case "YZX":this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-j,i);this.y=Math.atan2(-l,e)}else{this.x=0;this.y=Math.atan2(l,d)}break;case "XZY":this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(o,i);this.y=Math.atan2(g,e)}else{this.x=
+Math.atan2(-g,d);this.y=0}break;default:this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-j,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(h,i);this.z=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;switch(b){case "YXZ":this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f);break;case "ZXY":this.x=Math.asin(c(2*
 (a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f);break;case "ZYX":this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f);break;case "YZX":this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)));break;case "XZY":this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f);this.y=Math.atan2(2*
 (a.x*a.z+a.y*a.w),g+d-e-f);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)));break;default:this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).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},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};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},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=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=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=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{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=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
-a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var k=a[10];if(Math.abs(d-g)<0.01&&Math.abs(f-c)<0.01&&Math.abs(i-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(f+c)<0.1&&Math.abs(i+b)<0.1&&Math.abs(e+h+k-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;h=(h+1)/2;k=(k+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;if(e>h&&e>k)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(h>
-k)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=i/c}else if(k<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(k);b=f/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.0010&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+k-1)/2);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,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],h=d[5],i=d[6],k=d[7],l=d[8],o=d[9],m=d[10],p=d[11],q=d[12],n=d[13],r=d[14],d=d[15];c[0].set(f-a,k-g,p-l,d-q);c[1].set(f+a,k+g,p+l,d+q);c[2].set(f+b,k+h,p+o,d+n);c[3].set(f-b,k-h,p-o,d-n);c[4].set(f-e,k-i,p-m,d-r);c[5].set(f+e,k+i,p+m,d+r);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))}};
+a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(Math.abs(d-g)<0.01&&Math.abs(f-c)<0.01&&Math.abs(i-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(f+c)<0.1&&Math.abs(i+b)<0.1&&Math.abs(e+h+j-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;if(e>h&&e>j)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(h>
+j)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=i/c}else if(j<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(j);b=f/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};
+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.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,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],h=d[5],i=d[6],j=d[7],l=d[8],o=d[9],m=d[10],p=d[11],r=d[12],n=d[13],q=d[14],d=d[15];c[0].set(f-a,j-g,p-l,d-r);c[1].set(f+a,j+g,p+l,d+r);c[2].set(f+b,j+h,p+o,d+n);c[3].set(f-b,j-h,p-o,d-n);c[4].set(f-e,j-i,p-m,d-q);c[5].set(f+e,j+i,p+m,d+q);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=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){q.sub(c,a);u=q.dot(b);t=n.add(a,r.copy(b).multiplyScalar(u));return y=c.distanceTo(t)}function d(a,b,c,d){q.sub(d,b);n.sub(c,b);r.sub(a,b);s=q.dot(q);w=q.dot(n);H=q.dot(r);E=n.dot(n);z=n.dot(r);v=1/(s*E-w*w);A=(E*H-w*z)*v;J=(s*z-w*H)*v;return A>=0&&J>=0&&A+J<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,
-k=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,p=new THREE.Vector3;this.intersectObject=function(a){var b,n=[];if(a instanceof THREE.Particle){var q=c(this.origin,this.direction,a.matrixWorld.getPosition());if(q>a.scale.x)return[];b={distance:q,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){var q=c(this.origin,this.direction,a.matrixWorld.getPosition()),r=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
-a.matrixWorld.getColumnZ().length());if(q>a.geometry.boundingSphere.radius*Math.max(r.x,Math.max(r.y,r.z)))return n;var s,j,t=a.geometry,u=t.vertices,C;a.matrixRotationWorld.extractRotation(a.matrixWorld);q=0;for(r=t.faces.length;q<r;q++){b=t.faces[q];k.copy(this.origin);l.copy(this.direction);C=a.matrixWorld;o=C.multiplyVector3(o.copy(b.centroid)).subSelf(k);m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal));s=l.dot(m);if(!(Math.abs(s)<e)){j=m.dot(o)/s;if(!(j<0)&&(a.doubleSided||(a.flipSided?
-s>0:s<0))){p.add(k,l.multiplyScalar(j));if(b instanceof THREE.Face3){f=C.multiplyVector3(f.copy(u[b.a]));g=C.multiplyVector3(g.copy(u[b.b]));h=C.multiplyVector3(h.copy(u[b.c]));if(d(p,f,g,h)){b={distance:k.distanceTo(p),point:p.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){f=C.multiplyVector3(f.copy(u[b.a]));g=C.multiplyVector3(g.copy(u[b.b]));h=C.multiplyVector3(h.copy(u[b.c]));i=C.multiplyVector3(i.copy(u[b.d]));if(d(p,f,g,i)||d(p,g,h,i)){b={distance:k.distanceTo(p),point:p.clone(),
-face:b,object:a};n.push(b)}}}}}}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var q=new THREE.Vector3,n=new THREE.Vector3,r=new THREE.Vector3,u,t,y,s,w,H,E,z,v,A,J};
+THREE.Ray=function(a,b){function c(a,b,c){n.sub(c,a);t=n.dot(b);y=q.add(a,u.copy(b).multiplyScalar(t));return s=c.distanceTo(y)}function d(a,b,c,d){n.sub(d,b);q.sub(c,b);u.sub(a,b);x=n.dot(n);E=n.dot(q);D=n.dot(u);A=q.dot(q);v=q.dot(u);H=1/(x*A-E*E);I=(A*D-E*v)*H;M=(x*v-E*D)*H;return I>=0&&M>=0&&I+M<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,
+j=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3,m=new THREE.Vector3,p=new THREE.Vector3,r=function(a,b){return a.distance-b.distance};this.intersectObject=function(a){var b,n=[];if(a instanceof THREE.Particle){var q=c(this.origin,this.direction,a.matrixWorld.getPosition());if(q>a.scale.x)return[];b={distance:q,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){var q=c(this.origin,this.direction,a.matrixWorld.getPosition()),s=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),
+a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(q>a.geometry.boundingSphere.radius*Math.max(s.x,Math.max(s.y,s.z)))return n;var t,k,u=a.geometry,v=u.vertices,S;a.matrixRotationWorld.extractRotation(a.matrixWorld);q=0;for(s=u.faces.length;q<s;q++){b=u.faces[q];j.copy(this.origin);l.copy(this.direction);S=a.matrixWorld;o=S.multiplyVector3(o.copy(b.centroid)).subSelf(j);m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal));t=l.dot(m);if(!(Math.abs(t)<e)){k=m.dot(o)/t;
+if(!(k<0)&&(a.doubleSided||(a.flipSided?t>0:t<0))){p.add(j,l.multiplyScalar(k));if(b instanceof THREE.Face3){f=S.multiplyVector3(f.copy(v[b.a]));g=S.multiplyVector3(g.copy(v[b.b]));h=S.multiplyVector3(h.copy(v[b.c]));if(d(p,f,g,h)){b={distance:j.distanceTo(p),point:p.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){f=S.multiplyVector3(f.copy(v[b.a]));g=S.multiplyVector3(g.copy(v[b.b]));h=S.multiplyVector3(h.copy(v[b.c]));i=S.multiplyVector3(i.copy(v[b.d]));if(d(p,f,g,i)||d(p,
+g,h,i)){b={distance:j.distanceTo(p),point:p.clone(),face:b,object:a};n.push(b)}}}}}}n.sort(r);return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(r);return b};var n=new THREE.Vector3,q=new THREE.Vector3,u=new THREE.Vector3,t,y,s,x,E,D,A,v,H,I,M};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,o){h=false;b=f;c=g;d=l;e=o;a()};this.addPoint=function(f,g){if(h){h=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:g;d=d>f?d:f;e=e>g?
 e:g}a()};this.add3Points=function(f,g,l,o,m,p){if(h){h=false;b=f<l?f<m?f:m:l<m?l:m;c=g<o?g<p?g:p:o<p?o:p;d=f>l?f>m?f:m:l>m?l:m;e=g>o?g>p?g:p:o>p?o:p}else{b=f<l?f<m?f<b?f:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b;c=g<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=f>l?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d;e=g>o?g>p?g>e?g:e:p>e?p:e:o>p?o>e?o:e:p>e?p:e}a()};this.addRectangle=function(f){if(h){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
 d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){h=true;e=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,e){return d+(a-b)*(e-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.elements=new Float32Array(9)};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],i=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*i;l[8]=b*k;return this},
-transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},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,e,f,g,h,i,k,l,o,m,p,q,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,i||0,k||0,l!==void 0?l:1,o||0,m||0,p||0,q||0,n!==void 0?n:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,k,l,o,m,p,q,n){var r=this.elements;r[0]=a;r[4]=b;r[8]=c;r[12]=d;r[1]=e;r[5]=f;r[9]=g;r[13]=h;r[2]=i;r[6]=k;r[10]=l;r[14]=o;r[3]=m;r[7]=p;r[11]=q;r[15]=n;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){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],k=c[1],l=c[5],o=c[9],m=c[13],p=c[2],q=c[6],n=c[10],r=c[14],u=c[3],t=c[7],y=c[11],c=c[15],s=d[0],w=d[4],
-H=d[8],E=d[12],z=d[1],v=d[5],A=d[9],J=d[13],K=d[2],R=d[6],P=d[10],D=d[14],M=d[3],G=d[7],j=d[11],d=d[15];e[0]=f*s+g*z+h*K+i*M;e[4]=f*w+g*v+h*R+i*G;e[8]=f*H+g*A+h*P+i*j;e[12]=f*E+g*J+h*D+i*d;e[1]=k*s+l*z+o*K+m*M;e[5]=k*w+l*v+o*R+m*G;e[9]=k*H+l*A+o*P+m*j;e[13]=k*E+l*J+o*D+m*d;e[2]=p*s+q*z+n*K+r*M;e[6]=p*w+q*v+n*R+r*G;e[10]=p*H+q*A+n*P+r*j;e[14]=p*E+q*J+n*D+r*d;e[3]=u*s+t*z+y*K+c*M;e[7]=u*w+t*v+y*R+c*G;e[11]=u*H+t*A+y*P+c*j;e[15]=u*E+t*J+y*D+c*d;return this},multiplySelf:function(a){return this.multiply(this,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],i=-b[9]*b[0]+b[1]*b[8],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*i;l[8]=b*j;return this},
+transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},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,e,f,g,h,i,j,l,o,m,p,r,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,i||0,j||0,l!==void 0?l:1,o||0,m||0,p||0,r||0,n!==void 0?n:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,l,o,m,p,r,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=j;q[10]=l;q[14]=o;q[3]=m;q[7]=p;q[11]=r;q[15]=n;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){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],l=c[5],o=c[9],m=c[13],p=c[2],r=c[6],n=c[10],q=c[14],u=c[3],t=c[7],y=c[11],c=c[15],s=d[0],x=d[4],
+E=d[8],D=d[12],A=d[1],v=d[5],H=d[9],I=d[13],M=d[2],R=d[6],Z=d[10],B=d[14],G=d[3],Q=d[7],C=d[11],d=d[15];e[0]=f*s+g*A+h*M+i*G;e[4]=f*x+g*v+h*R+i*Q;e[8]=f*E+g*H+h*Z+i*C;e[12]=f*D+g*I+h*B+i*d;e[1]=j*s+l*A+o*M+m*G;e[5]=j*x+l*v+o*R+m*Q;e[9]=j*E+l*H+o*Z+m*C;e[13]=j*D+l*I+o*B+m*d;e[2]=p*s+r*A+n*M+q*G;e[6]=p*x+r*v+n*R+q*Q;e[10]=p*E+r*H+n*Z+q*C;e[14]=p*D+r*I+n*B+q*d;e[3]=u*s+t*A+y*M+c*G;e[7]=u*x+t*v+y*R+c*Q;e[11]=u*E+t*H+y*Z+c*C;e[15]=u*D+t*I+y*B+c*d;return this},multiplySelf:function(a){return this.multiply(this,
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
-d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],k=a[2],l=a[6],o=a[10],m=a[14],p=a[3],q=a[7],
-n=a[11],a=a[15];return e*h*l*p-d*i*l*p-e*g*o*p+c*i*o*p+d*g*m*p-c*h*m*p-e*h*k*q+d*i*k*q+e*f*o*q-b*i*o*q-d*f*m*q+b*h*m*q+e*g*k*n-c*i*k*n-e*f*l*n+b*i*l*n+c*f*m*n-b*g*m*n-d*g*k*a+c*h*k*a+d*f*l*a-b*h*l*a-c*f*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
+d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],j=a[2],l=a[6],o=a[10],m=a[14],p=a[3],r=a[7],
+n=a[11],a=a[15];return e*h*l*p-d*i*l*p-e*g*o*p+c*i*o*p+d*g*m*p-c*h*m*p-e*h*j*r+d*i*j*r+e*f*o*r-b*i*o*r-d*f*m*r+b*h*m*r+e*g*j*n-c*i*j*n-e*f*l*n+b*i*l*n+c*f*m*n-b*g*m*n-d*g*j*a+c*h*j*a+d*f*l*a-b*h*l*a-c*f*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
 a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],
-a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],i=c[5],k=c[9],l=c[13],o=c[2],m=c[6],p=c[10],q=
-c[14],n=c[3],r=c[7],u=c[11],c=c[15];b[0]=k*q*r-l*p*r+l*m*u-i*q*u-k*m*c+i*p*c;b[4]=g*p*r-f*q*r-g*m*u+e*q*u+f*m*c-e*p*c;b[8]=f*l*r-g*k*r+g*i*u-e*l*u-f*i*c+e*k*c;b[12]=g*k*m-f*l*m-g*i*p+e*l*p+f*i*q-e*k*q;b[1]=l*p*n-k*q*n-l*o*u+h*q*u+k*o*c-h*p*c;b[5]=f*q*n-g*p*n+g*o*u-d*q*u-f*o*c+d*p*c;b[9]=g*k*n-f*l*n-g*h*u+d*l*u+f*h*c-d*k*c;b[13]=f*l*o-g*k*o+g*h*p-d*l*p-f*h*q+d*k*q;b[2]=i*q*n-l*m*n+l*o*r-h*q*r-i*o*c+h*m*c;b[6]=g*m*n-e*q*n-g*o*r+d*q*r+e*o*c-d*m*c;b[10]=e*l*n-g*i*n+g*h*r-d*l*r-e*h*c+d*i*c;b[14]=g*i*o-
-e*l*o-g*h*m+d*l*m+e*h*q-d*i*q;b[3]=k*m*n-i*p*n-k*o*r+h*p*r+i*o*u-h*m*u;b[7]=e*p*n-f*m*n+f*o*r-d*p*r-e*o*u+d*m*u;b[11]=f*i*n-e*k*n-f*h*r+d*k*r+e*h*u-d*i*u;b[15]=e*k*o-f*i*o+f*h*m-d*k*m-e*h*p+d*i*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var k=h*i,l=h*f,o=e*i,m=e*f;c[0]=k+m*d;c[4]=o*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*
-i;c[9]=-d;c[2]=l*d-o;c[6]=m+k*d;c[10]=g*h;break;case "ZXY":k=h*i;l=h*f;o=e*i;m=e*f;c[0]=k-m*d;c[4]=-g*f;c[8]=o+l*d;c[1]=l+o*d;c[5]=g*i;c[9]=m-k*d;c[2]=-g*e;c[6]=d;c[10]=g*h;break;case "ZYX":k=g*i;l=g*f;o=d*i;m=d*f;c[0]=h*i;c[4]=o*e-l;c[8]=k*e+m;c[1]=h*f;c[5]=m*e+k;c[9]=l*e-o;c[2]=-e;c[6]=d*h;c[10]=g*h;break;case "YZX":k=g*h;l=g*e;o=d*h;m=d*e;c[0]=h*i;c[4]=m-k*f;c[8]=o*f+l;c[1]=f;c[5]=g*i;c[9]=-d*i;c[2]=-e*i;c[6]=l*f+o;c[10]=k-m*f;break;case "XZY":k=g*h;l=g*e;o=d*h;m=d*e;c[0]=h*i;c[4]=-f;c[8]=e*i;
-c[1]=k*f+m;c[5]=g*i;c[9]=l*f-o;c[2]=o*f-l;c[6]=d*i;c[10]=m*f+k;break;default:k=g*i;l=g*f;o=d*i;m=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+o*e;c[5]=k-m*e;c[9]=-d*h;c[2]=m-k*e;c[6]=o+l*e;c[10]=g*h}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,k=c*h,c=c*i,l=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},compose:function(a,b,c){var d=this.elements,
+a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],i=c[5],j=c[9],l=c[13],o=c[2],m=c[6],p=c[10],r=
+c[14],n=c[3],q=c[7],u=c[11],c=c[15];b[0]=j*r*q-l*p*q+l*m*u-i*r*u-j*m*c+i*p*c;b[4]=g*p*q-f*r*q-g*m*u+e*r*u+f*m*c-e*p*c;b[8]=f*l*q-g*j*q+g*i*u-e*l*u-f*i*c+e*j*c;b[12]=g*j*m-f*l*m-g*i*p+e*l*p+f*i*r-e*j*r;b[1]=l*p*n-j*r*n-l*o*u+h*r*u+j*o*c-h*p*c;b[5]=f*r*n-g*p*n+g*o*u-d*r*u-f*o*c+d*p*c;b[9]=g*j*n-f*l*n-g*h*u+d*l*u+f*h*c-d*j*c;b[13]=f*l*o-g*j*o+g*h*p-d*l*p-f*h*r+d*j*r;b[2]=i*r*n-l*m*n+l*o*q-h*r*q-i*o*c+h*m*c;b[6]=g*m*n-e*r*n-g*o*q+d*r*q+e*o*c-d*m*c;b[10]=e*l*n-g*i*n+g*h*q-d*l*q-e*h*c+d*i*c;b[14]=g*i*o-
+e*l*o-g*h*m+d*l*m+e*h*r-d*i*r;b[3]=j*m*n-i*p*n-j*o*q+h*p*q+i*o*u-h*m*u;b[7]=e*p*n-f*m*n+f*o*q-d*p*q-e*o*u+d*m*u;b[11]=f*i*n-e*j*n-f*h*q+d*j*q+e*h*u-d*i*u;b[15]=e*j*o-f*i*o+f*h*m-d*j*m-e*h*p+d*i*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var j=h*i,l=h*f,o=e*i,m=e*f;c[0]=j+m*d;c[4]=o*d-l;c[8]=g*e;c[1]=g*f;c[5]=g*
+i;c[9]=-d;c[2]=l*d-o;c[6]=m+j*d;c[10]=g*h;break;case "ZXY":j=h*i;l=h*f;o=e*i;m=e*f;c[0]=j-m*d;c[4]=-g*f;c[8]=o+l*d;c[1]=l+o*d;c[5]=g*i;c[9]=m-j*d;c[2]=-g*e;c[6]=d;c[10]=g*h;break;case "ZYX":j=g*i;l=g*f;o=d*i;m=d*f;c[0]=h*i;c[4]=o*e-l;c[8]=j*e+m;c[1]=h*f;c[5]=m*e+j;c[9]=l*e-o;c[2]=-e;c[6]=d*h;c[10]=g*h;break;case "YZX":j=g*h;l=g*e;o=d*h;m=d*e;c[0]=h*i;c[4]=m-j*f;c[8]=o*f+l;c[1]=f;c[5]=g*i;c[9]=-d*i;c[2]=-e*i;c[6]=l*f+o;c[10]=j-m*f;break;case "XZY":j=g*h;l=g*e;o=d*h;m=d*e;c[0]=h*i;c[4]=-f;c[8]=e*i;
+c[1]=j*f+m;c[5]=g*i;c[9]=l*f-o;c[2]=o*f-l;c[6]=d*i;c[10]=m*f+j;break;default:j=g*i;l=g*f;o=d*i;m=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+o*e;c[5]=j-m*e;c[9]=-d*h;c[2]=m-j*e;c[6]=o+l*e;c[10]=g*h}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,j=c*h,c=c*i,l=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=j-f;b[8]=c+h;b[1]=j+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},compose:function(a,b,c){var d=this.elements,
 e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);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=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;
 b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
-d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*k;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*k-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*k;b[8]=l*g+a*c;b[9]=
-l*h+a*d;b[10]=l*i+a*e;b[11]=l*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],k=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*k;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
-e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,k=Math.cos(b),l=Math.sin(b),o=1-k,m=d*e*o,p=d*f*o,o=e*f*o,d=d*l,q=e*l,l=f*l,f=g+(1-g)*k,g=m+l,e=p-q,m=m-l,h=h+(1-h)*k,l=o+d,p=p+q,o=o-d,i=i+(1-i)*k,k=c[0],d=c[1],q=c[2],n=c[3],r=c[4],u=c[5],t=c[6],y=c[7],s=c[8],w=c[9],H=c[10],E=c[11];c[0]=f*k+g*r+e*s;c[1]=f*d+g*u+e*w;c[2]=f*q+g*t+e*H;c[3]=f*n+g*y+e*E;c[4]=m*k+h*r+l*s;c[5]=m*d+h*u+l*w;c[6]=m*q+h*t+l*H;c[7]=m*n+h*y+l*E;c[8]=p*k+o*r+i*s;c[9]=p*d+o*u+i*w;c[10]=p*q+o*t+i*H;c[11]=
-p*n+o*y+i*E;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
-makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-
-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
-b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
+d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*j;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*j-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*j;b[8]=l*g+a*c;b[9]=
+l*h+a*d;b[10]=l*i+a*e;b[11]=l*j+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*j;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*j-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
+e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,j=Math.cos(b),l=Math.sin(b),o=1-j,m=d*e*o,p=d*f*o,o=e*f*o,d=d*l,r=e*l,l=f*l,f=g+(1-g)*j,g=m+l,e=p-r,m=m-l,h=h+(1-h)*j,l=o+d,p=p+r,o=o-d,i=i+(1-i)*j,j=c[0],d=c[1],r=c[2],n=c[3],q=c[4],u=c[5],t=c[6],y=c[7],s=c[8],x=c[9],E=c[10],D=c[11];c[0]=f*j+g*q+e*s;c[1]=f*d+g*u+e*x;c[2]=f*r+g*t+e*E;c[3]=f*n+g*y+e*D;c[4]=m*j+h*q+l*s;c[5]=m*d+h*u+l*x;c[6]=m*r+h*t+l*E;c[7]=m*n+h*y+l*D;c[8]=p*j+o*q+i*s;c[9]=p*d+o*u+i*x;c[10]=p*r+o*t+i*E;c[11]=
+p*n+o*y+i*D;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
+makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-
+d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
+b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};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=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
@@ -68,26 +69,27 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){thi
 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.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){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,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},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=true},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=false;a=true}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=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=k[i]=k[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,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
-d);return true}var e,f,g=[],h,i,k=[],l,o,m=[],p,q=[],n,r,u=[],t,y,s=[],w={objects:[],sprites:[],lights:[],elements:[]},H=new THREE.Vector3,E=new THREE.Vector4,z=new THREE.Matrix4,v=new THREE.Matrix4,A=new THREE.Frustum,J=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.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){f=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||A.contains(b))){H.copy(b.matrixWorld.getPosition());
-z.multiplyVector3(H);e=a();e.object=b;e.z=H.z;w.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){H.copy(b.matrixWorld.getPosition());z.multiplyVector3(H);e=a();e.object=b;e.z=H.z;w.sprites.push(e)}else b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,G=e.far,j=false,H,U,C,Y,F,ea,fa,ia,O,Q,Z,$,ha,Ma,Ka;y=r=p=o=0;w.elements.length=0;if(e.parent===
-void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);A.setFromMatrix(z);w=this.projectGraph(a,false);a=0;for(H=w.objects.length;a<H;a++){O=w.objects[a].object;Q=O.matrixWorld;i=0;if(O instanceof THREE.Mesh){Z=O.geometry;$=O.geometry.materials;Y=Z.vertices;ha=Z.faces;Ma=Z.faceVertexUvs;Z=O.matrixRotationWorld.extractRotation(Q);U=0;for(C=
-Y.length;U<C;U++){h=b();h.positionWorld.copy(Y[U]);Q.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);z.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<G}Y=0;for(U=ha.length;Y<U;Y++){C=ha[Y];if(C instanceof THREE.Face3){F=k[C.a];ea=k[C.b];fa=k[C.c];if(F.visible&&ea.visible&&fa.visible){j=(fa.positionScreen.x-F.positionScreen.x)*
-(ea.positionScreen.y-F.positionScreen.y)-(fa.positionScreen.y-F.positionScreen.y)*(ea.positionScreen.x-F.positionScreen.x)<0;if(O.doubleSided||j!=O.flipSided){ia=m[o]=m[o]||new THREE.RenderableFace3;o++;l=ia;l.v1.copy(F);l.v2.copy(ea);l.v3.copy(fa)}else continue}else continue}else if(C instanceof THREE.Face4){F=k[C.a];ea=k[C.b];fa=k[C.c];ia=k[C.d];if(F.visible&&ea.visible&&fa.visible&&ia.visible){j=(ia.positionScreen.x-F.positionScreen.x)*(ea.positionScreen.y-F.positionScreen.y)-(ia.positionScreen.y-
-F.positionScreen.y)*(ea.positionScreen.x-F.positionScreen.x)<0||(ea.positionScreen.x-fa.positionScreen.x)*(ia.positionScreen.y-fa.positionScreen.y)-(ea.positionScreen.y-fa.positionScreen.y)*(ia.positionScreen.x-fa.positionScreen.x)<0;if(O.doubleSided||j!=O.flipSided){Ka=q[p]=q[p]||new THREE.RenderableFace4;p++;l=Ka;l.v1.copy(F);l.v2.copy(ea);l.v3.copy(fa);l.v4.copy(ia)}else continue}else continue}l.normalWorld.copy(C.normal);!j&&(O.flipSided||O.doubleSided)&&l.normalWorld.negate();Z.multiplyVector3(l.normalWorld);
-l.centroidWorld.copy(C.centroid);Q.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);z.multiplyVector3(l.centroidScreen);fa=C.vertexNormals;F=0;for(ea=fa.length;F<ea;F++){ia=l.vertexNormalsWorld[F];ia.copy(fa[F]);!j&&(O.flipSided||O.doubleSided)&&ia.negate();Z.multiplyVector3(ia)}F=0;for(ea=Ma.length;F<ea;F++)if(Ka=Ma[F][Y]){fa=0;for(ia=Ka.length;fa<ia;fa++)l.uvs[F][fa]=Ka[fa]}l.material=O.material;l.faceMaterial=C.materialIndex!==null?$[C.materialIndex]:null;l.z=l.centroidScreen.z;
-w.elements.push(l)}}else if(O instanceof THREE.Line){v.multiply(z,Q);Y=O.geometry.vertices;F=b();F.positionScreen.copy(Y[0]);v.multiplyVector4(F.positionScreen);Q=O.type===THREE.LinePieces?2:1;U=1;for(C=Y.length;U<C;U++){F=b();F.positionScreen.copy(Y[U]);v.multiplyVector4(F.positionScreen);if(!((U+1)%Q>0)){ea=k[i-2];J.copy(F.positionScreen);K.copy(ea.positionScreen);if(d(J,K)){J.multiplyScalar(1/J.w);K.multiplyScalar(1/K.w);$=u[r]=u[r]||new THREE.RenderableLine;r++;n=$;n.v1.positionScreen.copy(J);
-n.v2.positionScreen.copy(K);n.z=Math.max(J.z,K.z);n.material=O.material;w.elements.push(n)}}}}}a=0;for(H=w.sprites.length;a<H;a++){O=w.sprites[a].object;Q=O.matrixWorld;if(O instanceof THREE.Particle){E.set(Q.elements[12],Q.elements[13],Q.elements[14],1);z.multiplyVector4(E);E.z=E.z/E.w;if(E.z>0&&E.z<1){g=s[y]=s[y]||new THREE.RenderableParticle;y++;t=g;t.x=E.x/E.w;t.y=E.y/E.w;t.z=E.z;t.rotation=O.rotation.z;t.scale.x=O.scale.x*Math.abs(t.x-(E.x+e.projectionMatrix.elements[0])/(E.w+e.projectionMatrix.elements[12]));
-t.scale.y=O.scale.y*Math.abs(t.y-(E.y+e.projectionMatrix.elements[5])/(E.w+e.projectionMatrix.elements[13]));t.material=O.material;w.elements.push(t)}}}f&&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};
+this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;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,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(e>=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
+d);return true}var e,f,g=[],h,i,j=[],l,o,m=[],p,r=[],n,q,u=[],t,y,s=[],x={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,D=new THREE.Vector4,A=new THREE.Matrix4,v=new THREE.Matrix4,H=new THREE.Frustum,I=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,b.matrixWorldInverse);A.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+A.multiply(b.matrixWorld,b.projectionMatrixInverse);A.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){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||H.contains(b))){E.copy(b.matrixWorld.getPosition());
+A.multiplyVector3(E);e=a();e.object=b;e.z=E.z;x.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){E.copy(b.matrixWorld.getPosition());A.multiplyVector3(E);e=a();e.object=b;e.z=E.z;x.sprites.push(e)}else b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&x.objects.sort(c);return x};this.projectScene=function(a,e,f){var g=e.near,E=e.far,C=false,k,P,L,S,aa,N,ca,fa,O,$,U,Y,ha,Sa,Ma;y=q=p=o=0;x.elements.length=0;if(e.parent===
+void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(e)}a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);A.multiply(e.projectionMatrix,e.matrixWorldInverse);H.setFromMatrix(A);x=this.projectGraph(a,false);a=0;for(k=x.objects.length;a<k;a++){O=x.objects[a].object;$=O.matrixWorld;i=0;if(O instanceof THREE.Mesh){U=O.geometry;Y=O.geometry.materials;S=U.vertices;ha=U.faces;Sa=U.faceVertexUvs;U=O.matrixRotationWorld.extractRotation($);P=0;for(L=
+S.length;P<L;P++){h=b();h.positionWorld.copy(S[P]);$.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);A.multiplyVector4(h.positionScreen);h.positionScreen.x=h.positionScreen.x/h.positionScreen.w;h.positionScreen.y=h.positionScreen.y/h.positionScreen.w;h.visible=h.positionScreen.z>g&&h.positionScreen.z<E}S=0;for(P=ha.length;S<P;S++){L=ha[S];if(L instanceof THREE.Face3){aa=j[L.a];N=j[L.b];ca=j[L.c];if(aa.visible&&N.visible&&ca.visible){C=(ca.positionScreen.x-aa.positionScreen.x)*
+(N.positionScreen.y-aa.positionScreen.y)-(ca.positionScreen.y-aa.positionScreen.y)*(N.positionScreen.x-aa.positionScreen.x)<0;if(O.doubleSided||C!=O.flipSided){fa=m[o]=m[o]||new THREE.RenderableFace3;o++;l=fa;l.v1.copy(aa);l.v2.copy(N);l.v3.copy(ca)}else continue}else continue}else if(L instanceof THREE.Face4){aa=j[L.a];N=j[L.b];ca=j[L.c];fa=j[L.d];if(aa.visible&&N.visible&&ca.visible&&fa.visible){C=(fa.positionScreen.x-aa.positionScreen.x)*(N.positionScreen.y-aa.positionScreen.y)-(fa.positionScreen.y-
+aa.positionScreen.y)*(N.positionScreen.x-aa.positionScreen.x)<0||(N.positionScreen.x-ca.positionScreen.x)*(fa.positionScreen.y-ca.positionScreen.y)-(N.positionScreen.y-ca.positionScreen.y)*(fa.positionScreen.x-ca.positionScreen.x)<0;if(O.doubleSided||C!=O.flipSided){Ma=r[p]=r[p]||new THREE.RenderableFace4;p++;l=Ma;l.v1.copy(aa);l.v2.copy(N);l.v3.copy(ca);l.v4.copy(fa)}else continue}else continue}l.normalWorld.copy(L.normal);!C&&(O.flipSided||O.doubleSided)&&l.normalWorld.negate();U.multiplyVector3(l.normalWorld);
+l.centroidWorld.copy(L.centroid);$.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);A.multiplyVector3(l.centroidScreen);ca=L.vertexNormals;aa=0;for(N=ca.length;aa<N;aa++){fa=l.vertexNormalsWorld[aa];fa.copy(ca[aa]);!C&&(O.flipSided||O.doubleSided)&&fa.negate();U.multiplyVector3(fa)}aa=0;for(N=Sa.length;aa<N;aa++)if(Ma=Sa[aa][S]){ca=0;for(fa=Ma.length;ca<fa;ca++)l.uvs[aa][ca]=Ma[ca]}l.material=O.material;l.faceMaterial=L.materialIndex!==null?Y[L.materialIndex]:null;l.z=l.centroidScreen.z;
+x.elements.push(l)}}else if(O instanceof THREE.Line){v.multiply(A,$);S=O.geometry.vertices;aa=b();aa.positionScreen.copy(S[0]);v.multiplyVector4(aa.positionScreen);$=O.type===THREE.LinePieces?2:1;P=1;for(L=S.length;P<L;P++){aa=b();aa.positionScreen.copy(S[P]);v.multiplyVector4(aa.positionScreen);if(!((P+1)%$>0)){N=j[i-2];I.copy(aa.positionScreen);M.copy(N.positionScreen);if(d(I,M)){I.multiplyScalar(1/I.w);M.multiplyScalar(1/M.w);Y=u[q]=u[q]||new THREE.RenderableLine;q++;n=Y;n.v1.positionScreen.copy(I);
+n.v2.positionScreen.copy(M);n.z=Math.max(I.z,M.z);n.material=O.material;x.elements.push(n)}}}}}a=0;for(k=x.sprites.length;a<k;a++){O=x.sprites[a].object;$=O.matrixWorld;if(O instanceof THREE.Particle){D.set($.elements[12],$.elements[13],$.elements[14],1);A.multiplyVector4(D);D.z=D.z/D.w;if(D.z>0&&D.z<1){g=s[y]=s[y]||new THREE.RenderableParticle;y++;t=g;t.x=D.x/D.w;t.y=D.y/D.w;t.z=D.z;t.rotation=O.rotation.z;t.scale.x=O.scale.x*Math.abs(t.x-(D.x+e.projectionMatrix.elements[0])/(D.w+e.projectionMatrix.elements[12]));
+t.scale.y=O.scale.y*Math.abs(t.y-(D.y+e.projectionMatrix.elements[5])/(D.w+e.projectionMatrix.elements[13]));t.material=O.material;x.elements.push(t)}}}f&&x.elements.sort(c);return x}};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},setFromEuler:function(a,b){var c=b||"XYZ",d=Math.cos(a.x/2),e=Math.cos(a.y/2),f=Math.cos(a.z/2),g=Math.sin(a.x/2),h=Math.sin(a.y/2),i=Math.sin(a.z/2);switch(c){case "YXZ":this.x=g*e*f+d*h*i;this.y=d*h*f-g*e*i;this.z=d*e*i-g*h*f;this.w=d*e*f+g*h*i;break;case "ZXY":this.x=g*e*f-d*h*i;this.y=d*h*f+g*e*
 i;this.z=d*e*i+g*h*f;this.w=d*e*f-g*h*i;break;case "ZYX":this.x=g*e*f-d*h*i;this.y=d*h*f+g*e*i;this.z=d*e*i-g*h*f;this.w=d*e*f+g*h*i;break;case "YZX":this.x=g*e*f+d*h*i;this.y=d*h*f+g*e*i;this.z=d*e*i-g*h*f;this.w=d*e*f-g*h*i;break;case "XZY":this.x=g*e*f-d*h*i;this.y=d*h*f-g*e*i;this.z=d*e*i+g*h*f;this.w=d*e*f+g*h*i;break;default:this.x=g*e*f+d*h*i;this.y=d*h*f-g*e*i;this.z=d*e*i+g*h*f;this.w=d*e*f-g*h*i}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=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],k=c+f+b;if(k>0){c=0.5/Math.sqrt(k+1);this.w=0.25/c;this.x=(i-g)*c;this.y=(d-h)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+h)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-h)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
+d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;if(j>0){c=0.5/Math.sqrt(j+1);this.w=0.25/c;this.x=(i-g)*c;this.y=(d-h)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+h)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-h)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
 (d+h)/c;this.y=(g+i)/c;this.z=0.25*c}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=this.x*-1;this.y=this.y*-1;this.z=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);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
 this.y*a;this.z=this.z*a;this.w=this.w*a}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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,
-f=this.x,g=this.y,h=this.z,i=this.w,k=i*c+g*e-h*d,l=i*d+h*c-f*e,o=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=k*i+c*-f+l*-h-o*-g;b.y=l*i+c*-g+o*-f-k*-h;b.z=o*i+c*-h+k*-g-l*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010){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);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;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(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
+f=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*e-h*d,l=i*d+h*c-f*e,o=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+l*-h-o*-g;b.y=l*i+c*-g+o*-f-j*-h;b.z=o*i+c*-h+j*-g-l*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
+this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};THREE.Vertex=function(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 THREE.Face3=function(a,b,c,d,e,f){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=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;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;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
 return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];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};
@@ -100,23 +102,23 @@ b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices
 else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(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)}}a=0;
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(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])}else if(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,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
 e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
-[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];i=new THREE.Vector3;k=e 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};g.push(i);h.push(k)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
-i=g.faceNormals[c];k=g.vertexNormals[c];i.copy(e.normal);if(e instanceof THREE.Face3){k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2])}else{k.a.copy(e.vertexNormals[0]);k.b.copy(e.vertexNormals[1]);k.c.copy(e.vertexNormals[2]);k.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,F){h=a.vertices[b];i=a.vertices[c];
-k=a.vertices[d];l=g[e];o=g[f];m=g[F];p=i.x-h.x;q=k.x-h.x;n=i.y-h.y;r=k.y-h.y;u=i.z-h.z;t=k.z-h.z;y=o.u-l.u;s=m.u-l.u;w=o.v-l.v;H=m.v-l.v;E=1/(y*H-s*w);J.set((H*p-w*q)*E,(H*n-w*r)*E,(H*u-w*t)*E);K.set((y*q-s*p)*E,(y*r-s*n)*E,(y*t-s*u)*E);v[b].addSelf(J);v[c].addSelf(J);v[d].addSelf(J);A[b].addSelf(K);A[c].addSelf(K);A[d].addSelf(K)}var b,c,d,e,f,g,h,i,k,l,o,m,p,q,n,r,u,t,y,s,w,H,E,z,v=[],A=[],J=new THREE.Vector3,K=new THREE.Vector3,R=new THREE.Vector3,P=new THREE.Vector3,D=new THREE.Vector3;b=0;for(c=
-this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;A[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var M=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){D.copy(f.vertexNormals[d]);e=f[M[d]];z=v[e];R.copy(z);R.subSelf(D.multiplyScalar(D.dot(z))).normalize();
-P.cross(f.vertexNormals[d],z);e=P.dot(A[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.z,e)}}this.hasTangents=true},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];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
+[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];i=new THREE.Vector3;j=e 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};g.push(i);h.push(j)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
+i=g.faceNormals[c];j=g.vertexNormals[c];i.copy(e.normal);if(e instanceof THREE.Face3){j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2])}else{j.a.copy(e.vertexNormals[0]);j.b.copy(e.vertexNormals[1]);j.c.copy(e.vertexNormals[2]);j.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,e,f,A){h=a.vertices[b];i=a.vertices[c];
+j=a.vertices[d];l=g[e];o=g[f];m=g[A];p=i.x-h.x;r=j.x-h.x;n=i.y-h.y;q=j.y-h.y;u=i.z-h.z;t=j.z-h.z;y=o.u-l.u;s=m.u-l.u;x=o.v-l.v;E=m.v-l.v;D=1/(y*E-s*x);I.set((E*p-x*r)*D,(E*n-x*q)*D,(E*u-x*t)*D);M.set((y*r-s*p)*D,(y*q-s*n)*D,(y*t-s*u)*D);v[b].addSelf(I);v[c].addSelf(I);v[d].addSelf(I);H[b].addSelf(M);H[c].addSelf(M);H[d].addSelf(M)}var b,c,d,e,f,g,h,i,j,l,o,m,p,r,n,q,u,t,y,s,x,E,D,A,v=[],H=[],I=new THREE.Vector3,M=new THREE.Vector3,R=new THREE.Vector3,Z=new THREE.Vector3,B=new THREE.Vector3;b=0;for(c=
+this.vertices.length;b<c;b++){v[b]=new THREE.Vector3;H[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var G=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){B.copy(f.vertexNormals[d]);e=f[G[d]];A=v[e];R.copy(A);R.subSelf(B.multiplyScalar(B.dot(A))).normalize();
+Z.cross(f.vertexNormals[d],A);e=Z.dot(H[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.z,e)}}this.hasTangents=true},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];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];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].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
 e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){e=this.faces[f];if(e instanceof THREE.Face3){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c]}else if(e instanceof THREE.Face4){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e.d=c[e.d];d=[e.a,e.b,e.c,e.d];for(a=3;a>0;a--)if(d.indexOf(e["abcd"[a]])!=a){d.splice(a,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2]);e=0;for(d=this.faceVertexUvs.length;e<d;e++)(h=
 this.faceVertexUvs[e][f])&&h.splice(a,1);break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,k,l,o,m;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){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
-f+2;k=this.points[c[0]];l=this.points[c[1]];o=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(k.x,l.x,o.x,m.x,g,h,i);d.y=b(k.y,l.y,o.y,m.y,g,h,i);d.z=b(k.z,l.z,o.z,m.z,g,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,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++){b=
-a/c;d=this.getPoint(b);g.copy(d);i=i+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){h[b]=i;e=b}}h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];g=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++){d=e+c*(1/g)*(f-e);d=this.getPoint(d);
+THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,l,o,m;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){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
+f+2;j=this.points[c[0]];l=this.points[c[1]];o=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,l.x,o.x,m.x,g,h,i);d.y=b(j.y,l.y,o.y,m.y,g,h,i);d.z=b(j.z,l.z,o.z,m.z,g,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,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++){b=
+a/c;d=this.getPoint(b);g.copy(d);i=i+g.distanceTo(f);f.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=e){h[b]=i;e=b}}h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,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];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++){d=e+c*(1/g)*(f-e);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.setEulerFromRotationMatrix(this.matrix,this.order)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
 THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(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,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;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.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.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.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.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=false;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=false;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;
 this.shadowCascade=false;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;
@@ -125,49 +127,50 @@ this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.protot
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
 Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=true};e.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=
-d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var l=a.shading.toLowerCase();l==="phong"?i="MeshPhongMaterial":l==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)k.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.depthWrite!==void 0)k.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;
-if(a.colorDiffuse)k.color=g(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=g(a.colorSpecular);if(a.colorAmbient)k.ambient=g(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(i.uniforms);l.tNormal.texture=k.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(k.map){l.tDiffuse.texture=k.map;l.enableDiffuse.value=true}if(k.specularMap){l.tSpecular.texture=k.specularMap;l.enableSpecular.value=true}if(k.lightMap){l.tAO.texture=k.lightMap;
-l.enableAO.value=true}l.uDiffuseColor.value.setHex(k.color);l.uSpecularColor.value.setHex(k.specular);l.uAmbientColor.value.setHex(k.ambient);l.uShininess.value=k.shininess;if(k.opacity!==void 0)l.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:l,lights:true,fog:true})}else k=new THREE[i](k);if(a.DbgName!==void 0)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
+if(a.shading){var l=a.shading.toLowerCase();l==="phong"?i="MeshPhongMaterial":l==="basic"&&(i="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)j.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.depthWrite!==void 0)j.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;
+if(a.colorDiffuse)j.color=g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&f(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(j,"normalMap",a.mapNormal,a.mapNormalRepeat,
+a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;l=THREE.UniformsUtils.clone(i.uniforms);l.tNormal.texture=j.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(j.map){l.tDiffuse.texture=j.map;l.enableDiffuse.value=true}if(j.specularMap){l.tSpecular.texture=j.specularMap;l.enableSpecular.value=true}if(j.lightMap){l.tAO.texture=j.lightMap;
+l.enableAO.value=true}l.uDiffuseColor.value.setHex(j.color);l.uSpecularColor.value.setHex(j.specular);l.uAmbientColor.value.setHex(j.ambient);l.uShininess.value=j.shininess;if(j.opacity!==void 0)l.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:l,lights:true,fog:true})}else j=new THREE[i](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
 THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){h==0&&(h=f.getResponseHeader("Content-Length"));e({total:h,loaded:f.responseText.length})}}else f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};
 f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,l,o,m,p,q,n,r,u,t,y,s;function w(a){return a%4?4-a%4:0}function H(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,e,f,g,h,j,i,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=G[e*2];e=G[e*2+1];j=G[f*2];i=G[f*2+1];f=G[g*2];k=G[g*2+1];g=P.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(j,i));m.push(new THREE.UV(f,
-k));g.push(m)}}function v(b,c){var d,e,f,g,h,j,i,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];j=G[e*2];e=G[e*2+1];i=G[f*2];l=G[f*2+1];k=G[g*2];m=G[g*2+1];g=G[h*2];f=G[h*2+1];h=P.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,e));o.push(new THREE.UV(i,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,f));h.push(o)}}function A(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=j[d];
-P.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function J(b,c,d){for(var e,f,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];j=i[d];P.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}}function K(b,c,d,e){for(var f,g,h,j,i,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];i=d[e*3];k=d[e*3+1];l=d[e*3+2];j=m[e];var n=M[k*3],o=M[k*3+1];k=M[k*3+2];var p=M[l*3],
-q=M[l*3+1];l=M[l*3+2];P.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(M[i*3],M[i*3+1],M[i*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,l)],null,j))}}function R(b,c,d,e){for(var f,g,h,j,i,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];j=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];i=o[e];var p=M[l*3],q=M[l*3+1];l=M[l*3+2];var r=M[m*3],s=M[m*3+1];m=M[m*3+2];var t=M[n*3],u=M[n*3+1];n=M[n*3+2];P.faces.push(new THREE.Face4(f,
-g,h,j,[new THREE.Vector3(M[k*3],M[k*3+1],M[k*3+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,i))}}var P=this,D=0,M=[],G=[],j,T,U;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,D,12);c=H(a,D+12);H(a,D+13);H(a,D+14);H(a,D+15);e=H(a,D+16);i=H(a,D+17);k=H(a,D+18);l=H(a,D+19);o=E(a,D+20);m=E(a,D+20+4);p=E(a,D+20+8);b=E(a,D+20+12);q=
-E(a,D+20+16);n=E(a,D+20+20);r=E(a,D+20+24);u=E(a,D+20+28);t=E(a,D+20+32);y=E(a,D+20+36);s=E(a,D+20+40);D=D+c;c=e*3+l;U=e*4+l;j=b*c;T=q*(c+i*3);e=n*(c+k*3);l=r*(c+i*3+k*3);c=u*U;i=t*(U+i*4);k=y*(U+k*4);D=D+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];P.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(D);D=D+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];M.push(d/
-127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(D);D=D+w(m*3);D=D+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,e;for(c=0;c<p;c++){d=b[c*2];e=b[c*2+1];G.push(d,e)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(D);j=D+j+w(b*2);T=j+T+w(q*2);e=T+e+w(n*2);l=e+l+w(r*2);c=l+c+w(u*2);i=c+i+w(t*2);k=i+k+w(y*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;A(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);z(n,b)}})(T);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-r*Uint32Array.BYTES_PER_ELEMENT*3;K(r,a,b,c+r*Uint32Array.BYTES_PER_ELEMENT*3);z(r,c)}})(e);(function(a){if(y){var b=a+y*Uint32Array.BYTES_PER_ELEMENT*4;J(y,a,b+y*Uint32Array.BYTES_PER_ELEMENT*4);v(y,b)}})(i);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4,c=b+s*Uint32Array.BYTES_PER_ELEMENT*4;R(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*4);v(s,c)}})(k);b&&A(b,D,D+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;K(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
-3)}})(j);u&&J(u,l,l+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;R(t,a,b,b+t*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,l,o,m,p,r,n,q,u,t,y,s;function x(a){return a%4?4-a%4:0}function E(a,b){return(new Uint8Array(a,b,1))[0]}function D(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,e,f,g,h,k,i,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=Q[e*2];e=Q[e*2+1];k=Q[f*2];i=Q[f*2+1];f=Q[g*2];j=Q[g*2+1];g=Z.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(k,i));m.push(new THREE.UV(f,
+j));g.push(m)}}function v(b,c){var d,e,f,g,h,k,i,j,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];k=Q[e*2];e=Q[e*2+1];i=Q[f*2];l=Q[f*2+1];j=Q[g*2];m=Q[g*2+1];g=Q[h*2];f=Q[h*2+1];h=Z.faceVertexUvs[0];var o=[];o.push(new THREE.UV(k,e));o.push(new THREE.UV(i,l));o.push(new THREE.UV(j,m));o.push(new THREE.UV(g,f));h.push(o)}}function H(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*3];f=c[d*3+1];g=c[d*3+2];h=k[d];
+Z.faces.push(new THREE.Face3(e,f,g,null,null,h))}}function I(b,c,d){for(var e,f,g,h,k,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){e=c[d*4];f=c[d*4+1];g=c[d*4+2];h=c[d*4+3];k=i[d];Z.faces.push(new THREE.Face4(e,f,g,h,null,null,k))}}function M(b,c,d,e){for(var f,g,h,k,i,j,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];i=d[e*3];j=d[e*3+1];l=d[e*3+2];k=m[e];var n=G[j*3],o=G[j*3+1];j=G[j*3+2];var p=G[l*3],
+r=G[l*3+1];l=G[l*3+2];Z.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(G[i*3],G[i*3+1],G[i*3+2]),new THREE.Vector3(n,o,j),new THREE.Vector3(p,r,l)],null,k))}}function R(b,c,d,e){for(var f,g,h,k,i,j,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];k=c[e*4+3];j=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];i=o[e];var p=G[l*3],r=G[l*3+1];l=G[l*3+2];var q=G[m*3],s=G[m*3+1];m=G[m*3+2];var t=G[n*3],v=G[n*3+1];n=G[n*3+2];Z.faces.push(new THREE.Face4(f,
+g,h,k,[new THREE.Vector3(G[j*3],G[j*3+1],G[j*3+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,v,n)],null,i))}}var Z=this,B=0,G=[],Q=[],C,k,P;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Z,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d=d+String.fromCharCode(a[b+e]);return d})(a,B,12);c=E(a,B+12);E(a,B+13);E(a,B+14);E(a,B+15);e=E(a,B+16);i=E(a,B+17);j=E(a,B+18);l=E(a,B+19);o=D(a,B+20);m=D(a,B+20+4);p=D(a,B+20+8);b=D(a,B+20+12);r=
+D(a,B+20+16);n=D(a,B+20+20);q=D(a,B+20+24);u=D(a,B+20+28);t=D(a,B+20+32);y=D(a,B+20+36);s=D(a,B+20+40);B=B+c;c=e*3+l;P=e*4+l;C=b*c;k=r*(c+i*3);e=n*(c+j*3);l=q*(c+i*3+j*3);c=u*P;i=t*(P+i*4);j=y*(P+j*4);B=B+function(b){var b=new Float32Array(a,b,o*3),c,d,e,f;for(c=0;c<o;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];Z.vertices.push(new THREE.Vector3(d,e,f))}return o*3*Float32Array.BYTES_PER_ELEMENT}(B);B=B+function(b){if(m){var b=new Int8Array(a,b,m*3),c,d,e,f;for(c=0;c<m;c++){d=b[c*3];e=b[c*3+1];f=b[c*3+2];G.push(d/
+127,e/127,f/127)}}return m*3*Int8Array.BYTES_PER_ELEMENT}(B);B=B+x(m*3);B=B+function(b){if(p){var b=new Float32Array(a,b,p*2),c,d,e;for(c=0;c<p;c++){d=b[c*2];e=b[c*2+1];Q.push(d,e)}}return p*2*Float32Array.BYTES_PER_ELEMENT}(B);C=B+C+x(b*2);k=C+k+x(r*2);e=k+e+x(n*2);l=e+l+x(q*2);c=l+c+x(u*2);i=c+i+x(t*2);j=i+j+x(y*2);(function(a){if(n){var b=a+n*Uint32Array.BYTES_PER_ELEMENT*3;H(n,a,b+n*Uint32Array.BYTES_PER_ELEMENT*3);A(n,b)}})(k);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+q*Uint32Array.BYTES_PER_ELEMENT*3;M(q,a,b,c+q*Uint32Array.BYTES_PER_ELEMENT*3);A(q,c)}})(e);(function(a){if(y){var b=a+y*Uint32Array.BYTES_PER_ELEMENT*4;I(y,a,b+y*Uint32Array.BYTES_PER_ELEMENT*4);v(y,b)}})(i);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*4,c=b+s*Uint32Array.BYTES_PER_ELEMENT*4;R(s,a,b,c+s*Uint32Array.BYTES_PER_ELEMENT*4);v(s,c)}})(j);b&&H(b,B,B+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*3;M(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*
+3)}})(C);u&&I(u,l,l+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;R(t,a,b,b+t*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
 THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
 e({total:g,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,k,l,o,m,p,q,n,r,u,t,y,s=a.faces;o=a.vertices;var w=a.normals,H=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}k=0;for(l=o.length;k<l;){m=new THREE.Vector3;m.x=o[k++]*b;m.y=o[k++]*b;m.z=o[k++]*b;d.vertices.push(m)}k=0;for(l=s.length;k<l;){b=s[k++];o=b&1;i=b&2;c=b&
-4;e=b&8;p=b&16;m=b&32;n=b&64;b=b&128;if(o){r=new THREE.Face4;r.a=s[k++];r.b=s[k++];r.c=s[k++];r.d=s[k++];o=4}else{r=new THREE.Face3;r.a=s[k++];r.b=s[k++];r.c=s[k++];o=3}if(i){i=s[k++];r.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<E;c++){u=a.uvs[c];q=s[k++];y=u[q*2];q=u[q*2+1];d.faceUvs[c][i]=new THREE.UV(y,q)}if(e)for(c=0;c<E;c++){u=a.uvs[c];t=[];for(e=0;e<o;e++){q=s[k++];y=u[q*2];q=u[q*2+1];t[e]=new THREE.UV(y,q)}d.faceVertexUvs[c][i]=t}if(p){p=s[k++]*3;e=new THREE.Vector3;e.x=w[p++];e.y=w[p++];
-e.z=w[p];r.normal=e}if(m)for(c=0;c<o;c++){p=s[k++]*3;e=new THREE.Vector3;e.x=w[p++];e.y=w[p++];e.z=w[p];r.vertexNormals.push(e)}if(n){m=s[k++];m=new THREE.Color(H[m]);r.color=m}if(b)for(c=0;c<o;c++){m=s[k++];m=new THREE.Color(H[m]);r.vertexColors.push(m)}d.faces.push(r)}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-b+2){e=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,l,o;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;i=0;for(k=o.length;i<k;i=i+3){var m=new THREE.Vector3;m.x=o[i]*b;m.y=o[i+1]*b;m.z=o[i+2]*b;l.push(m)}}}if(a.morphColors!==
-void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b=b+3){o=new THREE.Color(16755200);o.setRGB(l[b],l[b+1],l[b+2]);k.push(o)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,j,l,o,m,p,r,n,q,u,t,y,s=a.faces;o=a.vertices;var x=a.normals,E=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}j=0;for(l=o.length;j<l;){m=new THREE.Vector3;m.x=o[j++]*b;m.y=o[j++]*b;m.z=o[j++]*b;d.vertices.push(m)}j=0;for(l=s.length;j<l;){b=s[j++];o=b&1;i=b&2;c=b&
+4;e=b&8;p=b&16;m=b&32;n=b&64;b=b&128;if(o){q=new THREE.Face4;q.a=s[j++];q.b=s[j++];q.c=s[j++];q.d=s[j++];o=4}else{q=new THREE.Face3;q.a=s[j++];q.b=s[j++];q.c=s[j++];o=3}if(i){i=s[j++];q.materialIndex=i}i=d.faces.length;if(c)for(c=0;c<D;c++){u=a.uvs[c];r=s[j++];y=u[r*2];r=u[r*2+1];d.faceUvs[c][i]=new THREE.UV(y,r)}if(e)for(c=0;c<D;c++){u=a.uvs[c];t=[];for(e=0;e<o;e++){r=s[j++];y=u[r*2];r=u[r*2+1];t[e]=new THREE.UV(y,r)}d.faceVertexUvs[c][i]=t}if(p){p=s[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];
+e.z=x[p];q.normal=e}if(m)for(c=0;c<o;c++){p=s[j++]*3;e=new THREE.Vector3;e.x=x[p++];e.y=x[p++];e.z=x[p];q.vertexNormals.push(e)}if(n){m=s[j++];m=new THREE.Color(E[m]);q.color=m}if(b)for(c=0;c<o;c++){m=s[j++];m=new THREE.Color(E[m]);q.vertexColors.push(m)}d.faces.push(q)}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];i=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,i,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){e=a.skinIndices[b];i=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,i,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,j,l,o;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;o=a.morphTargets[c].vertices;i=0;for(j=o.length;i<j;i=i+3){var m=new THREE.Vector3;m.x=o[i]*b;m.y=o[i+1]*b;m.z=o[i+2]*b;l.push(m)}}}if(a.morphColors!==
+void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b=b+3){o=new THREE.Color(16755200);o.setRGB(l[b],l[b+1],l[b+2]);j.push(o)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(m in D.objects)if(!C.objects[m]){u=D.objects[m];if(u.geometry!==void 0){if(J=C.geometries[u.geometry]){a=false;K=C.materials[u.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&J.computeTangents();w=u.position;H=u.rotation;E=u.quaternion;z=u.scale;t=u.matrix;E=0;u.materials.length==0&&(K=new THREE.MeshFaceMaterial);u.materials.length>1&&(K=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(J,K);a.name=m;if(t){a.matrixAutoUpdate=false;a.matrix.set(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}else{a.position.set(w[0],w[1],w[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(H[0],H[1],H[2]);a.scale.set(z[0],z[1],z[2])}a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;C.scene.add(a);C.objects[m]=a}}else{w=u.position;H=u.rotation;E=u.quaternion;
-z=u.scale;E=0;a=new THREE.Object3D;a.name=m;a.position.set(w[0],w[1],w[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(H[0],H[1],H[2]);a.scale.set(z[0],z[1],z[2]);a.visible=u.visible!==void 0?u.visible:false;C.scene.add(a);C.objects[m]=a;C.empties[m]=a}}}function f(a){return function(b){C.geometries[a]=b;e();G=G-1;i.onLoadComplete();h()}}function g(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:T,totalTextures:U,loadedModels:T-
-G,loadedTextures:U-j},C);i.onLoadProgress();G==0&&j==0&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlBase(c),l,o,m,p,q,n,r,u,t,y,s,w,H,E,z,v,A,J,K,R,P,D,M,G,j,T,U,C;D=a;c=new THREE.BinaryLoader;M=new THREE.JSONLoader;j=G=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(D.transform){a=D.transform.position;y=D.transform.rotation;v=D.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);y&&C.scene.rotation.set(y[0],y[1],
-y[2]);v&&C.scene.scale.set(v[0],v[1],v[2]);if(a||y||v){C.scene.updateMatrix();C.scene.updateMatrixWorld()}}a=function(){j=j-1;h();i.onLoadComplete()};for(q in D.cameras){v=D.cameras[q];v.type=="perspective"?R=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type=="ortho"&&(R=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));w=v.position;y=v.target;v=v.up;R.position.set(w[0],w[1],w[2]);R.target=new THREE.Vector3(y[0],y[1],y[2]);v&&R.up.set(v[0],v[1],v[2]);C.cameras[q]=
-R}for(p in D.lights){y=D.lights[p];q=y.color!==void 0?y.color:16777215;R=y.intensity!==void 0?y.intensity:1;if(y.type=="directional"){w=y.direction;s=new THREE.DirectionalLight(q,R);s.position.set(w[0],w[1],w[2]);s.position.normalize()}else if(y.type=="point"){w=y.position;s=y.distance;s=new THREE.PointLight(q,R,s);s.position.set(w[0],w[1],w[2])}else y.type=="ambient"&&(s=new THREE.AmbientLight(q));C.scene.add(s);C.lights[p]=s}for(n in D.fogs){p=D.fogs[n];p.type=="linear"?P=new THREE.Fog(0,p.near,
-p.far):p.type=="exp2"&&(P=new THREE.FogExp2(0,p.density));v=p.color;P.color.setRGB(v[0],v[1],v[2]);C.fogs[n]=P}if(C.cameras&&D.defaults.camera)C.currentCamera=C.cameras[D.defaults.camera];if(C.fogs&&D.defaults.fog)C.scene.fog=C.fogs[D.defaults.fog];v=D.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(v[0],v[1],v[2]);C.bgColorAlpha=D.defaults.bgalpha;for(l in D.geometries){n=D.geometries[l];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){G=G+1;i.onLoadStart()}}T=G;for(l in D.geometries){n=
-D.geometries[l];if(n.type=="cube"){J=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);C.geometries[l]=J}else if(n.type=="plane"){J=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);C.geometries[l]=J}else if(n.type=="sphere"){J=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);C.geometries[l]=J}else if(n.type=="cylinder"){J=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,
-n.heightSegs);C.geometries[l]=J}else if(n.type=="torus"){J=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);C.geometries[l]=J}else if(n.type=="icosahedron"){J=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);C.geometries[l]=J}else if(n.type=="bin_mesh")c.load(d(n.url,D.urlBaseType),f(l));else if(n.type=="ascii_mesh")M.load(d(n.url,D.urlBaseType),f(l));else if(n.type=="embedded_mesh"){n=D.embeds[n.id];n.metadata=D.metadata;n&&M.createModel(n,g(l),"")}}for(r in D.textures){l=D.textures[r];
-if(l.url instanceof Array){j=j+l.url.length;for(n=0;n<l.url.length;n++)i.onLoadStart()}else{j=j+1;i.onLoadStart()}}U=j;for(r in D.textures){l=D.textures[r];if(l.mapping!=void 0&&THREE[l.mapping]!=void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){n=[];for(P=0;P<l.url.length;P++)n[P]=d(l.url[P],D.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,l.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(l.url,D.urlBaseType),l.mapping,a);if(THREE[l.minFilter]!=void 0)n.minFilter=THREE[l.minFilter];
-if(THREE[l.magFilter]!=void 0)n.magFilter=THREE[l.magFilter];if(l.repeat){n.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}l.offset&&n.offset.set(l.offset[0],l.offset[1]);if(l.wrap){P={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(P[l.wrap[0]]!==void 0)n.wrapS=P[l.wrap[0]];if(P[l.wrap[1]]!==void 0)n.wrapT=P[l.wrap[1]]}}C.textures[r]=n}for(o in D.materials){t=D.materials[o];for(A in t.parameters)if(A==
-"envMap"||A=="map"||A=="lightMap")t.parameters[A]=C.textures[t.parameters[A]];else if(A=="shading")t.parameters[A]=t.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")t.parameters[A]=THREE[t.parameters[A]]?THREE[t.parameters[A]]:THREE.NormalBlending;else if(A=="combine")t.parameters[A]=t.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A=="vertexColors")if(t.parameters[A]=="face")t.parameters[A]=THREE.FaceColors;else if(t.parameters[A])t.parameters[A]=
-THREE.VertexColors;if(t.parameters.opacity!==void 0&&t.parameters.opacity<1)t.parameters.transparent=true;if(t.parameters.normalMap){r=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(r.uniforms);l=t.parameters.color;n=t.parameters.specular;P=t.parameters.ambient;c=t.parameters.shininess;a.tNormal.texture=C.textures[t.parameters.normalMap];if(t.parameters.normalMapFactor)a.uNormalScale.value=t.parameters.normalMapFactor;if(t.parameters.map){a.tDiffuse.texture=t.parameters.map;a.enableDiffuse.value=
-true}if(t.parameters.lightMap){a.tAO.texture=t.parameters.lightMap;a.enableAO.value=true}if(t.parameters.specularMap){a.tSpecular.texture=C.textures[t.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(P);a.uShininess.value=c;if(t.parameters.opacity)a.uOpacity.value=t.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:r.fragmentShader,vertexShader:r.vertexShader,uniforms:a,lights:true,fog:true})}else K=
-new THREE[t.type](t.parameters);C.materials[o]=K}e();i.callbackSync(C);h()};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(m in B.objects)if(!L.objects[m]){u=B.objects[m];if(u.geometry!==void 0){if(I=L.geometries[u.geometry]){a=false;M=L.materials[u.materials[0]];(a=M instanceof THREE.ShaderMaterial)&&I.computeTangents();x=u.position;E=u.rotation;D=u.quaternion;A=u.scale;t=u.matrix;D=0;u.materials.length==0&&(M=new THREE.MeshFaceMaterial);u.materials.length>1&&(M=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(I,M);a.name=m;if(t){a.matrixAutoUpdate=false;a.matrix.set(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}else{a.position.set(x[0],x[1],x[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(E[0],E[1],E[2]);a.scale.set(A[0],A[1],A[2])}a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;L.scene.add(a);L.objects[m]=a}}else{x=u.position;E=u.rotation;D=u.quaternion;
+A=u.scale;D=0;a=new THREE.Object3D;a.name=m;a.position.set(x[0],x[1],x[2]);if(D){a.quaternion.set(D[0],D[1],D[2],D[3]);a.useQuaternion=true}else a.rotation.set(E[0],E[1],E[2]);a.scale.set(A[0],A[1],A[2]);a.visible=u.visible!==void 0?u.visible:false;L.scene.add(a);L.objects[m]=a;L.empties[m]=a}}}function f(a){return function(b){L.geometries[a]=b;e();Q=Q-1;i.onLoadComplete();h()}}function g(a){return function(b){L.geometries[a]=b}}function h(){i.callbackProgress({totalModels:k,totalTextures:P,loadedModels:k-
+Q,loadedTextures:P-C},L);i.onLoadProgress();Q==0&&C==0&&b(L)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),l,o,m,p,r,n,q,u,t,y,s,x,E,D,A,v,H,I,M,R,Z,B,G,Q,C,k,P,L;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;C=Q=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(B.transform){a=B.transform.position;y=B.transform.rotation;v=B.transform.scale;a&&L.scene.position.set(a[0],a[1],a[2]);y&&L.scene.rotation.set(y[0],y[1],
+y[2]);v&&L.scene.scale.set(v[0],v[1],v[2]);if(a||y||v){L.scene.updateMatrix();L.scene.updateMatrixWorld()}}a=function(){C=C-1;h();i.onLoadComplete()};for(r in B.cameras){v=B.cameras[r];v.type=="perspective"?R=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type=="ortho"&&(R=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));x=v.position;y=v.target;v=v.up;R.position.set(x[0],x[1],x[2]);R.target=new THREE.Vector3(y[0],y[1],y[2]);v&&R.up.set(v[0],v[1],v[2]);L.cameras[r]=
+R}for(p in B.lights){y=B.lights[p];r=y.color!==void 0?y.color:16777215;R=y.intensity!==void 0?y.intensity:1;if(y.type=="directional"){x=y.direction;s=new THREE.DirectionalLight(r,R);s.position.set(x[0],x[1],x[2]);s.position.normalize()}else if(y.type=="point"){x=y.position;s=y.distance;s=new THREE.PointLight(r,R,s);s.position.set(x[0],x[1],x[2])}else y.type=="ambient"&&(s=new THREE.AmbientLight(r));L.scene.add(s);L.lights[p]=s}for(n in B.fogs){p=B.fogs[n];p.type=="linear"?Z=new THREE.Fog(0,p.near,
+p.far):p.type=="exp2"&&(Z=new THREE.FogExp2(0,p.density));v=p.color;Z.color.setRGB(v[0],v[1],v[2]);L.fogs[n]=Z}if(L.cameras&&B.defaults.camera)L.currentCamera=L.cameras[B.defaults.camera];if(L.fogs&&B.defaults.fog)L.scene.fog=L.fogs[B.defaults.fog];v=B.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(v[0],v[1],v[2]);L.bgColorAlpha=B.defaults.bgalpha;for(l in B.geometries){n=B.geometries[l];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){Q=Q+1;i.onLoadStart()}}k=Q;for(l in B.geometries){n=
+B.geometries[l];if(n.type=="cube"){I=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);L.geometries[l]=I}else if(n.type=="plane"){I=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);L.geometries[l]=I}else if(n.type=="sphere"){I=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);L.geometries[l]=I}else if(n.type=="cylinder"){I=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,
+n.heightSegs);L.geometries[l]=I}else if(n.type=="torus"){I=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);L.geometries[l]=I}else if(n.type=="icosahedron"){I=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);L.geometries[l]=I}else if(n.type=="bin_mesh")c.load(d(n.url,B.urlBaseType),f(l));else if(n.type=="ascii_mesh")G.load(d(n.url,B.urlBaseType),f(l));else if(n.type=="embedded_mesh"){n=B.embeds[n.id];n.metadata=B.metadata;n&&G.createModel(n,g(l),"")}}for(q in B.textures){l=B.textures[q];
+if(l.url instanceof Array){C=C+l.url.length;for(n=0;n<l.url.length;n++)i.onLoadStart()}else{C=C+1;i.onLoadStart()}}P=C;for(q in B.textures){l=B.textures[q];if(l.mapping!=void 0&&THREE[l.mapping]!=void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){n=[];for(Z=0;Z<l.url.length;Z++)n[Z]=d(l.url[Z],B.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,l.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(l.url,B.urlBaseType),l.mapping,a);if(THREE[l.minFilter]!=void 0)n.minFilter=THREE[l.minFilter];
+if(THREE[l.magFilter]!=void 0)n.magFilter=THREE[l.magFilter];if(l.repeat){n.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}l.offset&&n.offset.set(l.offset[0],l.offset[1]);if(l.wrap){Z={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Z[l.wrap[0]]!==void 0)n.wrapS=Z[l.wrap[0]];if(Z[l.wrap[1]]!==void 0)n.wrapT=Z[l.wrap[1]]}}L.textures[q]=n}for(o in B.materials){t=B.materials[o];for(H in t.parameters)if(H==
+"envMap"||H=="map"||H=="lightMap")t.parameters[H]=L.textures[t.parameters[H]];else if(H=="shading")t.parameters[H]=t.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")t.parameters[H]=THREE[t.parameters[H]]?THREE[t.parameters[H]]:THREE.NormalBlending;else if(H=="combine")t.parameters[H]=t.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H=="vertexColors")if(t.parameters[H]=="face")t.parameters[H]=THREE.FaceColors;else if(t.parameters[H])t.parameters[H]=
+THREE.VertexColors;if(t.parameters.opacity!==void 0&&t.parameters.opacity<1)t.parameters.transparent=true;if(t.parameters.normalMap){q=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(q.uniforms);l=t.parameters.color;n=t.parameters.specular;Z=t.parameters.ambient;c=t.parameters.shininess;a.tNormal.texture=L.textures[t.parameters.normalMap];if(t.parameters.normalMapFactor)a.uNormalScale.value=t.parameters.normalMapFactor;if(t.parameters.map){a.tDiffuse.texture=t.parameters.map;a.enableDiffuse.value=
+true}if(t.parameters.lightMap){a.tAO.texture=t.parameters.lightMap;a.enableAO.value=true}if(t.parameters.specularMap){a.tSpecular.texture=L.textures[t.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(Z);a.uShininess.value=c;if(t.parameters.opacity)a.uOpacity.value=t.parameters.opacity;M=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,uniforms:a,lights:true,fog:true})}else M=
+new THREE[t.type](t.parameters);L.materials[o]=M}e();i.callbackSync(L);h()};
 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:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
 a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;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:false;this.needsUpdate=this.visible=true};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.CustomBlending=6;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;
@@ -191,15 +194,14 @@ THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragme
 a.fog!==void 0?a.fog:false;this.lights=a.lights!==void 0?a.lights:false;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:THREE.NoColors;this.skinning=a.skinning!==void 0?a.skinning:false;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:false};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
 THREE.Texture=function(a,b,c,d,e,f,g,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=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g: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=
 true;this.needsUpdate=this.premultiplyAlpha=false;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.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
-THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=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,e,f,g,h,i,k){THREE.Texture.call(this,null,f,g,h,i,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=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.UnsignedByteType=9;THREE.ByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;
+THREE.UnsignedShort4444Type=16;THREE.UnsignedShort5551Type=17;THREE.UnsignedShort565Type=18;THREE.AlphaFormat=19;THREE.RGBFormat=20;THREE.RGBAFormat=21;THREE.LuminanceFormat=22;THREE.LuminanceAlphaFormat=23;THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,j){THREE.Texture.call(this,null,f,g,h,i,j,d,e);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=false;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}this.frustumCulled=false};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:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(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=b|this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=false;b=true}var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
+this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;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.update=function(a,b){this.matrixAutoUpdate&&(b=b|this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=false;b=true}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,e,f,g,h;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++){e=this.geometry.bones[c];f=e.pos;g=e.rotq;h=e.scl;d=this.addBone();d.name=e.name;d.position.set(f[0],f[1],f[2]);d.quaternion.set(g[0],g[1],g[2],g[3]);d.useQuaternion=true;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++){e=this.geometry.bones[c];
 d=this.bones[c];e.parent===-1?this.add(d):this.bones[e.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=false}for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,false):c.updateMatrixWorld(true)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
@@ -212,7 +214,7 @@ THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;if(
 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];if(c){this.setFrameRange(c.start,c.end);this.duration=1E3*((c.end-c.start)/b);this.time=0}else console.warn("animation["+a+"] undefined")};
 THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time=this.time+this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||this.time<0){this.direction=this.direction*-1;if(this.time>this.duration){this.time=this.duration;this.directionBackwards=true}if(this.time<0){this.time=0;this.directionBackwards=false}}}else{this.time=this.time%this.duration;if(this.time<0)this.time=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.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.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.elements[2]*this.matrixWorld.elements[12]+a.elements[6]*this.matrixWorld.elements[13]+a.elements[10]*this.matrixWorld.elements[14]+a.elements[14]);this.LODs[0].object3D.visible=true;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance){this.LODs[b-1].object3D.visible=false;this.LODs[b].object3D.visible=true}else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=
 false}};
 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.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?
@@ -223,50 +225,35 @@ THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function()
 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 if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(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(){console.log("THREE.DOMRenderer",THREE.REVISION);var a,b,c,d,e,f,g,h=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if(typeof b.style[a[c]]==="string")return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var l,o,m,p,q,n;a=h.projectScene(c,d);b=a.elements;l=0;for(o=
-b.length;l<o;l++){m=b[l];if(m instanceof THREE.RenderableParticle&&m.material instanceof THREE.ParticleDOMMaterial){p=m.material.domElement;q=m.x*e+e-(p.offsetWidth>>1);n=m.y*f+f-(p.offsetHeight>>1);p.style.left=q+"px";p.style.top=n+"px";p.style.zIndex=Math.abs(Math.floor((1-m.z)*d.far/d.near));g&&(p.style[g]="scale("+m.scale.x*e+","+m.scale.y*f+")")}}}};
-THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(y!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter"}y=a}}function d(a){if(s!=a)n.strokeStyle=s=a}function e(a){if(w!=a)n.fillStyle=w=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,k=new THREE.Projector,l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),o,m,p,q,n=l.getContext("2d"),
-r=new THREE.Color(0),u=0,t=1,y=0,s=null,w=null,H=null,E=null,z=null,v,A,J,K,R=new THREE.RenderableVertex,P=new THREE.RenderableVertex,D,M,G,j,T,U,C,Y,F,ea,fa,ia,O=new THREE.Color,Q=new THREE.Color,Z=new THREE.Color,$=new THREE.Color,ha=new THREE.Color,Ma=[],Ka=[],Ra,La,Sa,Na,Kb,lb,gb,Lb,hb,Cb,Wa=new THREE.Rectangle,Ba=new THREE.Rectangle,xa=new THREE.Rectangle,$a=false,aa=new THREE.Color,Ta=new THREE.Color,Qa=new THREE.Color,oa=new THREE.Vector3,ib,Db,Sc,ab,pc,Bc,a=16;ib=document.createElement("canvas");
-ib.width=ib.height=2;Db=ib.getContext("2d");Db.fillStyle="rgba(0,0,0,1)";Db.fillRect(0,0,2,2);Sc=Db.getImageData(0,0,2,2);ab=Sc.data;pc=document.createElement("canvas");pc.width=pc.height=a;Bc=pc.getContext("2d");Bc.translate(-a/2,-a/2);Bc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;m=b;p=Math.floor(o/2);q=Math.floor(m/2);l.width=o;l.height=m;Wa.set(-p,-q,p,q);Ba.set(-p,-q,p,q);t=1;y=
-0;z=E=H=w=s=null};this.setClearColor=function(a,b){r.copy(a);u=b!==void 0?b:1;Ba.set(-p,-q,p,q)};this.setClearColorHex=function(a,b){r.setHex(a);u=b!==void 0?b:1;Ba.set(-p,-q,p,q)};this.clear=function(){n.setTransform(1,0,0,-1,p,q);if(!Ba.isEmpty()){Ba.minSelf(Wa);Ba.inflate(2);u<1&&n.clearRect(Math.floor(Ba.getX()),Math.floor(Ba.getY()),Math.floor(Ba.getWidth()),Math.floor(Ba.getHeight()));if(u>0){c(THREE.NormalBlending);b(1);e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*
-255)+","+u+")");n.fillRect(Math.floor(Ba.getX()),Math.floor(Ba.getY()),Math.floor(Ba.getWidth()),Math.floor(Ba.getHeight()))}Ba.empty()}};this.render=function(a,l){function m(a){var b,c,d,e;aa.setRGB(0,0,0);Ta.setRGB(0,0,0);Qa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){aa.r=aa.r+e.r;aa.g=aa.g+e.g;aa.b=aa.b+e.b}else if(d instanceof THREE.DirectionalLight){Ta.r=Ta.r+e.r;Ta.g=Ta.g+e.g;Ta.b=Ta.b+e.b}else if(d instanceof THREE.PointLight){Qa.r=Qa.r+e.r;
-Qa.g=Qa.g+e.g;Qa.b=Qa.b+e.b}}}function o(a,b,c,d){var e,f,g,h,j,i;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){j=g.matrixWorld.getPosition();i=c.dot(j);if(!(i<=0)){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}else if(g instanceof THREE.PointLight){j=g.matrixWorld.getPosition();i=c.dot(oa.sub(j,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1));if(i!=0){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+
-h.b*i}}}}}function r(a,f,g){b(g.opacity);c(g.blending);var h,j,i,l,k,m;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){l=g.map.image;k=l.width>>1;m=l.height>>1;g=f.scale.x*p;i=f.scale.y*q;h=g*k;j=i*m;xa.set(a.x-h,a.y-j,a.x+h,a.y+j);if(Wa.intersects(xa)){n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(g,-i);n.translate(-k,-m);n.drawImage(l,0,0);n.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=f.scale.x*p;j=f.scale.y*q;xa.set(a.x-h,a.y-j,a.x+h,a.y+j);if(Wa.intersects(xa)){d(g.color.getContextStyle());
-e(g.color.getContextStyle());n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(h,j);g.program(n);n.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(H!=a)n.lineWidth=H=a;a=g.linecap;if(E!=a)n.lineCap=E=a;a=g.linejoin;if(z!=a)n.lineJoin=z=a;d(g.color.getContextStyle());n.stroke();xa.inflate(g.linewidth*
-2)}}function t(a,d,e,g,h,k,m,n){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(n.opacity);c(n.blending);D=a.positionScreen.x;M=a.positionScreen.y;G=d.positionScreen.x;j=d.positionScreen.y;T=e.positionScreen.x;U=e.positionScreen.y;w(D,M,G,j,T,U);if(n instanceof THREE.MeshBasicMaterial)if(n.map){if(n.map.mapping instanceof THREE.UVMapping){Na=m.uvs[0];ad(D,M,G,j,T,U,Na[g].u,Na[g].v,Na[h].u,Na[h].v,Na[k].u,Na[k].v,n.map)}}else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=
-l.matrixWorldInverse;oa.copy(m.vertexNormalsWorld[g]);Kb=(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;lb=-(oa.x*a.elements[1]+oa.y*a.elements[5]+oa.z*a.elements[9])*0.5+0.5;oa.copy(m.vertexNormalsWorld[h]);gb=(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;Lb=-(oa.x*a.elements[1]+oa.y*a.elements[5]+oa.z*a.elements[9])*0.5+0.5;oa.copy(m.vertexNormalsWorld[k]);hb=(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;Cb=-(oa.x*a.elements[1]+oa.y*
-a.elements[5]+oa.z*a.elements[9])*0.5+0.5;ad(D,M,G,j,T,U,Kb,lb,gb,Lb,hb,Cb,n.envMap)}}else n.wireframe?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Eb(n.color);else if(n instanceof THREE.MeshLambertMaterial)if($a)if(!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3){Q.r=Z.r=$.r=aa.r;Q.g=Z.g=$.g=aa.g;Q.b=Z.b=$.b=aa.b;o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],Q);o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],Z);o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],
-$);Q.r=Math.max(0,Math.min(n.color.r*Q.r,1));Q.g=Math.max(0,Math.min(n.color.g*Q.g,1));Q.b=Math.max(0,Math.min(n.color.b*Q.b,1));Z.r=Math.max(0,Math.min(n.color.r*Z.r,1));Z.g=Math.max(0,Math.min(n.color.g*Z.g,1));Z.b=Math.max(0,Math.min(n.color.b*Z.b,1));$.r=Math.max(0,Math.min(n.color.r*$.r,1));$.g=Math.max(0,Math.min(n.color.g*$.g,1));$.b=Math.max(0,Math.min(n.color.b*$.b,1));ha.r=(Z.r+$.r)*0.5;ha.g=(Z.g+$.g)*0.5;ha.b=(Z.b+$.b)*0.5;Sa=Cc(Q,Z,$,ha);gc(D,M,G,j,T,U,0,0,1,0,0,1,Sa)}else{O.r=aa.r;O.g=
-aa.g;O.b=aa.b;o(i,m.centroidWorld,m.normalWorld,O);O.r=Math.max(0,Math.min(n.color.r*O.r,1));O.g=Math.max(0,Math.min(n.color.g*O.g,1));O.b=Math.max(0,Math.min(n.color.b*O.b,1));n.wireframe?Mb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Eb(O)}else n.wireframe?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Eb(n.color);else if(n instanceof THREE.MeshDepthMaterial){Ra=l.near;La=l.far;Q.r=Q.g=Q.b=1-ac(a.positionScreen.z,Ra,La);Z.r=Z.g=Z.b=1-ac(d.positionScreen.z,
-Ra,La);$.r=$.g=$.b=1-ac(e.positionScreen.z,Ra,La);ha.r=(Z.r+$.r)*0.5;ha.g=(Z.g+$.g)*0.5;ha.b=(Z.b+$.b)*0.5;Sa=Cc(Q,Z,$,ha);gc(D,M,G,j,T,U,0,0,1,0,0,1,Sa)}else if(n instanceof THREE.MeshNormalMaterial){O.r=hc(m.normalWorld.x);O.g=hc(m.normalWorld.y);O.b=hc(m.normalWorld.z);n.wireframe?Mb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Eb(O)}}function u(a,d,e,g,h,k,n,m,p){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(m.opacity);c(m.blending);if(m.map||m.envMap){t(a,
-d,g,0,1,3,n,m,p);t(h,e,k,1,2,3,n,m,p)}else{D=a.positionScreen.x;M=a.positionScreen.y;G=d.positionScreen.x;j=d.positionScreen.y;T=e.positionScreen.x;U=e.positionScreen.y;C=g.positionScreen.x;Y=g.positionScreen.y;F=h.positionScreen.x;ea=h.positionScreen.y;fa=k.positionScreen.x;ia=k.positionScreen.y;if(m instanceof THREE.MeshBasicMaterial){y(D,M,G,j,T,U,C,Y);m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Eb(m.color)}else if(m instanceof THREE.MeshLambertMaterial)if($a)if(!m.wireframe&&
-m.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4){Q.r=Z.r=$.r=ha.r=aa.r;Q.g=Z.g=$.g=ha.g=aa.g;Q.b=Z.b=$.b=ha.b=aa.b;o(i,n.v1.positionWorld,n.vertexNormalsWorld[0],Q);o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],Z);o(i,n.v4.positionWorld,n.vertexNormalsWorld[3],$);o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],ha);Q.r=Math.max(0,Math.min(m.color.r*Q.r,1));Q.g=Math.max(0,Math.min(m.color.g*Q.g,1));Q.b=Math.max(0,Math.min(m.color.b*Q.b,1));Z.r=Math.max(0,Math.min(m.color.r*Z.r,1));Z.g=
-Math.max(0,Math.min(m.color.g*Z.g,1));Z.b=Math.max(0,Math.min(m.color.b*Z.b,1));$.r=Math.max(0,Math.min(m.color.r*$.r,1));$.g=Math.max(0,Math.min(m.color.g*$.g,1));$.b=Math.max(0,Math.min(m.color.b*$.b,1));ha.r=Math.max(0,Math.min(m.color.r*ha.r,1));ha.g=Math.max(0,Math.min(m.color.g*ha.g,1));ha.b=Math.max(0,Math.min(m.color.b*ha.b,1));Sa=Cc(Q,Z,$,ha);w(D,M,G,j,C,Y);gc(D,M,G,j,C,Y,0,0,1,0,0,1,Sa);w(F,ea,T,U,fa,ia);gc(F,ea,T,U,fa,ia,1,0,1,1,0,1,Sa)}else{O.r=aa.r;O.g=aa.g;O.b=aa.b;o(i,n.centroidWorld,
-n.normalWorld,O);O.r=Math.max(0,Math.min(m.color.r*O.r,1));O.g=Math.max(0,Math.min(m.color.g*O.g,1));O.b=Math.max(0,Math.min(m.color.b*O.b,1));y(D,M,G,j,T,U,C,Y);m.wireframe?Mb(O,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Eb(O)}else{y(D,M,G,j,T,U,C,Y);m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Eb(m.color)}else if(m instanceof THREE.MeshNormalMaterial){O.r=hc(n.normalWorld.x);O.g=hc(n.normalWorld.y);O.b=hc(n.normalWorld.z);y(D,M,G,j,T,U,C,
-Y);m.wireframe?Mb(O,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Eb(O)}else if(m instanceof THREE.MeshDepthMaterial){Ra=l.near;La=l.far;Q.r=Q.g=Q.b=1-ac(a.positionScreen.z,Ra,La);Z.r=Z.g=Z.b=1-ac(d.positionScreen.z,Ra,La);$.r=$.g=$.b=1-ac(g.positionScreen.z,Ra,La);ha.r=ha.g=ha.b=1-ac(e.positionScreen.z,Ra,La);Sa=Cc(Q,Z,$,ha);w(D,M,G,j,C,Y);gc(D,M,G,j,C,Y,0,0,1,0,0,1,Sa);w(F,ea,T,U,fa,ia);gc(F,ea,T,U,fa,ia,1,0,1,1,0,1,Sa)}}}function w(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,
-d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function y(a,b,c,d,e,f,g,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,h);n.lineTo(a,b);n.closePath()}function Mb(a,b,c,e){if(H!=b)n.lineWidth=H=b;if(E!=c)n.lineCap=E=c;if(z!=e)n.lineJoin=z=e;d(a.getContextStyle());n.stroke();xa.inflate(b*2)}function Eb(a){e(a.getContextStyle());n.fill()}function ad(a,b,c,d,f,g,h,j,i,k,l,m,o){if(o.image.width!=0){if(o.needsUpdate==true||Ma[o.id]==void 0){var p=o.wrapS==THREE.RepeatWrapping,q=o.wrapT==
-THREE.RepeatWrapping;Ma[o.id]=n.createPattern(o.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");o.needsUpdate=false}e(Ma[o.id]);var p=o.offset.x/o.repeat.x,q=o.offset.y/o.repeat.y,Db=o.image.width*o.repeat.x,r=o.image.height*o.repeat.y,h=(h+p)*Db,j=(j+q)*r,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+p)*Db-h,k=(k+q)*r-j,l=(l+p)*Db-h,m=(m+q)*r-j,p=i*m-l*k;if(p==0){if(Ka[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");b.drawImage(o.image,
-0,0);Ka[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=Ka[o.id];h=(Math.floor(h)+Math.floor(j)*o.image.width)*4;O.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Eb(O)}else{p=1/p;o=(m*c-k*f)*p;k=(m*d-k*g)*p;c=(i*f-l*c)*p;d=(i*g-l*d)*p;a=a-o*h-c*j;h=b-k*h-d*j;n.save();n.transform(o,k,c,d,a,h);n.fill();n.restore()}}}function gc(a,b,c,d,e,f,g,h,j,i,k,l,m){var o,p;o=m.width-1;p=m.height-1;g=g*o;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;j=j*o-g;i=i*p-h;k=k*o-g;l=l*p-h;p=1/(j*l-k*i);o=(l*c-i*e)*p;i=(l*d-i*f)*
-p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-o*g-c*h;b=b-i*g-d*h;n.save();n.transform(o,i,c,d,a,b);n.clip();n.drawImage(m,0,0);n.restore()}function Cc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),j=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ab[0]=e<0?0:e>255?255:e;ab[1]=f<0?0:f>255?255:f;ab[2]=a<0?0:a>255?255:a;ab[4]=g<0?0:g>255?255:g;ab[5]=h<0?0:h>255?255:h;ab[6]=b<0?0:b>255?255:b;ab[8]=j<0?0:j>255?255:j;ab[9]=i<0?0:
-i>255?255:i;ab[10]=c<0?0:c>255?255:c;ab[12]=k<0?0:k>255?255:k;ab[13]=l<0?0:l>255?255:l;ab[14]=d<0?0:d>255?255:d;Db.putImageData(Sc,0,0);Bc.drawImage(ib,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Dc,bd,Ha,eb;this.autoClear?this.clear():n.setTransform(1,0,0,-1,p,q);f.info.render.vertices=0;f.info.render.faces=
-0;g=k.projectScene(a,l,this.sortElements);h=g.elements;i=g.lights;($a=i.length>0)&&m(i);Dc=0;for(bd=h.length;Dc<bd;Dc++){Ha=h[Dc];eb=Ha.material;eb=eb instanceof THREE.MeshFaceMaterial?Ha.faceMaterial:eb;if(!(eb===void 0||eb.visible===false)){xa.empty();if(Ha instanceof THREE.RenderableParticle){v=Ha;v.x=v.x*p;v.y=v.y*q;r(v,Ha,eb,a)}else if(Ha instanceof THREE.RenderableLine){v=Ha.v1;A=Ha.v2;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*q;A.positionScreen.x=A.positionScreen.x*
-p;A.positionScreen.y=A.positionScreen.y*q;xa.addPoint(v.positionScreen.x,v.positionScreen.y);xa.addPoint(A.positionScreen.x,A.positionScreen.y);Wa.intersects(xa)&&s(v,A,Ha,eb,a)}else if(Ha instanceof THREE.RenderableFace3){v=Ha.v1;A=Ha.v2;J=Ha.v3;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*q;A.positionScreen.x=A.positionScreen.x*p;A.positionScreen.y=A.positionScreen.y*q;J.positionScreen.x=J.positionScreen.x*p;J.positionScreen.y=J.positionScreen.y*q;if(eb.overdraw){Nb(v.positionScreen,
-A.positionScreen);Nb(A.positionScreen,J.positionScreen);Nb(J.positionScreen,v.positionScreen)}xa.add3Points(v.positionScreen.x,v.positionScreen.y,A.positionScreen.x,A.positionScreen.y,J.positionScreen.x,J.positionScreen.y);Wa.intersects(xa)&&t(v,A,J,0,1,2,Ha,eb,a)}else if(Ha instanceof THREE.RenderableFace4){v=Ha.v1;A=Ha.v2;J=Ha.v3;K=Ha.v4;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*q;A.positionScreen.x=A.positionScreen.x*p;A.positionScreen.y=A.positionScreen.y*q;
-J.positionScreen.x=J.positionScreen.x*p;J.positionScreen.y=J.positionScreen.y*q;K.positionScreen.x=K.positionScreen.x*p;K.positionScreen.y=K.positionScreen.y*q;R.positionScreen.copy(A.positionScreen);P.positionScreen.copy(K.positionScreen);if(eb.overdraw){Nb(v.positionScreen,A.positionScreen);Nb(A.positionScreen,K.positionScreen);Nb(K.positionScreen,v.positionScreen);Nb(J.positionScreen,R.positionScreen);Nb(J.positionScreen,P.positionScreen)}xa.addPoint(v.positionScreen.x,v.positionScreen.y);xa.addPoint(A.positionScreen.x,
-A.positionScreen.y);xa.addPoint(J.positionScreen.x,J.positionScreen.y);xa.addPoint(K.positionScreen.x,K.positionScreen.y);Wa.intersects(xa)&&u(v,A,J,K,R,P,Ha,eb,a)}Ba.addRectangle(xa)}}n.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,k;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){i=g.matrixWorld.getPosition();k=c.dot(i);if(!(k<=0)){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*k}}else if(g instanceof THREE.PointLight){i=g.matrixWorld.getPosition();k=c.dot(v.sub(i,b).normalize());if(!(k<=0)){k=k*(g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1));if(k!=0){k=k*g.intensity;d.r=d.r+h.r*k;d.g=d.g+h.g*k;d.b=d.b+h.b*
-k}}}}}function b(a){if(A[a]==null){A[a]=document.createElementNS("http://www.w3.org/2000/svg","path");D==0&&A[a].setAttribute("shape-rendering","crispEdges")}return A[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}console.log("THREE.SVGRenderer",THREE.REVISION);var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,o,m,p,q,n,r,u=new THREE.Rectangle,t=new THREE.Rectangle,y=false,s=new THREE.Color,w=new THREE.Color,H=new THREE.Color,E=new THREE.Color,
-z,v=new THREE.Vector3,A=[],J=[],K,R,P,D=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":D=1;break;case "low":D=0}};this.setSize=function(a,b){k=a;l=b;o=k/2;m=l/2;i.setAttribute("viewBox",-o+" "+-m+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);u.set(-o,-m,o,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,
-l){var j,v,A,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,l,this.sortElements);f=e.elements;g=e.lights;P=R=0;if(y=g.length>0){w.setRGB(0,0,0);H.setRGB(0,0,0);E.setRGB(0,0,0);j=0;for(v=g.length;j<v;j++){C=g[j];A=C.color;if(C instanceof THREE.AmbientLight){w.r=w.r+A.r;w.g=w.g+A.g;w.b=w.b+A.b}else if(C instanceof THREE.DirectionalLight){H.r=H.r+A.r;H.g=H.g+A.g;H.b=H.b+A.b}else if(C instanceof THREE.PointLight){E.r=E.r+A.r;E.g=E.g+A.g;E.b=E.b+A.b}}}j=
-0;for(v=f.length;j<v;j++){A=f[j];C=A.material;C=C instanceof THREE.MeshFaceMaterial?A.faceMaterial:C;if(!(C===void 0||C.visible===false)){t.empty();if(A instanceof THREE.RenderableParticle){p=A;p.x=p.x*o;p.y=p.y*-m}else if(A instanceof THREE.RenderableLine){p=A.v1;q=A.v2;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*o;q.positionScreen.y=q.positionScreen.y*-m;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(q.positionScreen.x,
-q.positionScreen.y);if(u.intersects(t)){A=p;var Y=q,F=P++;if(J[F]==null){J[F]=document.createElementNS("http://www.w3.org/2000/svg","line");D==0&&J[F].setAttribute("shape-rendering","crispEdges")}K=J[F];K.setAttribute("x1",A.positionScreen.x);K.setAttribute("y1",A.positionScreen.y);K.setAttribute("x2",Y.positionScreen.x);K.setAttribute("y2",Y.positionScreen.y);if(C instanceof THREE.LineBasicMaterial){K.setAttribute("style","fill: none; stroke: "+C.color.getContextStyle()+"; stroke-width: "+C.linewidth+
-"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.linecap+"; stroke-linejoin: "+C.linejoin);i.appendChild(K)}}}else if(A instanceof THREE.RenderableFace3){p=A.v1;q=A.v2;n=A.v3;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*o;q.positionScreen.y=q.positionScreen.y*-m;n.positionScreen.x=n.positionScreen.x*o;n.positionScreen.y=n.positionScreen.y*-m;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(q.positionScreen.x,
-q.positionScreen.y);t.addPoint(n.positionScreen.x,n.positionScreen.y);if(u.intersects(t)){var Y=p,F=q,ea=n;d.info.render.vertices=d.info.render.vertices+3;d.info.render.faces++;K=b(R++);K.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+ea.positionScreen.x+","+ea.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)s.copy(C.color);else if(C instanceof THREE.MeshLambertMaterial)if(y){s.r=w.r;s.g=w.g;s.b=w.b;a(g,A.centroidWorld,
-A.normalWorld,s);s.r=Math.max(0,Math.min(C.color.r*s.r,1));s.g=Math.max(0,Math.min(C.color.g*s.g,1));s.b=Math.max(0,Math.min(C.color.b*s.b,1))}else s.copy(C.color);else if(C instanceof THREE.MeshDepthMaterial){z=1-C.__2near/(C.__farPlusNear-A.z*C.__farMinusNear);s.setRGB(z,z,z)}else C instanceof THREE.MeshNormalMaterial&&s.setRGB(c(A.normalWorld.x),c(A.normalWorld.y),c(A.normalWorld.z));C.wireframe?K.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+
-"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):K.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(K)}}else if(A instanceof THREE.RenderableFace4){p=A.v1;q=A.v2;n=A.v3;r=A.v4;p.positionScreen.x=p.positionScreen.x*o;p.positionScreen.y=p.positionScreen.y*-m;q.positionScreen.x=q.positionScreen.x*o;q.positionScreen.y=q.positionScreen.y*-m;n.positionScreen.x=n.positionScreen.x*o;n.positionScreen.y=
-n.positionScreen.y*-m;r.positionScreen.x=r.positionScreen.x*o;r.positionScreen.y=r.positionScreen.y*-m;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(q.positionScreen.x,q.positionScreen.y);t.addPoint(n.positionScreen.x,n.positionScreen.y);t.addPoint(r.positionScreen.x,r.positionScreen.y);if(u.intersects(t)){var Y=p,F=q,ea=n,fa=r;d.info.render.vertices=d.info.render.vertices+4;d.info.render.faces++;K=b(R++);K.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+F.positionScreen.x+
-" "+F.positionScreen.y+" L "+ea.positionScreen.x+","+ea.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");if(C instanceof THREE.MeshBasicMaterial)s.copy(C.color);else if(C instanceof THREE.MeshLambertMaterial)if(y){s.r=w.r;s.g=w.g;s.b=w.b;a(g,A.centroidWorld,A.normalWorld,s);s.r=Math.max(0,Math.min(C.color.r*s.r,1));s.g=Math.max(0,Math.min(C.color.g*s.g,1));s.b=Math.max(0,Math.min(C.color.b*s.b,1))}else s.copy(C.color);else if(C instanceof THREE.MeshDepthMaterial){z=1-C.__2near/
-(C.__farPlusNear-A.z*C.__farMinusNear);s.setRGB(z,z,z)}else C instanceof THREE.MeshNormalMaterial&&s.setRGB(c(A.normalWorld.x),c(A.normalWorld.y),c(A.normalWorld.z));C.wireframe?K.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):K.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(K)}}}}}};
+THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(y!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}y=a}}function d(a){if(s!=a)n.strokeStyle=s=a}function e(a){if(x!=a)n.fillStyle=x=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,l=a.canvas!==
+void 0?a.canvas:document.createElement("canvas"),o,m,p,r,n=l.getContext("2d"),q=new THREE.Color(0),u=0,t=1,y=0,s=null,x=null,E=null,D=null,A=null,v,H,I,M,R=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,B,G,Q,C,k,P,L,S,aa,N,ca,fa,O=new THREE.Color,$=new THREE.Color,U=new THREE.Color,Y=new THREE.Color,ha=new THREE.Color,Sa=[],Ma=[],Oa,oa,Ta,eb,fb,Za,Lb,mb,jb,nb,ab=new THREE.Rectangle,Ba=new THREE.Rectangle,ya=new THREE.Rectangle,gb=false,wa=new THREE.Color,Pa=new THREE.Color,Da=new THREE.Color,
+la=new THREE.Vector3,ob,$a,ac,Ja,pc,Bc,a=16;ob=document.createElement("canvas");ob.width=ob.height=2;$a=ob.getContext("2d");$a.fillStyle="rgba(0,0,0,1)";$a.fillRect(0,0,2,2);ac=$a.getImageData(0,0,2,2);Ja=ac.data;pc=document.createElement("canvas");pc.width=pc.height=a;Bc=pc.getContext("2d");Bc.translate(-a/2,-a/2);Bc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;m=b;p=Math.floor(o/2);
+r=Math.floor(m/2);l.width=o;l.height=m;ab.set(-p,-r,p,r);Ba.set(-p,-r,p,r);t=1;y=0;A=D=E=x=s=null};this.setClearColor=function(a,b){q.copy(a);u=b!==void 0?b:1;Ba.set(-p,-r,p,r)};this.setClearColorHex=function(a,b){q.setHex(a);u=b!==void 0?b:1;Ba.set(-p,-r,p,r)};this.clear=function(){n.setTransform(1,0,0,-1,p,r);if(!Ba.isEmpty()){Ba.minSelf(ab);Ba.inflate(2);u<1&&n.clearRect(Math.floor(Ba.getX()),Math.floor(Ba.getY()),Math.floor(Ba.getWidth()),Math.floor(Ba.getHeight()));if(u>0){c(THREE.NormalBlending);
+b(1);e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+u+")");n.fillRect(Math.floor(Ba.getX()),Math.floor(Ba.getY()),Math.floor(Ba.getWidth()),Math.floor(Ba.getHeight()))}Ba.empty()}};this.render=function(a,l){function m(a){var b,c,d,e;wa.setRGB(0,0,0);Pa.setRGB(0,0,0);Da.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){wa.r=wa.r+e.r;wa.g=wa.g+e.g;wa.b=wa.b+e.b}else if(d instanceof THREE.DirectionalLight){Pa.r=Pa.r+e.r;
+Pa.g=Pa.g+e.g;Pa.b=Pa.b+e.b}else if(d instanceof THREE.PointLight){Da.r=Da.r+e.r;Da.g=Da.g+e.g;Da.b=Da.b+e.b}}}function o(a,b,c,d){var e,f,g,h,k,i;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){k=g.matrixWorld.getPosition();i=c.dot(k);if(!(i<=0)){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}else if(g instanceof THREE.PointLight){k=g.matrixWorld.getPosition();i=c.dot(la.sub(k,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(k)/
+g.distance,1));if(i!=0){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}}}}function q(a,f,g){b(g.opacity);c(g.blending);var h,k,i,j,l,m;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){j=g.map.image;l=j.width>>1;m=j.height>>1;g=f.scale.x*p;i=f.scale.y*r;h=g*l;k=i*m;ya.set(a.x-h,a.y-k,a.x+h,a.y+k);if(ab.intersects(ya)){n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(g,-i);n.translate(-l,-m);n.drawImage(j,0,0);n.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=
+f.scale.x*p;k=f.scale.y*r;ya.set(a.x-h,a.y-k,a.x+h,a.y+k);if(ab.intersects(ya)){d(g.color.getContextStyle());e(g.color.getContextStyle());n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(h,k);g.program(n);n.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(E!=a)n.lineWidth=E=a;a=g.linecap;if(D!=a)n.lineCap=
+D=a;a=g.linejoin;if(A!=a)n.lineJoin=A=a;d(g.color.getContextStyle());n.stroke();ya.inflate(g.linewidth*2)}}function t(a,d,e,g,h,j,m,n){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(n.opacity);c(n.blending);B=a.positionScreen.x;G=a.positionScreen.y;Q=d.positionScreen.x;C=d.positionScreen.y;k=e.positionScreen.x;P=e.positionScreen.y;x(B,G,Q,C,k,P);if(n instanceof THREE.MeshBasicMaterial)if(n.map){if(n.map.mapping instanceof THREE.UVMapping){eb=m.uvs[0];$c(B,G,Q,C,k,P,eb[g].u,
+eb[g].v,eb[h].u,eb[h].v,eb[j].u,eb[j].v,n.map)}}else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=l.matrixWorldInverse;la.copy(m.vertexNormalsWorld[g]);fb=(la.x*a.elements[0]+la.y*a.elements[4]+la.z*a.elements[8])*0.5+0.5;Za=-(la.x*a.elements[1]+la.y*a.elements[5]+la.z*a.elements[9])*0.5+0.5;la.copy(m.vertexNormalsWorld[h]);Lb=(la.x*a.elements[0]+la.y*a.elements[4]+la.z*a.elements[8])*0.5+0.5;mb=-(la.x*a.elements[1]+la.y*a.elements[5]+la.z*a.elements[9])*0.5+0.5;
+la.copy(m.vertexNormalsWorld[j]);jb=(la.x*a.elements[0]+la.y*a.elements[4]+la.z*a.elements[8])*0.5+0.5;nb=-(la.x*a.elements[1]+la.y*a.elements[5]+la.z*a.elements[9])*0.5+0.5;$c(B,G,Q,C,k,P,fb,Za,Lb,mb,jb,nb,n.envMap)}}else n.wireframe?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Fb(n.color);else if(n instanceof THREE.MeshLambertMaterial)if(gb)if(!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3){$.r=U.r=Y.r=wa.r;$.g=U.g=Y.g=wa.g;$.b=U.b=Y.b=wa.b;
+o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],$);o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],U);o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],Y);$.r=Math.max(0,Math.min(n.color.r*$.r,1));$.g=Math.max(0,Math.min(n.color.g*$.g,1));$.b=Math.max(0,Math.min(n.color.b*$.b,1));U.r=Math.max(0,Math.min(n.color.r*U.r,1));U.g=Math.max(0,Math.min(n.color.g*U.g,1));U.b=Math.max(0,Math.min(n.color.b*U.b,1));Y.r=Math.max(0,Math.min(n.color.r*Y.r,1));Y.g=Math.max(0,Math.min(n.color.g*Y.g,1));Y.b=Math.max(0,
+Math.min(n.color.b*Y.b,1));ha.r=(U.r+Y.r)*0.5;ha.g=(U.g+Y.g)*0.5;ha.b=(U.b+Y.b)*0.5;Ta=Cc($,U,Y,ha);hc(B,G,Q,C,k,P,0,0,1,0,0,1,Ta)}else{O.r=wa.r;O.g=wa.g;O.b=wa.b;o(i,m.centroidWorld,m.normalWorld,O);O.r=Math.max(0,Math.min(n.color.r*O.r,1));O.g=Math.max(0,Math.min(n.color.g*O.g,1));O.b=Math.max(0,Math.min(n.color.b*O.b,1));n.wireframe?Mb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Fb(O)}else n.wireframe?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Fb(n.color);
+else if(n instanceof THREE.MeshDepthMaterial){Oa=l.near;oa=l.far;$.r=$.g=$.b=1-bc(a.positionScreen.z,Oa,oa);U.r=U.g=U.b=1-bc(d.positionScreen.z,Oa,oa);Y.r=Y.g=Y.b=1-bc(e.positionScreen.z,Oa,oa);ha.r=(U.r+Y.r)*0.5;ha.g=(U.g+Y.g)*0.5;ha.b=(U.b+Y.b)*0.5;Ta=Cc($,U,Y,ha);hc(B,G,Q,C,k,P,0,0,1,0,0,1,Ta)}else if(n instanceof THREE.MeshNormalMaterial){O.r=ic(m.normalWorld.x);O.g=ic(m.normalWorld.y);O.b=ic(m.normalWorld.z);n.wireframe?Mb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Fb(O)}}
+function u(a,d,e,g,h,j,n,m,p){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(m.opacity);c(m.blending);if(m.map||m.envMap){t(a,d,g,0,1,3,n,m,p);t(h,e,j,1,2,3,n,m,p)}else{B=a.positionScreen.x;G=a.positionScreen.y;Q=d.positionScreen.x;C=d.positionScreen.y;k=e.positionScreen.x;P=e.positionScreen.y;L=g.positionScreen.x;S=g.positionScreen.y;aa=h.positionScreen.x;N=h.positionScreen.y;ca=j.positionScreen.x;fa=j.positionScreen.y;if(m instanceof THREE.MeshBasicMaterial){y(B,G,Q,C,k,
+P,L,S);m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Fb(m.color)}else if(m instanceof THREE.MeshLambertMaterial)if(gb)if(!m.wireframe&&m.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4){$.r=U.r=Y.r=ha.r=wa.r;$.g=U.g=Y.g=ha.g=wa.g;$.b=U.b=Y.b=ha.b=wa.b;o(i,n.v1.positionWorld,n.vertexNormalsWorld[0],$);o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],U);o(i,n.v4.positionWorld,n.vertexNormalsWorld[3],Y);o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],ha);
+$.r=Math.max(0,Math.min(m.color.r*$.r,1));$.g=Math.max(0,Math.min(m.color.g*$.g,1));$.b=Math.max(0,Math.min(m.color.b*$.b,1));U.r=Math.max(0,Math.min(m.color.r*U.r,1));U.g=Math.max(0,Math.min(m.color.g*U.g,1));U.b=Math.max(0,Math.min(m.color.b*U.b,1));Y.r=Math.max(0,Math.min(m.color.r*Y.r,1));Y.g=Math.max(0,Math.min(m.color.g*Y.g,1));Y.b=Math.max(0,Math.min(m.color.b*Y.b,1));ha.r=Math.max(0,Math.min(m.color.r*ha.r,1));ha.g=Math.max(0,Math.min(m.color.g*ha.g,1));ha.b=Math.max(0,Math.min(m.color.b*
+ha.b,1));Ta=Cc($,U,Y,ha);x(B,G,Q,C,L,S);hc(B,G,Q,C,L,S,0,0,1,0,0,1,Ta);x(aa,N,k,P,ca,fa);hc(aa,N,k,P,ca,fa,1,0,1,1,0,1,Ta)}else{O.r=wa.r;O.g=wa.g;O.b=wa.b;o(i,n.centroidWorld,n.normalWorld,O);O.r=Math.max(0,Math.min(m.color.r*O.r,1));O.g=Math.max(0,Math.min(m.color.g*O.g,1));O.b=Math.max(0,Math.min(m.color.b*O.b,1));y(B,G,Q,C,k,P,L,S);m.wireframe?Mb(O,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Fb(O)}else{y(B,G,Q,C,k,P,L,S);m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,
+m.wireframeLinejoin):Fb(m.color)}else if(m instanceof THREE.MeshNormalMaterial){O.r=ic(n.normalWorld.x);O.g=ic(n.normalWorld.y);O.b=ic(n.normalWorld.z);y(B,G,Q,C,k,P,L,S);m.wireframe?Mb(O,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Fb(O)}else if(m instanceof THREE.MeshDepthMaterial){Oa=l.near;oa=l.far;$.r=$.g=$.b=1-bc(a.positionScreen.z,Oa,oa);U.r=U.g=U.b=1-bc(d.positionScreen.z,Oa,oa);Y.r=Y.g=Y.b=1-bc(g.positionScreen.z,Oa,oa);ha.r=ha.g=ha.b=1-bc(e.positionScreen.z,Oa,oa);Ta=Cc($,
+U,Y,ha);x(B,G,Q,C,L,S);hc(B,G,Q,C,L,S,0,0,1,0,0,1,Ta);x(aa,N,k,P,ca,fa);hc(aa,N,k,P,ca,fa,1,0,1,1,0,1,Ta)}}}function x(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b)}function y(a,b,c,d,e,f,g,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,h);n.lineTo(a,b)}function Mb(a,b,c,e){if(E!=b)n.lineWidth=E=b;if(D!=c)n.lineCap=D=c;if(A!=e)n.lineJoin=A=e;d(a.getContextStyle());n.stroke();ya.inflate(b*2)}function Fb(a){e(a.getContextStyle());n.fill()}
+function $c(a,b,c,d,f,g,h,k,i,j,l,m,o){if(!(o.image===void 0||o.image.width===0)){if(o.needsUpdate===true||Sa[o.id]===void 0){var p=o.wrapS==THREE.RepeatWrapping,Ja=o.wrapT==THREE.RepeatWrapping;Sa[o.id]=n.createPattern(o.image,p&&Ja?"repeat":p&&!Ja?"repeat-x":!p&&Ja?"repeat-y":"no-repeat");o.needsUpdate=false}e(Sa[o.id]);var p=o.offset.x/o.repeat.x,Ja=o.offset.y/o.repeat.y,r=o.image.width*o.repeat.x,q=o.image.height*o.repeat.y,h=(h+p)*r,k=(k+Ja)*q,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+p)*r-h,j=(j+Ja)*q-k,
+l=(l+p)*r-h,m=(m+Ja)*q-k,p=i*m-l*j;if(p==0){if(Ma[o.id]===void 0){b=document.createElement("canvas");b.width=o.image.width;b.height=o.image.height;b=b.getContext("2d");b.drawImage(o.image,0,0);Ma[o.id]=b.getImageData(0,0,o.image.width,o.image.height).data}b=Ma[o.id];h=(Math.floor(h)+Math.floor(k)*o.image.width)*4;O.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Fb(O)}else{p=1/p;o=(m*c-j*f)*p;j=(m*d-j*g)*p;c=(i*f-l*c)*p;d=(i*g-l*d)*p;a=a-o*h-c*k;h=b-j*h-d*k;n.save();n.transform(o,j,c,d,a,h);n.fill();n.restore()}}}
+function hc(a,b,c,d,e,f,g,h,k,i,j,l,m){var o,p;o=m.width-1;p=m.height-1;g=g*o;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;k=k*o-g;i=i*p-h;j=j*o-g;l=l*p-h;p=1/(k*l-j*i);o=(l*c-i*e)*p;i=(l*d-i*f)*p;c=(k*e-j*c)*p;d=(k*f-j*d)*p;a=a-o*g-c*h;b=b-i*g-d*h;n.save();n.transform(o,i,c,d,a,b);n.clip();n.drawImage(m,0,0);n.restore()}function Cc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),j=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);
+Ja[0]=e<0?0:e>255?255:e;Ja[1]=f<0?0:f>255?255:f;Ja[2]=a<0?0:a>255?255:a;Ja[4]=g<0?0:g>255?255:g;Ja[5]=h<0?0:h>255?255:h;Ja[6]=b<0?0:b>255?255:b;Ja[8]=k<0?0:k>255?255:k;Ja[9]=i<0?0:i>255?255:i;Ja[10]=c<0?0:c>255?255:c;Ja[12]=j<0?0:j>255?255:j;Ja[13]=l<0?0:l>255?255:l;Ja[14]=d<0?0:d>255?255:d;$a.putImageData(ac,0,0);Bc.drawImage(ob,0,0);return pc}function bc(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ic(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=
+0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Dc,ad,Ka,hb;this.autoClear?this.clear():n.setTransform(1,0,0,-1,p,r);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,l,this.sortElements);h=g.elements;i=g.lights;(gb=i.length>0)&&m(i);Dc=0;for(ad=h.length;Dc<ad;Dc++){Ka=h[Dc];hb=Ka.material;hb=hb instanceof THREE.MeshFaceMaterial?Ka.faceMaterial:hb;if(!(hb===void 0||hb.visible===false)){ya.empty();if(Ka instanceof THREE.RenderableParticle){v=Ka;v.x=v.x*
+p;v.y=v.y*r;q(v,Ka,hb,a)}else if(Ka instanceof THREE.RenderableLine){v=Ka.v1;H=Ka.v2;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;ya.addPoint(v.positionScreen.x,v.positionScreen.y);ya.addPoint(H.positionScreen.x,H.positionScreen.y);ab.intersects(ya)&&s(v,H,Ka,hb,a)}else if(Ka instanceof THREE.RenderableFace3){v=Ka.v1;H=Ka.v2;I=Ka.v3;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=
+v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;I.positionScreen.x=I.positionScreen.x*p;I.positionScreen.y=I.positionScreen.y*r;if(hb.overdraw){Nb(v.positionScreen,H.positionScreen);Nb(H.positionScreen,I.positionScreen);Nb(I.positionScreen,v.positionScreen)}ya.add3Points(v.positionScreen.x,v.positionScreen.y,H.positionScreen.x,H.positionScreen.y,I.positionScreen.x,I.positionScreen.y);ab.intersects(ya)&&t(v,H,I,0,1,2,Ka,hb,a)}else if(Ka instanceof
+THREE.RenderableFace4){v=Ka.v1;H=Ka.v2;I=Ka.v3;M=Ka.v4;v.positionScreen.x=v.positionScreen.x*p;v.positionScreen.y=v.positionScreen.y*r;H.positionScreen.x=H.positionScreen.x*p;H.positionScreen.y=H.positionScreen.y*r;I.positionScreen.x=I.positionScreen.x*p;I.positionScreen.y=I.positionScreen.y*r;M.positionScreen.x=M.positionScreen.x*p;M.positionScreen.y=M.positionScreen.y*r;R.positionScreen.copy(H.positionScreen);Z.positionScreen.copy(M.positionScreen);if(hb.overdraw){Nb(v.positionScreen,H.positionScreen);
+Nb(H.positionScreen,M.positionScreen);Nb(M.positionScreen,v.positionScreen);Nb(I.positionScreen,R.positionScreen);Nb(I.positionScreen,Z.positionScreen)}ya.addPoint(v.positionScreen.x,v.positionScreen.y);ya.addPoint(H.positionScreen.x,H.positionScreen.y);ya.addPoint(I.positionScreen.x,I.positionScreen.y);ya.addPoint(M.positionScreen.x,M.positionScreen.y);ab.intersects(ya)&&u(v,H,I,M,R,Z,Ka,hb,a)}Ba.addRectangle(ya)}}n.setTransform(1,0,0,1,0,0)}};
 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",
@@ -303,135 +290,137 @@ THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.Shader
 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 e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
+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 e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=true;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=k.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=true}a.__webglCustomAttributesList.push(f)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?true:false}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
-var i=a.colors,k=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,q=a.__webglCustomAttributesList;if(c.sortParticles){xa.copy(Ba);xa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];$a.copy(e);xa.multiplyVector3($a);n[d]=[$a.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[n[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<k;d++){f=d*3;e=i[n[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(q){i=0;for(k=q.length;i<k;i++){h=q[i];
+var i=a.colors,j=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,r=a.__webglCustomAttributesList;if(c.sortParticles){wa.copy(gb);wa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){e=h[d];Pa.copy(e);wa.multiplyVector3(Pa);n[d]=[Pa.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){e=h[n[d][1]];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}for(d=0;d<j;d++){f=d*3;e=i[n[d][1]];m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];
 if(h.boundTo===void 0||h.boundTo==="vertices"){f=0;e=h.value.length;if(h.size===1)for(d=0;d<e;d++){g=n[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=n[d][1];g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=n[d][1];
-g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(o)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(p)for(d=0;d<k;d++){e=i[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(q){i=0;for(k=q.length;i<k;i++){h=q[i];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===
-3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(o||c.sortParticles){j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
-m,b)}if(q){i=0;for(k=q.length;i<k;i++){h=q[i];if(h.needsUpdate||c.sortParticles){j.bindBuffer(j.ARRAY_BUFFER,h.buffer);j.bufferData(j.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){ea=U=null;Y=F=O=ia=Ka=Ma=Q=-1;Ta=true;a[d].render(b,c,hb,Cb);ea=U=null;Y=F=O=ia=Ka=Ma=Q=-1;Ta=true}}function i(a,b,c,d,e,f,g,h){var j,i,k,l;if(b){i=a.length-1;l=b=-1}else{i=0;b=a.length;l=1}for(var m=i;m!==b;m=m+l){j=a[m];if(j.render){i=j.object;k=
-j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&G.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);G.setDepthTest(j.depthTest);G.setDepthWrite(j.depthWrite);u(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}G.setObjectFaces(i);k instanceof THREE.BufferGeometry?G.renderBufferDirect(d,e,f,j,k,i):G.renderBuffer(d,e,f,j,k,i)}}}function k(a,b,c,d,e,f,g){for(var h,j,i=0,k=a.length;i<k;i++){h=a[i];j=h.object;if(j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&G.setBlending(h.blending,
-h.blendEquation,h.blendSrc,h.blendDst);G.setDepthTest(h.depthTest);G.setDepthWrite(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}G.renderImmediateObject(c,d,e,h,j)}}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function o(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===
-b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function n(a,b,c,d,e){if(!d.program||d.needsUpdate){G.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var f=0,g=G.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=false,f=d.program,g=f.uniforms,i=d.uniforms;if(f!==U){j.useProgram(f);U=f;h=true}if(d.id!==Y){Y=d.id;h=true}if(h||a!==
-ea){j.uniformMatrix4fv(g.projectionMatrix,false,a._projectionMatrixArray);a!==ea&&(ea=a)}if(h){if(c&&d.fog){i.fogColor.value=c.color;if(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){if(Ta){for(var k,l=0,m=0,n=0,o,p,q,r=Qa,s=r.directional.colors,t=r.directional.positions,u=r.point.colors,v=r.point.positions,w=r.point.distances,
-z=r.spot.colors,A=r.spot.positions,C=r.spot.distances,D=r.spot.directions,F=r.spot.angles,J=r.spot.exponents,K=0,Q=0,M=0,O=q=0,c=O=0,h=b.length;c<h;c++){k=b[c];if(!k.onlyShadow){o=k.color;p=k.intensity;q=k.distance;if(k instanceof THREE.AmbientLight)if(G.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(k instanceof THREE.DirectionalLight){q=K*3;if(G.gammaInput){s[q]=o.r*o.r*p*p;s[q+1]=o.g*o.g*p*p;s[q+2]=o.b*o.b*p*p}else{s[q]=o.r*p;s[q+1]=o.g*p;s[q+2]=o.b*p}aa.copy(k.matrixWorld.getPosition());
-aa.subSelf(k.target.matrixWorld.getPosition());aa.normalize();t[q]=aa.x;t[q+1]=aa.y;t[q+2]=aa.z;K=K+1}else if(k instanceof THREE.PointLight){O=Q*3;if(G.gammaInput){u[O]=o.r*o.r*p*p;u[O+1]=o.g*o.g*p*p;u[O+2]=o.b*o.b*p*p}else{u[O]=o.r*p;u[O+1]=o.g*p;u[O+2]=o.b*p}o=k.matrixWorld.getPosition();v[O]=o.x;v[O+1]=o.y;v[O+2]=o.z;w[Q]=q;Q=Q+1}else if(k instanceof THREE.SpotLight){O=M*3;if(G.gammaInput){z[O]=o.r*o.r*p*p;z[O+1]=o.g*o.g*p*p;z[O+2]=o.b*o.b*p*p}else{z[O]=o.r*p;z[O+1]=o.g*p;z[O+2]=o.b*p}o=k.matrixWorld.getPosition();
-A[O]=o.x;A[O+1]=o.y;A[O+2]=o.z;C[M]=q;aa.copy(o);aa.subSelf(k.target.matrixWorld.getPosition());aa.normalize();D[O]=aa.x;D[O+1]=aa.y;D[O+2]=aa.z;F[M]=Math.cos(k.angle);J[M]=k.exponent;M=M+1}}}c=K*3;for(h=s.length;c<h;c++)s[c]=0;c=Q*3;for(h=u.length;c<h;c++)u[c]=0;c=M*3;for(h=z.length;c<h;c++)z[c]=0;r.directional.length=K;r.point.length=Q;r.spot.length=M;r.ambient[0]=l;r.ambient[1]=m;r.ambient[2]=n;Ta=false}c=Qa;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;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngle.value=c.spot.angles;i.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
-d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;G.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=E.height/2;i.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){i.shininess.value=d.shininess;if(G.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive);
-i.specular.value.copyGammaToLinear(d.specular)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive;i.specular.value=d.specular}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(G.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive}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(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=c=0;for(k=b.length;h<k;h++){l=b[h];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){i.shadowMap.texture[c]=l.shadowMap;i.shadowMapSize.value[c]=l.shadowMapSize;i.shadowMatrix.value[c]=l.shadowMatrix;i.shadowDarkness.value[c]=l.shadowDarkness;i.shadowBias.value[c]=l.shadowBias;
-c++}}}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(l=f.uniforms[b[i][1]]){h=b[i][0];m=h.type;k=h.value;switch(m){case "i":j.uniform1i(l,k);break;case "f":j.uniform1f(l,k);break;case "v2":j.uniform2f(l,k.x,k.y);break;case "v3":j.uniform3f(l,k.x,k.y,k.z);break;case "v4":j.uniform4f(l,k.x,k.y,k.z,k.w);break;case "c":j.uniform3f(l,k.r,k.g,k.b);break;case "fv1":j.uniform1fv(l,k);break;case "fv":j.uniform3fv(l,k);break;case "v2v":if(!h._array)h._array=new Float32Array(2*k.length);m=0;for(n=k.length;m<
-n;m++){r=m*2;h._array[r]=k[m].x;h._array[r+1]=k[m].y}j.uniform2fv(l,h._array);break;case "v3v":if(!h._array)h._array=new Float32Array(3*k.length);m=0;for(n=k.length;m<n;m++){r=m*3;h._array[r]=k[m].x;h._array[r+1]=k[m].y;h._array[r+2]=k[m].z}j.uniform3fv(l,h._array);break;case "v4v":if(!h._array)h._array=new Float32Array(4*k.length);m=0;for(n=k.length;m<n;m++){r=m*4;h._array[r]=k[m].x;h._array[r+1]=k[m].y;h._array[r+2]=k[m].z;h._array[r+3]=k[m].w}j.uniform4fv(l,h._array);break;case "m4":if(!h._array)h._array=
-new Float32Array(16);k.flattenToArray(h._array);j.uniformMatrix4fv(l,false,h._array);break;case "m4v":if(!h._array)h._array=new Float32Array(16*k.length);m=0;for(n=k.length;m<n;m++)k[m].flattenToArrayOffset(h._array,m*16);j.uniformMatrix4fv(l,false,h._array);break;case "t":j.uniform1i(l,k);l=h.texture;if(!l)continue;if(l.image instanceof Array&&l.image.length===6){h=l;if(h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+
-k);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(l=0;l<6;l++){m=k;n=l;if(G.autoScaleCubemaps){r=h.image[l];t=ib;if(!(r.width<=t&&r.height<=t)){u=Math.max(r.width,r.height);s=Math.floor(r.width*t/u);t=Math.floor(r.height*t/u);u=document.createElement("canvas");u.width=s;u.height=t;u.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,s,t);r=u}}else r=h.image[l];m[n]=r}l=k[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;n=H(h.format);r=H(h.type);y(j.TEXTURE_CUBE_MAP,
-h,m);for(l=0;l<6;l++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,n,n,r,k[l]);h.generateMipmaps&&m&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=false;if(h.onUpdate)h.onUpdate()}else{j.activeTexture(j.TEXTURE0+k);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){h=l;j.activeTexture(j.TEXTURE0+k);j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)}else G.setTexture(l,k);break;case "tv":if(!h._array){h._array=[];m=0;for(n=h.texture.length;m<
-n;m++)h._array[m]=k+m}j.uniform1iv(l,h._array);m=0;for(n=h.texture.length;m<n;m++)(l=h.texture[m])&&G.setTexture(l,h._array[m])}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null){b=a.matrixWorld.getPosition();j.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&&j.uniformMatrix4fv(g.viewMatrix,false,a._viewMatrixArray);
-d.skinning&&j.uniformMatrix4fv(g.boneGlobalMatrices,false,e.boneMatrices)}j.uniformMatrix4fv(g.modelViewMatrix,false,e._modelViewMatrix.elements);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,false,e._normalMatrix.elements);g.objectMatrix!==null&&j.uniformMatrix4fv(g.objectMatrix,false,e.matrixWorld.elements);return f}function r(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function u(a,b,c){if(Ra!==
-a){a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL);Ra=a}if(a&&(La!==b||Sa!==c)){j.polygonOffset(b,c);La=b;Sa=c}}function t(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS)){console.error(j.getShaderInfoLog(c));console.error(b);return null}return c}function y(a,b,c){if(c){j.texParameteri(a,j.TEXTURE_WRAP_S,H(b.wrapS));j.texParameteri(a,
-j.TEXTURE_WRAP_T,H(b.wrapT));j.texParameteri(a,j.TEXTURE_MAG_FILTER,H(b.magFilter));j.texParameteri(a,j.TEXTURE_MIN_FILTER,H(b.minFilter))}else{j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(a,j.TEXTURE_MAG_FILTER,w(b.magFilter));j.texParameteri(a,j.TEXTURE_MIN_FILTER,w(b.minFilter))}}function s(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,
-b.width,b.height);j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height);j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)}else j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}
-function H(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedIntType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA;
-case THREE.AddEquation:return j.FUNC_ADD;case THREE.SubtractEquation:return j.FUNC_SUBTRACT;case THREE.ReverseSubtractEquation:return j.FUNC_REVERSE_SUBTRACT;case THREE.ZeroFactor:return j.ZERO;case THREE.OneFactor:return j.ONE;case THREE.SrcColorFactor:return j.SRC_COLOR;case THREE.OneMinusSrcColorFactor:return j.ONE_MINUS_SRC_COLOR;case THREE.SrcAlphaFactor:return j.SRC_ALPHA;case THREE.OneMinusSrcAlphaFactor:return j.ONE_MINUS_SRC_ALPHA;case THREE.DstAlphaFactor:return j.DST_ALPHA;case THREE.OneMinusDstAlphaFactor:return j.ONE_MINUS_DST_ALPHA;
-case THREE.DstColorFactor:return j.DST_COLOR;case THREE.OneMinusDstColorFactor:return j.ONE_MINUS_DST_COLOR;case THREE.SrcAlphaSaturateFactor:return j.SRC_ALPHA_SATURATE}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},E=a.canvas!==void 0?a.canvas:document.createElement("canvas"),z=a.precision!==void 0?a.precision:"highp",v=a.alpha!==void 0?a.alpha:true,A=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,J=a.antialias!==void 0?a.antialias:false,K=a.stencil!==void 0?a.stencil:
-true,R=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,P=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),D=a.clearAlpha!==void 0?a.clearAlpha:0,M=a.maxLights!==void 0?a.maxLights:4;this.domElement=E;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=
-this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var G=this,j,T=[],U=null,C=null,Y=-1,F=null,ea=null,fa=0,ia=-1,O=-1,Q=-1,Z=-1,$=-1,ha=-1,Ma=-1,Ka=-1,Ra=null,La=null,Sa=null,Na=null,Kb=0,lb=0,gb=0,Lb=0,hb=0,Cb=0,Wa=new THREE.Frustum,
-Ba=new THREE.Matrix4,xa=new THREE.Matrix4,$a=new THREE.Vector4,aa=new THREE.Vector3,Ta=true,Qa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}};j=function(){var a;try{if(!(a=E.getContext("experimental-webgl",{alpha:v,premultipliedAlpha:A,antialias:J,stencil:K,preserveDrawingBuffer:R})))throw"Error creating WebGL context.";}catch(b){console.error(b)}a.getExtension("OES_texture_float")||
-console.log("THREE.WebGLRenderer: Float textures not supported.");return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(P.r,P.g,P.b,D);this.context=j;var oa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var ib=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);
-this.getContext=function(){return j};this.supportsVertexTextures=function(){return oa>0};this.setSize=function(a,b){E.width=a;E.height=b;this.setViewport(0,0,E.width,E.height)};this.setViewport=function(a,b,c,d){Kb=a;lb=b;gb=c;Lb=d;j.viewport(Kb,lb,gb,Lb)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){P.setHex(a);D=b;j.clearColor(P.r,P.g,P.b,D)};this.setClearColor=function(a,
-b){P.copy(a);D=b;j.clearColor(P.r,P.g,P.b,D)};this.getClearColor=function(){return P};this.getClearAlpha=function(){return D};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|j.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|j.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|j.STENCIL_BUFFER_BIT;j.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){a.__webglInit=false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);
-j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=
-void 0;for(d in c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}G.info.memory.geometries--}else if(a instanceof THREE.Ribbon){a=a.geometry;j.deleteBuffer(a.__webglVertexBuffer);j.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;j.deleteBuffer(a.__webglVertexBuffer);j.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;j.deleteBuffer(a.__webglVertexBuffer);
-j.deleteBuffer(a.__webglColorBuffer);G.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;j.deleteTexture(a.__webglTexture);G.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){j.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){j.deleteFramebuffer(a.__webglFramebuffer[b]);j.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{j.deleteFramebuffer(a.__webglFramebuffer);
-j.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.updateShadowMap=function(a,b){U=null;Y=F=Ka=Ma=Q=-1;Ta=true;O=ia=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();if(a.hasPos){j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.position);j.vertexAttribPointer(b.attributes.position,
-3,j.FLOAT,false,0,0)}if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,k,l,m,n,o=a.count*3;for(n=0;n<o;n=n+9){c=a.normalArray;d=c[n];e=c[n+1];f=c[n+2];g=c[n+3];i=c[n+4];l=c[n+5];h=c[n+6];k=c[n+7];m=c[n+8];d=(d+g+h)/3;e=(e+i+k)/3;f=(f+l+m)/3;c[n]=d;c[n+1]=e;c[n+2]=f;c[n+3]=d;c[n+4]=e;c[n+5]=f;c[n+6]=d;c[n+7]=e;c[n+8]=f}}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,
-3,j.FLOAT,false,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=n(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==F){F=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer);j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,false,0,f[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){j.bindBuffer(j.ARRAY_BUFFER,
-e.vertexNormalBuffer);j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,false,0,f[d].index*12)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer);j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,false,0,f[d].index*8);j.enableVertexAttribArray(a.uv)}else j.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer);j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,
-j.FLOAT,false,0,f[d].index*16)}j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)}j.drawElements(j.TRIANGLES,f[d].count,j.UNSIGNED_SHORT,f[d].start*2);G.info.render.calls++;G.info.render.vertices=G.info.render.vertices+f[d].count;G.info.render.faces=G.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var g,h,c=n(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==F){F=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){j.bindBuffer(j.ARRAY_BUFFER,
-e.__webglVertexBuffer);j.vertexAttribPointer(b.position,3,j.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;if(f.morphTargetBase!==-1){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);j.vertexAttribPointer(c.position,3,j.FLOAT,false,0,0)}else if(c.position>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer);j.vertexAttribPointer(c.position,3,j.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<
-d.numSupportedMorphTargets&&g<i.length;){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,false,0,0);if(d.morphNormals){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[g]]);j.vertexAttribPointer(c["morphNormal"+g],3,j.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=h[i[g]];g++}}else{var i=[],k=-1,l=0;h=f.morphTargetInfluences;var m,o=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=true);g<d.numSupportedMorphTargets;){for(m=
-0;m<o;m++)if(!i[m]&&h[m]>k){l=m;k=h[l]}j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,false,0,0);if(d.morphNormals){j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);j.vertexAttribPointer(c["morphNormal"+g],3,j.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[g]=k;i[l]=1;k=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
-0;for(h=e.__webglCustomAttributesList.length;g<h;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){j.bindBuffer(j.ARRAY_BUFFER,c.buffer);j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,false,0,0)}}}if(b.color>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer);j.vertexAttribPointer(b.color,3,j.FLOAT,false,0,0)}if(b.normal>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer);j.vertexAttribPointer(b.normal,3,j.FLOAT,false,0,0)}if(b.tangent>=0){j.bindBuffer(j.ARRAY_BUFFER,
-e.__webglTangentBuffer);j.vertexAttribPointer(b.tangent,4,j.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer);j.vertexAttribPointer(b.uv,2,j.FLOAT,false,0,0);j.enableVertexAttribArray(b.uv)}else j.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer);j.vertexAttribPointer(b.uv2,2,j.FLOAT,false,0,0);j.enableVertexAttribArray(b.uv2)}else j.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=
-0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer);j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,false,0,0);j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,false,0,0);j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,false,0,0);j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,false,0,0)}}if(f instanceof
-THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==Na){j.lineWidth(d);Na=d}a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)}else{a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)}G.info.render.calls++;G.info.render.vertices=G.info.render.vertices+e.__webglFaceCount;G.info.render.faces=G.info.render.faces+e.__webglFaceCount/3}else if(f instanceof
-THREE.Line){f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;d=d.linewidth;if(d!==Na){j.lineWidth(d);Na=d}j.drawArrays(f,0,e.__webglLineCount);G.info.render.calls++}else if(f instanceof THREE.ParticleSystem){j.drawArrays(j.POINTS,0,e.__webglParticleCount);G.info.render.calls++;G.info.render.points=G.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount);G.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,l,m,n=a.__lights,
-o=a.fog;Y=-1;Ta=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Ba.multiply(b.projectionMatrix,
-b.matrixWorldInverse);Wa.setFromMatrix(Ba);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;G.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];l=f.object;f.render=false;if(l.visible&&(!(l instanceof THREE.Mesh||l instanceof THREE.ParticleSystem)||!l.frustumCulled||
-Wa.contains(l))){r(l,b);var p=f,q=p.object,s=p.buffer,t=void 0,t=t=void 0,t=q.material;if(t instanceof THREE.MeshFaceMaterial){t=s.materialIndex;if(t>=0){t=q.geometry.materials[t];if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}}}else if(t)if(t.transparent){p.transparent=t;p.opaque=null}else{p.opaque=t;p.transparent=null}f.render=true;if(this.sortObjects)if(l.renderDepth)f.z=l.renderDepth;else{$a.copy(l.matrixWorld.getPosition());Ba.multiplyVector3($a);f.z=$a.z}}}this.sortObjects&&
-m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];l=f.object;if(l.visible){r(l,b);l=f.object.material;if(l.transparent){f.transparent=l;f.opaque=null}else{f.opaque=l;f.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);u(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);i(a.__webglObjects,false,"",b,n,o,true,d);k(a.__webglObjectsImmediate,
-"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);i(a.__webglObjects,true,"opaque",b,n,o,false);k(a.__webglObjectsImmediate,"opaque",b,n,o,false);i(a.__webglObjects,false,"transparent",b,n,o,true);k(a.__webglObjectsImmediate,"transparent",b,n,o,true)}h(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture);j.generateMipmap(j.TEXTURE_CUBE_MAP);
-j.bindTexture(j.TEXTURE_CUBE_MAP,null)}else{j.bindTexture(j.TEXTURE_2D,c.__webglTexture);j.generateMipmap(j.TEXTURE_2D);j.bindTexture(j.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};this.renderImmediateObject=function(a,b,c,d,e){var f=n(a,b,c,d,e);F=-1;G.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Wa):e.render(function(a){G.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=
-[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,k=void 0,n=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){k=g.geometry;if(k instanceof THREE.Geometry){if(k.geometryGroups===void 0){var r=k,s=void 0,t=void 0,u=void 0,v=void 0,w=void 0,z=void 0,y=void 0,A={},C=r.morphTargets.length,D=r.morphNormals.length;r.geometryGroups={};s=0;for(t=r.faces.length;s<
-t;s++){u=r.faces[s];v=u.materialIndex;z=v!==void 0?v:-1;A[z]===void 0&&(A[z]={hash:z,counter:0});y=A[z].hash+"_"+A[z].counter;r.geometryGroups[y]===void 0&&(r.geometryGroups[y]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,numMorphNormals:D});w=u instanceof THREE.Face3?3:4;if(r.geometryGroups[y].vertices+w>65535){A[z].counter=A[z].counter+1;y=A[z].hash+"_"+A[z].counter;r.geometryGroups[y]===void 0&&(r.geometryGroups[y]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:C,
-numMorphNormals:D})}u instanceof THREE.Face3?r.geometryGroups[y].faces3.push(s):r.geometryGroups[y].faces4.push(s);r.geometryGroups[y].vertices=r.geometryGroups[y].vertices+w}r.geometryGroupsList=[];var E=void 0;for(E in r.geometryGroups){r.geometryGroups[E].id=fa++;r.geometryGroupsList.push(r.geometryGroups[E])}}for(i in k.geometryGroups){n=k.geometryGroups[i];if(!n.__webglVertexBuffer){var F=n;F.__webglVertexBuffer=j.createBuffer();F.__webglNormalBuffer=j.createBuffer();F.__webglTangentBuffer=j.createBuffer();
-F.__webglColorBuffer=j.createBuffer();F.__webglUVBuffer=j.createBuffer();F.__webglUV2Buffer=j.createBuffer();F.__webglSkinVertexABuffer=j.createBuffer();F.__webglSkinVertexBBuffer=j.createBuffer();F.__webglSkinIndicesBuffer=j.createBuffer();F.__webglSkinWeightsBuffer=j.createBuffer();F.__webglFaceBuffer=j.createBuffer();F.__webglLineBuffer=j.createBuffer();var H=void 0,K=void 0;if(F.numMorphTargets){F.__webglMorphTargetsBuffers=[];H=0;for(K=F.numMorphTargets;H<K;H++)F.__webglMorphTargetsBuffers.push(j.createBuffer())}if(F.numMorphNormals){F.__webglMorphNormalsBuffers=
-[];H=0;for(K=F.numMorphNormals;H<K;H++)F.__webglMorphNormalsBuffers.push(j.createBuffer())}G.info.memory.geometries++;var Q=n,J=g,O=J.geometry,M=Q.faces3,$=Q.faces4,P=M.length*3+$.length*4,Z=M.length*1+$.length*2,Y=M.length*3+$.length*4,R=c(J,Q),T=e(R),ea=d(R),ia=R.vertexColors?R.vertexColors:false;Q.__vertexArray=new Float32Array(P*3);if(ea)Q.__normalArray=new Float32Array(P*3);if(O.hasTangents)Q.__tangentArray=new Float32Array(P*4);if(ia)Q.__colorArray=new Float32Array(P*3);if(T){if(O.faceUvs.length>
-0||O.faceVertexUvs.length>0)Q.__uvArray=new Float32Array(P*2);if(O.faceUvs.length>1||O.faceVertexUvs.length>1)Q.__uv2Array=new Float32Array(P*2)}if(J.geometry.skinWeights.length&&J.geometry.skinIndices.length){Q.__skinVertexAArray=new Float32Array(P*4);Q.__skinVertexBArray=new Float32Array(P*4);Q.__skinIndexArray=new Float32Array(P*4);Q.__skinWeightArray=new Float32Array(P*4)}Q.__faceArray=new Uint16Array(Z*3);Q.__lineArray=new Uint16Array(Y*2);var U=void 0,ha=void 0;if(Q.numMorphTargets){Q.__morphTargetsArrays=
-[];U=0;for(ha=Q.numMorphTargets;U<ha;U++)Q.__morphTargetsArrays.push(new Float32Array(P*3))}if(Q.numMorphNormals){Q.__morphNormalsArrays=[];U=0;for(ha=Q.numMorphNormals;U<ha;U++)Q.__morphNormalsArrays.push(new Float32Array(P*3))}Q.__webglFaceCount=Z*3;Q.__webglLineCount=Y*2;if(R.attributes){if(Q.__webglCustomAttributesList===void 0)Q.__webglCustomAttributesList=[];var Ra=void 0;for(Ra in R.attributes){var Ma=R.attributes[Ra],aa={},Ka;for(Ka in Ma)aa[Ka]=Ma[Ka];if(!aa.__webglInitialized||aa.createUniqueBuffers){aa.__webglInitialized=
-true;var La=1;aa.type==="v2"?La=2:aa.type==="v3"?La=3:aa.type==="v4"?La=4:aa.type==="c"&&(La=3);aa.size=La;aa.array=new Float32Array(P*La);aa.buffer=j.createBuffer();aa.buffer.belongsToAttribute=Ra;Ma.needsUpdate=true;aa.__original=Ma}Q.__webglCustomAttributesList.push(aa)}}Q.__inittedArrays=true;k.verticesNeedUpdate=true;k.morphTargetsNeedUpdate=true;k.elementsNeedUpdate=true;k.uvsNeedUpdate=true;k.normalsNeedUpdate=true;k.tangetsNeedUpdate=true;k.colorsNeedUpdate=true}}}}else if(g instanceof THREE.Ribbon){k=
-g.geometry;if(!k.__webglVertexBuffer){var Sa=k;Sa.__webglVertexBuffer=j.createBuffer();Sa.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;var oa=k,xa=oa.vertices.length;oa.__vertexArray=new Float32Array(xa*3);oa.__colorArray=new Float32Array(xa*3);oa.__webglVertexCount=xa;k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){k=g.geometry;if(!k.__webglVertexBuffer){var Ba=k;Ba.__webglVertexBuffer=j.createBuffer();Ba.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;
-var Na=k,Ta=g,Wa=Na.vertices.length;Na.__vertexArray=new Float32Array(Wa*3);Na.__colorArray=new Float32Array(Wa*3);Na.__webglLineCount=Wa;b(Na,Ta);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){k=g.geometry;if(!k.__webglVertexBuffer){var $a=k;$a.__webglVertexBuffer=j.createBuffer();$a.__webglColorBuffer=j.createBuffer();G.info.geometries++;var Qa=k,Kb=g,lb=Qa.vertices.length;Qa.__vertexArray=new Float32Array(lb*3);Qa.__colorArray=new Float32Array(lb*
-3);Qa.__sortArray=[];Qa.__webglParticleCount=lb;b(Qa,Kb);k.verticesNeedUpdate=true;k.colorsNeedUpdate=true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){k=g.geometry;if(k instanceof THREE.BufferGeometry)l(h.__webglObjects,k,g);else for(i in k.geometryGroups){n=k.geometryGroups[i];l(h.__webglObjects,n,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){k=g.geometry;l(h.__webglObjects,k,g)}else g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?
-h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var bb=a.__objectsRemoved[0],gb=a;bb instanceof THREE.Mesh||bb instanceof THREE.ParticleSystem||bb instanceof THREE.Ribbon||bb instanceof THREE.Line?p(gb.__webglObjects,bb):bb instanceof THREE.Sprite?q(gb.__webglSprites,bb):bb instanceof THREE.LensFlare?
-q(gb.__webglFlares,bb):(bb instanceof THREE.ImmediateRenderObject||bb.immediateRenderCallback)&&p(gb.__webglObjectsImmediate,bb);bb.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var ib=0,Lb=a.__webglObjects.length;ib<Lb;ib++){var jb=a.__webglObjects[ib].object,ga=jb.geometry,hb=void 0,ic=void 0,Ua=void 0;if(jb instanceof THREE.Mesh)if(ga instanceof THREE.BufferGeometry){ga.verticesNeedUpdate=false;ga.elementsNeedUpdate=false;ga.uvsNeedUpdate=false;ga.normalsNeedUpdate=false;ga.colorsNeedUpdate=
-false}else{for(var Cb=0,nd=ga.geometryGroupsList.length;Cb<nd;Cb++){hb=ga.geometryGroupsList[Cb];Ua=c(jb,hb);ic=Ua.attributes&&o(Ua);if(ga.verticesNeedUpdate||ga.morphTargetsNeedUpdate||ga.elementsNeedUpdate||ga.uvsNeedUpdate||ga.normalsNeedUpdate||ga.colorsNeedUpdate||ga.tangetsNeedUpdate||ic){var ca=hb,od=jb,Xa=j.DYNAMIC_DRAW,pd=!ga.dynamic,bc=Ua;if(ca.__inittedArrays){var cd=d(bc),Tc=bc.vertexColors?bc.vertexColors:false,dd=e(bc),Ec=cd===THREE.SmoothShading,I=void 0,S=void 0,fb=void 0,N=void 0,
-jc=void 0,Ob=void 0,kb=void 0,Fc=void 0,Fb=void 0,kc=void 0,lc=void 0,V=void 0,W=void 0,X=void 0,ma=void 0,mb=void 0,nb=void 0,ob=void 0,qc=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,xb=void 0,tc=void 0,yb=void 0,zb=void 0,Ab=void 0,uc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Gc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Hc=void 0,ja=void 0,ed=void 0,Vb=void 0,mc=void 0,nc=void 0,Ea=void 0,fd=void 0,Ca=void 0,Da=void 0,Wb=void 0,Gb=void 0,wa=0,
-Aa=0,Hb=0,Ib=0,cb=0,Ja=0,na=0,Oa=0,ya=0,L=0,ba=0,B=0,Ya=void 0,Fa=ca.__vertexArray,vc=ca.__uvArray,wc=ca.__uv2Array,db=ca.__normalArray,qa=ca.__tangentArray,Ga=ca.__colorArray,ra=ca.__skinVertexAArray,sa=ca.__skinVertexBArray,ta=ca.__skinIndexArray,ua=ca.__skinWeightArray,Uc=ca.__morphTargetsArrays,Vc=ca.__morphNormalsArrays,Wc=ca.__webglCustomAttributesList,x=void 0,Bb=ca.__faceArray,Za=ca.__lineArray,Pa=od.geometry,qd=Pa.elementsNeedUpdate,gd=Pa.uvsNeedUpdate,rd=Pa.normalsNeedUpdate,sd=Pa.tangetsNeedUpdate,
-td=Pa.colorsNeedUpdate,ud=Pa.morphTargetsNeedUpdate,cc=Pa.vertices,ka=ca.faces3,la=ca.faces4,za=Pa.faces,Xc=Pa.faceVertexUvs[0],Yc=Pa.faceVertexUvs[1],dc=Pa.skinVerticesA,ec=Pa.skinVerticesB,fc=Pa.skinIndices,Xb=Pa.skinWeights,Yb=Pa.morphTargets,Ic=Pa.morphNormals;if(Pa.verticesNeedUpdate){I=0;for(S=ka.length;I<S;I++){N=za[ka[I]];V=cc[N.a];W=cc[N.b];X=cc[N.c];Fa[Aa]=V.x;Fa[Aa+1]=V.y;Fa[Aa+2]=V.z;Fa[Aa+3]=W.x;Fa[Aa+4]=W.y;Fa[Aa+5]=W.z;Fa[Aa+6]=X.x;Fa[Aa+7]=X.y;Fa[Aa+8]=X.z;Aa=Aa+9}I=0;for(S=la.length;I<
-S;I++){N=za[la[I]];V=cc[N.a];W=cc[N.b];X=cc[N.c];ma=cc[N.d];Fa[Aa]=V.x;Fa[Aa+1]=V.y;Fa[Aa+2]=V.z;Fa[Aa+3]=W.x;Fa[Aa+4]=W.y;Fa[Aa+5]=W.z;Fa[Aa+6]=X.x;Fa[Aa+7]=X.y;Fa[Aa+8]=X.z;Fa[Aa+9]=ma.x;Fa[Aa+10]=ma.y;Fa[Aa+11]=ma.z;Aa=Aa+12}j.bindBuffer(j.ARRAY_BUFFER,ca.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Fa,Xa)}if(ud){Ea=0;for(fd=Yb.length;Ea<fd;Ea++){I=ba=0;for(S=ka.length;I<S;I++){Wb=ka[I];N=za[Wb];V=Yb[Ea].vertices[N.a];W=Yb[Ea].vertices[N.b];X=Yb[Ea].vertices[N.c];Ca=Uc[Ea];Ca[ba]=V.x;Ca[ba+
-1]=V.y;Ca[ba+2]=V.z;Ca[ba+3]=W.x;Ca[ba+4]=W.y;Ca[ba+5]=W.z;Ca[ba+6]=X.x;Ca[ba+7]=X.y;Ca[ba+8]=X.z;if(bc.morphNormals){if(Ec){Gb=Ic[Ea].vertexNormals[Wb];pb=Gb.a;qb=Gb.b;rb=Gb.c}else rb=qb=pb=Ic[Ea].faceNormals[Wb];Da=Vc[Ea];Da[ba]=pb.x;Da[ba+1]=pb.y;Da[ba+2]=pb.z;Da[ba+3]=qb.x;Da[ba+4]=qb.y;Da[ba+5]=qb.z;Da[ba+6]=rb.x;Da[ba+7]=rb.y;Da[ba+8]=rb.z}ba=ba+9}I=0;for(S=la.length;I<S;I++){Wb=la[I];N=za[Wb];V=Yb[Ea].vertices[N.a];W=Yb[Ea].vertices[N.b];X=Yb[Ea].vertices[N.c];ma=Yb[Ea].vertices[N.d];Ca=Uc[Ea];
-Ca[ba]=V.x;Ca[ba+1]=V.y;Ca[ba+2]=V.z;Ca[ba+3]=W.x;Ca[ba+4]=W.y;Ca[ba+5]=W.z;Ca[ba+6]=X.x;Ca[ba+7]=X.y;Ca[ba+8]=X.z;Ca[ba+9]=ma.x;Ca[ba+10]=ma.y;Ca[ba+11]=ma.z;if(bc.morphNormals){if(Ec){Gb=Ic[Ea].vertexNormals[Wb];pb=Gb.a;qb=Gb.b;rb=Gb.c;rc=Gb.d}else rc=rb=qb=pb=Ic[Ea].faceNormals[Wb];Da=Vc[Ea];Da[ba]=pb.x;Da[ba+1]=pb.y;Da[ba+2]=pb.z;Da[ba+3]=qb.x;Da[ba+4]=qb.y;Da[ba+5]=qb.z;Da[ba+6]=rb.x;Da[ba+7]=rb.y;Da[ba+8]=rb.z;Da[ba+9]=rc.x;Da[ba+10]=rc.y;Da[ba+11]=rc.z}ba=ba+12}j.bindBuffer(j.ARRAY_BUFFER,
-ca.__webglMorphTargetsBuffers[Ea]);j.bufferData(j.ARRAY_BUFFER,Uc[Ea],Xa);if(bc.morphNormals){j.bindBuffer(j.ARRAY_BUFFER,ca.__webglMorphNormalsBuffers[Ea]);j.bufferData(j.ARRAY_BUFFER,Vc[Ea],Xa)}}}if(Xb.length){I=0;for(S=ka.length;I<S;I++){N=za[ka[I]];vb=Xb[N.a];wb=Xb[N.b];xb=Xb[N.c];ua[L]=vb.x;ua[L+1]=vb.y;ua[L+2]=vb.z;ua[L+3]=vb.w;ua[L+4]=wb.x;ua[L+5]=wb.y;ua[L+6]=wb.z;ua[L+7]=wb.w;ua[L+8]=xb.x;ua[L+9]=xb.y;ua[L+10]=xb.z;ua[L+11]=xb.w;yb=fc[N.a];zb=fc[N.b];Ab=fc[N.c];ta[L]=yb.x;ta[L+1]=yb.y;ta[L+
-2]=yb.z;ta[L+3]=yb.w;ta[L+4]=zb.x;ta[L+5]=zb.y;ta[L+6]=zb.z;ta[L+7]=zb.w;ta[L+8]=Ab.x;ta[L+9]=Ab.y;ta[L+10]=Ab.z;ta[L+11]=Ab.w;Pb=dc[N.a];Qb=dc[N.b];Rb=dc[N.c];ra[L]=Pb.x;ra[L+1]=Pb.y;ra[L+2]=Pb.z;ra[L+3]=1;ra[L+4]=Qb.x;ra[L+5]=Qb.y;ra[L+6]=Qb.z;ra[L+7]=1;ra[L+8]=Rb.x;ra[L+9]=Rb.y;ra[L+10]=Rb.z;ra[L+11]=1;Sb=ec[N.a];Tb=ec[N.b];Ub=ec[N.c];sa[L]=Sb.x;sa[L+1]=Sb.y;sa[L+2]=Sb.z;sa[L+3]=1;sa[L+4]=Tb.x;sa[L+5]=Tb.y;sa[L+6]=Tb.z;sa[L+7]=1;sa[L+8]=Ub.x;sa[L+9]=Ub.y;sa[L+10]=Ub.z;sa[L+11]=1;L=L+12}I=0;for(S=
-la.length;I<S;I++){N=za[la[I]];vb=Xb[N.a];wb=Xb[N.b];xb=Xb[N.c];tc=Xb[N.d];ua[L]=vb.x;ua[L+1]=vb.y;ua[L+2]=vb.z;ua[L+3]=vb.w;ua[L+4]=wb.x;ua[L+5]=wb.y;ua[L+6]=wb.z;ua[L+7]=wb.w;ua[L+8]=xb.x;ua[L+9]=xb.y;ua[L+10]=xb.z;ua[L+11]=xb.w;ua[L+12]=tc.x;ua[L+13]=tc.y;ua[L+14]=tc.z;ua[L+15]=tc.w;yb=fc[N.a];zb=fc[N.b];Ab=fc[N.c];uc=fc[N.d];ta[L]=yb.x;ta[L+1]=yb.y;ta[L+2]=yb.z;ta[L+3]=yb.w;ta[L+4]=zb.x;ta[L+5]=zb.y;ta[L+6]=zb.z;ta[L+7]=zb.w;ta[L+8]=Ab.x;ta[L+9]=Ab.y;ta[L+10]=Ab.z;ta[L+11]=Ab.w;ta[L+12]=uc.x;
-ta[L+13]=uc.y;ta[L+14]=uc.z;ta[L+15]=uc.w;Pb=dc[N.a];Qb=dc[N.b];Rb=dc[N.c];Gc=dc[N.d];ra[L]=Pb.x;ra[L+1]=Pb.y;ra[L+2]=Pb.z;ra[L+3]=1;ra[L+4]=Qb.x;ra[L+5]=Qb.y;ra[L+6]=Qb.z;ra[L+7]=1;ra[L+8]=Rb.x;ra[L+9]=Rb.y;ra[L+10]=Rb.z;ra[L+11]=1;ra[L+12]=Gc.x;ra[L+13]=Gc.y;ra[L+14]=Gc.z;ra[L+15]=1;Sb=ec[N.a];Tb=ec[N.b];Ub=ec[N.c];Hc=ec[N.d];sa[L]=Sb.x;sa[L+1]=Sb.y;sa[L+2]=Sb.z;sa[L+3]=1;sa[L+4]=Tb.x;sa[L+5]=Tb.y;sa[L+6]=Tb.z;sa[L+7]=1;sa[L+8]=Ub.x;sa[L+9]=Ub.y;sa[L+10]=Ub.z;sa[L+11]=1;sa[L+12]=Hc.x;sa[L+13]=Hc.y;
-sa[L+14]=Hc.z;sa[L+15]=1;L=L+16}if(L>0){j.bindBuffer(j.ARRAY_BUFFER,ca.__webglSkinVertexABuffer);j.bufferData(j.ARRAY_BUFFER,ra,Xa);j.bindBuffer(j.ARRAY_BUFFER,ca.__webglSkinVertexBBuffer);j.bufferData(j.ARRAY_BUFFER,sa,Xa);j.bindBuffer(j.ARRAY_BUFFER,ca.__webglSkinIndicesBuffer);j.bufferData(j.ARRAY_BUFFER,ta,Xa);j.bindBuffer(j.ARRAY_BUFFER,ca.__webglSkinWeightsBuffer);j.bufferData(j.ARRAY_BUFFER,ua,Xa)}}if(td&&Tc){I=0;for(S=ka.length;I<S;I++){N=za[ka[I]];kb=N.vertexColors;Fc=N.color;if(kb.length===
-3&&Tc===THREE.VertexColors){sb=kb[0];tb=kb[1];ub=kb[2]}else ub=tb=sb=Fc;Ga[ya]=sb.r;Ga[ya+1]=sb.g;Ga[ya+2]=sb.b;Ga[ya+3]=tb.r;Ga[ya+4]=tb.g;Ga[ya+5]=tb.b;Ga[ya+6]=ub.r;Ga[ya+7]=ub.g;Ga[ya+8]=ub.b;ya=ya+9}I=0;for(S=la.length;I<S;I++){N=za[la[I]];kb=N.vertexColors;Fc=N.color;if(kb.length===4&&Tc===THREE.VertexColors){sb=kb[0];tb=kb[1];ub=kb[2];sc=kb[3]}else sc=ub=tb=sb=Fc;Ga[ya]=sb.r;Ga[ya+1]=sb.g;Ga[ya+2]=sb.b;Ga[ya+3]=tb.r;Ga[ya+4]=tb.g;Ga[ya+5]=tb.b;Ga[ya+6]=ub.r;Ga[ya+7]=ub.g;Ga[ya+8]=ub.b;Ga[ya+
-9]=sc.r;Ga[ya+10]=sc.g;Ga[ya+11]=sc.b;ya=ya+12}if(ya>0){j.bindBuffer(j.ARRAY_BUFFER,ca.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Ga,Xa)}}if(sd&&Pa.hasTangents){I=0;for(S=ka.length;I<S;I++){N=za[ka[I]];Fb=N.vertexTangents;mb=Fb[0];nb=Fb[1];ob=Fb[2];qa[na]=mb.x;qa[na+1]=mb.y;qa[na+2]=mb.z;qa[na+3]=mb.w;qa[na+4]=nb.x;qa[na+5]=nb.y;qa[na+6]=nb.z;qa[na+7]=nb.w;qa[na+8]=ob.x;qa[na+9]=ob.y;qa[na+10]=ob.z;qa[na+11]=ob.w;na=na+12}I=0;for(S=la.length;I<S;I++){N=za[la[I]];Fb=N.vertexTangents;mb=Fb[0];
-nb=Fb[1];ob=Fb[2];qc=Fb[3];qa[na]=mb.x;qa[na+1]=mb.y;qa[na+2]=mb.z;qa[na+3]=mb.w;qa[na+4]=nb.x;qa[na+5]=nb.y;qa[na+6]=nb.z;qa[na+7]=nb.w;qa[na+8]=ob.x;qa[na+9]=ob.y;qa[na+10]=ob.z;qa[na+11]=ob.w;qa[na+12]=qc.x;qa[na+13]=qc.y;qa[na+14]=qc.z;qa[na+15]=qc.w;na=na+16}j.bindBuffer(j.ARRAY_BUFFER,ca.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,qa,Xa)}if(rd&&cd){I=0;for(S=ka.length;I<S;I++){N=za[ka[I]];jc=N.vertexNormals;Ob=N.normal;if(jc.length===3&&Ec)for(ja=0;ja<3;ja++){Vb=jc[ja];db[Ja]=Vb.x;db[Ja+
-1]=Vb.y;db[Ja+2]=Vb.z;Ja=Ja+3}else for(ja=0;ja<3;ja++){db[Ja]=Ob.x;db[Ja+1]=Ob.y;db[Ja+2]=Ob.z;Ja=Ja+3}}I=0;for(S=la.length;I<S;I++){N=za[la[I]];jc=N.vertexNormals;Ob=N.normal;if(jc.length===4&&Ec)for(ja=0;ja<4;ja++){Vb=jc[ja];db[Ja]=Vb.x;db[Ja+1]=Vb.y;db[Ja+2]=Vb.z;Ja=Ja+3}else for(ja=0;ja<4;ja++){db[Ja]=Ob.x;db[Ja+1]=Ob.y;db[Ja+2]=Ob.z;Ja=Ja+3}}j.bindBuffer(j.ARRAY_BUFFER,ca.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,db,Xa)}if(gd&&Xc&&dd){I=0;for(S=ka.length;I<S;I++){fb=ka[I];N=za[fb];kc=
-Xc[fb];if(kc!==void 0)for(ja=0;ja<3;ja++){mc=kc[ja];vc[Hb]=mc.u;vc[Hb+1]=mc.v;Hb=Hb+2}}I=0;for(S=la.length;I<S;I++){fb=la[I];N=za[fb];kc=Xc[fb];if(kc!==void 0)for(ja=0;ja<4;ja++){mc=kc[ja];vc[Hb]=mc.u;vc[Hb+1]=mc.v;Hb=Hb+2}}if(Hb>0){j.bindBuffer(j.ARRAY_BUFFER,ca.__webglUVBuffer);j.bufferData(j.ARRAY_BUFFER,vc,Xa)}}if(gd&&Yc&&dd){I=0;for(S=ka.length;I<S;I++){fb=ka[I];N=za[fb];lc=Yc[fb];if(lc!==void 0)for(ja=0;ja<3;ja++){nc=lc[ja];wc[Ib]=nc.u;wc[Ib+1]=nc.v;Ib=Ib+2}}I=0;for(S=la.length;I<S;I++){fb=
-la[I];N=za[fb];lc=Yc[fb];if(lc!==void 0)for(ja=0;ja<4;ja++){nc=lc[ja];wc[Ib]=nc.u;wc[Ib+1]=nc.v;Ib=Ib+2}}if(Ib>0){j.bindBuffer(j.ARRAY_BUFFER,ca.__webglUV2Buffer);j.bufferData(j.ARRAY_BUFFER,wc,Xa)}}if(qd){I=0;for(S=ka.length;I<S;I++){N=za[ka[I]];Bb[cb]=wa;Bb[cb+1]=wa+1;Bb[cb+2]=wa+2;cb=cb+3;Za[Oa]=wa;Za[Oa+1]=wa+1;Za[Oa+2]=wa;Za[Oa+3]=wa+2;Za[Oa+4]=wa+1;Za[Oa+5]=wa+2;Oa=Oa+6;wa=wa+3}I=0;for(S=la.length;I<S;I++){N=za[la[I]];Bb[cb]=wa;Bb[cb+1]=wa+1;Bb[cb+2]=wa+3;Bb[cb+3]=wa+1;Bb[cb+4]=wa+2;Bb[cb+5]=
-wa+3;cb=cb+6;Za[Oa]=wa;Za[Oa+1]=wa+1;Za[Oa+2]=wa;Za[Oa+3]=wa+3;Za[Oa+4]=wa+1;Za[Oa+5]=wa+2;Za[Oa+6]=wa+2;Za[Oa+7]=wa+3;Oa=Oa+8;wa=wa+4}j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ca.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Bb,Xa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ca.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Za,Xa)}if(Wc){ja=0;for(ed=Wc.length;ja<ed;ja++){x=Wc[ja];if(x.__original.needsUpdate){B=0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){I=0;for(S=ka.length;I<
-S;I++){N=za[ka[I]];x.array[B]=x.value[N.a];x.array[B+1]=x.value[N.b];x.array[B+2]=x.value[N.c];B=B+3}I=0;for(S=la.length;I<S;I++){N=za[la[I]];x.array[B]=x.value[N.a];x.array[B+1]=x.value[N.b];x.array[B+2]=x.value[N.c];x.array[B+3]=x.value[N.d];B=B+4}}else{if(x.boundTo==="faces"){I=0;for(S=ka.length;I<S;I++){Ya=x.value[ka[I]];x.array[B]=Ya;x.array[B+1]=Ya;x.array[B+2]=Ya;B=B+3}I=0;for(S=la.length;I<S;I++){Ya=x.value[la[I]];x.array[B]=Ya;x.array[B+1]=Ya;x.array[B+2]=Ya;x.array[B+3]=Ya;B=B+4}}}else if(x.size===
-2)if(x.boundTo===void 0||x.boundTo==="vertices"){I=0;for(S=ka.length;I<S;I++){N=za[ka[I]];V=x.value[N.a];W=x.value[N.b];X=x.value[N.c];x.array[B]=V.x;x.array[B+1]=V.y;x.array[B+2]=W.x;x.array[B+3]=W.y;x.array[B+4]=X.x;x.array[B+5]=X.y;B=B+6}I=0;for(S=la.length;I<S;I++){N=za[la[I]];V=x.value[N.a];W=x.value[N.b];X=x.value[N.c];ma=x.value[N.d];x.array[B]=V.x;x.array[B+1]=V.y;x.array[B+2]=W.x;x.array[B+3]=W.y;x.array[B+4]=X.x;x.array[B+5]=X.y;x.array[B+6]=ma.x;x.array[B+7]=ma.y;B=B+8}}else{if(x.boundTo===
-"faces"){I=0;for(S=ka.length;I<S;I++){X=W=V=Ya=x.value[ka[I]];x.array[B]=V.x;x.array[B+1]=V.y;x.array[B+2]=W.x;x.array[B+3]=W.y;x.array[B+4]=X.x;x.array[B+5]=X.y;B=B+6}I=0;for(S=la.length;I<S;I++){ma=X=W=V=Ya=x.value[la[I]];x.array[B]=V.x;x.array[B+1]=V.y;x.array[B+2]=W.x;x.array[B+3]=W.y;x.array[B+4]=X.x;x.array[B+5]=X.y;x.array[B+6]=ma.x;x.array[B+7]=ma.y;B=B+8}}}else if(x.size===3){var da;da=x.type==="c"?["r","g","b"]:["x","y","z"];if(x.boundTo===void 0||x.boundTo==="vertices"){I=0;for(S=ka.length;I<
-S;I++){N=za[ka[I]];V=x.value[N.a];W=x.value[N.b];X=x.value[N.c];x.array[B]=V[da[0]];x.array[B+1]=V[da[1]];x.array[B+2]=V[da[2]];x.array[B+3]=W[da[0]];x.array[B+4]=W[da[1]];x.array[B+5]=W[da[2]];x.array[B+6]=X[da[0]];x.array[B+7]=X[da[1]];x.array[B+8]=X[da[2]];B=B+9}I=0;for(S=la.length;I<S;I++){N=za[la[I]];V=x.value[N.a];W=x.value[N.b];X=x.value[N.c];ma=x.value[N.d];x.array[B]=V[da[0]];x.array[B+1]=V[da[1]];x.array[B+2]=V[da[2]];x.array[B+3]=W[da[0]];x.array[B+4]=W[da[1]];x.array[B+5]=W[da[2]];x.array[B+
-6]=X[da[0]];x.array[B+7]=X[da[1]];x.array[B+8]=X[da[2]];x.array[B+9]=ma[da[0]];x.array[B+10]=ma[da[1]];x.array[B+11]=ma[da[2]];B=B+12}}else if(x.boundTo==="faces"){I=0;for(S=ka.length;I<S;I++){X=W=V=Ya=x.value[ka[I]];x.array[B]=V[da[0]];x.array[B+1]=V[da[1]];x.array[B+2]=V[da[2]];x.array[B+3]=W[da[0]];x.array[B+4]=W[da[1]];x.array[B+5]=W[da[2]];x.array[B+6]=X[da[0]];x.array[B+7]=X[da[1]];x.array[B+8]=X[da[2]];B=B+9}I=0;for(S=la.length;I<S;I++){ma=X=W=V=Ya=x.value[la[I]];x.array[B]=V[da[0]];x.array[B+
-1]=V[da[1]];x.array[B+2]=V[da[2]];x.array[B+3]=W[da[0]];x.array[B+4]=W[da[1]];x.array[B+5]=W[da[2]];x.array[B+6]=X[da[0]];x.array[B+7]=X[da[1]];x.array[B+8]=X[da[2]];x.array[B+9]=ma[da[0]];x.array[B+10]=ma[da[1]];x.array[B+11]=ma[da[2]];B=B+12}}}else if(x.size===4)if(x.boundTo===void 0||x.boundTo==="vertices"){I=0;for(S=ka.length;I<S;I++){N=za[ka[I]];V=x.value[N.a];W=x.value[N.b];X=x.value[N.c];x.array[B]=V.x;x.array[B+1]=V.y;x.array[B+2]=V.z;x.array[B+3]=V.w;x.array[B+4]=W.x;x.array[B+5]=W.y;x.array[B+
-6]=W.z;x.array[B+7]=W.w;x.array[B+8]=X.x;x.array[B+9]=X.y;x.array[B+10]=X.z;x.array[B+11]=X.w;B=B+12}I=0;for(S=la.length;I<S;I++){N=za[la[I]];V=x.value[N.a];W=x.value[N.b];X=x.value[N.c];ma=x.value[N.d];x.array[B]=V.x;x.array[B+1]=V.y;x.array[B+2]=V.z;x.array[B+3]=V.w;x.array[B+4]=W.x;x.array[B+5]=W.y;x.array[B+6]=W.z;x.array[B+7]=W.w;x.array[B+8]=X.x;x.array[B+9]=X.y;x.array[B+10]=X.z;x.array[B+11]=X.w;x.array[B+12]=ma.x;x.array[B+13]=ma.y;x.array[B+14]=ma.z;x.array[B+15]=ma.w;B=B+16}}else if(x.boundTo===
-"faces"){I=0;for(S=ka.length;I<S;I++){X=W=V=Ya=x.value[ka[I]];x.array[B]=V.x;x.array[B+1]=V.y;x.array[B+2]=V.z;x.array[B+3]=V.w;x.array[B+4]=W.x;x.array[B+5]=W.y;x.array[B+6]=W.z;x.array[B+7]=W.w;x.array[B+8]=X.x;x.array[B+9]=X.y;x.array[B+10]=X.z;x.array[B+11]=X.w;B=B+12}I=0;for(S=la.length;I<S;I++){ma=X=W=V=Ya=x.value[la[I]];x.array[B]=V.x;x.array[B+1]=V.y;x.array[B+2]=V.z;x.array[B+3]=V.w;x.array[B+4]=W.x;x.array[B+5]=W.y;x.array[B+6]=W.z;x.array[B+7]=W.w;x.array[B+8]=X.x;x.array[B+9]=X.y;x.array[B+
-10]=X.z;x.array[B+11]=X.w;x.array[B+12]=ma.x;x.array[B+13]=ma.y;x.array[B+14]=ma.z;x.array[B+15]=ma.w;B=B+16}}j.bindBuffer(j.ARRAY_BUFFER,x.buffer);j.bufferData(j.ARRAY_BUFFER,x.array,Xa)}}}if(pd){delete ca.__inittedArrays;delete ca.__colorArray;delete ca.__normalArray;delete ca.__tangentArray;delete ca.__uvArray;delete ca.__uv2Array;delete ca.__faceArray;delete ca.__vertexArray;delete ca.__lineArray;delete ca.__skinVertexAArray;delete ca.__skinVertexBArray;delete ca.__skinIndexArray;delete ca.__skinWeightArray}}}}ga.verticesNeedUpdate=
-false;ga.morphTargetsNeedUpdate=false;ga.elementsNeedUpdate=false;ga.uvsNeedUpdate=false;ga.normalsNeedUpdate=false;ga.colorsNeedUpdate=false;ga.tangetsNeedUpdate=false;Ua.attributes&&m(Ua)}else if(jb instanceof THREE.Ribbon){if(ga.verticesNeedUpdate||ga.colorsNeedUpdate){var Zb=ga,hd=j.DYNAMIC_DRAW,xc=void 0,yc=void 0,Jc=void 0,$b=void 0,Kc=void 0,id=Zb.vertices,jd=Zb.colors,vd=id.length,wd=jd.length,Lc=Zb.__vertexArray,Mc=Zb.__colorArray,xd=Zb.colorsNeedUpdate;if(Zb.verticesNeedUpdate){for(xc=0;xc<
-vd;xc++){Jc=id[xc];$b=xc*3;Lc[$b]=Jc.x;Lc[$b+1]=Jc.y;Lc[$b+2]=Jc.z}j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Lc,hd)}if(xd){for(yc=0;yc<wd;yc++){Kc=jd[yc];$b=yc*3;Mc[$b]=Kc.r;Mc[$b+1]=Kc.g;Mc[$b+2]=Kc.b}j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Mc,hd)}}ga.verticesNeedUpdate=false;ga.colorsNeedUpdate=false}else if(jb instanceof THREE.Line){Ua=c(jb,hb);ic=Ua.attributes&&o(Ua);if(ga.verticesNeedUpdate||ga.colorsNeedUpdate||ic){var Jb=
-ga,Zc=j.DYNAMIC_DRAW,zc=void 0,Ac=void 0,Nc=void 0,va=void 0,Oc=void 0,kd=Jb.vertices,ld=Jb.colors,yd=kd.length,zd=ld.length,Pc=Jb.__vertexArray,Qc=Jb.__colorArray,Ad=Jb.colorsNeedUpdate,$c=Jb.__webglCustomAttributesList,Rc=void 0,md=void 0,Ia=void 0,oc=void 0,Va=void 0,pa=void 0;if(Jb.verticesNeedUpdate){for(zc=0;zc<yd;zc++){Nc=kd[zc];va=zc*3;Pc[va]=Nc.x;Pc[va+1]=Nc.y;Pc[va+2]=Nc.z}j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Pc,Zc)}if(Ad){for(Ac=0;Ac<zd;Ac++){Oc=
-ld[Ac];va=Ac*3;Qc[va]=Oc.r;Qc[va+1]=Oc.g;Qc[va+2]=Oc.b}j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Qc,Zc)}if($c){Rc=0;for(md=$c.length;Rc<md;Rc++){pa=$c[Rc];if(pa.needsUpdate&&(pa.boundTo===void 0||pa.boundTo==="vertices")){va=0;oc=pa.value.length;if(pa.size===1)for(Ia=0;Ia<oc;Ia++)pa.array[Ia]=pa.value[Ia];else if(pa.size===2)for(Ia=0;Ia<oc;Ia++){Va=pa.value[Ia];pa.array[va]=Va.x;pa.array[va+1]=Va.y;va=va+2}else if(pa.size===3)if(pa.type==="c")for(Ia=0;Ia<oc;Ia++){Va=
-pa.value[Ia];pa.array[va]=Va.r;pa.array[va+1]=Va.g;pa.array[va+2]=Va.b;va=va+3}else for(Ia=0;Ia<oc;Ia++){Va=pa.value[Ia];pa.array[va]=Va.x;pa.array[va+1]=Va.y;pa.array[va+2]=Va.z;va=va+3}else if(pa.size===4)for(Ia=0;Ia<oc;Ia++){Va=pa.value[Ia];pa.array[va]=Va.x;pa.array[va+1]=Va.y;pa.array[va+2]=Va.z;pa.array[va+3]=Va.w;va=va+4}j.bindBuffer(j.ARRAY_BUFFER,pa.buffer);j.bufferData(j.ARRAY_BUFFER,pa.array,Zc)}}}}ga.verticesNeedUpdate=false;ga.colorsNeedUpdate=false;Ua.attributes&&m(Ua)}else if(jb instanceof
-THREE.ParticleSystem){Ua=c(jb,hb);ic=Ua.attributes&&o(Ua);(ga.verticesNeedUpdate||ga.colorsNeedUpdate||jb.sortParticles||ic)&&f(ga,j.DYNAMIC_DRAW,jb);ga.verticesNeedUpdate=false;ga.colorsNeedUpdate=false;Ua.attributes&&m(Ua)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof THREE.MeshPhongMaterial?
-g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var i,k,l,m,n;i=m=n=h=0;for(k=b.length;i<k;i++){l=b[i];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&h++}}if(n+h+m<=M){k=m;l=n;m=h}else{k=Math.ceil(M*m/(n+m));
-m=l=M-k}var o=0,h=0;for(n=b.length;h<n;h++){i=b[h];if(i.castShadow){i instanceof THREE.SpotLight&&o++;i instanceof THREE.DirectionalLight&&!i.shadowCascade&&o++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var q;a:{n=a.fragmentShader;i=a.vertexShader;var h=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,maxBones:p,morphTargets:a.morphTargets,
-morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:k,maxPointLights:l,maxSpotLights:m,maxShadows:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},r,d=[];if(g)d.push(g);else{d.push(n);d.push(i)}for(r in c){d.push(r);
-d.push(c[r])}g=d.join();r=0;for(d=T.length;r<d;r++)if(T[r].code===g){q=T[r].program;break a}r=j.createProgram();d=["precision "+z+" float;",oa>0?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#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");
-k=["precision "+z+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.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":
+g=h.value[g];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}else{if(o)for(d=0;d<g;d++){e=h[d];f=d*3;l[f]=e.x;l[f+1]=e.y;l[f+2]=e.z}if(p)for(d=0;d<j;d++){e=i[d];f=d*3;m[f]=e.r;m[f+1]=e.g;m[f+2]=e.b}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices")){e=h.value.length;f=0;if(h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;f=f+2}else if(h.size===
+3)if(h.type==="c")for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.r;h.array[f+1]=g.g;h.array[f+2]=g.b;f=f+3}else for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;f=f+3}else if(h.size===4)for(d=0;d<e;d++){g=h.value[d];h.array[f]=g.x;h.array[f+1]=g.y;h.array[f+2]=g.z;h.array[f+3]=g.w;f=f+4}}}}}if(o||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
+m,b)}if(r){i=0;for(j=r.length;i<j;i++){h=r[i];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function g(a,b){return b.z-a.z}function h(a,b){return b[1]-a[1]}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++){fa=S=null;N=ca=U=$=oa=Oa=Y=-1;la=true;a[d].render(b,c,ab,Ba);fa=S=null;N=ca=U=$=oa=Oa=Y=-1;la=true}}function j(a,b,c,d,e,f,g,h){var k,i,j,l;if(b){i=a.length-1;l=b=-1}else{i=0;b=a.length;l=1}for(var m=i;m!==b;m=m+l){k=
+a[m];if(k.render){i=k.object;j=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&C.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);C.setDepthTest(k.depthTest);C.setDepthWrite(k.depthWrite);t(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}C.setObjectFaces(i);j instanceof THREE.BufferGeometry?C.renderBufferDirect(d,e,f,k,j,i):C.renderBuffer(d,e,f,k,j,i)}}}function l(a,b,c,d,e,f,g){for(var h,k,i=0,j=a.length;i<j;i++){h=a[i];k=h.object;if(k.visible){if(g)h=g;else{h=h[b];if(!h)continue;
+f&&C.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);C.setDepthTest(h.depthTest);C.setDepthWrite(h.depthWrite);t(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}C.renderImmediateObject(c,d,e,h,k)}}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=false}function r(a,b){for(var c=a.length-
+1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){if(d.needsUpdate){d.program&&C.deallocateMaterial(d);C.initMaterial(d,b,c,e);d.needsUpdate=false}if(d.morphTargets&&!e.__webglMorphTargetInfluences)e.__webglMorphTargetInfluences=new Float32Array(C.maxMorphTargets);var f=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==S){k.useProgram(g);S=g;f=true}if(d.id!==N){N=d.id;f=true}if(f||a!==fa){k.uniformMatrix4fv(h.projectionMatrix,
+false,a._projectionMatrixArray);a!==fa&&(fa=a)}if(f){if(c&&d.fog){i.fogColor.value=c.color;if(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){if(la){for(var j,l=0,m=0,n=0,o,p,r,q=ob,t=q.directional.colors,v=q.directional.positions,u=q.point.colors,x=q.point.positions,y=q.point.distances,B=q.spot.colors,H=q.spot.positions,E=q.spot.distances,
+$=q.spot.directions,I=q.spot.angles,G=q.spot.exponents,M=0,L=0,Y=0,O=r=0,c=O=0,f=b.length;c<f;c++){j=b[c];if(!j.onlyShadow){o=j.color;p=j.intensity;r=j.distance;if(j instanceof THREE.AmbientLight)if(C.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(j instanceof THREE.DirectionalLight){r=M*3;if(C.gammaInput){t[r]=o.r*o.r*p*p;t[r+1]=o.g*o.g*p*p;t[r+2]=o.b*o.b*p*p}else{t[r]=o.r*p;t[r+1]=o.g*p;t[r+2]=o.b*p}Da.copy(j.matrixWorld.getPosition());Da.subSelf(j.target.matrixWorld.getPosition());
+Da.normalize();v[r]=Da.x;v[r+1]=Da.y;v[r+2]=Da.z;M=M+1}else if(j instanceof THREE.PointLight){O=L*3;if(C.gammaInput){u[O]=o.r*o.r*p*p;u[O+1]=o.g*o.g*p*p;u[O+2]=o.b*o.b*p*p}else{u[O]=o.r*p;u[O+1]=o.g*p;u[O+2]=o.b*p}o=j.matrixWorld.getPosition();x[O]=o.x;x[O+1]=o.y;x[O+2]=o.z;y[L]=r;L=L+1}else if(j instanceof THREE.SpotLight){O=Y*3;if(C.gammaInput){B[O]=o.r*o.r*p*p;B[O+1]=o.g*o.g*p*p;B[O+2]=o.b*o.b*p*p}else{B[O]=o.r*p;B[O+1]=o.g*p;B[O+2]=o.b*p}o=j.matrixWorld.getPosition();H[O]=o.x;H[O+1]=o.y;H[O+2]=
+o.z;E[Y]=r;Da.copy(o);Da.subSelf(j.target.matrixWorld.getPosition());Da.normalize();$[O]=Da.x;$[O+1]=Da.y;$[O+2]=Da.z;I[Y]=Math.cos(j.angle);G[Y]=j.exponent;Y=Y+1}}}c=M*3;for(f=t.length;c<f;c++)t[c]=0;c=L*3;for(f=u.length;c<f;c++)u[c]=0;c=Y*3;for(f=B.length;c<f;c++)B[c]=0;q.directional.length=M;q.point.length=L;q.spot.length=Y;q.ambient[0]=l;q.ambient[1]=m;q.ambient[2]=n;la=false}c=ob;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;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngle.value=c.spot.angles;i.spotLightExponent.value=c.spot.exponents}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=
+d.opacity;C.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=A.height/2;i.map.texture=d.map}else if(d instanceof THREE.MeshPhongMaterial){i.shininess.value=d.shininess;if(C.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive);i.specular.value.copyGammaToLinear(d.specular)}else{i.ambient.value=d.ambient;
+i.emissive.value=d.emissive;i.specular.value=d.specular}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(C.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive}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(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){f=c=0;for(j=b.length;f<j;f++){l=b[f];if(l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)){i.shadowMap.texture[c]=l.shadowMap;i.shadowMapSize.value[c]=l.shadowMapSize;i.shadowMatrix.value[c]=l.shadowMatrix;i.shadowDarkness.value[c]=l.shadowDarkness;i.shadowBias.value[c]=l.shadowBias;c++}}}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(l=g.uniforms[b[i][1]]){f=b[i][0];m=f.type;j=f.value;
+switch(m){case "i":k.uniform1i(l,j);break;case "f":k.uniform1f(l,j);break;case "v2":k.uniform2f(l,j.x,j.y);break;case "v3":k.uniform3f(l,j.x,j.y,j.z);break;case "v4":k.uniform4f(l,j.x,j.y,j.z,j.w);break;case "c":k.uniform3f(l,j.r,j.g,j.b);break;case "fv1":k.uniform1fv(l,j);break;case "fv":k.uniform3fv(l,j);break;case "v2v":if(!f._array)f._array=new Float32Array(2*j.length);m=0;for(n=j.length;m<n;m++){q=m*2;f._array[q]=j[m].x;f._array[q+1]=j[m].y}k.uniform2fv(l,f._array);break;case "v3v":if(!f._array)f._array=
+new Float32Array(3*j.length);m=0;for(n=j.length;m<n;m++){q=m*3;f._array[q]=j[m].x;f._array[q+1]=j[m].y;f._array[q+2]=j[m].z}k.uniform3fv(l,f._array);break;case "v4v":if(!f._array)f._array=new Float32Array(4*j.length);m=0;for(n=j.length;m<n;m++){q=m*4;f._array[q]=j[m].x;f._array[q+1]=j[m].y;f._array[q+2]=j[m].z;f._array[q+3]=j[m].w}k.uniform4fv(l,f._array);break;case "m4":if(!f._array)f._array=new Float32Array(16);j.flattenToArray(f._array);k.uniformMatrix4fv(l,false,f._array);break;case "m4v":if(!f._array)f._array=
+new Float32Array(16*j.length);m=0;for(n=j.length;m<n;m++)j[m].flattenToArrayOffset(f._array,m*16);k.uniformMatrix4fv(l,false,f._array);break;case "t":k.uniform1i(l,j);l=f.texture;if(!l)continue;if(l.image instanceof Array&&l.image.length===6){f=l;if(f.image.length===6)if(f.needsUpdate){if(!f.image.__webglTextureCube)f.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,f.image.__webglTextureCube);j=[];for(l=0;l<6;l++){m=j;n=l;if(C.autoScaleCubemaps){q=
+f.image[l];v=ac;if(!(q.width<=v&&q.height<=v)){u=Math.max(q.width,q.height);t=Math.floor(q.width*v/u);v=Math.floor(q.height*v/u);u=document.createElement("canvas");u.width=t;u.height=v;u.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,t,v);q=u}}else q=f.image[l];m[n]=q}l=j[0];m=(l.width&l.width-1)===0&&(l.height&l.height-1)===0;n=D(f.format);q=D(f.type);s(k.TEXTURE_CUBE_MAP,f,m);for(l=0;l<6;l++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,n,n,q,j[l]);f.generateMipmaps&&m&&k.generateMipmap(k.TEXTURE_CUBE_MAP);
+f.needsUpdate=false;if(f.onUpdate)f.onUpdate()}else{k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,f.image.__webglTextureCube)}}else if(l instanceof THREE.WebGLRenderTargetCube){f=l;k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,f.__webglTexture)}else C.setTexture(l,j);break;case "tv":if(!f._array){f._array=[];m=0;for(n=f.texture.length;m<n;m++)f._array[m]=j+m}k.uniform1iv(l,f._array);m=0;for(n=f.texture.length;m<n;m++)(l=f.texture[m])&&C.setTexture(l,f._array[m])}}if((d instanceof
+THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();k.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray);d.skinning&&k.uniformMatrix4fv(h.boneGlobalMatrices,false,e.boneMatrices)}k.uniformMatrix4fv(h.modelViewMatrix,false,e._modelViewMatrix.elements);
+h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,false,e._normalMatrix.elements);h.objectMatrix!==null&&k.uniformMatrix4fv(h.objectMatrix,false,e.matrixWorld.elements);return g}function u(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function t(a,b,c){if(Ta!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);Ta=a}if(a&&(eb!==b||fb!==c)){k.polygonOffset(b,c);eb=b;fb=c}}function y(a,
+b){var c;a==="fragment"?c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS)){console.error(k.getShaderInfoLog(c));console.error(b);return null}return c}function s(a,b,c){if(c){k.texParameteri(a,k.TEXTURE_WRAP_S,D(b.wrapS));k.texParameteri(a,k.TEXTURE_WRAP_T,D(b.wrapT));k.texParameteri(a,k.TEXTURE_MAG_FILTER,D(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,D(b.minFilter))}else{k.texParameteri(a,
+k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_MAG_FILTER,E(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,E(b.minFilter))}}function x(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,
+k.DEPTH_STENCIL,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)}else k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function E(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function D(a){switch(a){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;
+case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.UnsignedShort4444Type:return k.UNSIGNED_SHORT_4_4_4_4;case THREE.UnsignedShort5551Type:return k.UNSIGNED_SHORT_5_5_5_1;
+case THREE.UnsignedShort565Type:return k.UNSIGNED_SHORT_5_6_5;case THREE.ByteType:return k.BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedIntType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA;
+case THREE.AddEquation:return k.FUNC_ADD;case THREE.SubtractEquation:return k.FUNC_SUBTRACT;case THREE.ReverseSubtractEquation:return k.FUNC_REVERSE_SUBTRACT;case THREE.ZeroFactor:return k.ZERO;case THREE.OneFactor:return k.ONE;case THREE.SrcColorFactor:return k.SRC_COLOR;case THREE.OneMinusSrcColorFactor:return k.ONE_MINUS_SRC_COLOR;case THREE.SrcAlphaFactor:return k.SRC_ALPHA;case THREE.OneMinusSrcAlphaFactor:return k.ONE_MINUS_SRC_ALPHA;case THREE.DstAlphaFactor:return k.DST_ALPHA;case THREE.OneMinusDstAlphaFactor:return k.ONE_MINUS_DST_ALPHA;
+case THREE.DstColorFactor:return k.DST_COLOR;case THREE.OneMinusDstColorFactor:return k.ONE_MINUS_DST_COLOR;case THREE.SrcAlphaSaturateFactor:return k.SRC_ALPHA_SATURATE}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},A=a.canvas!==void 0?a.canvas:document.createElement("canvas"),v=a.precision!==void 0?a.precision:"highp",H=a.alpha!==void 0?a.alpha:true,I=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,M=a.antialias!==void 0?a.antialias:false,R=a.stencil!==void 0?a.stencil:
+true,Z=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,B=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),G=a.clearAlpha!==void 0?a.clearAlpha:0,Q=a.maxLights!==void 0?a.maxLights:4;this.domElement=A;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=
+this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var C=this,k,P=[],L=0,S=null,aa=null,N=-1,ca=null,fa=null,O=0,$=-1,U=-1,Y=-1,ha=-1,Sa=-1,Ma=-1,Oa=-1,oa=-1,Ta=null,eb=null,fb=null,Za=null,Lb=0,mb=0,jb=0,nb=0,ab=0,Ba=0,ya=new THREE.Frustum,
+gb=new THREE.Matrix4,wa=new THREE.Matrix4,Pa=new THREE.Vector4,Da=new THREE.Vector3,la=true,ob={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]}};k=function(){var a;try{if(!(a=A.getContext("experimental-webgl",{alpha:H,premultipliedAlpha:I,antialias:M,stencil:R,preserveDrawingBuffer:Z})))throw"Error creating WebGL context.";}catch(b){console.error(b)}a.getExtension("OES_texture_float")||
+console.log("THREE.WebGLRenderer: Float textures not supported.");return a}();k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(B.r,B.g,B.b,G);this.context=k;var $a=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var ac=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE);
+this.getContext=function(){return k};this.supportsVertexTextures=function(){return $a>0};this.setSize=function(a,b){A.width=a;A.height=b;this.setViewport(0,0,A.width,A.height)};this.setViewport=function(a,b,c,d){Lb=a;mb=b;jb=c;nb=d;k.viewport(Lb,mb,jb,nb)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){B.setHex(a);G=b;k.clearColor(B.r,B.g,B.b,G)};this.setClearColor=function(a,
+b){B.copy(a);G=b;k.clearColor(B.r,B.g,B.b,G)};this.getClearColor=function(){return B};this.getClearAlpha=function(){return G};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|k.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|k.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|k.STENCIL_BUFFER_BIT;k.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){a.__webglInit=false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._objectMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);
+k.deleteBuffer(c.__webglSkinVertexABuffer);k.deleteBuffer(c.__webglSkinVertexBBuffer);k.deleteBuffer(c.__webglSkinIndicesBuffer);k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets){d=0;for(e=c.numMorphTargets;d<e;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)k.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=
+void 0;for(d in c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}C.info.memory.geometries--}else if(a instanceof THREE.Ribbon){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);C.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);C.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);
+k.deleteBuffer(a.__webglColorBuffer);C.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=false;k.deleteTexture(a.__webglTexture);C.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){k.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){k.deleteFramebuffer(a.__webglFramebuffer[b]);k.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{k.deleteFramebuffer(a.__webglFramebuffer);
+k.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,e=false,a=0;for(c=P.length;a<c;a++){d=P[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(e=true);break}}if(e){e=[];a=0;for(c=P.length;a<c;a++){d=P[a];d.program!==b&&e.push(d)}P=e;k.deleteProgram(b);C.info.memory.programs--}}};this.updateShadowMap=function(a,b){S=null;N=ca=oa=Oa=Y=-1;la=true;U=$=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,
+b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=k.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=k.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=k.createBuffer();if(a.hasPositions){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.position);k.vertexAttribPointer(b.attributes.position,
+3,k.FLOAT,false,0,0)}if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,j,l,m,n,o,p=a.count*3;for(o=0;o<p;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];g=n[o+3];i=n[o+4];l=n[o+5];h=n[o+6];j=n[o+7];m=n[o+8];d=(d+g+h)/3;e=(e+i+j)/3;f=(f+l+m)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+7]=e;n[o+8]=f}}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,
+3,k.FLOAT,false,0,0)}if(a.hasUvs&&c.map){k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer);k.bufferData(k.ARRAY_BUFFER,a.uvArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.uv);k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.color);k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,false,
+0,0)}k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==ca){ca=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){k.bindBuffer(k.ARRAY_BUFFER,e.vertexPositionBuffer);k.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,k.FLOAT,false,0,f[d].index*12);if(a.normal>=0&&e.vertexNormalBuffer){k.bindBuffer(k.ARRAY_BUFFER,
+e.vertexNormalBuffer);k.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,k.FLOAT,false,0,f[d].index*12)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){k.bindBuffer(k.ARRAY_BUFFER,e.vertexUvBuffer);k.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,k.FLOAT,false,0,f[d].index*8);k.enableVertexAttribArray(a.uv)}else k.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){k.bindBuffer(k.ARRAY_BUFFER,e.vertexColorBuffer);k.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,
+k.FLOAT,false,0,f[d].index*16)}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)}k.drawElements(k.TRIANGLES,f[d].count,k.UNSIGNED_SHORT,f[d].start*2);C.info.render.calls++;C.info.render.vertices=C.info.render.vertices+f[d].count;C.info.render.faces=C.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var g,i,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==ca){ca=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){k.bindBuffer(k.ARRAY_BUFFER,
+e.__webglVertexBuffer);k.vertexAttribPointer(b.position,3,k.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;if(f.morphTargetBase!==-1){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}else if(c.position>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var j=0;i=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;j<
+d.numSupportedMorphTargets&&j<i.length;){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[j]]);k.vertexAttribPointer(c["morphTarget"+j],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[j]]);k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[i[j]];j++}}else{i=[];g=f.morphTargetInfluences;var l,m=g.length;for(l=0;l<m;l++){j=g[l];j>0&&i.push([l,j])}if(i.length>d.numSupportedMorphTargets){i.sort(h);
+i.length=d.numSupportedMorphTargets}else i.length>d.numSupportedMorphNormals?i.sort(h):i.length===0&&i.push([0,0]);for(j=0;j<d.numSupportedMorphTargets;){if(i[j]){l=i[j][0];k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);k.vertexAttribPointer(c["morphTarget"+j],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[l]}else{k.vertexAttribPointer(c["morphTarget"+
+j],3,k.FLOAT,false,0,0);d.morphNormals&&k.vertexAttribPointer(c["morphNormal"+j],3,k.FLOAT,false,0,0);f.__webglMorphTargetInfluences[j]=0}j++}}d.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(i=e.__webglCustomAttributesList.length;g<i;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){k.bindBuffer(k.ARRAY_BUFFER,c.buffer);k.vertexAttribPointer(b[c.buffer.belongsToAttribute],
+c.size,k.FLOAT,false,0,0)}}}if(b.color>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer);k.vertexAttribPointer(b.color,3,k.FLOAT,false,0,0)}if(b.normal>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer);k.vertexAttribPointer(b.normal,3,k.FLOAT,false,0,0)}if(b.tangent>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglTangentBuffer);k.vertexAttribPointer(b.tangent,4,k.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer);k.vertexAttribPointer(b.uv,2,k.FLOAT,
+false,0,0);k.enableVertexAttribArray(b.uv)}else k.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(e.__webglUV2Buffer){k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer);k.vertexAttribPointer(b.uv2,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv2)}else k.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexABuffer);k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,
+e.__webglSkinVertexBBuffer);k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==Za){k.lineWidth(d);Za=d}a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);k.drawElements(k.LINES,e.__webglLineCount,
+k.UNSIGNED_SHORT,0)}else{a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)}C.info.render.calls++;C.info.render.vertices=C.info.render.vertices+e.__webglFaceCount;C.info.render.faces=C.info.render.faces+e.__webglFaceCount/3}else if(f instanceof THREE.Line){f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;d=d.linewidth;if(d!==Za){k.lineWidth(d);Za=d}k.drawArrays(f,0,e.__webglLineCount);C.info.render.calls++}else if(f instanceof
+THREE.ParticleSystem){k.drawArrays(k.POINTS,0,e.__webglParticleCount);C.info.render.calls++;C.info.render.points=C.info.render.points+e.__webglParticleCount}else if(f instanceof THREE.Ribbon){k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount);C.info.render.calls++}}};this.render=function(a,b,c,d){var e,f,h,m,n=a.__lights,o=a.fog;N=-1;la=true;if(b.parent===void 0){console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it...");a.add(b)}this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=
+new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);gb.multiply(b.projectionMatrix,b.matrixWorldInverse);ya.setFromMatrix(gb);this.autoUpdateObjects&&this.initWebGLObjects(a);i(this.renderPluginsPre,a,b);C.info.render.calls=0;C.info.render.vertices=0;C.info.render.faces=0;C.info.render.points=
+0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;f.render=false;if(h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||ya.contains(h))){u(h,b);var p=f,r=p.object,q=p.buffer,s=void 0,s=s=void 0,s=r.material;if(s instanceof THREE.MeshFaceMaterial){s=q.materialIndex;if(s>=0){s=r.geometry.materials[s];if(s.transparent){p.transparent=
+s;p.opaque=null}else{p.opaque=s;p.transparent=null}}}else if(s)if(s.transparent){p.transparent=s;p.opaque=null}else{p.opaque=s;p.transparent=null}f.render=true;if(this.sortObjects)if(h.renderDepth)f.z=h.renderDepth;else{Pa.copy(h.matrixWorld.getPosition());gb.multiplyVector3(Pa);f.z=Pa.z}}}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++){f=m[d];h=f.object;if(h.visible){u(h,b);h=f.object.material;if(h.transparent){f.transparent=h;f.opaque=null}else{f.opaque=h;f.transparent=
+null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);t(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);j(a.__webglObjects,false,"",b,n,o,true,d);l(a.__webglObjectsImmediate,"",b,n,o,false,d)}else{this.setBlending(THREE.NormalBlending);j(a.__webglObjects,true,"opaque",b,n,o,false);l(a.__webglObjectsImmediate,"opaque",b,n,o,false);j(a.__webglObjects,false,"transparent",
+b,n,o,true);l(a.__webglObjectsImmediate,"transparent",b,n,o,true)}i(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)};
+this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);ca=-1;C.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,k,ya):e.render(function(a){C.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,j=void 0,l=void 0;if(!g.__webglInit){g.__webglInit=true;g._modelViewMatrix=new THREE.Matrix4;
+g._normalMatrix=new THREE.Matrix3;if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=j,s=void 0,t=void 0,u=void 0,v=void 0,x=void 0,y=void 0,A=void 0,B={},D=q.morphTargets.length,H=q.morphNormals.length;q.geometryGroups={};s=0;for(t=q.faces.length;s<t;s++){u=q.faces[s];v=u.materialIndex;y=v!==void 0?v:-1;B[y]===void 0&&(B[y]={hash:y,counter:0});A=B[y].hash+"_"+B[y].counter;q.geometryGroups[A]===void 0&&(q.geometryGroups[A]={faces3:[],faces4:[],
+materialIndex:v,vertices:0,numMorphTargets:D,numMorphNormals:H});x=u instanceof THREE.Face3?3:4;if(q.geometryGroups[A].vertices+x>65535){B[y].counter=B[y].counter+1;A=B[y].hash+"_"+B[y].counter;q.geometryGroups[A]===void 0&&(q.geometryGroups[A]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:D,numMorphNormals:H})}u instanceof THREE.Face3?q.geometryGroups[A].faces3.push(s):q.geometryGroups[A].faces4.push(s);q.geometryGroups[A].vertices=q.geometryGroups[A].vertices+x}q.geometryGroupsList=
+[];var N=void 0;for(N in q.geometryGroups){q.geometryGroups[N].id=O++;q.geometryGroupsList.push(q.geometryGroups[N])}}for(i in j.geometryGroups){l=j.geometryGroups[i];if(!l.__webglVertexBuffer){var E=l;E.__webglVertexBuffer=k.createBuffer();E.__webglNormalBuffer=k.createBuffer();E.__webglTangentBuffer=k.createBuffer();E.__webglColorBuffer=k.createBuffer();E.__webglUVBuffer=k.createBuffer();E.__webglUV2Buffer=k.createBuffer();E.__webglSkinVertexABuffer=k.createBuffer();E.__webglSkinVertexBBuffer=k.createBuffer();
+E.__webglSkinIndicesBuffer=k.createBuffer();E.__webglSkinWeightsBuffer=k.createBuffer();E.__webglFaceBuffer=k.createBuffer();E.__webglLineBuffer=k.createBuffer();var $=void 0,I=void 0;if(E.numMorphTargets){E.__webglMorphTargetsBuffers=[];$=0;for(I=E.numMorphTargets;$<I;$++)E.__webglMorphTargetsBuffers.push(k.createBuffer())}if(E.numMorphNormals){E.__webglMorphNormalsBuffers=[];$=0;for(I=E.numMorphNormals;$<I;$++)E.__webglMorphNormalsBuffers.push(k.createBuffer())}C.info.memory.geometries++;var G=
+l,M=g,Y=M.geometry,L=G.faces3,S=G.faces4,U=L.length*3+S.length*4,Q=L.length*1+S.length*2,P=L.length*3+S.length*4,R=c(M,G),aa=e(R),Z=d(R),fa=R.vertexColors?R.vertexColors:false;G.__vertexArray=new Float32Array(U*3);if(Z)G.__normalArray=new Float32Array(U*3);if(Y.hasTangents)G.__tangentArray=new Float32Array(U*4);if(fa)G.__colorArray=new Float32Array(U*3);if(aa){if(Y.faceUvs.length>0||Y.faceVertexUvs.length>0)G.__uvArray=new Float32Array(U*2);if(Y.faceUvs.length>1||Y.faceVertexUvs.length>1)G.__uv2Array=
+new Float32Array(U*2)}if(M.geometry.skinWeights.length&&M.geometry.skinIndices.length){G.__skinVertexAArray=new Float32Array(U*4);G.__skinVertexBArray=new Float32Array(U*4);G.__skinIndexArray=new Float32Array(U*4);G.__skinWeightArray=new Float32Array(U*4)}G.__faceArray=new Uint16Array(Q*3);G.__lineArray=new Uint16Array(P*2);var ca=void 0,ha=void 0;if(G.numMorphTargets){G.__morphTargetsArrays=[];ca=0;for(ha=G.numMorphTargets;ca<ha;ca++)G.__morphTargetsArrays.push(new Float32Array(U*3))}if(G.numMorphNormals){G.__morphNormalsArrays=
+[];ca=0;for(ha=G.numMorphNormals;ca<ha;ca++)G.__morphNormalsArrays.push(new Float32Array(U*3))}G.__webglFaceCount=Q*3;G.__webglLineCount=P*2;if(R.attributes){if(G.__webglCustomAttributesList===void 0)G.__webglCustomAttributesList=[];var Oa=void 0;for(Oa in R.attributes){var Sa=R.attributes[Oa],oa={},la;for(la in Sa)oa[la]=Sa[la];if(!oa.__webglInitialized||oa.createUniqueBuffers){oa.__webglInitialized=true;var Ma=1;oa.type==="v2"?Ma=2:oa.type==="v3"?Ma=3:oa.type==="v4"?Ma=4:oa.type==="c"&&(Ma=3);oa.size=
+Ma;oa.array=new Float32Array(U*Ma);oa.buffer=k.createBuffer();oa.buffer.belongsToAttribute=Oa;Sa.needsUpdate=true;oa.__original=Sa}G.__webglCustomAttributesList.push(oa)}}G.__inittedArrays=true;j.verticesNeedUpdate=true;j.morphTargetsNeedUpdate=true;j.elementsNeedUpdate=true;j.uvsNeedUpdate=true;j.normalsNeedUpdate=true;j.tangetsNeedUpdate=true;j.colorsNeedUpdate=true}}}}else if(g instanceof THREE.Ribbon){j=g.geometry;if(!j.__webglVertexBuffer){var Ta=j;Ta.__webglVertexBuffer=k.createBuffer();Ta.__webglColorBuffer=
+k.createBuffer();C.info.memory.geometries++;var wa=j,ya=wa.vertices.length;wa.__vertexArray=new Float32Array(ya*3);wa.__colorArray=new Float32Array(ya*3);wa.__webglVertexCount=ya;j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.Line){j=g.geometry;if(!j.__webglVertexBuffer){var Da=j;Da.__webglVertexBuffer=k.createBuffer();Da.__webglColorBuffer=k.createBuffer();C.info.memory.geometries++;var Ba=j,eb=g,Pa=Ba.vertices.length;Ba.__vertexArray=new Float32Array(Pa*3);Ba.__colorArray=
+new Float32Array(Pa*3);Ba.__webglLineCount=Pa;b(Ba,eb);j.verticesNeedUpdate=true;j.colorsNeedUpdate=true}}else if(g instanceof THREE.ParticleSystem){j=g.geometry;if(!j.__webglVertexBuffer){var ab=j;ab.__webglVertexBuffer=k.createBuffer();ab.__webglColorBuffer=k.createBuffer();C.info.geometries++;var Za=j,Lb=g,mb=Za.vertices.length;Za.__vertexArray=new Float32Array(mb*3);Za.__colorArray=new Float32Array(mb*3);Za.__sortArray=[];Za.__webglParticleCount=mb;b(Za,Lb);j.verticesNeedUpdate=true;j.colorsNeedUpdate=
+true}}}if(!g.__webglActive){if(g instanceof THREE.Mesh){j=g.geometry;if(j instanceof THREE.BufferGeometry)o(h.__webglObjects,j,g);else for(i in j.geometryGroups){l=j.geometryGroups[i];o(h.__webglObjects,l,g)}}else if(g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem){j=g.geometry;o(h.__webglObjects,j,g)}else g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?
+h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var bb=a.__objectsRemoved[0],jb=a;bb instanceof THREE.Mesh||bb instanceof THREE.ParticleSystem||bb instanceof THREE.Ribbon||bb instanceof THREE.Line?r(jb.__webglObjects,bb):bb instanceof THREE.Sprite?n(jb.__webglSprites,bb):bb instanceof THREE.LensFlare?n(jb.__webglFlares,bb):(bb instanceof THREE.ImmediateRenderObject||bb.immediateRenderCallback)&&
+r(jb.__webglObjectsImmediate,bb);bb.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var gb=0,ob=a.__webglObjects.length;gb<ob;gb++){var kb=a.__webglObjects[gb].object,ga=kb.geometry,$a=void 0,fb=void 0,Ua=void 0;if(kb instanceof THREE.Mesh)if(ga instanceof THREE.BufferGeometry){ga.verticesNeedUpdate=false;ga.elementsNeedUpdate=false;ga.uvsNeedUpdate=false;ga.normalsNeedUpdate=false;ga.colorsNeedUpdate=false}else{for(var nb=0,ac=ga.geometryGroupsList.length;nb<ac;nb++){$a=ga.geometryGroupsList[nb];
+Ua=c(kb,$a);fb=Ua.attributes&&m(Ua);if(ga.verticesNeedUpdate||ga.morphTargetsNeedUpdate||ga.elementsNeedUpdate||ga.uvsNeedUpdate||ga.normalsNeedUpdate||ga.colorsNeedUpdate||ga.tangetsNeedUpdate||fb){var da=$a,md=kb,Wa=k.DYNAMIC_DRAW,nd=!ga.dynamic,cc=Ua;if(da.__inittedArrays){var bd=d(cc),Sc=cc.vertexColors?cc.vertexColors:false,cd=e(cc),Ec=bd===THREE.SmoothShading,F=void 0,T=void 0,ib=void 0,K=void 0,jc=void 0,Ob=void 0,lb=void 0,Fc=void 0,Gb=void 0,kc=void 0,lc=void 0,V=void 0,W=void 0,X=void 0,
+ma=void 0,pb=void 0,qb=void 0,rb=void 0,qc=void 0,sb=void 0,tb=void 0,ub=void 0,rc=void 0,vb=void 0,wb=void 0,xb=void 0,sc=void 0,yb=void 0,zb=void 0,Ab=void 0,tc=void 0,Bb=void 0,Cb=void 0,Db=void 0,uc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Gc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Hc=void 0,ia=void 0,dd=void 0,Vb=void 0,mc=void 0,nc=void 0,Ga=void 0,ed=void 0,Ea=void 0,Fa=void 0,Wb=void 0,Hb=void 0,xa=0,Ca=0,Ib=0,Jb=0,cb=0,Na=0,na=0,Qa=0,za=0,J=0,ba=0,z=0,Xa=void 0,Ha=da.__vertexArray,vc=da.__uvArray,
+wc=da.__uv2Array,db=da.__normalArray,qa=da.__tangentArray,Ia=da.__colorArray,ra=da.__skinVertexAArray,sa=da.__skinVertexBArray,ta=da.__skinIndexArray,ua=da.__skinWeightArray,Tc=da.__morphTargetsArrays,Uc=da.__morphNormalsArrays,Vc=da.__webglCustomAttributesList,w=void 0,Eb=da.__faceArray,Ya=da.__lineArray,Ra=md.geometry,od=Ra.elementsNeedUpdate,fd=Ra.uvsNeedUpdate,pd=Ra.normalsNeedUpdate,qd=Ra.tangetsNeedUpdate,rd=Ra.colorsNeedUpdate,sd=Ra.morphTargetsNeedUpdate,dc=Ra.vertices,ja=da.faces3,ka=da.faces4,
+Aa=Ra.faces,Wc=Ra.faceVertexUvs[0],Xc=Ra.faceVertexUvs[1],ec=Ra.skinVerticesA,fc=Ra.skinVerticesB,gc=Ra.skinIndices,Xb=Ra.skinWeights,Yb=Ra.morphTargets,Ic=Ra.morphNormals;if(Ra.verticesNeedUpdate){F=0;for(T=ja.length;F<T;F++){K=Aa[ja[F]];V=dc[K.a];W=dc[K.b];X=dc[K.c];Ha[Ca]=V.x;Ha[Ca+1]=V.y;Ha[Ca+2]=V.z;Ha[Ca+3]=W.x;Ha[Ca+4]=W.y;Ha[Ca+5]=W.z;Ha[Ca+6]=X.x;Ha[Ca+7]=X.y;Ha[Ca+8]=X.z;Ca=Ca+9}F=0;for(T=ka.length;F<T;F++){K=Aa[ka[F]];V=dc[K.a];W=dc[K.b];X=dc[K.c];ma=dc[K.d];Ha[Ca]=V.x;Ha[Ca+1]=V.y;Ha[Ca+
+2]=V.z;Ha[Ca+3]=W.x;Ha[Ca+4]=W.y;Ha[Ca+5]=W.z;Ha[Ca+6]=X.x;Ha[Ca+7]=X.y;Ha[Ca+8]=X.z;Ha[Ca+9]=ma.x;Ha[Ca+10]=ma.y;Ha[Ca+11]=ma.z;Ca=Ca+12}k.bindBuffer(k.ARRAY_BUFFER,da.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Ha,Wa)}if(sd){Ga=0;for(ed=Yb.length;Ga<ed;Ga++){F=ba=0;for(T=ja.length;F<T;F++){Wb=ja[F];K=Aa[Wb];V=Yb[Ga].vertices[K.a];W=Yb[Ga].vertices[K.b];X=Yb[Ga].vertices[K.c];Ea=Tc[Ga];Ea[ba]=V.x;Ea[ba+1]=V.y;Ea[ba+2]=V.z;Ea[ba+3]=W.x;Ea[ba+4]=W.y;Ea[ba+5]=W.z;Ea[ba+6]=X.x;Ea[ba+7]=X.y;Ea[ba+
+8]=X.z;if(cc.morphNormals){if(Ec){Hb=Ic[Ga].vertexNormals[Wb];sb=Hb.a;tb=Hb.b;ub=Hb.c}else ub=tb=sb=Ic[Ga].faceNormals[Wb];Fa=Uc[Ga];Fa[ba]=sb.x;Fa[ba+1]=sb.y;Fa[ba+2]=sb.z;Fa[ba+3]=tb.x;Fa[ba+4]=tb.y;Fa[ba+5]=tb.z;Fa[ba+6]=ub.x;Fa[ba+7]=ub.y;Fa[ba+8]=ub.z}ba=ba+9}F=0;for(T=ka.length;F<T;F++){Wb=ka[F];K=Aa[Wb];V=Yb[Ga].vertices[K.a];W=Yb[Ga].vertices[K.b];X=Yb[Ga].vertices[K.c];ma=Yb[Ga].vertices[K.d];Ea=Tc[Ga];Ea[ba]=V.x;Ea[ba+1]=V.y;Ea[ba+2]=V.z;Ea[ba+3]=W.x;Ea[ba+4]=W.y;Ea[ba+5]=W.z;Ea[ba+6]=X.x;
+Ea[ba+7]=X.y;Ea[ba+8]=X.z;Ea[ba+9]=ma.x;Ea[ba+10]=ma.y;Ea[ba+11]=ma.z;if(cc.morphNormals){if(Ec){Hb=Ic[Ga].vertexNormals[Wb];sb=Hb.a;tb=Hb.b;ub=Hb.c;rc=Hb.d}else rc=ub=tb=sb=Ic[Ga].faceNormals[Wb];Fa=Uc[Ga];Fa[ba]=sb.x;Fa[ba+1]=sb.y;Fa[ba+2]=sb.z;Fa[ba+3]=tb.x;Fa[ba+4]=tb.y;Fa[ba+5]=tb.z;Fa[ba+6]=ub.x;Fa[ba+7]=ub.y;Fa[ba+8]=ub.z;Fa[ba+9]=rc.x;Fa[ba+10]=rc.y;Fa[ba+11]=rc.z}ba=ba+12}k.bindBuffer(k.ARRAY_BUFFER,da.__webglMorphTargetsBuffers[Ga]);k.bufferData(k.ARRAY_BUFFER,Tc[Ga],Wa);if(cc.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,
+da.__webglMorphNormalsBuffers[Ga]);k.bufferData(k.ARRAY_BUFFER,Uc[Ga],Wa)}}}if(Xb.length){F=0;for(T=ja.length;F<T;F++){K=Aa[ja[F]];yb=Xb[K.a];zb=Xb[K.b];Ab=Xb[K.c];ua[J]=yb.x;ua[J+1]=yb.y;ua[J+2]=yb.z;ua[J+3]=yb.w;ua[J+4]=zb.x;ua[J+5]=zb.y;ua[J+6]=zb.z;ua[J+7]=zb.w;ua[J+8]=Ab.x;ua[J+9]=Ab.y;ua[J+10]=Ab.z;ua[J+11]=Ab.w;Bb=gc[K.a];Cb=gc[K.b];Db=gc[K.c];ta[J]=Bb.x;ta[J+1]=Bb.y;ta[J+2]=Bb.z;ta[J+3]=Bb.w;ta[J+4]=Cb.x;ta[J+5]=Cb.y;ta[J+6]=Cb.z;ta[J+7]=Cb.w;ta[J+8]=Db.x;ta[J+9]=Db.y;ta[J+10]=Db.z;ta[J+11]=
+Db.w;Pb=ec[K.a];Qb=ec[K.b];Rb=ec[K.c];ra[J]=Pb.x;ra[J+1]=Pb.y;ra[J+2]=Pb.z;ra[J+3]=1;ra[J+4]=Qb.x;ra[J+5]=Qb.y;ra[J+6]=Qb.z;ra[J+7]=1;ra[J+8]=Rb.x;ra[J+9]=Rb.y;ra[J+10]=Rb.z;ra[J+11]=1;Sb=fc[K.a];Tb=fc[K.b];Ub=fc[K.c];sa[J]=Sb.x;sa[J+1]=Sb.y;sa[J+2]=Sb.z;sa[J+3]=1;sa[J+4]=Tb.x;sa[J+5]=Tb.y;sa[J+6]=Tb.z;sa[J+7]=1;sa[J+8]=Ub.x;sa[J+9]=Ub.y;sa[J+10]=Ub.z;sa[J+11]=1;J=J+12}F=0;for(T=ka.length;F<T;F++){K=Aa[ka[F]];yb=Xb[K.a];zb=Xb[K.b];Ab=Xb[K.c];tc=Xb[K.d];ua[J]=yb.x;ua[J+1]=yb.y;ua[J+2]=yb.z;ua[J+3]=
+yb.w;ua[J+4]=zb.x;ua[J+5]=zb.y;ua[J+6]=zb.z;ua[J+7]=zb.w;ua[J+8]=Ab.x;ua[J+9]=Ab.y;ua[J+10]=Ab.z;ua[J+11]=Ab.w;ua[J+12]=tc.x;ua[J+13]=tc.y;ua[J+14]=tc.z;ua[J+15]=tc.w;Bb=gc[K.a];Cb=gc[K.b];Db=gc[K.c];uc=gc[K.d];ta[J]=Bb.x;ta[J+1]=Bb.y;ta[J+2]=Bb.z;ta[J+3]=Bb.w;ta[J+4]=Cb.x;ta[J+5]=Cb.y;ta[J+6]=Cb.z;ta[J+7]=Cb.w;ta[J+8]=Db.x;ta[J+9]=Db.y;ta[J+10]=Db.z;ta[J+11]=Db.w;ta[J+12]=uc.x;ta[J+13]=uc.y;ta[J+14]=uc.z;ta[J+15]=uc.w;Pb=ec[K.a];Qb=ec[K.b];Rb=ec[K.c];Gc=ec[K.d];ra[J]=Pb.x;ra[J+1]=Pb.y;ra[J+2]=Pb.z;
+ra[J+3]=1;ra[J+4]=Qb.x;ra[J+5]=Qb.y;ra[J+6]=Qb.z;ra[J+7]=1;ra[J+8]=Rb.x;ra[J+9]=Rb.y;ra[J+10]=Rb.z;ra[J+11]=1;ra[J+12]=Gc.x;ra[J+13]=Gc.y;ra[J+14]=Gc.z;ra[J+15]=1;Sb=fc[K.a];Tb=fc[K.b];Ub=fc[K.c];Hc=fc[K.d];sa[J]=Sb.x;sa[J+1]=Sb.y;sa[J+2]=Sb.z;sa[J+3]=1;sa[J+4]=Tb.x;sa[J+5]=Tb.y;sa[J+6]=Tb.z;sa[J+7]=1;sa[J+8]=Ub.x;sa[J+9]=Ub.y;sa[J+10]=Ub.z;sa[J+11]=1;sa[J+12]=Hc.x;sa[J+13]=Hc.y;sa[J+14]=Hc.z;sa[J+15]=1;J=J+16}if(J>0){k.bindBuffer(k.ARRAY_BUFFER,da.__webglSkinVertexABuffer);k.bufferData(k.ARRAY_BUFFER,
+ra,Wa);k.bindBuffer(k.ARRAY_BUFFER,da.__webglSkinVertexBBuffer);k.bufferData(k.ARRAY_BUFFER,sa,Wa);k.bindBuffer(k.ARRAY_BUFFER,da.__webglSkinIndicesBuffer);k.bufferData(k.ARRAY_BUFFER,ta,Wa);k.bindBuffer(k.ARRAY_BUFFER,da.__webglSkinWeightsBuffer);k.bufferData(k.ARRAY_BUFFER,ua,Wa)}}if(rd&&Sc){F=0;for(T=ja.length;F<T;F++){K=Aa[ja[F]];lb=K.vertexColors;Fc=K.color;if(lb.length===3&&Sc===THREE.VertexColors){vb=lb[0];wb=lb[1];xb=lb[2]}else xb=wb=vb=Fc;Ia[za]=vb.r;Ia[za+1]=vb.g;Ia[za+2]=vb.b;Ia[za+3]=
+wb.r;Ia[za+4]=wb.g;Ia[za+5]=wb.b;Ia[za+6]=xb.r;Ia[za+7]=xb.g;Ia[za+8]=xb.b;za=za+9}F=0;for(T=ka.length;F<T;F++){K=Aa[ka[F]];lb=K.vertexColors;Fc=K.color;if(lb.length===4&&Sc===THREE.VertexColors){vb=lb[0];wb=lb[1];xb=lb[2];sc=lb[3]}else sc=xb=wb=vb=Fc;Ia[za]=vb.r;Ia[za+1]=vb.g;Ia[za+2]=vb.b;Ia[za+3]=wb.r;Ia[za+4]=wb.g;Ia[za+5]=wb.b;Ia[za+6]=xb.r;Ia[za+7]=xb.g;Ia[za+8]=xb.b;Ia[za+9]=sc.r;Ia[za+10]=sc.g;Ia[za+11]=sc.b;za=za+12}if(za>0){k.bindBuffer(k.ARRAY_BUFFER,da.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
+Ia,Wa)}}if(qd&&Ra.hasTangents){F=0;for(T=ja.length;F<T;F++){K=Aa[ja[F]];Gb=K.vertexTangents;pb=Gb[0];qb=Gb[1];rb=Gb[2];qa[na]=pb.x;qa[na+1]=pb.y;qa[na+2]=pb.z;qa[na+3]=pb.w;qa[na+4]=qb.x;qa[na+5]=qb.y;qa[na+6]=qb.z;qa[na+7]=qb.w;qa[na+8]=rb.x;qa[na+9]=rb.y;qa[na+10]=rb.z;qa[na+11]=rb.w;na=na+12}F=0;for(T=ka.length;F<T;F++){K=Aa[ka[F]];Gb=K.vertexTangents;pb=Gb[0];qb=Gb[1];rb=Gb[2];qc=Gb[3];qa[na]=pb.x;qa[na+1]=pb.y;qa[na+2]=pb.z;qa[na+3]=pb.w;qa[na+4]=qb.x;qa[na+5]=qb.y;qa[na+6]=qb.z;qa[na+7]=qb.w;
+qa[na+8]=rb.x;qa[na+9]=rb.y;qa[na+10]=rb.z;qa[na+11]=rb.w;qa[na+12]=qc.x;qa[na+13]=qc.y;qa[na+14]=qc.z;qa[na+15]=qc.w;na=na+16}k.bindBuffer(k.ARRAY_BUFFER,da.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,qa,Wa)}if(pd&&bd){F=0;for(T=ja.length;F<T;F++){K=Aa[ja[F]];jc=K.vertexNormals;Ob=K.normal;if(jc.length===3&&Ec)for(ia=0;ia<3;ia++){Vb=jc[ia];db[Na]=Vb.x;db[Na+1]=Vb.y;db[Na+2]=Vb.z;Na=Na+3}else for(ia=0;ia<3;ia++){db[Na]=Ob.x;db[Na+1]=Ob.y;db[Na+2]=Ob.z;Na=Na+3}}F=0;for(T=ka.length;F<T;F++){K=
+Aa[ka[F]];jc=K.vertexNormals;Ob=K.normal;if(jc.length===4&&Ec)for(ia=0;ia<4;ia++){Vb=jc[ia];db[Na]=Vb.x;db[Na+1]=Vb.y;db[Na+2]=Vb.z;Na=Na+3}else for(ia=0;ia<4;ia++){db[Na]=Ob.x;db[Na+1]=Ob.y;db[Na+2]=Ob.z;Na=Na+3}}k.bindBuffer(k.ARRAY_BUFFER,da.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,db,Wa)}if(fd&&Wc&&cd){F=0;for(T=ja.length;F<T;F++){ib=ja[F];K=Aa[ib];kc=Wc[ib];if(kc!==void 0)for(ia=0;ia<3;ia++){mc=kc[ia];vc[Ib]=mc.u;vc[Ib+1]=mc.v;Ib=Ib+2}}F=0;for(T=ka.length;F<T;F++){ib=ka[F];K=Aa[ib];kc=
+Wc[ib];if(kc!==void 0)for(ia=0;ia<4;ia++){mc=kc[ia];vc[Ib]=mc.u;vc[Ib+1]=mc.v;Ib=Ib+2}}if(Ib>0){k.bindBuffer(k.ARRAY_BUFFER,da.__webglUVBuffer);k.bufferData(k.ARRAY_BUFFER,vc,Wa)}}if(fd&&Xc&&cd){F=0;for(T=ja.length;F<T;F++){ib=ja[F];K=Aa[ib];lc=Xc[ib];if(lc!==void 0)for(ia=0;ia<3;ia++){nc=lc[ia];wc[Jb]=nc.u;wc[Jb+1]=nc.v;Jb=Jb+2}}F=0;for(T=ka.length;F<T;F++){ib=ka[F];K=Aa[ib];lc=Xc[ib];if(lc!==void 0)for(ia=0;ia<4;ia++){nc=lc[ia];wc[Jb]=nc.u;wc[Jb+1]=nc.v;Jb=Jb+2}}if(Jb>0){k.bindBuffer(k.ARRAY_BUFFER,
+da.__webglUV2Buffer);k.bufferData(k.ARRAY_BUFFER,wc,Wa)}}if(od){F=0;for(T=ja.length;F<T;F++){K=Aa[ja[F]];Eb[cb]=xa;Eb[cb+1]=xa+1;Eb[cb+2]=xa+2;cb=cb+3;Ya[Qa]=xa;Ya[Qa+1]=xa+1;Ya[Qa+2]=xa;Ya[Qa+3]=xa+2;Ya[Qa+4]=xa+1;Ya[Qa+5]=xa+2;Qa=Qa+6;xa=xa+3}F=0;for(T=ka.length;F<T;F++){K=Aa[ka[F]];Eb[cb]=xa;Eb[cb+1]=xa+1;Eb[cb+2]=xa+3;Eb[cb+3]=xa+1;Eb[cb+4]=xa+2;Eb[cb+5]=xa+3;cb=cb+6;Ya[Qa]=xa;Ya[Qa+1]=xa+1;Ya[Qa+2]=xa;Ya[Qa+3]=xa+3;Ya[Qa+4]=xa+1;Ya[Qa+5]=xa+2;Ya[Qa+6]=xa+2;Ya[Qa+7]=xa+3;Qa=Qa+8;xa=xa+4}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
+da.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Eb,Wa);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,da.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Ya,Wa)}if(Vc){ia=0;for(dd=Vc.length;ia<dd;ia++){w=Vc[ia];if(w.__original.needsUpdate){z=0;if(w.size===1)if(w.boundTo===void 0||w.boundTo==="vertices"){F=0;for(T=ja.length;F<T;F++){K=Aa[ja[F]];w.array[z]=w.value[K.a];w.array[z+1]=w.value[K.b];w.array[z+2]=w.value[K.c];z=z+3}F=0;for(T=ka.length;F<T;F++){K=Aa[ka[F]];w.array[z]=w.value[K.a];w.array[z+
+1]=w.value[K.b];w.array[z+2]=w.value[K.c];w.array[z+3]=w.value[K.d];z=z+4}}else{if(w.boundTo==="faces"){F=0;for(T=ja.length;F<T;F++){Xa=w.value[ja[F]];w.array[z]=Xa;w.array[z+1]=Xa;w.array[z+2]=Xa;z=z+3}F=0;for(T=ka.length;F<T;F++){Xa=w.value[ka[F]];w.array[z]=Xa;w.array[z+1]=Xa;w.array[z+2]=Xa;w.array[z+3]=Xa;z=z+4}}}else if(w.size===2)if(w.boundTo===void 0||w.boundTo==="vertices"){F=0;for(T=ja.length;F<T;F++){K=Aa[ja[F]];V=w.value[K.a];W=w.value[K.b];X=w.value[K.c];w.array[z]=V.x;w.array[z+1]=V.y;
+w.array[z+2]=W.x;w.array[z+3]=W.y;w.array[z+4]=X.x;w.array[z+5]=X.y;z=z+6}F=0;for(T=ka.length;F<T;F++){K=Aa[ka[F]];V=w.value[K.a];W=w.value[K.b];X=w.value[K.c];ma=w.value[K.d];w.array[z]=V.x;w.array[z+1]=V.y;w.array[z+2]=W.x;w.array[z+3]=W.y;w.array[z+4]=X.x;w.array[z+5]=X.y;w.array[z+6]=ma.x;w.array[z+7]=ma.y;z=z+8}}else{if(w.boundTo==="faces"){F=0;for(T=ja.length;F<T;F++){X=W=V=Xa=w.value[ja[F]];w.array[z]=V.x;w.array[z+1]=V.y;w.array[z+2]=W.x;w.array[z+3]=W.y;w.array[z+4]=X.x;w.array[z+5]=X.y;
+z=z+6}F=0;for(T=ka.length;F<T;F++){ma=X=W=V=Xa=w.value[ka[F]];w.array[z]=V.x;w.array[z+1]=V.y;w.array[z+2]=W.x;w.array[z+3]=W.y;w.array[z+4]=X.x;w.array[z+5]=X.y;w.array[z+6]=ma.x;w.array[z+7]=ma.y;z=z+8}}}else if(w.size===3){var ea;ea=w.type==="c"?["r","g","b"]:["x","y","z"];if(w.boundTo===void 0||w.boundTo==="vertices"){F=0;for(T=ja.length;F<T;F++){K=Aa[ja[F]];V=w.value[K.a];W=w.value[K.b];X=w.value[K.c];w.array[z]=V[ea[0]];w.array[z+1]=V[ea[1]];w.array[z+2]=V[ea[2]];w.array[z+3]=W[ea[0]];w.array[z+
+4]=W[ea[1]];w.array[z+5]=W[ea[2]];w.array[z+6]=X[ea[0]];w.array[z+7]=X[ea[1]];w.array[z+8]=X[ea[2]];z=z+9}F=0;for(T=ka.length;F<T;F++){K=Aa[ka[F]];V=w.value[K.a];W=w.value[K.b];X=w.value[K.c];ma=w.value[K.d];w.array[z]=V[ea[0]];w.array[z+1]=V[ea[1]];w.array[z+2]=V[ea[2]];w.array[z+3]=W[ea[0]];w.array[z+4]=W[ea[1]];w.array[z+5]=W[ea[2]];w.array[z+6]=X[ea[0]];w.array[z+7]=X[ea[1]];w.array[z+8]=X[ea[2]];w.array[z+9]=ma[ea[0]];w.array[z+10]=ma[ea[1]];w.array[z+11]=ma[ea[2]];z=z+12}}else if(w.boundTo===
+"faces"){F=0;for(T=ja.length;F<T;F++){X=W=V=Xa=w.value[ja[F]];w.array[z]=V[ea[0]];w.array[z+1]=V[ea[1]];w.array[z+2]=V[ea[2]];w.array[z+3]=W[ea[0]];w.array[z+4]=W[ea[1]];w.array[z+5]=W[ea[2]];w.array[z+6]=X[ea[0]];w.array[z+7]=X[ea[1]];w.array[z+8]=X[ea[2]];z=z+9}F=0;for(T=ka.length;F<T;F++){ma=X=W=V=Xa=w.value[ka[F]];w.array[z]=V[ea[0]];w.array[z+1]=V[ea[1]];w.array[z+2]=V[ea[2]];w.array[z+3]=W[ea[0]];w.array[z+4]=W[ea[1]];w.array[z+5]=W[ea[2]];w.array[z+6]=X[ea[0]];w.array[z+7]=X[ea[1]];w.array[z+
+8]=X[ea[2]];w.array[z+9]=ma[ea[0]];w.array[z+10]=ma[ea[1]];w.array[z+11]=ma[ea[2]];z=z+12}}}else if(w.size===4)if(w.boundTo===void 0||w.boundTo==="vertices"){F=0;for(T=ja.length;F<T;F++){K=Aa[ja[F]];V=w.value[K.a];W=w.value[K.b];X=w.value[K.c];w.array[z]=V.x;w.array[z+1]=V.y;w.array[z+2]=V.z;w.array[z+3]=V.w;w.array[z+4]=W.x;w.array[z+5]=W.y;w.array[z+6]=W.z;w.array[z+7]=W.w;w.array[z+8]=X.x;w.array[z+9]=X.y;w.array[z+10]=X.z;w.array[z+11]=X.w;z=z+12}F=0;for(T=ka.length;F<T;F++){K=Aa[ka[F]];V=w.value[K.a];
+W=w.value[K.b];X=w.value[K.c];ma=w.value[K.d];w.array[z]=V.x;w.array[z+1]=V.y;w.array[z+2]=V.z;w.array[z+3]=V.w;w.array[z+4]=W.x;w.array[z+5]=W.y;w.array[z+6]=W.z;w.array[z+7]=W.w;w.array[z+8]=X.x;w.array[z+9]=X.y;w.array[z+10]=X.z;w.array[z+11]=X.w;w.array[z+12]=ma.x;w.array[z+13]=ma.y;w.array[z+14]=ma.z;w.array[z+15]=ma.w;z=z+16}}else if(w.boundTo==="faces"){F=0;for(T=ja.length;F<T;F++){X=W=V=Xa=w.value[ja[F]];w.array[z]=V.x;w.array[z+1]=V.y;w.array[z+2]=V.z;w.array[z+3]=V.w;w.array[z+4]=W.x;w.array[z+
+5]=W.y;w.array[z+6]=W.z;w.array[z+7]=W.w;w.array[z+8]=X.x;w.array[z+9]=X.y;w.array[z+10]=X.z;w.array[z+11]=X.w;z=z+12}F=0;for(T=ka.length;F<T;F++){ma=X=W=V=Xa=w.value[ka[F]];w.array[z]=V.x;w.array[z+1]=V.y;w.array[z+2]=V.z;w.array[z+3]=V.w;w.array[z+4]=W.x;w.array[z+5]=W.y;w.array[z+6]=W.z;w.array[z+7]=W.w;w.array[z+8]=X.x;w.array[z+9]=X.y;w.array[z+10]=X.z;w.array[z+11]=X.w;w.array[z+12]=ma.x;w.array[z+13]=ma.y;w.array[z+14]=ma.z;w.array[z+15]=ma.w;z=z+16}}k.bindBuffer(k.ARRAY_BUFFER,w.buffer);k.bufferData(k.ARRAY_BUFFER,
+w.array,Wa)}}}if(nd){delete da.__inittedArrays;delete da.__colorArray;delete da.__normalArray;delete da.__tangentArray;delete da.__uvArray;delete da.__uv2Array;delete da.__faceArray;delete da.__vertexArray;delete da.__lineArray;delete da.__skinVertexAArray;delete da.__skinVertexBArray;delete da.__skinIndexArray;delete da.__skinWeightArray}}}}ga.verticesNeedUpdate=false;ga.morphTargetsNeedUpdate=false;ga.elementsNeedUpdate=false;ga.uvsNeedUpdate=false;ga.normalsNeedUpdate=false;ga.colorsNeedUpdate=
+false;ga.tangetsNeedUpdate=false;Ua.attributes&&p(Ua)}else if(kb instanceof THREE.Ribbon){if(ga.verticesNeedUpdate||ga.colorsNeedUpdate){var Zb=ga,gd=k.DYNAMIC_DRAW,xc=void 0,yc=void 0,Jc=void 0,$b=void 0,Kc=void 0,hd=Zb.vertices,id=Zb.colors,td=hd.length,ud=id.length,Lc=Zb.__vertexArray,Mc=Zb.__colorArray,vd=Zb.colorsNeedUpdate;if(Zb.verticesNeedUpdate){for(xc=0;xc<td;xc++){Jc=hd[xc];$b=xc*3;Lc[$b]=Jc.x;Lc[$b+1]=Jc.y;Lc[$b+2]=Jc.z}k.bindBuffer(k.ARRAY_BUFFER,Zb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,
+Lc,gd)}if(vd){for(yc=0;yc<ud;yc++){Kc=id[yc];$b=yc*3;Mc[$b]=Kc.r;Mc[$b+1]=Kc.g;Mc[$b+2]=Kc.b}k.bindBuffer(k.ARRAY_BUFFER,Zb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Mc,gd)}}ga.verticesNeedUpdate=false;ga.colorsNeedUpdate=false}else if(kb instanceof THREE.Line){Ua=c(kb,$a);fb=Ua.attributes&&m(Ua);if(ga.verticesNeedUpdate||ga.colorsNeedUpdate||fb){var Kb=ga,Yc=k.DYNAMIC_DRAW,zc=void 0,Ac=void 0,Nc=void 0,va=void 0,Oc=void 0,jd=Kb.vertices,kd=Kb.colors,wd=jd.length,xd=kd.length,Pc=Kb.__vertexArray,
+Qc=Kb.__colorArray,yd=Kb.colorsNeedUpdate,Zc=Kb.__webglCustomAttributesList,Rc=void 0,ld=void 0,La=void 0,oc=void 0,Va=void 0,pa=void 0;if(Kb.verticesNeedUpdate){for(zc=0;zc<wd;zc++){Nc=jd[zc];va=zc*3;Pc[va]=Nc.x;Pc[va+1]=Nc.y;Pc[va+2]=Nc.z}k.bindBuffer(k.ARRAY_BUFFER,Kb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Pc,Yc)}if(yd){for(Ac=0;Ac<xd;Ac++){Oc=kd[Ac];va=Ac*3;Qc[va]=Oc.r;Qc[va+1]=Oc.g;Qc[va+2]=Oc.b}k.bindBuffer(k.ARRAY_BUFFER,Kb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Qc,Yc)}if(Zc){Rc=
+0;for(ld=Zc.length;Rc<ld;Rc++){pa=Zc[Rc];if(pa.needsUpdate&&(pa.boundTo===void 0||pa.boundTo==="vertices")){va=0;oc=pa.value.length;if(pa.size===1)for(La=0;La<oc;La++)pa.array[La]=pa.value[La];else if(pa.size===2)for(La=0;La<oc;La++){Va=pa.value[La];pa.array[va]=Va.x;pa.array[va+1]=Va.y;va=va+2}else if(pa.size===3)if(pa.type==="c")for(La=0;La<oc;La++){Va=pa.value[La];pa.array[va]=Va.r;pa.array[va+1]=Va.g;pa.array[va+2]=Va.b;va=va+3}else for(La=0;La<oc;La++){Va=pa.value[La];pa.array[va]=Va.x;pa.array[va+
+1]=Va.y;pa.array[va+2]=Va.z;va=va+3}else if(pa.size===4)for(La=0;La<oc;La++){Va=pa.value[La];pa.array[va]=Va.x;pa.array[va+1]=Va.y;pa.array[va+2]=Va.z;pa.array[va+3]=Va.w;va=va+4}k.bindBuffer(k.ARRAY_BUFFER,pa.buffer);k.bufferData(k.ARRAY_BUFFER,pa.array,Yc)}}}}ga.verticesNeedUpdate=false;ga.colorsNeedUpdate=false;Ua.attributes&&p(Ua)}else if(kb instanceof THREE.ParticleSystem){Ua=c(kb,$a);fb=Ua.attributes&&m(Ua);(ga.verticesNeedUpdate||ga.colorsNeedUpdate||kb.sortParticles||fb)&&f(ga,k.DYNAMIC_DRAW,
+kb);ga.verticesNeedUpdate=false;ga.colorsNeedUpdate=false;Ua.attributes&&p(Ua)}}};this.initMaterial=function(a,b,c,d){var e,f,g;a instanceof THREE.MeshDepthMaterial?g="depth":a instanceof THREE.MeshNormalMaterial?g="normal":a instanceof THREE.MeshBasicMaterial?g="basic":a instanceof THREE.MeshLambertMaterial?g="lambert":a instanceof THREE.MeshPhongMaterial?g="phong":a instanceof THREE.LineBasicMaterial?g="basic":a instanceof THREE.ParticleBasicMaterial&&(g="particle_basic");if(g){var h=THREE.ShaderLib[g];
+a.uniforms=THREE.UniformsUtils.clone(h.uniforms);a.vertexShader=h.vertexShader;a.fragmentShader=h.fragmentShader}var i,j,l,m,n;i=m=n=h=0;for(j=b.length;i<j;i++){l=b[i];if(!l.onlyShadow){l instanceof THREE.DirectionalLight&&m++;l instanceof THREE.PointLight&&n++;l instanceof THREE.SpotLight&&h++}}if(n+h+m<=Q){j=m;l=n;m=h}else{j=Math.ceil(Q*m/(n+m));m=l=Q-j}var o=0,h=0;for(n=b.length;h<n;h++){i=b[h];if(i.castShadow){i instanceof THREE.SpotLight&&o++;i instanceof THREE.DirectionalLight&&!i.shadowCascade&&
+o++}}var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var r;a:{i=a.fragmentShader;n=a.vertexShader;var h=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,maxBones:p,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:j,maxPointLights:l,maxSpotLights:m,maxShadows:o,
+shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},q,d=[];if(g)d.push(g);else{d.push(i);d.push(n)}for(q in c){d.push(q);d.push(c[q])}g=d.join();q=0;for(d=P.length;q<d;q++){j=P[q];if(j.code===g){j.usedTimes++;r=j.program;break a}}q=k.createProgram();d=["precision "+v+" float;",$a>
+0?"#define VERTEX_TEXTURES":"",C.gammaInput?"#define GAMMA_INPUT":"",C.gammaOutput?"#define GAMMA_OUTPUT":"",C.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#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");
+j=["precision "+v+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",C.gammaInput?"#define GAMMA_INPUT":"",C.gammaOutput?"#define GAMMA_OUTPUT":"",C.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");
-j.attachShader(r,t("fragment",k+n));j.attachShader(r,t("vertex",d+i));j.linkProgram(r);j.getProgramParameter(r,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(r,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");r.uniforms={};r.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in h)d.push(s);s=d;d=0;for(h=s.length;d<h;d++){n=
-s[d];r.uniforms[n]=j.getUniformLocation(r,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(q in b)d.push(q);q=d;s=0;for(b=q.length;s<b;s++){c=q[s];r.attributes[c]=j.getAttribLocation(r,c)}r.id=T.length;T.push({program:r,code:g});G.info.memory.programs=T.length;q=r}a.program=q;q=a.program.attributes;q.position>=0&&j.enableVertexAttribArray(q.position);
-q.color>=0&&j.enableVertexAttribArray(q.color);q.normal>=0&&j.enableVertexAttribArray(q.normal);q.tangent>=0&&j.enableVertexAttribArray(q.tangent);if(a.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0){j.enableVertexAttribArray(q.skinVertexA);j.enableVertexAttribArray(q.skinVertexB);j.enableVertexAttribArray(q.skinIndex);j.enableVertexAttribArray(q.skinWeight)}if(a.attributes)for(f in a.attributes)q[f]!==void 0&&q[f]>=0&&j.enableVertexAttribArray(q[f]);if(a.morphTargets){a.numSupportedMorphTargets=
-0;r="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=r+f;if(q[s]>=0){j.enableVertexAttribArray(q[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;r="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=r+f;if(q[s]>=0){j.enableVertexAttribArray(q[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW);a==="back"?j.cullFace(j.BACK):
-a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK);j.enable(j.CULL_FACE)}else j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if(ia!==a.doubleSided){a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE);ia=a.doubleSided}if(O!==a.flipSided){a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW);O=a.flipSided}};this.setDepthTest=function(a){if(Ma!==a){a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST);Ma=a}};this.setDepthWrite=function(a){if(Ka!==a){j.depthMask(a);Ka=a}};this.setBlending=
-function(a,b,c,d){if(a!==Q){switch(a){case THREE.NoBlending:j.disable(j.BLEND);break;case THREE.AdditiveBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;case THREE.CustomBlending:j.enable(j.BLEND);break;default:j.enable(j.BLEND);
-j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD);j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}Q=a}if(a===THREE.CustomBlending){if(b!==Z){j.blendEquation(H(b));Z=b}if(c!==$||d!==ha){j.blendFunc(H(c),H(d));$=c;ha=d}}else ha=$=Z=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=j.createTexture();G.info.memory.textures++}j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
-a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=H(a.format),f=H(a.type);y(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.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=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=j.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=H(a.format),e=H(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);y(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;f<6;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();
-j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);s(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=j.createFramebuffer();a.__webglRenderbuffer=j.createRenderbuffer();j.bindTexture(j.TEXTURE_2D,a.__webglTexture);y(j.TEXTURE_2D,a,c);j.texImage2D(j.TEXTURE_2D,
-0,d,a.width,a.height,0,d,e,null);d=j.TEXTURE_2D;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0);s(a.__webglRenderbuffer,a);c&&j.generateMipmap(j.TEXTURE_2D)}b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;
-c=gb;a=Lb;d=Kb;e=lb}if(b!==C){j.bindFramebuffer(j.FRAMEBUFFER,b);j.viewport(d,e,c,a);C=b}hb=c;Cb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+i=y("fragment",j+i);d=y("vertex",d+n);k.attachShader(q,d);k.attachShader(q,i);k.linkProgram(q);k.getProgramParameter(q,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(q,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(i);k.deleteShader(d);q.uniforms={};q.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","boneGlobalMatrices","morphTargetInfluences"];for(s in h)d.push(s);
+s=d;d=0;for(h=s.length;d<h;d++){n=s[d];q.uniforms[n]=k.getUniformLocation(q,n)}d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(s=0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(b=r.length;s<b;s++){c=r[s];q.attributes[c]=k.getAttribLocation(q,c)}q.id=L++;P.push({program:q,code:g,usedTimes:1});C.info.memory.programs=P.length;r=q}a.program=r;r=a.program.attributes;
+r.position>=0&&k.enableVertexAttribArray(r.position);r.color>=0&&k.enableVertexAttribArray(r.color);r.normal>=0&&k.enableVertexAttribArray(r.normal);r.tangent>=0&&k.enableVertexAttribArray(r.tangent);if(a.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinVertexA);k.enableVertexAttribArray(r.skinVertexB);k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(f in a.attributes)r[f]!==void 0&&r[f]>=
+0&&k.enableVertexAttribArray(r[f]);if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(f=0;f<this.maxMorphTargets;f++){s=b+f;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(f=0;f<this.maxMorphNormals;f++){s=b+f;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,
+b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if($!==a.doubleSided){a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE);$=a.doubleSided}if(U!==a.flipSided){a.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW);U=a.flipSided}};this.setDepthTest=function(a){if(Oa!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);
+Oa=a}};this.setDepthWrite=function(a){if(oa!==a){k.depthMask(a);oa=a}};this.setBlending=function(a,b,c,d){if(a!==Y){switch(a){case THREE.NoBlending:k.disable(k.BLEND);break;case THREE.AdditiveBlending:k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,
+k.SRC_COLOR);break;case THREE.CustomBlending:k.enable(k.BLEND);break;default:k.enable(k.BLEND);k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD);k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}Y=a}if(a===THREE.CustomBlending){if(b!==ha){k.blendEquation(D(b));ha=b}if(c!==Sa||d!==Ma){k.blendFunc(D(c),D(d));Sa=c;Ma=d}}else Ma=Sa=ha=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();C.info.memory.textures++}k.activeTexture(k.TEXTURE0+
+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,e=D(a.format),f=D(a.type);s(k.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):k.texImage2D(k.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.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=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=k.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=D(a.format),e=D(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);s(k.TEXTURE_CUBE_MAP,a,c);for(var f=0;f<6;f++){a.__webglFramebuffer[f]=
+k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[f]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);x(a.__webglRenderbuffer[f],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=k.createFramebuffer();a.__webglRenderbuffer=k.createRenderbuffer();k.bindTexture(k.TEXTURE_2D,
+a.__webglTexture);s(k.TEXTURE_2D,a,c);k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null);d=k.TEXTURE_2D;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0);x(a.__webglRenderbuffer,a);c&&k.generateMipmap(k.TEXTURE_2D)}b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:
+a.__webglFramebuffer;c=a.width;a=a.height;e=d=0}else{b=null;c=jb;a=nb;d=Lb;e=mb}if(b!==aa){k.bindFramebuffer(k.FRAMEBUFFER,b);k.viewport(d,e,c,a);aa=b}ab=c;Ba=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:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
 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};
@@ -441,31 +430,32 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 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 e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,l=a.faceVertexUvs[0],o=f.faceVertexUvs[0],m={},p=0;p<a.materials.length;p++)m[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,q=h.length;p<q;p++){var n=h[p].clone();c&&c.multiplyVector3(n);g.push(n)}p=0;for(q=k.length;p<q;p++){var g=
-k[p],r,u,t=g.vertexNormals,y=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(n=t.length;h<n;h++){u=t[h].clone();d&&d.multiplyVector3(u);r.vertexNormals.push(u)}r.color.copy(g.color);h=0;for(n=y.length;h<n;h++){u=y[h];r.vertexColors.push(u.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];n=h.id;y=m[n];if(y===void 0){y=
-a.materials.length;m[n]=y;a.materials.push(h)}r.materialIndex=y}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}p=0;for(q=o.length;p<q;p++){c=o[p];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,j=f.faces,l=a.faceVertexUvs[0],o=f.faceVertexUvs[0],m={},p=0;p<a.materials.length;p++)m[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,r=h.length;p<r;p++){var n=h[p].clone();c&&c.multiplyVector3(n);g.push(n)}p=0;for(r=j.length;p<r;p++){var g=
+j[p],q,u,t=g.vertexNormals,y=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=t.length;h<n;h++){u=t[h].clone();d&&d.multiplyVector3(u);q.vertexNormals.push(u)}q.color.copy(g.color);h=0;for(n=y.length;h<n;h++){u=y[h];q.vertexColors.push(u.clone())}if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];n=h.id;y=m[n];if(y===void 0){y=
+a.materials.length;m[n]=y;a.materials.push(h)}q.materialIndex=y}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}p=0;for(r=o.length;p<r;p++){c=o[p];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;
 for(c=f.length;a<c;a++){for(var d=f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();if(d+e>1){d=1-d;e=1-e}f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof
 THREE.Face3){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,e,f)}if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b);a._area1=c;a._area2=g}else{c=THREE.GeometryUtils.triangleArea(d,e,b);g=THREE.GeometryUtils.triangleArea(e,f,b)}return THREE.GeometryUtils.random()*
-(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],l,o,m,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];o=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,o,m)}else if(d instanceof THREE.Face4){l=
-g[d.a];o=g[d.b];m=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,m,p);d._area=d._area1+d._area2}i=i+d._area;k[e]=i}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*i;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();
+(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],l,o,m,p;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3){l=g[d.a];o=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(l,o,m)}else if(d instanceof THREE.Face4){l=
+g[d.a];o=g[d.b];m=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(l,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,m,p);d._area=d._area1+d._area2}i=i+d._area;j[e]=i}d=[];for(e=0;e<b;e++){g=THREE.GeometryUtils.random()*i;g=c(g);d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,true)}return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.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).makeTranslation(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],e=0,f=d.length;e<f;e++){if(d[e].u!==1)d[e].u=d[e].u-Math.floor(d[e].u);if(d[e].v!==1)d[e].v=d[e].v-Math.floor(d[e].v)}},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<
-c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var i=d.b,k=d.c,l=d.d,o=new THREE.Face3,m=new THREE.Face3;o.color.copy(d.color);m.color.copy(d.color);o.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;o.a=e;o.b=i;o.c=l;m.a=i;m.b=k;m.c=l;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
-m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(o,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];i=o[1];k=o[2];l=o[3];o=[o[0].clone(),i.clone(),l.clone()];i=[i.clone(),k.clone(),l.clone()];h[d].push(o,i)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
-e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;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 e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(k.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
-h=f.b;i=f.c;g=a.vertices[g];h=a.vertices[h];i=a.vertices[i];b.push(g.clone());b.push(h.clone());b.push(i.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,k,l,o,m,p,q,n,r,u,t,y,s,w=[],H=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)H[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;k=a.vertices[f];l=a.vertices[g];o=a.vertices[h];p=k.distanceTo(l);q=l.distanceTo(o);m=k.distanceTo(o);if(p>
-b||q>b||m>b){i=a.vertices.length;y=e.clone();s=e.clone();if(p>=q&&p>=m){k=k.clone();k.lerpSelf(l,0.5);y.a=f;y.b=i;y.c=h;s.a=i;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);y.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);y.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(q>=p&&q>=m){k=l.clone();k.lerpSelf(o,0.5);y.a=f;y.b=g;y.c=
-i;s.a=i;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);y.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{k=k.clone();
-k.lerpSelf(o,0.5);y.a=f;y.b=g;y.c=i;s.a=i;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);y.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}w.push(y,s);a.vertices.push(k);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];y=k[2];if(e===
-0){l=s.clone();l.lerpSelf(h,0.5);k=[s.clone(),l.clone(),y.clone()];h=[l.clone(),h.clone(),y.clone()]}else if(e===1){l=h.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),y.clone(),s.clone()]}else{l=s.clone();l.lerpSelf(y,0.5);k=[s.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),y.clone()]}H[f].push(k,h)}}else{w.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)H[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;i=e.d;k=a.vertices[f];l=a.vertices[g];o=a.vertices[h];m=
-a.vertices[i];p=k.distanceTo(l);q=l.distanceTo(o);n=o.distanceTo(m);r=k.distanceTo(m);if(p>b||q>b||n>b||r>b){u=a.vertices.length;t=a.vertices.length+1;y=e.clone();s=e.clone();if(p>=q&&p>=n&&p>=r||n>=q&&n>=p&&n>=r){p=k.clone();p.lerpSelf(l,0.5);l=o.clone();l.lerpSelf(m,0.5);y.a=f;y.b=u;y.c=t;y.d=i;s.a=u;s.b=g;s.c=h;s.d=t;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);y.vertexNormals[1].copy(f);
-y.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);y.vertexColors[1].copy(f);y.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{p=l.clone();p.lerpSelf(o,0.5);l=m.clone();l.lerpSelf(k,0.5);y.a=f;y.b=g;y.c=u;y.d=t;s.a=t;s.b=u;s.c=h;s.d=i;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
-f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);y.vertexNormals[2].copy(f);y.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);y.vertexColors[2].copy(f);y.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}w.push(y,s);a.vertices.push(p,l);
-f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){k=a.faceVertexUvs[f][c];s=k[0];h=k[1];y=k[2];k=k[3];if(e===0){l=s.clone();l.lerpSelf(h,0.5);o=y.clone();o.lerpSelf(k,0.5);s=[s.clone(),l.clone(),o.clone(),k.clone()];h=[l.clone(),h.clone(),y.clone(),o.clone()]}else{l=h.clone();l.lerpSelf(y,0.5);o=k.clone();o.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),o.clone()];h=[o.clone(),l.clone(),y.clone(),k.clone()]}H[f].push(s,h)}}else{w.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)H[f].push(a.faceVertexUvs[f][c])}}}a.faces=
-w;a.faceVertexUvs=H}};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,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=true;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===6)f.needsUpdate=true;c&&c(this)};e[b].crossOrigin=this.crossOrigin;e[b].src=a[b]}return f},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=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),k=i.data,l=0;l<d;l++)for(var o=0;o<e;o++){var m=o-1<0?0:o-1,p=o+1>e-1?e-1:o+1,q=l-1<0?0:l-1,n=l+1>d-1?d-1:l+1,r=[],u=[0,0,h[(o*d+l)*4]/255*b];r.push([-1,0,h[(o*d+q)*4]/255*b]);r.push([-1,-1,h[(m*d+q)*4]/255*b]);r.push([0,
--1,h[(m*d+l)*4]/255*b]);r.push([1,-1,h[(m*d+n)*4]/255*b]);r.push([1,0,h[(o*d+n)*4]/255*b]);r.push([1,1,h[(p*d+n)*4]/255*b]);r.push([0,1,h[(p*d+l)*4]/255*b]);r.push([-1,1,h[(p*d+q)*4]/255*b]);m=[];q=r.length;for(p=0;p<q;p++){var n=r[p],t=r[(p+1)%q],n=[n[0]-u[0],n[1]-u[1],n[2]-u[2]],t=[t[0]-u[0],t[1]-u[1],t[2]-u[2]];m.push(c([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]))}r=[0,0,0];for(p=0;p<m.length;p++){r[0]=r[0]+m[p][0];r[1]=r[1]+m[p][1];r[2]=r[2]+m[p][2]}r[0]=r[0]/m.length;r[1]=
-r[1]/m.length;r[2]=r[2]/m.length;u=(o*d+l)*4;k[u]=(r[0]+1)/2*255|0;k[u+1]=(r[1]+0.5)*255|0;k[u+2]=r[2]*255|0;k[u+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=true;return a}};
+c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,l=d.d,o=new THREE.Face3,m=new THREE.Face3;o.color.copy(d.color);m.color.copy(d.color);o.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;o.a=e;o.b=i;o.c=l;m.a=i;m.b=j;m.c=l;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
+m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}f.push(o,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];i=o[1];j=o[2];l=o[3];o=[o[0].clone(),i.clone(),l.clone()];i=[i.clone(),j.clone(),l.clone()];h[d].push(o,i)}d=0;for(e=a.faceUvs.length;d<e;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d]);d=0;for(e=a.faceVertexUvs.length;d<
+e;d++)h[d].push(a.faceVertexUvs[d])}}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;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 e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else{g=f.a;
+h=f.b;i=f.c;g=a.vertices[g];h=a.vertices[h];i=a.vertices[i];b.push(g.clone());b.push(h.clone());b.push(i.clone());f.a=e;f.b=e+1;f.c=e+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,j,l,o,m,p,r,n,q,u,t,y,s,x=[],E=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)E[c]=[];c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=e.a;g=e.b;h=e.c;j=a.vertices[f];l=a.vertices[g];o=a.vertices[h];p=j.distanceTo(l);r=l.distanceTo(o);m=j.distanceTo(o);if(p>
+b||r>b||m>b){i=a.vertices.length;y=e.clone();s=e.clone();if(p>=r&&p>=m){j=j.clone();j.lerpSelf(l,0.5);y.a=f;y.b=i;y.c=h;s.a=i;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);y.vertexNormals[1].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);y.vertexColors[1].copy(f);s.vertexColors[0].copy(f)}e=0}else if(r>=p&&r>=m){j=l.clone();j.lerpSelf(o,0.5);y.a=f;y.b=g;y.c=
+i;s.a=i;s.b=h;s.c=f;if(e.vertexNormals.length===3){f=e.vertexNormals[1].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f);s.vertexNormals[1].copy(e.vertexNormals[2]);s.vertexNormals[2].copy(e.vertexNormals[0])}if(e.vertexColors.length===3){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);y.vertexColors[2].copy(f);s.vertexColors[0].copy(f);s.vertexColors[1].copy(e.vertexColors[2]);s.vertexColors[2].copy(e.vertexColors[0])}e=1}else{j=j.clone();
+j.lerpSelf(o,0.5);y.a=f;y.b=g;y.c=i;s.a=i;s.b=g;s.c=h;if(e.vertexNormals.length===3){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[2],0.5);y.vertexNormals[2].copy(f);s.vertexNormals[0].copy(f)}if(e.vertexColors.length===3){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[2],0.5);y.vertexColors[2].copy(f);s.vertexColors[0].copy(f)}e=2}x.push(y,s);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];s=j[0];h=j[1];y=j[2];if(e===
+0){l=s.clone();l.lerpSelf(h,0.5);j=[s.clone(),l.clone(),y.clone()];h=[l.clone(),h.clone(),y.clone()]}else if(e===1){l=h.clone();l.lerpSelf(y,0.5);j=[s.clone(),h.clone(),l.clone()];h=[l.clone(),y.clone(),s.clone()]}else{l=s.clone();l.lerpSelf(y,0.5);j=[s.clone(),h.clone(),l.clone()];h=[l.clone(),h.clone(),y.clone()]}E[f].push(j,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)E[f].push(a.faceVertexUvs[f][c])}}else{f=e.a;g=e.b;h=e.c;i=e.d;j=a.vertices[f];l=a.vertices[g];o=a.vertices[h];m=
+a.vertices[i];p=j.distanceTo(l);r=l.distanceTo(o);n=o.distanceTo(m);q=j.distanceTo(m);if(p>b||r>b||n>b||q>b){u=a.vertices.length;t=a.vertices.length+1;y=e.clone();s=e.clone();if(p>=r&&p>=n&&p>=q||n>=r&&n>=p&&n>=q){p=j.clone();p.lerpSelf(l,0.5);l=o.clone();l.lerpSelf(m,0.5);y.a=f;y.b=u;y.c=t;y.d=i;s.a=u;s.b=g;s.c=h;s.d=t;if(e.vertexNormals.length===4){f=e.vertexNormals[0].clone();f.lerpSelf(e.vertexNormals[1],0.5);g=e.vertexNormals[2].clone();g.lerpSelf(e.vertexNormals[3],0.5);y.vertexNormals[1].copy(f);
+y.vertexNormals[2].copy(g);s.vertexNormals[0].copy(f);s.vertexNormals[3].copy(g)}if(e.vertexColors.length===4){f=e.vertexColors[0].clone();f.lerpSelf(e.vertexColors[1],0.5);g=e.vertexColors[2].clone();g.lerpSelf(e.vertexColors[3],0.5);y.vertexColors[1].copy(f);y.vertexColors[2].copy(g);s.vertexColors[0].copy(f);s.vertexColors[3].copy(g)}e=0}else{p=l.clone();p.lerpSelf(o,0.5);l=m.clone();l.lerpSelf(j,0.5);y.a=f;y.b=g;y.c=u;y.d=t;s.a=t;s.b=u;s.c=h;s.d=i;if(e.vertexNormals.length===4){f=e.vertexNormals[1].clone();
+f.lerpSelf(e.vertexNormals[2],0.5);g=e.vertexNormals[3].clone();g.lerpSelf(e.vertexNormals[0],0.5);y.vertexNormals[2].copy(f);y.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(f)}if(e.vertexColors.length===4){f=e.vertexColors[1].clone();f.lerpSelf(e.vertexColors[2],0.5);g=e.vertexColors[3].clone();g.lerpSelf(e.vertexColors[0],0.5);y.vertexColors[2].copy(f);y.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(f)}e=1}x.push(y,s);a.vertices.push(p,l);
+f=0;for(g=a.faceVertexUvs.length;f<g;f++)if(a.faceVertexUvs[f].length){j=a.faceVertexUvs[f][c];s=j[0];h=j[1];y=j[2];j=j[3];if(e===0){l=s.clone();l.lerpSelf(h,0.5);o=y.clone();o.lerpSelf(j,0.5);s=[s.clone(),l.clone(),o.clone(),j.clone()];h=[l.clone(),h.clone(),y.clone(),o.clone()]}else{l=h.clone();l.lerpSelf(y,0.5);o=j.clone();o.lerpSelf(s,0.5);s=[s.clone(),h.clone(),l.clone(),o.clone()];h=[o.clone(),l.clone(),y.clone(),j.clone()]}E[f].push(s,h)}}else{x.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)E[f].push(a.faceVertexUvs[f][c])}}}a.faces=
+x;a.faceVertexUvs=E}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new THREE.Texture(void 0,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=true;c&&c()});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a);return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=new Image;e[b].onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===
+6){f.needsUpdate=true;c&&c()}};e[b].crossOrigin=this.crossOrigin;e[b].src=a[b]}return f},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=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var o=0;o<e;o++){var m=o-1<0?0:o-1,p=o+1>e-1?e-1:o+1,r=l-1<0?0:l-1,n=l+1>d-
+1?d-1:l+1,q=[],u=[0,0,h[(o*d+l)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(m*d+r)*4]/255*b]);q.push([0,-1,h[(m*d+l)*4]/255*b]);q.push([1,-1,h[(m*d+n)*4]/255*b]);q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(p*d+n)*4]/255*b]);q.push([0,1,h[(p*d+l)*4]/255*b]);q.push([-1,1,h[(p*d+r)*4]/255*b]);m=[];r=q.length;for(p=0;p<r;p++){var n=q[p],t=q[(p+1)%r],n=[n[0]-u[0],n[1]-u[1],n[2]-u[2]],t=[t[0]-u[0],t[1]-u[1],t[2]-u[2]];m.push(c([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*
+t[0]]))}q=[0,0,0];for(p=0;p<m.length;p++){q[0]=q[0]+m[p][0];q[1]=q[1]+m[p][1];q[2]=q[2]+m[p][2]}q[0]=q[0]/m.length;q[1]=q[1]/m.length;q[2]=q[2]/m.length;u=(o*d+l)*4;j[u]=(q[0]+1)/2*255|0;j[u+1]=(q[1]+1)/2*255|0;j[u+2]=q[2]*255|0;j[u+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){e[h*3]=f;e[h*3+1]=g;e[h*3+2]=c}a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);
+a.needsUpdate=true;return a}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++){c=a.children[d];b(c);THREE.SceneUtils.traverseHierarchy(c,b)}},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;if(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}else if(a instanceof THREE.SkinnedMesh)b=new THREE.SkinnedMesh(a.geometry,a.material);else if(a instanceof THREE.Mesh)b=new THREE.Mesh(a.geometry,a.material);else if(a instanceof THREE.Line)b=new THREE.Line(a.geometry,a.material,a.type);else if(a instanceof THREE.Ribbon)b=new THREE.Ribbon(a.geometry,a.material);
 else if(a instanceof THREE.ParticleSystem){b=new THREE.ParticleSystem(a.geometry,a.material);b.sortParticles=a.sortParticles}else if(a instanceof THREE.Particle)b=new THREE.Particle(a.material);else if(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);
@@ -481,6 +471,13 @@ THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"v
 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.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,l,o,m,p,r,n,q,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));j=b.length;for(a=0;a<j;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
+c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(p,r,i,l);if(g=f[f.length-1]){o=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h;THREE.Shape.Utils.b2(t,o,p,i);THREE.Shape.Utils.b2(t,m,r,l)}}break;case "b":i=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;r=b[a++]*-c;n=b[a++]*c+d;q=b[a++]*-c;e.bezierCurveTo(i,l,p,r,n,q);if(g=f[f.length-1]){o=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){t=g/h;THREE.Shape.Utils.b3(t,o,p,n,i);THREE.Shape.Utils.b3(t,m,r,q,l)}}}}}return{offset:u.ha*c,path:e}}}};
+THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",f=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=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],i,j,l;if(b(a)>0)for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var o=2*e;for(j=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var m;a:{m=a;var p=i,r=j,n=l,q=e,u=g,t=void 0,y=void 0,s=void 0,x=void 0,E=void 0,
+D=void 0,A=void 0,v=void 0,H=void 0,y=m[u[p]].x,s=m[u[p]].y,x=m[u[r]].x,E=m[u[r]].y,D=m[u[n]].x,A=m[u[n]].y;if(1.0E-10>(x-y)*(A-s)-(E-s)*(D-y))m=false;else{for(t=0;t<q;t++)if(!(t==p||t==r||t==n)){var v=m[u[t]].x,H=m[u[t]].y,I=void 0,M=void 0,R=void 0,Z=void 0,B=void 0,G=void 0,Q=void 0,C=void 0,k=void 0,P=void 0,L=void 0,S=void 0,I=R=B=void 0,I=D-x,M=A-E,R=y-D,Z=s-A,B=x-y,G=E-s,Q=v-y,C=H-s,k=v-x,P=H-E,L=v-D,S=H-A,I=I*P-M*k,B=B*C-G*Q,R=R*S-Z*L;if(I>=0&&R>=0&&B>=0){m=false;break a}}m=true}}if(m){f.push([a[g[i]],
+a[g[j]],a[g[l]]]);h.push([g[i],g[j],g[l]]);i=j;for(l=j+1;l<e;i++,l++)g[i]=g[l];e--;o=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 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=false;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=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=false;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++){c=this.getPoint(e/a);f=f+c.distanceTo(d);b.push(f);d=c}return this.cacheArcLengths=b};
@@ -501,11 +498,10 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]
 d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};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){b=c[a]-b;a=this.curves[a];b=1-b/a.getLength();return 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=b+this.curves[c].getLength();a.push(b)}return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,i;i=new THREE.Vector2;g=0;for(h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<c)e=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,i;i=new THREE.Vector2;g=0;for(h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<e)e=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,true))};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,true))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(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,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;i=g/c.maxX;i=b.getUtoTmapping(i,g);g=b.getPoint(i);h=b.getNormalVector(i).multiplyScalar(h);f.x=g.x+h.x;f.y=g.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.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;i=g/c.maxX;i=b.getUtoTmapping(i,g);g=b.getPoint(i);h=b.getNormalVector(i).multiplyScalar(h);f.x=g.x+h.x;f.y=g.y+h.y}return a};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){if(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)}else this.matrixWorld.copy(this.matrix);
 this.matrixWorldNeedsUpdate=false;a=true}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)};
@@ -515,46 +511,43 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
 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,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};
 THREE.Path.prototype.absarc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};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){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,i,k,l,o,m,p,q,n;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];o=f[0];m=f[1];if(c.length>0){g=c[c.length-1];
-p=g.x;q=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];q=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b2(n,p,o,h);n=THREE.Shape.Utils.b2(n,q,m,i);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];o=f[0];m=f[1];k=f[2];l=f[3];if(c.length>0){g=c[c.length-1];p=g.x;q=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];q=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b3(n,p,o,k,h);n=THREE.Shape.Utils.b3(n,q,m,l,i);c.push(new THREE.Vector2(g,
-n))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];k=f[2];o=f[3];m=!!f[5];l=f[4]-o;p=a*2;for(f=1;f<=p;f++){n=f/p;m||(n=1-n);n=o+n*l;g=h+k*Math.cos(n);n=i+k*Math.sin(n);c.push(new THREE.Vector2(g,n))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-
-1,1);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,e,f){var g=this.getPoints(),h,i,k,l,o;h=0;for(i=g.length;h<i;h++){k=g[h];l=k.x;o=k.y;k.x=a*l+b*o+c;k.y=d*o+e*l+f}return g};
-THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();if(!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,e,a=0;for(c=this.actions.length;a<c;a++){d=this.actions[a];e=d.args;d=d.action;d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e)}b.stroke();b.closePath();b.strokeStyle="red";
-d=this.getPoints();a=0;for(c=d.length;a<c;a++){e=d[a];b.beginPath();b.arc(e.x,e.y,1.5,0,Math.PI*2,false);b.stroke();b.closePath()}};
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,i,j,l,o,m,p,r,n;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];o=f[0];m=f[1];if(c.length>0){g=c[c.length-1];
+p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b2(n,p,o,h);n=THREE.Shape.Utils.b2(n,r,m,i);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];o=f[0];m=f[1];j=f[2];l=f[3];if(c.length>0){g=c[c.length-1];p=g.x;r=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];r=g[g.length-1]}for(f=1;f<=a;f++){n=f/a;g=THREE.Shape.Utils.b3(n,p,o,j,h);n=THREE.Shape.Utils.b3(n,r,m,l,i);c.push(new THREE.Vector2(g,
+n))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];j=f[2];o=f[3];m=!!f[5];l=f[4]-o;p=a*2;for(f=1;f<=p;f++){n=f/p;m||(n=1-n);n=o+n*l;g=h+j*Math.cos(n);n=i+j*Math.sin(n);c.push(new THREE.Vector2(g,n))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1.0E-10&&Math.abs(d.y-c[0].y)<1.0E-10&&c.splice(c.length-
+1,1);b&&c.push(c[0]);return c};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&f.actions.length!=0){e.push(f);f=new THREE.Path}f[c].apply(f,d)}f.actions.length!=0&&e.push(f);if(e.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(e.length==1){f=e[0];g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
 b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g.actions=f.actions;g.curves=f.curves;d.push(g);g=new THREE.Shape}else g.holes.push(f)}}else{a=0;for(b=e.length;a<b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves}else g.holes.push(f)}d.push(g)}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.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(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(),e,f,g,h,i,k,l,o,m,p,q=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];p=[];for(o=0;o<c.length;o++){l=c[o];l=m.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=o}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;var n=[k[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var r=[k[g],k[f],c[h]];m=THREE.FontUtils.Triangulate.area(r);p=h;l=g;h=h+1;g=g+
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;n=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);r=[k[g],k[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);if(o+m>n+r){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+k.length);g=g%k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1}o=c.slice(0,h);m=c.slice(h);p=k.slice(g);l=k.slice(0,g);f=[k[g],k[f],c[h]];q.push([k[g],c[h],c[e]]);q.push(f);c=o.concat(p).concat(l).concat(m)}return{shape:c,
-isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),f,g,h,i,k={};f=0;for(g=d.length;f<g;f++){i=d[f].x+":"+d[f].y;k[i]!==void 0&&console.log("Duplicate point",i);k[i]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=k[i];i!==void 0&&(h[d]=i)}}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=k[i];i!==void 0&&(h[d]=i)}}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,j,l,o,m,p,r=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){m=j[e];p=[];for(o=0;o<c.length;o++){l=c[o];l=m.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=o}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var n=[j[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[j[g],j[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);p=h;l=g;h=h+1;g=g+
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;n=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);if(o+m>n+q){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1}o=c.slice(0,h);m=c.slice(h);p=j.slice(g);l=j.slice(0,g);f=[j[g],j[f],c[h]];r.push([j[g],c[h],c[e]]);r.push(f);c=o.concat(p).concat(l).concat(m)}return{shape:c,
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),f,g,h,i,j={};f=0;for(g=d.length;f<g;f++){i=d[f].x+":"+d[f].y;j[i]!==void 0&&console.log("Duplicate point",i);j[i]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}f=0;for(g=e.length;f<g;f++){h=e[f];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(e)},
 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,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
-this.b3p3(a,e)}};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",e=b.weight!==void 0?b.weight:"normal",f=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=e;THREE.FontUtils.style=f};
-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!==true){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 k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=
-h;for(d=0;d<a.hierarchy[c].keys.length;d++){var l={};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){l[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(l[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(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=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return 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=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:true;this.points=[];this.target=new THREE.Vector3};
+this.b3p3(a,e)}};
+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!==true){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 l=
+{};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){l[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(l[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(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=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return 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=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:true;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;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=false;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,e,f,g,h,i,k,l=this.data.JIT.hierarchy,o,m;m=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;k=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,q=this.hierarchy.length;p<q;p++){a=this.hierarchy[p];i=a.animationCache;if(this.JITCompile&&l[p][k]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=l[p][k];a.matrixAutoUpdate=
-false;a.matrixWorldNeedsUpdate=false}else{a.matrix=l[p][k];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){c=b[n];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(o<m)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<o;){g=h;h=this.getNextKeyWith(c,p,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,l=this.data.JIT.hierarchy,o,m;m=this.currentTime=this.currentTime+a*this.timeScale;o=this.currentTime=this.currentTime%this.data.length;j=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,r=this.hierarchy.length;p<r;p++){a=this.hierarchy[p];i=a.animationCache;if(this.JITCompile&&l[p][j]!==void 0)if(a instanceof THREE.Bone){a.skinMatrix=l[p][j];a.matrixAutoUpdate=
+false;a.matrixWorldNeedsUpdate=false}else{a.matrix=l[p][j];a.matrixAutoUpdate=false;a.matrixWorldNeedsUpdate=true}else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){c=b[n];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(o<m)if(this.loop){g=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(c,p,1);h.time<o;){g=h;h=this.getNextKeyWith(c,p,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,
 p,h.index+1)}while(h.time<o)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(o-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===
 THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",p,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",p,h.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(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(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(p=0;p<this.hierarchy.length;p++)l[p][k]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,k;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],k[2],e,c,g);return d};
+this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&l[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(true);for(p=0;p<this.hierarchy.length;p++)l[p][j]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;e=(a.length-1)*b;f=Math.floor(e);e=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=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<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.0010;this.isPlaying=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;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 e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=
+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=false;this.loop=this.isPaused=true;this.JITCompile=c!==void 0?c:true;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 e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=
 false;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey=null;f.animationCache.nextKey=null;f.animationCache.originalMatrix=e instanceof THREE.Bone?
 e.skinMatrix:e.matrix}e=this.data.hierarchy[c].keys;if(e.length){f.animationCache.prevKey=e[0];f.animationCache.nextKey=e[1];this.startTime=Math.min(e[0].time,this.startTime);this.endTime=Math.max(e[e.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{d.copy(b.matrix);b.matrix=d}delete c.animationCache}}};
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
-this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=
+this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
 true}else if(l.length){if(this.JITCompile&&o)d instanceof THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!i)for(var m=l.length-1;c.time<g&&c.index!==m;){b=c;c=l[b.index+1]}o.prevKey=b;o.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
 for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c%b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
 THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
@@ -568,7 +561,7 @@ THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;thi
 THREE.CombinedCamera.prototype.setLens=function(a,b){var c=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};
 THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=false};
 THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};
-THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=false;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
+THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=false;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
 this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=false;if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2;this.domElement.setAttribute("tabindex",-1)}this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 true;break;case 2:this.moveBackward=true}this.mouseDragOn=true};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=false;break;case 2:this.moveBackward=false}this.mouseDragOn=false};this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};
 this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=true;break;case 37:case 65:this.moveLeft=true;break;case 40:case 83:this.moveBackward=true;break;case 39:case 68:this.moveRight=true;break;case 82:this.moveUp=true;break;case 70:this.moveDown=true;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=false;break;case 37:case 65:this.moveLeft=false;break;case 40:case 83:this.moveBackward=false;break;case 39:case 68:this.moveRight=
@@ -577,16 +570,16 @@ this.moveRight&&this.object.translateX(b);this.moveUp&&this.object.translateY(b)
 Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon=this.lon+this.mouseX*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*a*b;this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+
 100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",
 c(this,this.onKeyUp),false)};
-THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,u=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++){u=d*h.chunks[f]/h.total;b.keys[f]={time:u,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
+THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,u=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++){u=d*h.chunks[f]/h.total;b.keys[f]={time:u,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
 return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);e.vertices[c]=new THREE.Vector3(d.x,d.y,d.z)}return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
-this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=
+this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;if(this.domElement===document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=
 this.domElement.offsetHeight/2;this.domElement.setAttribute("tabindex",-1)}var g=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
 b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){if(this.domElement===
 document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),p=0;p<b.points.length;p++){c=new THREE.Mesh(g,h);c.position.copy(b.points[p]);a.add(c)}}this.domElement.addEventListener("mousemove",d(this,
 this.onMouseMove),false)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
+THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
 new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=
 0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -595,79 +588,76 @@ false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.upd
 this.object.matrixWorldNeedsUpdate=true};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
 c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=false,h=1,i=0,k=0,l=0,o=0,m=0,p=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
-a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*l);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}e.copy(this.forward);
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=false,h=1,i=0,j=0,l=0,o=0,m=0,p=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=
+a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*j);this.object.translateY(b*l);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}e.copy(this.forward);
 d.set(0,1,0);c.cross(d,e).normalize();d.cross(e,c).normalize();this.object.matrix.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=e.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=e.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=e.z;f.identity();f.elements[0]=Math.cos(this.roll);f.elements[4]=-Math.sin(this.roll);f.elements[1]=Math.sin(this.roll);f.elements[5]=
 Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=true;this.object.matrix.elements[12]=this.object.position.x;this.object.matrix.elements[13]=this.object.position.y;this.object.matrix.elements[14]=this.object.position.z};this.translateX=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[0]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[1]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[2]*
 a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[4]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[5]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[6]*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.elements[8]*a;this.object.position.y=this.object.position.y-this.object.matrix.elements[9]*a;this.object.position.z=this.object.position.z-
 this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
-false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;m=(a.clientY-q)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:i=
-1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:g=false;break;case 69:g=false;break;case 82:l=0;break;case 70:l=0}},false)};
+false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;m=(a.clientY-r)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:i=
+1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:g=true;h=1;break;case 69:g=true;h=-1;break;case 82:l=1;break;case 70:l=-1}},false);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:g=false;break;case 69:g=false;break;case 82:l=0;break;case 70:l=0}},false)};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=false;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
-this.target=new THREE.Vector3;var d=new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,o=new THREE.Vector2,m=new THREE.Vector2,p={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
+this.target=new THREE.Vector3;var d=new THREE.Vector3,e=false,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,l=new THREE.Vector2,o=new THREE.Vector2,m=new THREE.Vector2,p={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
 c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
-d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-k.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?k=l:k.y=k.y+(l.y-k.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=m.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
+d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(l.y-j.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?j=l:j.y=j.y+(l.y-j.y)*this.dynamicDampingFactor}};this.panCamera=function(){var a=m.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
 b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=m:o.addSelf(a.sub(m,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);
-c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);k=l=c.getMouseOnScreen(a.clientX,a.clientY);o=
-m=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?k=l=c.getMouseOnScreen(a.clientX,
+c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceTo(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(e){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);j=l=c.getMouseOnScreen(a.clientX,a.clientY);o=
+m=c.getMouseOnScreen(a.clientX,a.clientY);e=false}f!==-1&&(f===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,a.clientY):f===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();if(f===-1){f=a.button;f===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===1&&!c.noZoom?j=l=c.getMouseOnScreen(a.clientX,
 a.clientY):this.noPan||(o=m=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();f=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&f===-1){a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2);f!==-1&&(e=true)}},false);window.addEventListener("keyup",function(){c.enabled&&f!==-1&&(f=-1)},false)};
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,l,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,t=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var j=o+1,u=p+1,y=h/o,C=i/p,Y=new THREE.Vector3;Y[n]=l>0?1:-1;for(h=0;h<u;h++)for(i=0;i<j;i++){var F=new THREE.Vector3;F[a]=(i*y-q)*c;F[b]=(h*C-r)*g;F[n]=l;k.vertices.push(F)}for(h=0;h<p;h++)for(i=0;i<o;i++){a=new THREE.Face4(i+
-j*h+t,i+j*(h+1)+t,i+1+j*(h+1)+t,i+1+j*h+t);a.normal.copy(Y);a.vertexNormals.push(Y.clone(),Y.clone(),Y.clone(),Y.clone());a.materialIndex=m;k.faces.push(a);k.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}}THREE.Geometry.call(this);var k=this,l=a/2,o=b/2,m=c/2,p,q,n,r,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;r=1;q=2;u=3;n=4;t=5}else this.materials=
-[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var y in h)this.sides[y]!==void 0&&(this.sides[y]=h[y]);this.sides.px&&i("z","y",-1,-1,c,b,l,p);this.sides.nx&&i("z","y",1,-1,c,b,-l,r);this.sides.py&&i("x","z",1,1,a,c,o,q);this.sides.ny&&i("x","z",1,-1,a,c,-o,u);this.sides.pz&&i("x","y",1,-1,a,b,m,n);this.sides.nz&&i("x","y",-1,-1,a,b,-m,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,l,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,t=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var u=o+1,k=p+1,y=h/o,L=i/p,S=new THREE.Vector3;S[n]=l>0?1:-1;for(h=0;h<k;h++)for(i=0;i<u;i++){var aa=new THREE.Vector3;aa[a]=(i*y-q)*c;aa[b]=(h*L-r)*g;aa[n]=l;j.vertices.push(aa)}for(h=0;h<p;h++)for(i=0;i<o;i++){a=new THREE.Face4(i+
+u*h+t,i+u*(h+1)+t,i+1+u*(h+1)+t,i+1+u*h+t);a.normal.copy(S);a.vertexNormals.push(S.clone(),S.clone(),S.clone(),S.clone());a.materialIndex=m;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}}THREE.Geometry.call(this);var j=this,l=a/2,o=b/2,m=c/2,p,r,n,q,u,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;u=3;n=4;t=5}else this.materials=
+[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var y in h)this.sides[y]!==void 0&&(this.sides[y]=h[y]);this.sides.px&&i("z","y",-1,-1,c,b,l,p);this.sides.nx&&i("z","y",1,-1,c,b,-l,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,u);this.sides.pz&&i("x","y",1,-1,a,b,m,n);this.sides.nz&&i("x","y",-1,-1,a,b,-m,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var o=[],m=[],p=i/e,q=p*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,r=new THREE.Vector3;r.x=q*Math.sin(n*Math.PI*2);r.y=-p*c+g;r.z=q*Math.cos(n*Math.PI*2);this.vertices.push(r);o.push(this.vertices.length-1);m.push(new THREE.UV(n,p))}k.push(o);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){o=this.vertices[k[0][h]].clone();m=this.vertices[k[0][h+
-1]].clone()}else{o=this.vertices[k[1][h]].clone();m=this.vertices[k[1][h+1]].clone()}o.setY(Math.sqrt(o.x*o.x+o.z*o.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var p=k[i][h],q=k[i+1][h],n=k[i+1][h+1],r=k[i][h+1],u=o.clone(),t=o.clone(),y=m.clone(),s=m.clone(),w=l[i][h].clone(),H=l[i+1][h].clone(),E=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,q,n,r,[u,t,y,s]));this.faceVertexUvs[0].push([w,H,E,z])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,
-g,0));for(h=0;h<d;h++){p=k[0][h];q=k[0][h+1];n=this.vertices.length-1;u=new THREE.Vector3(0,1,0);t=new THREE.Vector3(0,1,0);y=new THREE.Vector3(0,1,0);w=l[0][h].clone();H=l[0][h+1].clone();E=new THREE.UV(H.u,0);this.faces.push(new THREE.Face3(p,q,n,[u,t,y]));this.faceVertexUvs[0].push([w,H,E])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=k[i][h+1];q=k[i][h];n=this.vertices.length-1;u=new THREE.Vector3(0,-1,0);t=new THREE.Vector3(0,-1,0);y=new THREE.Vector3(0,-1,0);
-w=l[i][h+1].clone();H=l[i][h].clone();E=new THREE.UV(H.u,1);this.faces.push(new THREE.Face3(p,q,n,[u,t,y]));this.faceVertexUvs[0].push([w,H,E])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,i,j=[],l=[];for(i=0;i<=e;i++){var o=[],m=[],p=i/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=new THREE.Vector3;q.x=r*Math.sin(n*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(n*Math.PI*2);this.vertices.push(q);o.push(this.vertices.length-1);m.push(new THREE.UV(n,p))}j.push(o);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){o=this.vertices[j[0][h]].clone();m=this.vertices[j[0][h+
+1]].clone()}else{o=this.vertices[j[1][h]].clone();m=this.vertices[j[1][h+1]].clone()}o.setY(Math.sqrt(o.x*o.x+o.z*o.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var p=j[i][h],r=j[i+1][h],n=j[i+1][h+1],q=j[i][h+1],u=o.clone(),t=o.clone(),y=m.clone(),s=m.clone(),x=l[i][h].clone(),E=l[i+1][h].clone(),D=l[i+1][h+1].clone(),A=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,r,n,q,[u,t,y,s]));this.faceVertexUvs[0].push([x,E,D,A])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,
+g,0));for(h=0;h<d;h++){p=j[0][h];r=j[0][h+1];n=this.vertices.length-1;u=new THREE.Vector3(0,1,0);t=new THREE.Vector3(0,1,0);y=new THREE.Vector3(0,1,0);x=l[0][h].clone();E=l[0][h+1].clone();D=new THREE.UV(E.u,0);this.faces.push(new THREE.Face3(p,r,n,[u,t,y]));this.faceVertexUvs[0].push([x,E,D])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=j[i][h+1];r=j[i][h];n=this.vertices.length-1;u=new THREE.Vector3(0,-1,0);t=new THREE.Vector3(0,-1,0);y=new THREE.Vector3(0,-1,0);
+x=l[i][h+1].clone();E=l[i][h].clone();D=new THREE.UV(E.u,1);this.faces.push(new THREE.Face3(p,r,n,[u,t,y]));this.faceVertexUvs[0].push([x,E,D])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(F=c.length;--F>=0;){e=F;f=F-1;f<0&&(f=
-c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=U*g,j=U*(g+1),k=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,o=c,p=g,q=h,k=k+J,i=i+J,n=n+J,j=j+J;A.faces.push(new THREE.Face4(k,i,n,j,null,null,t));k=O.generateSideWallUV(A,a,o,b,k,i,n,j,p,q);A.faceVertexUvs[0].push(k)}}}function f(a,b,c){A.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+J;d=d+J;e=e+J;A.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?O.generateBottomUV(A,a,b,c,d,e):O.generateTopUV(A,a,b,c,d,e);A.faceVertexUvs[0].push(c)}var h=
-b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,p=b.bendPath,q=b.extrudePath,n,r=false,u=b.material,t=b.extrudeMaterial,y,s,w,H;if(q){n=q.getSpacedPoints(m);r=true;o=false;y=new THREE.TubeGeometry.FrenetFrames(q,m,false);s=new THREE.Vector3;w=new THREE.Vector3;H=new THREE.Vector3}if(!o)k=i=l=0;var E,z,v,A=this,
-J=this.vertices.length;p&&a.addWrapPath(p);var q=a.extractPoints(),p=q.shape,K=q.holes;if(q=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();z=0;for(v=K.length;z<v;z++){E=K[z];THREE.Shape.Utils.isClockWise(E)&&(K[z]=E.reverse())}q=false}var R=THREE.Shape.Utils.triangulateShape(p,K),P=p;z=0;for(v=K.length;z<v;z++){E=K[z];p=p.concat(E)}var D,M,G,j,T,U=p.length,C,Y=R.length,q=[],F=0;G=P.length;D=G-1;for(M=F+1;F<G;F++,D++,M++){D===G&&(D=0);M===G&&(M=0);q[F]=d(P[F],P[D],P[M])}var ea=[],fa,ia=q.concat();
-z=0;for(v=K.length;z<v;z++){E=K[z];fa=[];F=0;G=E.length;D=G-1;for(M=F+1;F<G;F++,D++,M++){D===G&&(D=0);M===G&&(M=0);fa[F]=d(E[F],E[D],E[M])}ea.push(fa);ia=ia.concat(fa)}for(D=0;D<l;D++){G=D/l;j=i*(1-G);M=k*Math.sin(G*Math.PI/2);F=0;for(G=P.length;F<G;F++){T=c(P[F],q[F],M);f(T.x,T.y,-j)}z=0;for(v=K.length;z<v;z++){E=K[z];fa=ea[z];F=0;for(G=E.length;F<G;F++){T=c(E[F],fa[F],M);f(T.x,T.y,-j)}}}M=k;for(F=0;F<U;F++){T=o?c(p[F],ia[F],M):p[F];if(r){w.copy(y.normals[0]).multiplyScalar(T.x);s.copy(y.binormals[0]).multiplyScalar(T.y);
-H.copy(n[0]).addSelf(w).addSelf(s);f(H.x,H.y,H.z)}else f(T.x,T.y,0)}for(G=1;G<=m;G++)for(F=0;F<U;F++){T=o?c(p[F],ia[F],M):p[F];if(r){w.copy(y.normals[G]).multiplyScalar(T.x);s.copy(y.binormals[G]).multiplyScalar(T.y);H.copy(n[G]).addSelf(w).addSelf(s);f(H.x,H.y,H.z)}else f(T.x,T.y,h/m*G)}for(D=l-1;D>=0;D--){G=D/l;j=i*(1-G);M=k*Math.sin(G*Math.PI/2);F=0;for(G=P.length;F<G;F++){T=c(P[F],q[F],M);f(T.x,T.y,h+j)}z=0;for(v=K.length;z<v;z++){E=K[z];fa=ea[z];F=0;for(G=E.length;F<G;F++){T=c(E[F],fa[F],M);
-r?f(T.x,T.y+n[m-1].y,n[m-1].x+j):f(T.x,T.y,h+j)}}}var O=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(o){var a;a=U*0;for(F=0;F<Y;F++){C=R[F];g(C[2]+a,C[1]+a,C[0]+a,true)}a=m+l*2;a=U*a;for(F=0;F<Y;F++){C=R[F];g(C[0]+a,C[1]+a,C[2]+a,false)}}else{for(F=0;F<Y;F++){C=R[F];g(C[2],C[1],C[0],true)}for(F=0;F<Y;F++){C=R[F];g(C[0]+U*m,C[1]+U*m,C[2]+U*m,false)}}})();(function(){var a=0;e(P,a);a=a+P.length;z=0;for(v=K.length;z<v;z++){E=K[z];e(E,a);a=a+E.length}})()};
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,l=
-a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(o,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(l,g),new THREE.UV(m,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(N=c.length;--N>=0;){e=N;f=N-1;f<0&&(f=
+c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=L*g,k=L*(g+1),j=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,o=c,p=g,q=h,r=e,s=f,j=j+M,i=i+M,n=n+M,k=k+M;I.faces.push(new THREE.Face4(j,i,n,k,null,null,t));j=y.generateSideWallUV(I,a,o,b,j,i,n,k,p,q,r,s);I.faceVertexUvs[0].push(j)}}}function f(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+M;d=d+M;e=e+M;I.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?y.generateBottomUV(I,a,b,c,d,e):y.generateTopUV(I,a,b,c,d,e);I.faceVertexUvs[0].push(c)}
+var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,p=b.bendPath,r=b.extrudePath,n,q=false,u=b.material,t=b.extrudeMaterial,y=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,s,x,E,D;if(r){n=r.getSpacedPoints(m);q=true;o=false;s=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(r,
+m,false);x=new THREE.Vector3;E=new THREE.Vector3;D=new THREE.Vector3}if(!o)j=i=l=0;var A,v,H,I=this,M=this.vertices.length;p&&a.addWrapPath(p);var r=a.extractPoints(),p=r.shape,R=r.holes;if(r=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();v=0;for(H=R.length;v<H;v++){A=R[v];THREE.Shape.Utils.isClockWise(A)&&(R[v]=A.reverse())}r=false}var Z=THREE.Shape.Utils.triangulateShape(p,R),B=p;v=0;for(H=R.length;v<H;v++){A=R[v];p=p.concat(A)}var G,Q,C,k,P,L=p.length,S,aa=Z.length,r=[],N=0;C=B.length;G=C-1;
+for(Q=N+1;N<C;N++,G++,Q++){G===C&&(G=0);Q===C&&(Q=0);r[N]=d(B[N],B[G],B[Q])}var ca=[],fa,O=r.concat();v=0;for(H=R.length;v<H;v++){A=R[v];fa=[];N=0;C=A.length;G=C-1;for(Q=N+1;N<C;N++,G++,Q++){G===C&&(G=0);Q===C&&(Q=0);fa[N]=d(A[N],A[G],A[Q])}ca.push(fa);O=O.concat(fa)}for(G=0;G<l;G++){C=G/l;k=i*(1-C);Q=j*Math.sin(C*Math.PI/2);N=0;for(C=B.length;N<C;N++){P=c(B[N],r[N],Q);f(P.x,P.y,-k)}v=0;for(H=R.length;v<H;v++){A=R[v];fa=ca[v];N=0;for(C=A.length;N<C;N++){P=c(A[N],fa[N],Q);f(P.x,P.y,-k)}}}Q=j;for(N=
+0;N<L;N++){P=o?c(p[N],O[N],Q):p[N];if(q){E.copy(s.normals[0]).multiplyScalar(P.x);x.copy(s.binormals[0]).multiplyScalar(P.y);D.copy(n[0]).addSelf(E).addSelf(x);f(D.x,D.y,D.z)}else f(P.x,P.y,0)}for(C=1;C<=m;C++)for(N=0;N<L;N++){P=o?c(p[N],O[N],Q):p[N];if(q){E.copy(s.normals[C]).multiplyScalar(P.x);x.copy(s.binormals[C]).multiplyScalar(P.y);D.copy(n[C]).addSelf(E).addSelf(x);f(D.x,D.y,D.z)}else f(P.x,P.y,h/m*C)}for(G=l-1;G>=0;G--){C=G/l;k=i*(1-C);Q=j*Math.sin(C*Math.PI/2);N=0;for(C=B.length;N<C;N++){P=
+c(B[N],r[N],Q);f(P.x,P.y,h+k)}v=0;for(H=R.length;v<H;v++){A=R[v];fa=ca[v];N=0;for(C=A.length;N<C;N++){P=c(A[N],fa[N],Q);q?f(P.x,P.y+n[m-1].y,n[m-1].x+k):f(P.x,P.y,h+k)}}}(function(){if(o){var a;a=L*0;for(N=0;N<aa;N++){S=Z[N];g(S[2]+a,S[1]+a,S[0]+a,true)}a=m+l*2;a=L*a;for(N=0;N<aa;N++){S=Z[N];g(S[0]+a,S[1]+a,S[2]+a,false)}}else{for(N=0;N<aa;N++){S=Z[N];g(S[2],S[1],S[0],true)}for(N=0;N<aa;N++){S=Z[N];g(S[0]+L*m,S[1]+L*m,S[2]+L*m,false)}}})();(function(){var a=0;e(B,a);a=a+B.length;v=0;for(H=R.length;v<
+H;v++){A=R[v];e(A,a);a=a+A.length}})()};
+THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,1-a.vertices[d].y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,l=
+a.vertices[g].y,g=a.vertices[g].z,o=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(j,g),new THREE.UV(o,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(l,g),new THREE.UV(m,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push(d[f])}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push(d[f])}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-c/b,d/e),new THREE.UV(1-
 (c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/e)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,k=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-e,0,a*k-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+1)/d),new THREE.UV((b+
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,j=b/d,l=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-e,0,a*j-f));for(a=0;a<d;a++)for(b=0;b<c;b++){e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);e.normal.copy(l);e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone());this.faces.push(e);this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+1)/d),new THREE.UV((b+
 1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,k=[],l=[];for(i=0;i<=c;i++){var o=[],m=[];for(h=0;h<=b;h++){var p=h/b,q=i/c,n=new THREE.Vector3;n.x=-a*Math.cos(d+p*e)*Math.sin(f+q*g);n.y=a*Math.cos(f+q*g);n.z=a*Math.sin(d+p*e)*Math.sin(f+q*g);this.vertices.push(n);o.push(this.vertices.length-1);m.push(new THREE.UV(p,
-q))}k.push(o);l.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],f=k[i+1][h],g=k[i+1][h+1],o=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),q=this.vertices[g].clone().normalize(),n=l[i][h+1].clone(),r=l[i][h].clone(),u=l[i+1][h].clone(),t=l[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[o,p,q]));this.faceVertexUvs[0].push([n,u,t])}else if(Math.abs(this.vertices[f].y)==
-a){this.faces.push(new THREE.Face3(d,e,f,[o,m,p]));this.faceVertexUvs[0].push([n,r,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[o,m,p,q]));this.faceVertexUvs[0].push([n,r,u,t])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
-THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],l=[];for(i=0;i<=c;i++){var o=[],m=[];for(h=0;h<=b;h++){var p=h/b,r=i/c,n=new THREE.Vector3;n.x=-a*Math.cos(d+p*e)*Math.sin(f+r*g);n.y=a*Math.cos(f+r*g);n.z=a*Math.sin(d+p*e)*Math.sin(f+r*g);this.vertices.push(n);o.push(this.vertices.length-1);m.push(new THREE.UV(p,
+r))}j.push(o);l.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],e=j[i][h],f=j[i+1][h],g=j[i+1][h+1],o=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),p=this.vertices[f].clone().normalize(),r=this.vertices[g].clone().normalize(),n=l[i][h+1].clone(),q=l[i][h].clone(),u=l[i+1][h].clone(),t=l[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,f,g,[o,p,r]));this.faceVertexUvs[0].push([n,u,t])}else if(Math.abs(this.vertices[f].y)==
+a){this.faces.push(new THREE.Face3(d,e,f,[o,m,p]));this.faceVertexUvs[0].push([n,q,u])}else{this.faces.push(new THREE.Face4(d,e,f,g,[o,m,p,r]));this.faceVertexUvs[0].push([n,q,u,t])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.TextGeometry=function(a,b){var c=THREE.FontUtils.generateShapes(a,b);b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,l,o,m,p,q,n,r,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=b.length;for(a=0;a<k;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(i,l));e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(i,
-l));e.lineTo(i,l);break;case "q":i=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(p,q,i,l);if(g=f[f.length-1]){o=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h,y=THREE.Shape.Utils.b2(t,o,p,i),t=THREE.Shape.Utils.b2(t,m,q,l);f.push(new THREE.Vector2(y,t))}}break;case "b":i=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;q=b[a++]*-c;n=b[a++]*c+d;r=b[a++]*-c;e.bezierCurveTo(i,l,p,q,n,r);if(g=f[f.length-1]){o=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){t=g/h;y=THREE.Shape.Utils.b3(t,o,p,
-n,i);t=THREE.Shape.Utils.b3(t,m,q,r,l);f.push(new THREE.Vector2(y,t))}}}}}return{offset:u.ha*c,points:f,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],i,k,l;if(b(a)>0)for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var o=2*e;for(k=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{m=a;var p=i,q=k,n=l,r=e,u=g,t=void 0,y=void 0,s=void 0,w=void 0,H=void 0,
-E=void 0,z=void 0,v=void 0,A=void 0,y=m[u[p]].x,s=m[u[p]].y,w=m[u[q]].x,H=m[u[q]].y,E=m[u[n]].x,z=m[u[n]].y;if(1.0E-10>(w-y)*(z-s)-(H-s)*(E-y))m=false;else{for(t=0;t<r;t++)if(!(t==p||t==q||t==n)){var v=m[u[t]].x,A=m[u[t]].y,J=void 0,K=void 0,R=void 0,P=void 0,D=void 0,M=void 0,G=void 0,j=void 0,T=void 0,U=void 0,C=void 0,Y=void 0,J=R=D=void 0,J=E-w,K=z-H,R=y-E,P=s-z,D=w-y,M=H-s,G=v-y,j=A-s,T=v-w,U=A-H,C=v-E,Y=A-z,J=J*U-K*T,D=D*j-M*G,R=R*Y-P*C;if(J>=0&&R>=0&&D>=0){m=false;break a}}m=true}}if(m){f.push([a[g[i]],
-a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);i=k;for(l=k+1;l<e;i++,l++)g[i]=g[l];e--;o=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
 this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
 Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(i*d.x+g*e.x);f.y=f.y+(i*d.y+g*e.y);f.z=f.z+(i*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}}for(a=0;a<
-this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,k,l])}this.computeCentroids();this.computeFaceNormals();
+this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,j,l])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
-THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,i,k,l,o=new THREE.Vector3,m,p,q,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;p=b.normals;q=b.binormals;this.tangents=m;this.normals=p;this.binormals=q;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=m[b];g=p[b];h=q[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
-l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;k=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);o.copy(l);o.x=o.x+(k*g.x+i*h.x);o.y=o.y+(k*g.y+i*h.y);o.z=o.z+(k*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
-a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][o];o=this.grid[b][o];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);q=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,o));this.faceVertexUvs[0].push([m,p,q,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
+THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,i,j,l,o=new THREE.Vector3,m,p,r,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;p=b.normals;r=b.binormals;this.tangents=m;this.normals=p;this.binormals=r;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=m[b];g=p[b];h=r[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
+l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);o.copy(l);o.x=o.x+(j*g.x+i*h.x);o.y=o.y+(j*g.y+i*h.y);o.z=o.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){f=e?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
+a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][o];o=this.grid[b][o];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);r=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,f,o));this.faceVertexUvs[0].push([m,p,r,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;
 THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,k,l,o;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++){l=k/(b-1);e[k]=a.getTangentAt(l);e[k].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);o=Math.abs(e[0].z);if(k<=a){a=k;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
-f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(k=1;k<b;k++){f[k]=f[k-1].clone();g[k]=g[k-1].clone();h.cross(e[k-1],e[k]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[k-1].dot(e[k]));i.makeRotationAxis(h,d).multiplyVector3(f[k])}g[k].cross(e[k],f[k])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(k=1;k<b;k++){i.makeRotationAxis(e[k],d*k).multiplyVector3(f[k]);g[k].cross(e[k],f[k])}}};
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,l,o;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++){l=j/(b-1);e[j]=a.getTangentAt(l);e[j].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);l=Math.abs(e[0].y);o=Math.abs(e[0].z);if(j<=a){a=j;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
+f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(j=1;j<b;j++){f[j]=f[j-1].clone();g[j]=g[j-1].clone();h.cross(e[j-1],e[j]);if(h.length()>1.0E-4){h.normalize();d=Math.acos(e[j-1].dot(e[j]));i.makeRotationAxis(h,d).multiplyVector3(f[j])}g[j].cross(e[j],f[j])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(j=1;j<b;j++){i.makeRotationAxis(e[j],d*j).multiplyVector3(f[j]);g[j].cross(e[j],f[j])}}};
 THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();i.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
 i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){o[a.index]||(o[a.index]=[]);o[b.index]||(o[b.index]=[]);var c=o[a.index][b.index];c===void 0&&(o[a.index][b.index]=o[b.index][a.index]=c=e((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
-for(var c=c||1,d=d||0,i=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var o=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
+for(var c=c||1,d=d||0,i=this,j=0,l=a.length;j<l;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var o=[],a=this.vertices,j=0,l=b.length;j<l;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(l=this.vertices.length;j<l;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
 THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
 THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;
-THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,k,l,o=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++){k=i/b;k=a(k,l);e.push(k)}}var m,p,q,n;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*o+i;e=h*o+i+1;l=(h+1)*o+i;k=(h+1)*o+i+1;m=new THREE.UV(h/b,i/c);p=new THREE.UV(h/b,(i+1)/c);q=new THREE.UV((h+1)/b,i/c);n=new THREE.UV((h+1)/b,(i+1)/c);if(d){f.push(new THREE.Face3(a,e,l));f.push(new THREE.Face3(e,k,l));g.push([m,
-p,q]);g.push([p,n,q])}else{f.push(new THREE.Face4(a,e,k,l));g.push([m,p,q,n])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=new THREE.Geometry;THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry;
+THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,j,l,o=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++){j=i/b;j=a(j,l);e.push(j)}}var m,p,r,n;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*o+i;e=h*o+i+1;l=(h+1)*o+i;j=(h+1)*o+i+1;m=new THREE.UV(i/b,h/c);p=new THREE.UV((i+1)/b,h/c);r=new THREE.UV(i/b,(h+1)/c);n=new THREE.UV((i+1)/b,(h+1)/c);if(d){f.push(new THREE.Face3(a,e,l));f.push(new THREE.Face3(e,j,l));g.push([m,
+p,r]);g.push([p,n,r])}else{f.push(new THREE.Face4(a,e,j,l));g.push([m,p,n,r])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=new THREE.Geometry;THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry;
+THREE.ConvexGeometry=function(a){function b(b){var d=a[b].clone(),f=d.length();d.x=d.x+f*c();d.y=d.y+f*c();d.z=d.z+f*c();for(var f=[],g=0;g<e.length;){var h=e[g],i=d,j=a[h[0]],u;u=j;var t=a[h[1]],y=a[h[2]],s=new THREE.Vector3,x=new THREE.Vector3;s.sub(y,t);x.sub(u,t);s.crossSelf(x);s.isZero()||s.normalize();u=s;j=u.dot(j);if(u.dot(i)>=j){for(i=0;i<3;i++){j=[h[i],h[(i+1)%3]];u=true;for(t=0;t<f.length;t++)if(f[t][0]===j[1]&&f[t][1]===j[0]){f[t]=f[f.length-1];f.pop();u=false;break}u&&f.push(j)}e[g]=
+e[e.length-1];e.pop()}else g++}for(t=0;t<f.length;t++)e.push([f[t][0],f[t][1],b])}function c(){return(Math.random()-0.5)*2.0E-6}function d(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var e=[[0,1,2],[0,2,1]],f=3;f<a.length;f++)b(f);for(var g=0,h=Array(a.length),f=0;f<e.length;f++)for(var i=e[f],j=0;j<3;j++){if(h[i[j]]===void 0){h[i[j]]=g++;this.vertices.push(a[i[j]])}i[j]=h[i[j]]}for(f=0;f<e.length;f++)this.faces.push(new THREE.Face3(e[f][0],e[f][1],e[f][2]));
+for(f=0;f<this.faces.length;f++){i=this.faces[f];this.faceVertexUvs[0].push([d(this.vertices[i.a]),d(this.vertices[i.b]),d(this.vertices[i.c])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=new THREE.Geometry;THREE.ConvexGeometry.prototype.constructor=THREE.ConvexGeometry;
 THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3);a.vertices.push(new THREE.Vector3(0,100,0));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=new THREE.Object3D;THREE.AxisHelper.prototype.constructor=THREE.AxisHelper;
 THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);d===void 0&&(d=16776960);c===void 0&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);if(b instanceof THREE.Vector3)this.position=
@@ -679,16 +669,16 @@ this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);
 THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,
 1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){m.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var j=new THREE.Face4(a,c,d,e,null,g.color,g.material);if(m.useOldVertexColors){j.vertexColors=[];for(var k,n,p,q=0;q<4;q++){p=h[q];k=new THREE.Color;k.setRGB(0,0,0);for(var r=0;r<p.length;r++){n=g.vertexColors[p[r]-1];k.r=k.r+n.r;k.g=k.g+n.g;k.b=k.b+n.b}k.r=k.r/p.length;k.g=k.g/p.length;k.b=k.b/p.length;
-j.vertexColors[q]=k}}l.push(j);if(m.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=t[e];if(!f){a>=y&&a<y+q.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}function h(a,
-b){R[a]===void 0&&(R[a]=[]);R[a].push(b)}function i(a,b,c){P[a]===void 0&&(P[a]={});P[a][b]=c}var k=[],l=[],o=[],m=this,p=a.vertices,q=a.faces,k=p.concat(),n=[],r={},u={},t={},y=p.length,s,w,H,E,z,v=a.faceVertexUvs[0],A;b("originalFaces, uvs, originalVerticesLength",q.length,v.length,y);if(m.supportUVs){s=0;for(w=v.length;s<w;s++){H=0;for(E=v[s].length;H<E;H++){A=q[s]["abcd".charAt(H)];g(A,s,v[s][H])}}}if(v.length==0)m.supportUVs=false;s=0;for(z in t)s++;if(!s){m.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
-t,"vs",v.length);s=0;for(w=q.length;s<w;s++){z=q[s];n.push(z.centroid);k.push(z.centroid);if(m.supportUVs){v=new THREE.UV;if(z instanceof THREE.Face3){v.u=f(z.a,s).u+f(z.b,s).u+f(z.c,s).u;v.v=f(z.a,s).v+f(z.b,s).v+f(z.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(z instanceof THREE.Face4){v.u=f(z.a,s).u+f(z.b,s).u+f(z.c,s).u+f(z.d,s).u;v.v=f(z.a,s).v+f(z.b,s).v+f(z.c,s).v+f(z.d,s).v;v.u=v.u/4;v.v=v.v/4}g(y+s,"",v)}}b("-- added UVs for new Faces",t);w=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
-var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);A=0;var J,K,R={},P={};for(s in w){v=w[s];J=s.split("_");K=J[0];J=J[1];h(K,[K,J]);h(J,[K,J]);H=0;for(E=v.length;H<E;H++){z=v[H];i(K,z,s);i(J,z,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",R,"vertexFaceMap",P);for(s in w){v=
-w[s];z=v[0];E=v[1];J=s.split("_");K=J[0];J=J[1];v=new THREE.Vector3;if(u[s]){v.addSelf(p[K]);v.addSelf(p[J]);v.multiplyScalar(0.5)}else{v.addSelf(n[z]);v.addSelf(n[E]);v.addSelf(p[K]);v.addSelf(p[J]);v.multiplyScalar(0.25)}r[s]=y+q.length+A;k.push(v);A++;if(m.supportUVs){v=new THREE.UV;v.u=f(K,z).u+f(J,z).u;v.v=f(K,z).v+f(J,z).v;v.u=v.u/2;v.v=v.v/2;g(r[s],z,v);if(!u[s]){v=new THREE.UV;v.u=f(K,E).u+f(J,E).u;v.v=f(K,E).v+f(J,E).v;v.u=v.u/2;v.v=v.v/2;g(r[s],E,v)}}}b("-- Step 2 done");var D,M;E=["123",
-"12","2","23"];J=["123","23","3","31"];var G=["123","31","1","12"],j=["1234","12","2","23"],T=["1234","23","3","34"],U=["1234","34","4","41"],C=["1234","41","1","12"];s=0;for(w=n.length;s<w;s++){z=q[s];v=y+s;if(z instanceof THREE.Face3){A=e(z.a,z.b);K=e(z.b,z.c);D=e(z.c,z.a);d(v,r[A],z.b,r[K],z,E,s);d(v,r[K],z.c,r[D],z,J,s);d(v,r[D],z.a,r[A],z,G,s)}else if(z instanceof THREE.Face4){A=e(z.a,z.b);K=e(z.b,z.c);D=e(z.c,z.d);M=e(z.d,z.a);d(v,r[A],z.b,r[K],z,j,s);d(v,r[K],z.c,r[D],z,T,s);d(v,r[D],z.d,r[M],
-z,U,s);d(v,r[M],z.a,r[A],z,C,s)}else b("face should be a face!",z)}r=new THREE.Vector3;z=new THREE.Vector3;s=0;for(w=p.length;s<w;s++)if(R[s]!==void 0){r.set(0,0,0);z.set(0,0,0);K=new THREE.Vector3(0,0,0);v=0;for(H in P[s]){r.addSelf(n[H]);v++}E=0;A=R[s].length;for(H=0;H<A;H++)u[e(R[s][H][0],R[s][H][1])]&&E++;if(E!=2){r.divideScalar(v);for(H=0;H<A;H++){v=R[s][H];v=p[v[0]].clone().addSelf(p[v[1]]).divideScalar(2);z.addSelf(v)}z.divideScalar(A);K.addSelf(p[s]);K.multiplyScalar(A-3);K.addSelf(r);K.addSelf(z.multiplyScalar(2));
-K.divideScalar(A);k[s]=K}}a.vertices=k;a.faces=l;a.faceVertexUvs[0]=o;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
-THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){m.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,e,g,h,i){var k=new THREE.Face4(a,c,d,e,null,g.color,g.materialIndex);if(m.useOldVertexColors){k.vertexColors=[];for(var j,n,p,q=0;q<4;q++){p=h[q];j=new THREE.Color;j.setRGB(0,0,0);for(var r=0;r<p.length;r++){n=g.vertexColors[p[r]-1];j.r=j.r+n.r;j.g=j.g+n.g;j.b=j.b+n.b}j.r=j.r/p.length;j.g=j.g/p.length;j.b=j.b/
+p.length;k.vertexColors[q]=j}}l.push(k);if(m.supportUVs){g=[f(a,""),f(c,i),f(d,i),f(e,i)];g[0]?g[1]?g[2]?g[3]?o.push(g):b("d :( ",e+":"+i):b("c :( ",d+":"+i):b("b :( ",c+":"+i):b("a :( ",a+":"+i)}}function e(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function f(a,d){var e=a+":"+d,f=t[e];if(!f){a>=y&&a<y+r.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}function h(a,
+b){R[a]===void 0&&(R[a]=[]);R[a].push(b)}function i(a,b,c){Z[a]===void 0&&(Z[a]={});Z[a][b]=c}var j=[],l=[],o=[],m=this,p=a.vertices,r=a.faces,j=p.concat(),n=[],q={},u={},t={},y=p.length,s,x,E,D,A,v=a.faceVertexUvs[0],H;b("originalFaces, uvs, originalVerticesLength",r.length,v.length,y);if(m.supportUVs){s=0;for(x=v.length;s<x;s++){E=0;for(D=v[s].length;E<D;E++){H=r[s]["abcd".charAt(E)];g(H,s,v[s][E])}}}if(v.length==0)m.supportUVs=false;s=0;for(A in t)s++;if(!s){m.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",
+t,"vs",v.length);s=0;for(x=r.length;s<x;s++){A=r[s];n.push(A.centroid);j.push(A.centroid);if(m.supportUVs){v=new THREE.UV;if(A instanceof THREE.Face3){v.u=f(A.a,s).u+f(A.b,s).u+f(A.c,s).u;v.v=f(A.a,s).v+f(A.b,s).v+f(A.c,s).v;v.u=v.u/3;v.v=v.v/3}else if(A instanceof THREE.Face4){v.u=f(A.a,s).u+f(A.b,s).u+f(A.c,s).u+f(A.d,s).u;v.v=f(A.a,s).v+f(A.b,s).v+f(A.c,s).v+f(A.d,s).v;v.u=v.u/4;v.v=v.v/4}g(y+s,"",v)}}b("-- added UVs for new Faces",t);x=function(a){function b(a,c){h[a]===void 0&&(h[a]=[]);h[a].push(c)}
+var c,d,f,g,h={};c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.a);b(g,c)}else if(f instanceof THREE.Face4){g=e(f.a,f.b);b(g,c);g=e(f.b,f.c);b(g,c);g=e(f.c,f.d);b(g,c);g=e(f.d,f.a);b(g,c)}}return h}(a);H=0;var I,M,R={},Z={};for(s in x){v=x[s];I=s.split("_");M=I[0];I=I[1];h(M,[M,I]);h(I,[M,I]);E=0;for(D=v.length;E<D;E++){A=v[E];i(M,A,s);i(I,A,s)}v.length<2&&(u[s]=true)}b("vertexEdgeMap",R,"vertexFaceMap",Z);for(s in x){v=
+x[s];A=v[0];D=v[1];I=s.split("_");M=I[0];I=I[1];v=new THREE.Vector3;if(u[s]){v.addSelf(p[M]);v.addSelf(p[I]);v.multiplyScalar(0.5)}else{v.addSelf(n[A]);v.addSelf(n[D]);v.addSelf(p[M]);v.addSelf(p[I]);v.multiplyScalar(0.25)}q[s]=y+r.length+H;j.push(v);H++;if(m.supportUVs){v=new THREE.UV;v.u=f(M,A).u+f(I,A).u;v.v=f(M,A).v+f(I,A).v;v.u=v.u/2;v.v=v.v/2;g(q[s],A,v);if(!u[s]){v=new THREE.UV;v.u=f(M,D).u+f(I,D).u;v.v=f(M,D).v+f(I,D).v;v.u=v.u/2;v.v=v.v/2;g(q[s],D,v)}}}b("-- Step 2 done");var B,G;D=["123",
+"12","2","23"];I=["123","23","3","31"];var Q=["123","31","1","12"],C=["1234","12","2","23"],k=["1234","23","3","34"],P=["1234","34","4","41"],L=["1234","41","1","12"];s=0;for(x=n.length;s<x;s++){A=r[s];v=y+s;if(A instanceof THREE.Face3){H=e(A.a,A.b);M=e(A.b,A.c);B=e(A.c,A.a);d(v,q[H],A.b,q[M],A,D,s);d(v,q[M],A.c,q[B],A,I,s);d(v,q[B],A.a,q[H],A,Q,s)}else if(A instanceof THREE.Face4){H=e(A.a,A.b);M=e(A.b,A.c);B=e(A.c,A.d);G=e(A.d,A.a);d(v,q[H],A.b,q[M],A,C,s);d(v,q[M],A.c,q[B],A,k,s);d(v,q[B],A.d,q[G],
+A,P,s);d(v,q[G],A.a,q[H],A,L,s)}else b("face should be a face!",A)}q=new THREE.Vector3;A=new THREE.Vector3;s=0;for(x=p.length;s<x;s++)if(R[s]!==void 0){q.set(0,0,0);A.set(0,0,0);M=new THREE.Vector3(0,0,0);v=0;for(E in Z[s]){q.addSelf(n[E]);v++}D=0;H=R[s].length;for(E=0;E<H;E++)u[e(R[s][E][0],R[s][E][1])]&&D++;if(D!=2){q.divideScalar(v);for(E=0;E<H;E++){v=R[s][E];v=p[v[0]].clone().addSelf(p[v[1]]).divideScalar(2);A.addSelf(v)}A.divideScalar(H);M.addSelf(p[s]);M.multiplyScalar(H-3);M.addSelf(q);M.addSelf(A.multiplyScalar(2));
+M.divideScalar(H);j[s]=M}}a.vertices=j;a.faces=l;a.faceVertexUvs[0]=o;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
+THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
 THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+e*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
 THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=new THREE.Mesh;THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;
@@ -699,37 +689,37 @@ THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.ani
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time=d.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<0)d.time=d.time+d.duration}var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
 e),0,d.length-1),g=d.weight;if(f!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[f]=0;d.lastFrame=d.currentFrame;d.currentFrame=f}e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,k,l,o,m,p;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
-0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,j,l,o,m,p;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);e=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
+0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;e[r++]=0;e[r++]=1;e[r++]=2;e[r++]=0;e[r++]=2;e[r++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
 b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){k=false;l=a(THREE.ShaderFlares.lensFlare)}else{k=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};m={};o.vertex=b.getAttribLocation(l,"position");o.uv=b.getAttribLocation(l,"uv");m.renderType=b.getUniformLocation(l,"renderType");m.map=b.getUniformLocation(l,"map");m.occlusionMap=b.getUniformLocation(l,"occlusionMap");m.opacity=b.getUniformLocation(l,"opacity");m.color=b.getUniformLocation(l,
-"color");m.scale=b.getUniformLocation(l,"scale");m.rotation=b.getUniformLocation(l,"rotation");m.screenPosition=b.getUniformLocation(l,"screenPosition");p=false};this.render=function(a,d,e,u){var a=a.__webglFlares,t=a.length;if(t){var y=new THREE.Vector3,s=u/e,w=e*0.5,H=u*0.5,E=16/u,z=new THREE.Vector2(E*s,E),v=new THREE.Vector3(1,1,0),A=new THREE.Vector2(1,1),J=m,E=o;b.useProgram(l);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(E.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(E.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var K,R,P,D,M;for(K=0;K<t;K++){E=16/u;z.set(E*s,E);D=a[K];y.set(D.matrixWorld.elements[12],D.matrixWorld.elements[13],D.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(y);d.projectionMatrix.multiplyVector3(y);v.copy(y);A.x=v.x*w+w;A.y=v.y*H+H;if(k||A.x>0&&A.x<e&&A.y>0&&
-A.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,A.x-8,A.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,z.x,z.y);b.uniform3f(J.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,A.x-8,A.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);D.positionScreen.copy(v);D.customUpdateCallback?D.customUpdateCallback(D):D.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);R=0;for(P=D.lensFlares.length;R<P;R++){M=D.lensFlares[R];if(M.opacity>0.0010&&M.scale>0.0010){v.x=M.x;v.y=M.y;v.z=M.z;E=M.size*M.scale/u;z.x=E*s;z.y=E;b.uniform3f(J.screenPosition,v.x,v.y,v.z);b.uniform2f(J.scale,z.x,z.y);b.uniform1f(J.rotation,M.rotation);b.uniform1f(J.opacity,M.opacity);
-b.uniform3f(J.color,M.color.r,M.color.g,M.color.b);c.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst);c.setTexture(M.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;l=a(THREE.ShaderFlares.lensFlare)}else{j=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};m={};o.vertex=b.getAttribLocation(l,"position");o.uv=b.getAttribLocation(l,"uv");m.renderType=b.getUniformLocation(l,"renderType");m.map=b.getUniformLocation(l,"map");m.occlusionMap=b.getUniformLocation(l,"occlusionMap");m.opacity=b.getUniformLocation(l,"opacity");m.color=b.getUniformLocation(l,
+"color");m.scale=b.getUniformLocation(l,"scale");m.rotation=b.getUniformLocation(l,"rotation");m.screenPosition=b.getUniformLocation(l,"screenPosition");p=false};this.render=function(a,d,e,u){var a=a.__webglFlares,t=a.length;if(t){var y=new THREE.Vector3,s=u/e,x=e*0.5,E=u*0.5,D=16/u,A=new THREE.Vector2(D*s,D),v=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),I=m,D=o;b.useProgram(l);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(D.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var M,R,Z,B,G;for(M=0;M<t;M++){D=16/u;A.set(D*s,D);B=a[M];y.set(B.matrixWorld.elements[12],B.matrixWorld.elements[13],B.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(y);d.projectionMatrix.multiplyVector3(y);v.copy(y);H.x=v.x*x+x;H.y=v.y*E+E;if(j||H.x>0&&H.x<e&&H.y>0&&
+H.y<u){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,A.x,A.y);b.uniform3f(I.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
+b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(v);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);R=0;for(Z=B.lensFlares.length;R<Z;R++){G=B.lensFlares[R];if(G.opacity>0.001&&G.scale>0.001){v.x=G.x;v.y=G.y;v.z=G.z;D=G.size*G.scale/u;A.x=D*s;A.y=D;b.uniform3f(I.screenPosition,v.x,v.y,v.z);b.uniform2f(I.scale,A.x,A.y);b.uniform1f(I.rotation,G.rotation);b.uniform1f(I.opacity,G.opacity);
+b.uniform3f(I.color,G.color.r,G.color.g,G.color.b);c.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst);c.setTexture(G.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,k){var l,o,m,p,q,n,r,u,t,y=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);l=0;for(o=i.__lights.length;l<o;l++){m=i.__lights[l];if(m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(q=0;q<m.shadowCascadeCount;q++){var s;if(m.shadowCascadeArray[q])s=m.shadowCascadeArray[q];
-else{t=m;r=q;s=new THREE.DirectionalLight;s.isVirtual=true;s.onlyShadow=true;s.castShadow=true;s.shadowCameraNear=t.shadowCameraNear;s.shadowCameraFar=t.shadowCameraFar;s.shadowCameraLeft=t.shadowCameraLeft;s.shadowCameraRight=t.shadowCameraRight;s.shadowCameraBottom=t.shadowCameraBottom;s.shadowCameraTop=t.shadowCameraTop;s.shadowCameraVisible=t.shadowCameraVisible;s.shadowDarkness=t.shadowDarkness;s.shadowBias=t.shadowCascadeBias[r];s.shadowMapWidth=t.shadowCascadeWidth[r];s.shadowMapHeight=t.shadowCascadeHeight[r];
-s.pointsWorld=[];s.pointsFrustum=[];u=s.pointsWorld;n=s.pointsFrustum;for(var w=0;w<8;w++){u[w]=new THREE.Vector3;n[w]=new THREE.Vector3}u=t.shadowCascadeNearZ[r];t=t.shadowCascadeFarZ[r];n[0].set(-1,-1,u);n[1].set(1,-1,u);n[2].set(-1,1,u);n[3].set(1,1,u);n[4].set(-1,-1,t);n[5].set(1,-1,t);n[6].set(-1,1,t);n[7].set(1,1,t);s.originalCamera=k;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(s);n.add(s.target);k.add(n);m.shadowCascadeArray[q]=s;console.log("Created virtualLight",s)}r=m;u=
-q;t=r.shadowCascadeArray[u];t.position.copy(r.position);t.target.position.copy(r.target.position);t.lookAt(t.target);t.shadowCameraVisible=r.shadowCameraVisible;t.shadowDarkness=r.shadowDarkness;t.shadowBias=r.shadowCascadeBias[u];n=r.shadowCascadeNearZ[u];r=r.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=n;t[1].z=n;t[2].z=n;t[3].z=n;t[4].z=r;t[5].z=r;t[6].z=r;t[7].z=r;y[p]=s;p++}else{y[p]=m;p++}}l=0;for(o=y.length;l<o;l++){m=y[l];if(!m.shadowMap){m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var l,o,m,p,r,n,q,u,t,y=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);b.shadowMapCullFrontFaces?a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);l=0;for(o=i.__lights.length;l<o;l++){m=i.__lights[l];if(m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(r=0;r<m.shadowCascadeCount;r++){var s;if(m.shadowCascadeArray[r])s=m.shadowCascadeArray[r];
+else{t=m;q=r;s=new THREE.DirectionalLight;s.isVirtual=true;s.onlyShadow=true;s.castShadow=true;s.shadowCameraNear=t.shadowCameraNear;s.shadowCameraFar=t.shadowCameraFar;s.shadowCameraLeft=t.shadowCameraLeft;s.shadowCameraRight=t.shadowCameraRight;s.shadowCameraBottom=t.shadowCameraBottom;s.shadowCameraTop=t.shadowCameraTop;s.shadowCameraVisible=t.shadowCameraVisible;s.shadowDarkness=t.shadowDarkness;s.shadowBias=t.shadowCascadeBias[q];s.shadowMapWidth=t.shadowCascadeWidth[q];s.shadowMapHeight=t.shadowCascadeHeight[q];
+s.pointsWorld=[];s.pointsFrustum=[];u=s.pointsWorld;n=s.pointsFrustum;for(var x=0;x<8;x++){u[x]=new THREE.Vector3;n[x]=new THREE.Vector3}u=t.shadowCascadeNearZ[q];t=t.shadowCascadeFarZ[q];n[0].set(-1,-1,u);n[1].set(1,-1,u);n[2].set(-1,1,u);n[3].set(1,1,u);n[4].set(-1,-1,t);n[5].set(1,-1,t);n[6].set(-1,1,t);n[7].set(1,1,t);s.originalCamera=j;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(s);n.add(s.target);j.add(n);m.shadowCascadeArray[r]=s;console.log("Created virtualLight",s)}q=m;u=
+r;t=q.shadowCascadeArray[u];t.position.copy(q.position);t.target.position.copy(q.target.position);t.lookAt(t.target);t.shadowCameraVisible=q.shadowCameraVisible;t.shadowDarkness=q.shadowDarkness;t.shadowBias=q.shadowCascadeBias[u];n=q.shadowCascadeNearZ[u];q=q.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=n;t[1].z=n;t[2].z=n;t[3].z=n;t[4].z=q;t[5].z=q;t[6].z=q;t[7].z=q;y[p]=s;p++}else{y[p]=m;p++}}l=0;for(o=y.length;l<o;l++){m=y[l];if(!m.shadowMap){m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,
 m.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight);m.shadowMatrix=new THREE.Matrix4}if(!m.shadowCamera){if(m instanceof THREE.SpotLight)m.shadowCamera=new THREE.PerspectiveCamera(m.shadowCameraFov,m.shadowMapWidth/m.shadowMapHeight,m.shadowCameraNear,m.shadowCameraFar);else if(m instanceof THREE.DirectionalLight)m.shadowCamera=new THREE.OrthographicCamera(m.shadowCameraLeft,m.shadowCameraRight,
-m.shadowCameraTop,m.shadowCameraBottom,m.shadowCameraNear,m.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(m.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper){m.cameraHelper=new THREE.CameraHelper(m.shadowCamera);m.shadowCamera.add(m.cameraHelper)}if(m.isVirtual&&s.originalCamera==k){q=k;p=m.shadowCamera;n=m.pointsFrustum;t=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=
-0;r<8;r++){u=t[r];u.copy(n[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,q);p.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}p.left=g.x;p.right=h.x;p.top=h.y;p.bottom=g.y;p.updateProjectionMatrix()}p=m.shadowMap;n=m.shadowMatrix;q=m.shadowCamera;q.position.copy(m.matrixWorld.getPosition());q.lookAt(m.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);
-if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;m.shadowCameraVisible&&m.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(q.projectionMatrix);n.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);q.projectionMatrix.flattenToArray(q._projectionMatrixArray);f.multiply(q.projectionMatrix,
-q.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(p);b.clear();t=i.__webglObjects;m=0;for(p=t.length;m<p;m++){r=t[m];n=r.object;r.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(q.matrixWorldInverse,n.matrixWorld);r.render=true}}m=0;for(p=t.length;m<p;m++){r=t[m];if(r.render){n=r.object;r=r.buffer;u=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;r instanceof THREE.BufferGeometry?
-b.renderBufferDirect(q,i.__lights,null,u,r,n):b.renderBuffer(q,i.__lights,null,u,r,n)}}t=i.__webglObjectsImmediate;m=0;for(p=t.length;m<p;m++){r=t[m];n=r.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(q.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(q,i.__lights,null,c,n)}}}l=b.getClearColor();o=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,k,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(p);b.compileShader(q);b.attachShader(m,p);b.attachShader(m,q);b.linkProgram(m);h=m;i={};k={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
-"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,e,p,q){var d=d.__webglSprites,n=d.length;if(n){var r=i,u=k,t=q/p,p=p*0.5,y=q*0.5,s=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(r.position);b.enableVertexAttribArray(r.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.uniformMatrix4fv(u.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var w,H=[],r=0;r<n;r++){w=d[r];if(w.visible&&w.opacity!==0)if(w.useScreenCoordinates)w.z=-w.position.z;else{w._modelViewMatrix.multiply(e.matrixWorldInverse,w.matrixWorld);w.z=-w._modelViewMatrix.elements[14]}}d.sort(a);for(r=0;r<n;r++){w=d[r];if(w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width){if(w.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
-b.uniform3f(u.screenPosition,(w.position.x-p)/p,(y-w.position.y)/y,Math.max(0,Math.min(1,w.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,w.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,w._modelViewMatrix.elements)}e=w.map.image.width/(w.scaleByViewport?q:1);H[0]=e*t*w.scale.x;H[1]=e*w.scale.y;b.uniform2f(u.uvScale,w.uvScale.x,w.uvScale.y);b.uniform2f(u.uvOffset,w.uvOffset.x,w.uvOffset.y);b.uniform2f(u.alignment,w.alignment.x,w.alignment.y);
-b.uniform1f(u.opacity,w.opacity);b.uniform3f(u.color,w.color.r,w.color.g,w.color.b);b.uniform1f(u.rotation,w.rotation);b.uniform2fv(u.scale,H);if(w.mergeWith3D&&!s){b.enable(b.DEPTH_TEST);s=true}else if(!w.mergeWith3D&&s){b.disable(b.DEPTH_TEST);s=false}c.setBlending(w.blending,w.blendEquation,w.blendSrc,w.blendDst);c.setTexture(w.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+m.shadowCameraTop,m.shadowCameraBottom,m.shadowCameraNear,m.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}i.add(m.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper){m.cameraHelper=new THREE.CameraHelper(m.shadowCamera);m.shadowCamera.add(m.cameraHelper)}if(m.isVirtual&&s.originalCamera==j){r=j;p=m.shadowCamera;n=m.pointsFrustum;t=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(q=
+0;q<8;q++){u=t[q];u.copy(n[q]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,r);p.matrixWorldInverse.multiplyVector3(u);if(u.x<g.x)g.x=u.x;if(u.x>h.x)h.x=u.x;if(u.y<g.y)g.y=u.y;if(u.y>h.y)h.y=u.y;if(u.z<g.z)g.z=u.z;if(u.z>h.z)h.z=u.z}p.left=g.x;p.right=h.x;p.top=h.y;p.bottom=g.y;p.updateProjectionMatrix()}p=m.shadowMap;n=m.shadowMatrix;r=m.shadowCamera;r.position.copy(m.matrixWorld.getPosition());r.lookAt(m.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);
+if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;m.shadowCameraVisible&&m.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(r.projectionMatrix);n.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);f.multiply(r.projectionMatrix,
+r.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(p);b.clear();t=i.__webglObjects;m=0;for(p=t.length;m<p;m++){q=t[m];n=q.object;q.render=false;if(n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n))){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);q.render=true}}m=0;for(p=t.length;m<p;m++){q=t[m];if(q.render){n=q.object;q=q.buffer;u=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c;q instanceof THREE.BufferGeometry?
+b.renderBufferDirect(r,i.__lights,null,u,q,n):b.renderBuffer(r,i.__lights,null,u,q,n)}}t=i.__webglObjectsImmediate;m=0;for(p=t.length;m<p;m++){q=t[m];n=q.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(r.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(r,i.__lights,null,c,n)}}}l=b.getClearColor();o=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,j,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(p);b.compileShader(r);b.attachShader(m,p);b.attachShader(m,r);b.linkProgram(m);h=m;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
+"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
+j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,e,p,r){var d=d.__webglSprites,n=d.length;if(n){var q=i,u=j,t=r/p,p=p*0.5,y=r*0.5,s=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.uniformMatrix4fv(u.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);for(var x,E=[],q=0;q<n;q++){x=d[q];if(x.visible&&x.opacity!==0)if(x.useScreenCoordinates)x.z=-x.position.z;else{x._modelViewMatrix.multiply(e.matrixWorldInverse,x.matrixWorld);x.z=-x._modelViewMatrix.elements[14]}}d.sort(a);for(q=0;q<n;q++){x=d[q];if(x.visible&&x.opacity!==0&&x.map&&x.map.image&&x.map.image.width){if(x.useScreenCoordinates){b.uniform1i(u.useScreenCoordinates,1);
+b.uniform3f(u.screenPosition,(x.position.x-p)/p,(y-x.position.y)/y,Math.max(0,Math.min(1,x.position.z)))}else{b.uniform1i(u.useScreenCoordinates,0);b.uniform1i(u.affectedByDistance,x.affectedByDistance?1:0);b.uniformMatrix4fv(u.modelViewMatrix,false,x._modelViewMatrix.elements)}e=x.map.image.width/(x.scaleByViewport?r:1);E[0]=e*t*x.scale.x;E[1]=e*x.scale.y;b.uniform2f(u.uvScale,x.uvScale.x,x.uvScale.y);b.uniform2f(u.uvOffset,x.uvOffset.x,x.uvOffset.y);b.uniform2f(u.alignment,x.alignment.x,x.alignment.y);
+b.uniform1f(u.opacity,x.opacity);b.uniform3f(u.color,x.color.r,x.color.g,x.color.b);b.uniform1f(u.rotation,x.rotation);b.uniform2fv(u.scale,E);if(x.mergeWith3D&&!s){b.enable(b.DEPTH_TEST);s=true}else if(!x.mergeWith3D&&s){b.disable(b.DEPTH_TEST);s=false}c.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst);c.setTexture(x.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,k,l,o,m,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
-h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(k=p.length;i<k;i++){l=p[i];m=l.object;l.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);l.render=true}}i=0;for(k=p.length;i<k;i++){l=p[i];if(l.render){m=l.object;l=l.buffer;b.setObjectFaces(m);o=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;l instanceof
-THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,l,m):b.renderBuffer(h,g.__lights,null,o,l,m)}}p=g.__webglObjectsImmediate;i=0;for(k=p.length;i<k;i++){l=p[i];m=l.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}i=b.getClearColor();k=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,k);a.enable(a.BLEND)}};
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,l,o,m,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
+h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(j=p.length;i<j;i++){l=p[i];m=l.object;l.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);l.render=true}}i=0;for(j=p.length;i<j;i++){l=p[i];if(l.render){m=l.object;l=l.buffer;b.setObjectFaces(m);o=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c;l instanceof
+THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,l,m):b.renderBuffer(h,g.__lights,null,o,l,m)}}p=g.__webglObjectsImmediate;i=0;for(j=p.length;i<j;i++){l=p[i];m=l.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",

+ 128 - 121
build/custom/ThreeCanvas.js

@@ -13,74 +13,81 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 a;this.z=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=this.x-a.x;this.y=this.y-a.y;this.z=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=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
 this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else 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=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=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.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.elements[0]/c,g=a.elements[4]/d,c=a.elements[1]/c,d=a.elements[5]/d,k=a.elements[9]/e,m=a.elements[10]/e;this.y=Math.asin(a.elements[8]/e);e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-k/e,m/e);this.z=Math.atan2(-g/e,f/e)}else{this.x=0;this.z=Math.atan2(c,d)}return this},getScaleFromMatrix:function(a){var b=
-this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).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},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};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};
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],i=d[1],j=d[5],l=d[9],h=d[2],k=d[6],d=d[10];switch(b||"XYZ"){case "YXZ":this.x=Math.asin(-c(l));if(Math.abs(l)<0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(i,j)}else{this.y=Math.atan2(-h,e);this.z=0}break;case "ZXY":this.x=Math.asin(c(k));if(Math.abs(k)<
+0.99999){this.y=Math.atan2(-h,d);this.z=Math.atan2(-f,j)}else{this.y=0;this.z=Math.atan2(g,e)}break;case "ZYX":this.y=Math.asin(-c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(k,d);this.z=Math.atan2(i,e)}else{this.x=0;this.z=Math.atan2(-f,j)}break;case "YZX":this.z=Math.asin(c(i));if(Math.abs(i)<0.99999){this.x=Math.atan2(-l,j);this.y=Math.atan2(-h,e)}else{this.x=0;this.y=Math.atan2(h,d)}break;case "XZY":this.z=Math.asin(-c(f));if(Math.abs(f)<0.99999){this.x=Math.atan2(k,j);this.y=Math.atan2(g,e)}else{this.x=
+Math.atan2(-g,d);this.y=0}break;default:this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-l,d);this.z=Math.atan2(-f,e)}else{this.x=Math.atan2(i,j);this.z=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;switch(b){case "YXZ":this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f);break;case "ZXY":this.x=Math.asin(c(2*
+(a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f);break;case "ZYX":this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f);break;case "YZX":this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)));break;case "XZY":this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f);this.y=Math.atan2(2*
+(a.x*a.z+a.y*a.w),g+d-e-f);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)));break;default:this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).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},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};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},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=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=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=
 this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{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=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};
+normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1.0E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=
+a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],i=a[5],j=a[9];c=a[2];b=a[6];var l=a[10];if(Math.abs(d-g)<0.01&&Math.abs(f-c)<0.01&&Math.abs(j-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(f+c)<0.1&&Math.abs(j+b)<0.1&&Math.abs(e+i+l-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;e=(e+1)/2;i=(i+1)/2;l=(l+1)/2;d=(d+g)/4;f=(f+c)/4;j=(j+b)/4;if(e>i&&e>l)if(e<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(e);c=d/b;d=f/b}else if(i>
+l)if(i<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(i);b=d/c;d=j/c}else if(l<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(l);b=f/d;c=j/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-j)*(b-j)+(f-c)*(f-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-j)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+i+l-1)/2);return this}};
 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.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,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],k=d[5],m=d[6],i=d[7],h=d[8],j=d[9],o=d[10],n=d[11],q=d[12],l=d[13],p=d[14],d=d[15];c[0].set(f-a,i-g,n-h,d-q);c[1].set(f+a,i+g,n+h,d+q);c[2].set(f+b,i+k,n+j,d+l);c[3].set(f-b,i-k,n-j,d-l);c[4].set(f-e,i-m,n-o,d-p);c[5].set(f+e,i+m,n+o,d+p);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.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],i=d[5],j=d[6],l=d[7],h=d[8],k=d[9],o=d[10],n=d[11],q=d[12],m=d[13],p=d[14],d=d[15];c[0].set(f-a,l-g,n-h,d-q);c[1].set(f+a,l+g,n+h,d+q);c[2].set(f+b,l+i,n+k,d+m);c[3].set(f-b,l-i,n-k,d-m);c[4].set(f-e,l-j,n-o,d-p);c[5].set(f+e,l+j,n+o,d+p);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=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){l.sub(c,a);r=l.dot(b);z=p.add(a,u.copy(b).multiplyScalar(r));return A=c.distanceTo(z)}function d(a,b,c,d){l.sub(d,b);p.sub(c,b);u.sub(a,b);v=l.dot(l);D=l.dot(p);x=l.dot(u);G=p.dot(p);s=p.dot(u);y=1/(v*G-D*D);C=(G*x-D*s)*y;H=(v*s-D*x)*y;return C>=0&&H>=0&&C+H<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,
-i=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,o=new THREE.Vector3,n=new THREE.Vector3,q=function(a,b){return a.distance-b.distance};this.intersectObject=function(a){var b,l=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};l.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),r=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),
-a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(r.x,Math.max(r.y,r.z)))return l;var s,u,v=a.geometry,w=v.vertices,P;a.matrixRotationWorld.extractRotation(a.matrixWorld);p=0;for(r=v.faces.length;p<r;p++){b=v.faces[p];i.copy(this.origin);h.copy(this.direction);P=a.matrixWorld;j=P.multiplyVector3(j.copy(b.centroid)).subSelf(i);o=a.matrixRotationWorld.multiplyVector3(o.copy(b.normal));s=h.dot(o);if(!(Math.abs(s)<e)){u=o.dot(j)/s;
-if(!(u<0)&&(a.doubleSided||(a.flipSided?s>0:s<0))){n.add(i,h.multiplyScalar(u));if(b instanceof THREE.Face3){f=P.multiplyVector3(f.copy(w[b.a]));g=P.multiplyVector3(g.copy(w[b.b]));k=P.multiplyVector3(k.copy(w[b.c]));if(d(n,f,g,k)){b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a};l.push(b)}}else if(b instanceof THREE.Face4){f=P.multiplyVector3(f.copy(w[b.a]));g=P.multiplyVector3(g.copy(w[b.b]));k=P.multiplyVector3(k.copy(w[b.c]));m=P.multiplyVector3(m.copy(w[b.d]));if(d(n,f,g,m)||d(n,
-g,k,m)){b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a};l.push(b)}}}}}}l.sort(q);return l};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(q);return b};var l=new THREE.Vector3,p=new THREE.Vector3,u=new THREE.Vector3,r,z,A,v,D,x,G,s,y,C,H};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,k=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,h,j){k=false;b=f;c=g;d=h;e=j;a()};this.addPoint=function(f,g){if(k){k=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:g;d=d>f?d:f;e=e>g?
-e:g}a()};this.add3Points=function(f,g,h,j,o,n){if(k){k=false;b=f<h?f<o?f:o:h<o?h:o;c=g<j?g<n?g:n:j<n?j:n;d=f>h?f>o?f:o:h>o?h:o;e=g>j?g>n?g:n:j>n?j:n}else{b=f<h?f<o?f<b?f:b:o<b?o:b:h<o?h<b?h:b:o<b?o:b;c=g<j?g<n?g<c?g:c:n<c?n:c:j<n?j<c?j:c:n<c?n:c;d=f>h?f>o?f>d?f:d:o>d?o:d:h>o?h>d?h:d:o>d?o:d;e=g>j?g>n?g>e?g:e:n>e?n:e:j>n?j>e?j:e:n>e?n:e}a()};this.addRectangle=function(f){if(k){k=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
-d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){k=true;e=d=c=b=0;a()};this.isEmpty=function(){return k}};
+THREE.Ray=function(a,b){function c(a,b,c){m.sub(c,a);r=m.dot(b);z=p.add(a,u.copy(b).multiplyScalar(r));return A=c.distanceTo(z)}function d(a,b,c,d){m.sub(d,b);p.sub(c,b);u.sub(a,b);v=m.dot(m);D=m.dot(p);x=m.dot(u);G=p.dot(p);s=p.dot(u);y=1/(v*G-D*D);C=(G*x-D*s)*y;H=(v*s-D*x)*y;return C>=0&&H>=0&&C+H<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,
+l=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,o=new THREE.Vector3,n=new THREE.Vector3,q=function(a,b){return a.distance-b.distance};this.intersectObject=function(a){var b,m=[];if(a instanceof THREE.Particle){var p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){var p=c(this.origin,this.direction,a.matrixWorld.getPosition()),r=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),
+a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(p>a.geometry.boundingSphere.radius*Math.max(r.x,Math.max(r.y,r.z)))return m;var s,u,v=a.geometry,w=v.vertices,P;a.matrixRotationWorld.extractRotation(a.matrixWorld);p=0;for(r=v.faces.length;p<r;p++){b=v.faces[p];l.copy(this.origin);h.copy(this.direction);P=a.matrixWorld;k=P.multiplyVector3(k.copy(b.centroid)).subSelf(l);o=a.matrixRotationWorld.multiplyVector3(o.copy(b.normal));s=h.dot(o);if(!(Math.abs(s)<e)){u=o.dot(k)/s;
+if(!(u<0)&&(a.doubleSided||(a.flipSided?s>0:s<0))){n.add(l,h.multiplyScalar(u));if(b instanceof THREE.Face3){f=P.multiplyVector3(f.copy(w[b.a]));g=P.multiplyVector3(g.copy(w[b.b]));i=P.multiplyVector3(i.copy(w[b.c]));if(d(n,f,g,i)){b={distance:l.distanceTo(n),point:n.clone(),face:b,object:a};m.push(b)}}else if(b instanceof THREE.Face4){f=P.multiplyVector3(f.copy(w[b.a]));g=P.multiplyVector3(g.copy(w[b.b]));i=P.multiplyVector3(i.copy(w[b.c]));j=P.multiplyVector3(j.copy(w[b.d]));if(d(n,f,g,j)||d(n,
+g,i,j)){b={distance:l.distanceTo(n),point:n.clone(),face:b,object:a};m.push(b)}}}}}}m.sort(q);return m};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(q);return b};var m=new THREE.Vector3,p=new THREE.Vector3,u=new THREE.Vector3,r,z,A,v,D,x,G,s,y,C,H};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,h,k){i=false;b=f;c=g;d=h;e=k;a()};this.addPoint=function(f,g){if(i){i=false;b=f;c=g;d=f;e=g}else{b=b<f?b:f;c=c<g?c:g;d=d>f?d:f;e=e>g?
+e:g}a()};this.add3Points=function(f,g,h,k,o,n){if(i){i=false;b=f<h?f<o?f:o:h<o?h:o;c=g<k?g<n?g:n:k<n?k:n;d=f>h?f>o?f:o:h>o?h:o;e=g>k?g>n?g:n:k>n?k:n}else{b=f<h?f<o?f<b?f:b:o<b?o:b:h<o?h<b?h:b:o<b?o:b;c=g<k?g<n?g<c?g:c:n<c?n:c:k<n?k<c?k:c:n<c?n:c;d=f>h?f>o?f>d?f:d:o>d?o:d:h>o?h>d?h:d:o>d?o:d;e=g>k?g>n?g>e?g:e:n>e?n:e:k>n?k>e?k:e:n>e?n:e}a()};this.addRectangle=function(f){if(i){i=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=b<f.getLeft()?b:f.getLeft();c=c<f.getTop()?c:f.getTop();
+d=d>f.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){i=true;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 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,e){return d+(a-b)*(e-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.elements=new Float32Array(9)};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],k=b[9]*b[4]-b[5]*b[8],m=-b[9]*b[0]+b[1]*b[8],i=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*k;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,h=this.elements;h[0]=b*a;h[1]=b*c;h[2]=b*d;h[3]=b*e;h[4]=b*f;h[5]=b*g;h[6]=b*k;h[7]=b*m;h[8]=b*i;return this},
-transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},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,e,f,g,k,m,i,h,j,o,n,q,l){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,k||0,m||0,i||0,h!==void 0?h:1,j||0,o||0,n||0,q||0,l!==void 0?l:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,k,m,i,h,j,o,n,q,l){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=e;p[5]=f;p[9]=g;p[13]=k;p[2]=m;p[6]=i;p[10]=h;p[14]=j;p[3]=o;p[7]=n;p[11]=q;p[15]=l;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){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],k=c[8],m=c[12],i=c[1],h=c[5],j=c[9],o=c[13],n=c[2],q=c[6],l=c[10],p=c[14],u=c[3],r=c[7],z=c[11],c=c[15],A=d[0],v=d[4],
-D=d[8],x=d[12],G=d[1],s=d[5],y=d[9],C=d[13],H=d[2],R=d[6],N=d[10],t=d[14],E=d[3],F=d[7],I=d[11],d=d[15];e[0]=f*A+g*G+k*H+m*E;e[4]=f*v+g*s+k*R+m*F;e[8]=f*D+g*y+k*N+m*I;e[12]=f*x+g*C+k*t+m*d;e[1]=i*A+h*G+j*H+o*E;e[5]=i*v+h*s+j*R+o*F;e[9]=i*D+h*y+j*N+o*I;e[13]=i*x+h*C+j*t+o*d;e[2]=n*A+q*G+l*H+p*E;e[6]=n*v+q*s+l*R+p*F;e[10]=n*D+q*y+l*N+p*I;e[14]=n*x+q*C+l*t+p*d;e[3]=u*A+r*G+z*H+c*E;e[7]=u*v+r*s+z*R+c*F;e[11]=u*D+r*y+z*N+c*I;e[15]=u*x+r*C+z*t+c*d;return this},multiplySelf:function(a){return this.multiply(this,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],i=b[9]*b[4]-b[5]*b[8],j=-b[9]*b[0]+b[1]*b[8],l=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*i;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,h=this.elements;h[0]=b*a;h[1]=b*c;h[2]=b*d;h[3]=b*e;h[4]=b*f;h[5]=b*g;h[6]=b*i;h[7]=b*j;h[8]=b*l;return this},
+transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},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,e,f,g,i,j,l,h,k,o,n,q,m){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,i||0,j||0,l||0,h!==void 0?h:1,k||0,o||0,n||0,q||0,m!==void 0?m:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,i,j,l,h,k,o,n,q,m){var p=this.elements;p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=e;p[5]=f;p[9]=g;p[13]=i;p[2]=j;p[6]=l;p[10]=h;p[14]=k;p[3]=o;p[7]=n;p[11]=q;p[15]=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){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],i=c[8],j=c[12],l=c[1],h=c[5],k=c[9],o=c[13],n=c[2],q=c[6],m=c[10],p=c[14],u=c[3],r=c[7],z=c[11],c=c[15],A=d[0],v=d[4],
+D=d[8],x=d[12],G=d[1],s=d[5],y=d[9],C=d[13],H=d[2],R=d[6],N=d[10],t=d[14],E=d[3],F=d[7],I=d[11],d=d[15];e[0]=f*A+g*G+i*H+j*E;e[4]=f*v+g*s+i*R+j*F;e[8]=f*D+g*y+i*N+j*I;e[12]=f*x+g*C+i*t+j*d;e[1]=l*A+h*G+k*H+o*E;e[5]=l*v+h*s+k*R+o*F;e[9]=l*D+h*y+k*N+o*I;e[13]=l*x+h*C+k*t+o*d;e[2]=n*A+q*G+m*H+p*E;e[6]=n*v+q*s+m*R+p*F;e[10]=n*D+q*y+m*N+p*I;e[14]=n*x+q*C+m*t+p*d;e[3]=u*A+r*G+z*H+c*E;e[7]=u*v+r*s+z*R+c*F;e[11]=u*D+r*y+z*N+c*I;e[15]=u*x+r*C+z*t+c*d;return this},multiplySelf:function(a){return this.multiply(this,
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
-d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],k=a[9],m=a[13],i=a[2],h=a[6],j=a[10],o=a[14],n=a[3],q=a[7],
-l=a[11],a=a[15];return e*k*h*n-d*m*h*n-e*g*j*n+c*m*j*n+d*g*o*n-c*k*o*n-e*k*i*q+d*m*i*q+e*f*j*q-b*m*j*q-d*f*o*q+b*k*o*q+e*g*i*l-c*m*i*l-e*f*h*l+b*m*h*l+c*f*o*l-b*g*o*l-d*g*i*a+c*k*i*a+d*f*h*a-b*k*h*a-c*f*j*a+b*g*j*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
+d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],i=a[9],j=a[13],l=a[2],h=a[6],k=a[10],o=a[14],n=a[3],q=a[7],
+m=a[11],a=a[15];return e*i*h*n-d*j*h*n-e*g*k*n+c*j*k*n+d*g*o*n-c*i*o*n-e*i*l*q+d*j*l*q+e*f*k*q-b*j*k*q-d*f*o*q+b*i*o*q+e*g*l*m-c*j*l*m-e*f*h*m+b*j*h*m+c*f*o*m-b*g*o*m-d*g*l*a+c*i*l*a+d*f*h*a-b*i*h*a-c*f*k*a+b*g*k*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];
 a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],
-a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],k=c[1],m=c[5],i=c[9],h=c[13],j=c[2],o=c[6],n=c[10],q=
-c[14],l=c[3],p=c[7],u=c[11],c=c[15];b[0]=i*q*p-h*n*p+h*o*u-m*q*u-i*o*c+m*n*c;b[4]=g*n*p-f*q*p-g*o*u+e*q*u+f*o*c-e*n*c;b[8]=f*h*p-g*i*p+g*m*u-e*h*u-f*m*c+e*i*c;b[12]=g*i*o-f*h*o-g*m*n+e*h*n+f*m*q-e*i*q;b[1]=h*n*l-i*q*l-h*j*u+k*q*u+i*j*c-k*n*c;b[5]=f*q*l-g*n*l+g*j*u-d*q*u-f*j*c+d*n*c;b[9]=g*i*l-f*h*l-g*k*u+d*h*u+f*k*c-d*i*c;b[13]=f*h*j-g*i*j+g*k*n-d*h*n-f*k*q+d*i*q;b[2]=m*q*l-h*o*l+h*j*p-k*q*p-m*j*c+k*o*c;b[6]=g*o*l-e*q*l-g*j*p+d*q*p+e*j*c-d*o*c;b[10]=e*h*l-g*m*l+g*k*p-d*h*p-e*k*c+d*m*c;b[14]=g*m*j-
-e*h*j-g*k*o+d*h*o+e*k*q-d*m*q;b[3]=i*o*l-m*n*l-i*j*p+k*n*p+m*j*u-k*o*u;b[7]=e*n*l-f*o*l+f*j*p-d*n*p-e*j*u+d*o*u;b[11]=f*m*l-e*i*l-f*k*p+d*i*p+e*k*u-d*m*u;b[15]=e*i*j-f*m*j+f*k*o-d*i*o-e*k*n+d*m*n;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),k=Math.cos(e),e=Math.sin(e),m=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var i=k*m,h=k*f,j=e*m,o=e*f;c[0]=i+o*d;c[4]=j*d-h;c[8]=g*e;c[1]=g*f;c[5]=g*
-m;c[9]=-d;c[2]=h*d-j;c[6]=o+i*d;c[10]=g*k;break;case "ZXY":i=k*m;h=k*f;j=e*m;o=e*f;c[0]=i-o*d;c[4]=-g*f;c[8]=j+h*d;c[1]=h+j*d;c[5]=g*m;c[9]=o-i*d;c[2]=-g*e;c[6]=d;c[10]=g*k;break;case "ZYX":i=g*m;h=g*f;j=d*m;o=d*f;c[0]=k*m;c[4]=j*e-h;c[8]=i*e+o;c[1]=k*f;c[5]=o*e+i;c[9]=h*e-j;c[2]=-e;c[6]=d*k;c[10]=g*k;break;case "YZX":i=g*k;h=g*e;j=d*k;o=d*e;c[0]=k*m;c[4]=o-i*f;c[8]=j*f+h;c[1]=f;c[5]=g*m;c[9]=-d*m;c[2]=-e*m;c[6]=h*f+j;c[10]=i-o*f;break;case "XZY":i=g*k;h=g*e;j=d*k;o=d*e;c[0]=k*m;c[4]=-f;c[8]=e*m;
-c[1]=i*f+o;c[5]=g*m;c[9]=h*f-j;c[2]=j*f-h;c[6]=d*m;c[10]=o*f+i;break;default:i=g*m;h=g*f;j=d*m;o=d*f;c[0]=k*m;c[4]=-k*f;c[8]=e;c[1]=h+j*e;c[5]=i-o*e;c[9]=-d*k;c[2]=o-i*e;c[6]=j+h*e;c[10]=g*k}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,k=d+d,m=e+e,a=c*g,i=c*k,c=c*m,h=d*k,d=d*m,e=e*m,g=f*g,k=f*k,f=f*m;b[0]=1-(h+e);b[4]=i-f;b[8]=c+k;b[1]=i+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-k;b[6]=d+g;b[10]=1-(a+h);return this},compose:function(a,b,c){var d=this.elements,
+a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],i=c[1],j=c[5],l=c[9],h=c[13],k=c[2],o=c[6],n=c[10],q=
+c[14],m=c[3],p=c[7],u=c[11],c=c[15];b[0]=l*q*p-h*n*p+h*o*u-j*q*u-l*o*c+j*n*c;b[4]=g*n*p-f*q*p-g*o*u+e*q*u+f*o*c-e*n*c;b[8]=f*h*p-g*l*p+g*j*u-e*h*u-f*j*c+e*l*c;b[12]=g*l*o-f*h*o-g*j*n+e*h*n+f*j*q-e*l*q;b[1]=h*n*m-l*q*m-h*k*u+i*q*u+l*k*c-i*n*c;b[5]=f*q*m-g*n*m+g*k*u-d*q*u-f*k*c+d*n*c;b[9]=g*l*m-f*h*m-g*i*u+d*h*u+f*i*c-d*l*c;b[13]=f*h*k-g*l*k+g*i*n-d*h*n-f*i*q+d*l*q;b[2]=j*q*m-h*o*m+h*k*p-i*q*p-j*k*c+i*o*c;b[6]=g*o*m-e*q*m-g*k*p+d*q*p+e*k*c-d*o*c;b[10]=e*h*m-g*j*m+g*i*p-d*h*p-e*i*c+d*j*c;b[14]=g*j*k-
+e*h*k-g*i*o+d*h*o+e*i*q-d*j*q;b[3]=l*o*m-j*n*m-l*k*p+i*n*p+j*k*u-i*o*u;b[7]=e*n*m-f*o*m+f*k*p-d*n*p-e*k*u+d*o*u;b[11]=f*j*m-e*l*m-f*i*p+d*l*p+e*i*u-d*j*u;b[15]=e*l*k-f*j*k+f*i*o-d*l*o-e*i*n+d*j*n;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=i*j,h=i*f,k=e*j,o=e*f;c[0]=l+o*d;c[4]=k*d-h;c[8]=g*e;c[1]=g*f;c[5]=g*
+j;c[9]=-d;c[2]=h*d-k;c[6]=o+l*d;c[10]=g*i;break;case "ZXY":l=i*j;h=i*f;k=e*j;o=e*f;c[0]=l-o*d;c[4]=-g*f;c[8]=k+h*d;c[1]=h+k*d;c[5]=g*j;c[9]=o-l*d;c[2]=-g*e;c[6]=d;c[10]=g*i;break;case "ZYX":l=g*j;h=g*f;k=d*j;o=d*f;c[0]=i*j;c[4]=k*e-h;c[8]=l*e+o;c[1]=i*f;c[5]=o*e+l;c[9]=h*e-k;c[2]=-e;c[6]=d*i;c[10]=g*i;break;case "YZX":l=g*i;h=g*e;k=d*i;o=d*e;c[0]=i*j;c[4]=o-l*f;c[8]=k*f+h;c[1]=f;c[5]=g*j;c[9]=-d*j;c[2]=-e*j;c[6]=h*f+k;c[10]=l-o*f;break;case "XZY":l=g*i;h=g*e;k=d*i;o=d*e;c[0]=i*j;c[4]=-f;c[8]=e*j;
+c[1]=l*f+o;c[5]=g*j;c[9]=h*f-k;c[2]=k*f-h;c[6]=d*j;c[10]=o*f+l;break;default:l=g*j;h=g*f;k=d*j;o=d*f;c[0]=i*j;c[4]=-i*f;c[8]=e;c[1]=h+k*e;c[5]=l-o*e;c[9]=-d*i;c[2]=o-l*e;c[6]=k+h*e;c[10]=g*i}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,i=d+d,j=e+e,a=c*g,l=c*i,c=c*j,h=d*i,d=d*j,e=e*j,g=f*g,i=f*i,f=f*j;b[0]=1-(h+e);b[4]=l-f;b[8]=c+i;b[1]=l+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-i;b[6]=d+g;b[10]=1-(a+h);return this},compose:function(a,b,c){var d=this.elements,
 e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);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=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;
 b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
-d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],k=b[9],m=b[10],i=b[11],h=Math.cos(a),a=Math.sin(a);b[4]=h*c+a*g;b[5]=h*d+a*k;b[6]=h*e+a*m;b[7]=h*f+a*i;b[8]=h*g-a*c;b[9]=h*k-a*d;b[10]=h*m-a*e;b[11]=h*i-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],k=b[9],m=b[10],i=b[11],h=Math.cos(a),a=Math.sin(a);b[0]=h*c-a*g;b[1]=h*d-a*k;b[2]=h*e-a*m;b[3]=h*f-a*i;b[8]=h*g+a*c;b[9]=
-h*k+a*d;b[10]=h*m+a*e;b[11]=h*i+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],k=b[5],m=b[6],i=b[7],h=Math.cos(a),a=Math.sin(a);b[0]=h*c+a*g;b[1]=h*d+a*k;b[2]=h*e+a*m;b[3]=h*f+a*i;b[4]=h*g-a*c;b[5]=h*k-a*d;b[6]=h*m-a*e;b[7]=h*i-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
-e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,k=e*e,m=f*f,i=Math.cos(b),h=Math.sin(b),j=1-i,o=d*e*j,n=d*f*j,j=e*f*j,d=d*h,q=e*h,h=f*h,f=g+(1-g)*i,g=o+h,e=n-q,o=o-h,k=k+(1-k)*i,h=j+d,n=n+q,j=j-d,m=m+(1-m)*i,i=c[0],d=c[1],q=c[2],l=c[3],p=c[4],u=c[5],r=c[6],z=c[7],A=c[8],v=c[9],D=c[10],x=c[11];c[0]=f*i+g*p+e*A;c[1]=f*d+g*u+e*v;c[2]=f*q+g*r+e*D;c[3]=f*l+g*z+e*x;c[4]=o*i+k*p+h*A;c[5]=o*d+k*u+h*v;c[6]=o*q+k*r+h*D;c[7]=o*l+k*z+h*x;c[8]=n*i+j*p+m*A;c[9]=n*d+j*u+m*v;c[10]=n*q+j*r+m*D;c[11]=
-n*l+j*z+m*x;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
-makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,k=a.z,m=e*f,i=e*g;this.set(m*f+c,m*g-d*k,m*k+d*g,0,m*g+d*k,i*g+c,i*k-d*f,0,m*k-
-d*g,i*k+d*f,e*k*k+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
-b,c,d,e,f){var g=this.elements,k=b-a,m=c-d,i=f-e;g[0]=2/k;g[4]=0;g[8]=0;g[12]=-((b+a)/k);g[1]=0;g[5]=2/m;g[9]=0;g[13]=-((c+d)/m);g[2]=0;g[6]=0;g[10]=-2/i;g[14]=-((f+e)/i);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
+d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],i=b[9],j=b[10],l=b[11],h=Math.cos(a),a=Math.sin(a);b[4]=h*c+a*g;b[5]=h*d+a*i;b[6]=h*e+a*j;b[7]=h*f+a*l;b[8]=h*g-a*c;b[9]=h*i-a*d;b[10]=h*j-a*e;b[11]=h*l-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],i=b[9],j=b[10],l=b[11],h=Math.cos(a),a=Math.sin(a);b[0]=h*c-a*g;b[1]=h*d-a*i;b[2]=h*e-a*j;b[3]=h*f-a*l;b[8]=h*g+a*c;b[9]=
+h*i+a*d;b[10]=h*j+a*e;b[11]=h*l+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],i=b[5],j=b[6],l=b[7],h=Math.cos(a),a=Math.sin(a);b[0]=h*c+a*g;b[1]=h*d+a*i;b[2]=h*e+a*j;b[3]=h*f+a*l;b[4]=h*g-a*c;b[5]=h*i-a*d;b[6]=h*j-a*e;b[7]=h*l-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
+e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,i=e*e,j=f*f,l=Math.cos(b),h=Math.sin(b),k=1-l,o=d*e*k,n=d*f*k,k=e*f*k,d=d*h,q=e*h,h=f*h,f=g+(1-g)*l,g=o+h,e=n-q,o=o-h,i=i+(1-i)*l,h=k+d,n=n+q,k=k-d,j=j+(1-j)*l,l=c[0],d=c[1],q=c[2],m=c[3],p=c[4],u=c[5],r=c[6],z=c[7],A=c[8],v=c[9],D=c[10],x=c[11];c[0]=f*l+g*p+e*A;c[1]=f*d+g*u+e*v;c[2]=f*q+g*r+e*D;c[3]=f*m+g*z+e*x;c[4]=o*l+i*p+h*A;c[5]=o*d+i*u+h*v;c[6]=o*q+i*r+h*D;c[7]=o*m+i*z+h*x;c[8]=n*l+k*p+j*A;c[9]=n*d+k*u+j*v;c[10]=n*q+k*r+j*D;c[11]=
+n*m+k*z+j*x;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
+makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,j=e*f,l=e*g;this.set(j*f+c,j*g-d*i,j*i+d*g,0,j*g+d*i,l*g+c,l*i-d*f,0,j*i-
+d*g,l*i+d*f,e*i*i+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
+b,c,d,e,f){var g=this.elements,i=b-a,j=c-d,l=f-e;g[0]=2/i;g[4]=0;g[8]=0;g[12]=-((b+a)/i);g[1]=0;g[5]=2/j;g[9]=0;g[13]=-((c+d)/j);g[2]=0;g[6]=0;g[10]=-2/l;g[14]=-((f+e)/l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};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=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;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(a instanceof THREE.Object3D){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,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},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=true},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=false;a=true}for(var b=0,c=this.children.length;b<
-c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[m]=i[m]||new THREE.RenderableVertex;m++;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,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
-d);return true}var e,f,g=[],k,m,i=[],h,j,o=[],n,q=[],l,p,u=[],r,z,A=[],v={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,x=new THREE.Vector4,G=new THREE.Matrix4,s=new THREE.Matrix4,y=new THREE.Frustum,C=new THREE.Vector4,H=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.setEulerFromRotationMatrix((new THREE.Matrix4).extractRotation(this.matrix),this.eulerOrder);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.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(a instanceof THREE.Object3D){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,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==void 0)return e}}},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=true},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=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},worldToLocal:function(a){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(a)},localToWorld:function(a){return this.matrixWorld.multiplyVector3(a)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[j]=l[j]||new THREE.RenderableVertex;j++;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,e=b.z+b.w,g=-a.z+a.w,i=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&i>=0)return true;if(f<0&&e<0||g<0&&i<0)return false;f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));g<0?c=Math.max(c,g/(g-i)):i<0&&(d=Math.min(d,g/(g-i)));if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-
+d);return true}var e,f,g=[],i,j,l=[],h,k,o=[],n,q=[],m,p,u=[],r,z,A=[],v={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,x=new THREE.Vector4,G=new THREE.Matrix4,s=new THREE.Matrix4,y=new THREE.Frustum,C=new THREE.Vector4,H=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 G.multiply(b.matrixWorld,b.projectionMatrixInverse);G.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){f=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var g=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||y.contains(b))){D.copy(b.matrixWorld.getPosition());
-G.multiplyVector3(D);e=a();e.object=b;e.z=D.z;v.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){D.copy(b.matrixWorld.getPosition());G.multiplyVector3(D);e=a();e.object=b;e.z=D.z;v.sprites.push(e)}else b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,f,e){var g=f.near,D=f.far,I=false,Q,O,w,P,M,U,T,W,B,K,J,L,S,ja,da;z=p=n=j=0;v.elements.length=0;if(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);G.multiply(f.projectionMatrix,f.matrixWorldInverse);y.setFromMatrix(G);v=this.projectGraph(a,false);a=0;for(Q=v.objects.length;a<Q;a++){B=v.objects[a].object;K=B.matrixWorld;m=0;if(B instanceof THREE.Mesh){J=B.geometry;L=B.geometry.materials;P=J.vertices;S=J.faces;ja=J.faceVertexUvs;J=B.matrixRotationWorld.extractRotation(K);O=0;for(w=
-P.length;O<w;O++){k=b();k.positionWorld.copy(P[O]);K.multiplyVector3(k.positionWorld);k.positionScreen.copy(k.positionWorld);G.multiplyVector4(k.positionScreen);k.positionScreen.x=k.positionScreen.x/k.positionScreen.w;k.positionScreen.y=k.positionScreen.y/k.positionScreen.w;k.visible=k.positionScreen.z>g&&k.positionScreen.z<D}P=0;for(O=S.length;P<O;P++){w=S[P];if(w instanceof THREE.Face3){M=i[w.a];U=i[w.b];T=i[w.c];if(M.visible&&U.visible&&T.visible){I=(T.positionScreen.x-M.positionScreen.x)*(U.positionScreen.y-
-M.positionScreen.y)-(T.positionScreen.y-M.positionScreen.y)*(U.positionScreen.x-M.positionScreen.x)<0;if(B.doubleSided||I!=B.flipSided){W=o[j]=o[j]||new THREE.RenderableFace3;j++;h=W;h.v1.copy(M);h.v2.copy(U);h.v3.copy(T)}else continue}else continue}else if(w instanceof THREE.Face4){M=i[w.a];U=i[w.b];T=i[w.c];W=i[w.d];if(M.visible&&U.visible&&T.visible&&W.visible){I=(W.positionScreen.x-M.positionScreen.x)*(U.positionScreen.y-M.positionScreen.y)-(W.positionScreen.y-M.positionScreen.y)*(U.positionScreen.x-
+G.multiplyVector3(D);e=a();e.object=b;e.z=D.z;v.objects.push(e)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){D.copy(b.matrixWorld.getPosition());G.multiplyVector3(D);e=a();e.object=b;e.z=D.z;v.sprites.push(e)}else b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,f,e){var g=f.near,D=f.far,I=false,Q,O,w,P,M,U,T,W,B,K,J,L,S,ja,da;z=p=n=k=0;v.elements.length=0;if(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);G.multiply(f.projectionMatrix,f.matrixWorldInverse);y.setFromMatrix(G);v=this.projectGraph(a,false);a=0;for(Q=v.objects.length;a<Q;a++){B=v.objects[a].object;K=B.matrixWorld;j=0;if(B instanceof THREE.Mesh){J=B.geometry;L=B.geometry.materials;P=J.vertices;S=J.faces;ja=J.faceVertexUvs;J=B.matrixRotationWorld.extractRotation(K);O=0;for(w=
+P.length;O<w;O++){i=b();i.positionWorld.copy(P[O]);K.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);G.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>g&&i.positionScreen.z<D}P=0;for(O=S.length;P<O;P++){w=S[P];if(w instanceof THREE.Face3){M=l[w.a];U=l[w.b];T=l[w.c];if(M.visible&&U.visible&&T.visible){I=(T.positionScreen.x-M.positionScreen.x)*(U.positionScreen.y-
+M.positionScreen.y)-(T.positionScreen.y-M.positionScreen.y)*(U.positionScreen.x-M.positionScreen.x)<0;if(B.doubleSided||I!=B.flipSided){W=o[k]=o[k]||new THREE.RenderableFace3;k++;h=W;h.v1.copy(M);h.v2.copy(U);h.v3.copy(T)}else continue}else continue}else if(w instanceof THREE.Face4){M=l[w.a];U=l[w.b];T=l[w.c];W=l[w.d];if(M.visible&&U.visible&&T.visible&&W.visible){I=(W.positionScreen.x-M.positionScreen.x)*(U.positionScreen.y-M.positionScreen.y)-(W.positionScreen.y-M.positionScreen.y)*(U.positionScreen.x-
 M.positionScreen.x)<0||(U.positionScreen.x-T.positionScreen.x)*(W.positionScreen.y-T.positionScreen.y)-(U.positionScreen.y-T.positionScreen.y)*(W.positionScreen.x-T.positionScreen.x)<0;if(B.doubleSided||I!=B.flipSided){da=q[n]=q[n]||new THREE.RenderableFace4;n++;h=da;h.v1.copy(M);h.v2.copy(U);h.v3.copy(T);h.v4.copy(W)}else continue}else continue}h.normalWorld.copy(w.normal);!I&&(B.flipSided||B.doubleSided)&&h.normalWorld.negate();J.multiplyVector3(h.normalWorld);h.centroidWorld.copy(w.centroid);K.multiplyVector3(h.centroidWorld);
 h.centroidScreen.copy(h.centroidWorld);G.multiplyVector3(h.centroidScreen);T=w.vertexNormals;M=0;for(U=T.length;M<U;M++){W=h.vertexNormalsWorld[M];W.copy(T[M]);!I&&(B.flipSided||B.doubleSided)&&W.negate();J.multiplyVector3(W)}M=0;for(U=ja.length;M<U;M++)if(da=ja[M][P]){T=0;for(W=da.length;T<W;T++)h.uvs[M][T]=da[T]}h.material=B.material;h.faceMaterial=w.materialIndex!==null?L[w.materialIndex]:null;h.z=h.centroidScreen.z;v.elements.push(h)}}else if(B instanceof THREE.Line){s.multiply(G,K);P=B.geometry.vertices;
-M=b();M.positionScreen.copy(P[0]);s.multiplyVector4(M.positionScreen);K=B.type===THREE.LinePieces?2:1;O=1;for(w=P.length;O<w;O++){M=b();M.positionScreen.copy(P[O]);s.multiplyVector4(M.positionScreen);if(!((O+1)%K>0)){U=i[m-2];C.copy(M.positionScreen);H.copy(U.positionScreen);if(d(C,H)){C.multiplyScalar(1/C.w);H.multiplyScalar(1/H.w);L=u[p]=u[p]||new THREE.RenderableLine;p++;l=L;l.v1.positionScreen.copy(C);l.v2.positionScreen.copy(H);l.z=Math.max(C.z,H.z);l.material=B.material;v.elements.push(l)}}}}}a=
+M=b();M.positionScreen.copy(P[0]);s.multiplyVector4(M.positionScreen);K=B.type===THREE.LinePieces?2:1;O=1;for(w=P.length;O<w;O++){M=b();M.positionScreen.copy(P[O]);s.multiplyVector4(M.positionScreen);if(!((O+1)%K>0)){U=l[j-2];C.copy(M.positionScreen);H.copy(U.positionScreen);if(d(C,H)){C.multiplyScalar(1/C.w);H.multiplyScalar(1/H.w);L=u[p]=u[p]||new THREE.RenderableLine;p++;m=L;m.v1.positionScreen.copy(C);m.v2.positionScreen.copy(H);m.z=Math.max(C.z,H.z);m.material=B.material;v.elements.push(m)}}}}}a=
 0;for(Q=v.sprites.length;a<Q;a++){B=v.sprites[a].object;K=B.matrixWorld;if(B instanceof THREE.Particle){x.set(K.elements[12],K.elements[13],K.elements[14],1);G.multiplyVector4(x);x.z=x.z/x.w;if(x.z>0&&x.z<1){g=A[z]=A[z]||new THREE.RenderableParticle;z++;r=g;r.x=x.x/x.w;r.y=x.y/x.w;r.z=x.z;r.rotation=B.rotation.z;r.scale.x=B.scale.x*Math.abs(r.x-(x.x+f.projectionMatrix.elements[0])/(x.w+f.projectionMatrix.elements[12]));r.scale.y=B.scale.y*Math.abs(r.y-(x.y+f.projectionMatrix.elements[5])/(x.w+f.projectionMatrix.elements[13]));
 r.material=B.material;v.elements.push(r)}}}e&&v.elements.sort(c);return v}};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},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,k=d*e;this.w=g*f-k*c;this.x=g*c+k*f;this.y=d*b*f+a*e*c;this.z=a*e*f-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.elements[0]+a.elements[5]+a.elements[10]))/2;this.x=Math.sqrt(Math.max(0,b+a.elements[0]-a.elements[5]-a.elements[10]))/2;this.y=Math.sqrt(Math.max(0,b-a.elements[0]+a.elements[5]-a.elements[10]))/2;this.z=Math.sqrt(Math.max(0,b-a.elements[0]-a.elements[5]+a.elements[10]))/2;this.x=a.elements[6]-a.elements[9]<0?-Math.abs(this.x):
-Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<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=this.x*-1;this.y=this.y*-1;this.z=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);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a}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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,k=a.z,a=a.w;this.x=b*a+e*f+c*k-d*g;this.y=
-c*a+e*g+d*f-b*k;this.z=d*a+e*k+b*g-c*f;this.w=e*a-b*f-c*g-d*k;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,k=this.z,m=this.w,i=m*c+g*e-k*d,h=m*d+k*c-f*e,j=m*e+f*d-g*c,c=-f*c-g*d-k*e;b.x=i*m+c*-f+h*-k-j*-g;b.y=h*m+c*-g+j*-f-i*-k;b.z=j*m+c*-k+i*-g-h*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=
-c;this.y=d;this.z=e;return this}var k=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*k)/m;k=Math.sin(b*k)/m;this.w=f*g+this.w*k;this.x=c*g+this.x*k;this.y=d*g+this.y*k;this.z=e*g+this.z*k;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+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},setFromEuler:function(a,b){var c=b||"XYZ",d=Math.cos(a.x/2),e=Math.cos(a.y/2),f=Math.cos(a.z/2),g=Math.sin(a.x/2),i=Math.sin(a.y/2),j=Math.sin(a.z/2);switch(c){case "YXZ":this.x=g*e*f+d*i*j;this.y=d*i*f-g*e*j;this.z=d*e*j-g*i*f;this.w=d*e*f+g*i*j;break;case "ZXY":this.x=g*e*f-d*i*j;this.y=d*i*f+g*e*
+j;this.z=d*e*j+g*i*f;this.w=d*e*f-g*i*j;break;case "ZYX":this.x=g*e*f-d*i*j;this.y=d*i*f+g*e*j;this.z=d*e*j-g*i*f;this.w=d*e*f+g*i*j;break;case "YZX":this.x=g*e*f+d*i*j;this.y=d*i*f+g*e*j;this.z=d*e*j-g*i*f;this.w=d*e*f-g*i*j;break;case "XZY":this.x=g*e*f-d*i*j;this.y=d*i*f-g*e*j;this.z=d*e*j+g*i*f;this.w=d*e*f+g*i*j;break;default:this.x=g*e*f+d*i*j;this.y=d*i*f-g*e*j;this.z=d*e*j+g*i*f;this.w=d*e*f-g*i*j}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=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],i=b[2],j=b[6],b=b[10],l=c+f+b;if(l>0){c=0.5/Math.sqrt(l+1);this.w=0.25/c;this.x=(j-g)*c;this.y=(d-i)*c;this.z=(e-a)*c}else if(c>f&&c>b){c=2*Math.sqrt(1+c-f-b);this.w=(j-g)/c;this.x=0.25*c;this.y=(a+e)/c;this.z=(d+i)/c}else if(f>b){c=2*Math.sqrt(1+f-c-b);this.w=(d-i)/c;this.x=(a+e)/c;this.y=0.25*c;this.z=(g+j)/c}else{c=2*Math.sqrt(1+b-c-f);this.w=(e-a)/c;this.x=
+(d+i)/c;this.y=(g+j)/c;this.z=0.25*c}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=this.x*-1;this.y=this.y*-1;this.z=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);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
+this.y*a;this.z=this.z*a;this.w=this.w*a}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},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,
+f=this.x,g=this.y,i=this.z,j=this.w,l=j*c+g*e-i*d,h=j*d+i*c-f*e,k=j*e+f*d-g*c,c=-f*c-g*d-i*e;b.x=l*j+c*-f+h*-i-k*-g;b.y=h*j+c*-g+k*-f-l*-i;b.z=k*j+c*-i+l*-g-h*-f;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=f;this.x=c;this.y=d;this.z=e;return this}var i=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){this.w=0.5*(f+this.w);this.x=0.5*(c+this.x);
+this.y=0.5*(d+this.y);this.z=0.5*(e+this.z);return this}g=Math.sin((1-b)*i)/j;i=Math.sin(b*i)/j;this.w=f*g+this.w*i;this.x=c*g+this.x*i;this.y=d*g+this.y*i;this.z=e*g+this.z*i;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};THREE.Vertex=function(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
 THREE.Face3=function(a,b,c,d,e,f){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=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;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;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
@@ -89,20 +96,20 @@ THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.
 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=this.u+(a.u-this.u)*b;this.v=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=false};
 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]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal);for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]);a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,
-0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,g=new THREE.Vector3,k=new THREE.Vector3;a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f,e);k.sub(d,e);g.crossSelf(k);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
+0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a]);c.centroid.addSelf(this.vertices[c.b]);c.centroid.addSelf(this.vertices[c.c]);c.centroid.addSelf(this.vertices[c.d]);c.centroid.divideScalar(4)}}},computeFaceNormals:function(){var a,b,c,d,e,f,g=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<
+b;a++){c=this.faces[a];d=this.vertices[c.a];e=this.vertices[c.b];f=this.vertices[c.c];g.sub(f,e);i.sub(d,e);g.crossSelf(i);g.isZero()||g.normalize();c.normal.copy(g)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(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;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(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)}}a=0;
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(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])}else if(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,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?
 e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
-[];var g=this.morphNormals[a].faceNormals,k=this.morphNormals[a].vertexNormals,m,i;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];m=new THREE.Vector3;i=e 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};g.push(m);k.push(i)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
-m=g.faceNormals[c];i=g.vertexNormals[c];m.copy(e.normal);if(e instanceof THREE.Face3){i.a.copy(e.vertexNormals[0]);i.b.copy(e.vertexNormals[1]);i.c.copy(e.vertexNormals[2])}else{i.a.copy(e.vertexNormals[0]);i.b.copy(e.vertexNormals[1]);i.c.copy(e.vertexNormals[2]);i.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,e,M){k=a.vertices[b];m=a.vertices[c];
-i=a.vertices[d];h=g[f];j=g[e];o=g[M];n=m.x-k.x;q=i.x-k.x;l=m.y-k.y;p=i.y-k.y;u=m.z-k.z;r=i.z-k.z;z=j.u-h.u;A=o.u-h.u;v=j.v-h.v;D=o.v-h.v;x=1/(z*D-A*v);C.set((D*n-v*q)*x,(D*l-v*p)*x,(D*u-v*r)*x);H.set((z*q-A*n)*x,(z*p-A*l)*x,(z*r-A*u)*x);s[b].addSelf(C);s[c].addSelf(C);s[d].addSelf(C);y[b].addSelf(H);y[c].addSelf(H);y[d].addSelf(H)}var b,c,d,e,f,g,k,m,i,h,j,o,n,q,l,p,u,r,z,A,v,D,x,G,s=[],y=[],C=new THREE.Vector3,H=new THREE.Vector3,R=new THREE.Vector3,N=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=
+[];var g=this.morphNormals[a].faceNormals,i=this.morphNormals[a].vertexNormals,j,l;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];j=new THREE.Vector3;l=e 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};g.push(j);i.push(l)}}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];
+j=g.faceNormals[c];l=g.vertexNormals[c];j.copy(e.normal);if(e instanceof THREE.Face3){l.a.copy(e.vertexNormals[0]);l.b.copy(e.vertexNormals[1]);l.c.copy(e.vertexNormals[2])}else{l.a.copy(e.vertexNormals[0]);l.b.copy(e.vertexNormals[1]);l.c.copy(e.vertexNormals[2]);l.d.copy(e.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.normal=e.__originalFaceNormal;e.vertexNormals=e.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,e,M){i=a.vertices[b];j=a.vertices[c];
+l=a.vertices[d];h=g[f];k=g[e];o=g[M];n=j.x-i.x;q=l.x-i.x;m=j.y-i.y;p=l.y-i.y;u=j.z-i.z;r=l.z-i.z;z=k.u-h.u;A=o.u-h.u;v=k.v-h.v;D=o.v-h.v;x=1/(z*D-A*v);C.set((D*n-v*q)*x,(D*m-v*p)*x,(D*u-v*r)*x);H.set((z*q-A*n)*x,(z*p-A*m)*x,(z*r-A*u)*x);s[b].addSelf(C);s[c].addSelf(C);s[d].addSelf(C);y[b].addSelf(H);y[c].addSelf(H);y[d].addSelf(H)}var b,c,d,e,f,g,i,j,l,h,k,o,n,q,m,p,u,r,z,A,v,D,x,G,s=[],y=[],C=new THREE.Vector3,H=new THREE.Vector3,R=new THREE.Vector3,N=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=
 this.vertices.length;b<c;b++){s[b]=new THREE.Vector3;y[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.d,0,1,3);a(this,f.b,f.c,f.d,1,2,3)}}var E=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++){t.copy(f.vertexNormals[d]);e=f[E[d]];G=s[e];R.copy(G);R.subSelf(t.multiplyScalar(t.dot(G))).normalize();
 N.cross(f.vertexNormals[d],G);e=N.dot(y[e]);e=e<0?-1:1;f.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.z,e)}}this.hasTangents=true},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];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];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].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,k;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
-e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){e=this.faces[f];if(e instanceof THREE.Face3){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c]}else if(e instanceof THREE.Face4){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e.d=c[e.d];d=[e.a,e.b,e.c,e.d];for(a=3;a>0;a--)if(d.indexOf(e["abcd"[a]])!=a){d.splice(a,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2]);e=0;for(d=this.faceVertexUvs.length;e<d;e++)(k=
-this.faceVertexUvs[e][f])&&k.splice(a,1);break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;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,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+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].length();a>b&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,i;f=0;for(g=this.vertices.length;f<g;f++){d=this.vertices[f];d=[Math.round(d.x*
+e),Math.round(d.y*e),Math.round(d.z*e)].join("_");if(a[d]===void 0){a[d]=f;b.push(this.vertices[f]);c[f]=b.length-1}else c[f]=c[a[d]]}f=0;for(g=this.faces.length;f<g;f++){e=this.faces[f];if(e instanceof THREE.Face3){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c]}else if(e instanceof THREE.Face4){e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e.d=c[e.d];d=[e.a,e.b,e.c,e.d];for(a=3;a>0;a--)if(d.indexOf(e["abcd"[a]])!=a){d.splice(a,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2]);e=0;for(d=this.faceVertexUvs.length;e<d;e++)(i=
+this.faceVertexUvs[e][f])&&i.splice(a,1);break}}}c=this.vertices.length-b.length;this.vertices=b;return c}};THREE.GeometryCount=0;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.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
 THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(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,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;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.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.makePerspective(this.fov,this.aspect,this.near,this.far)};
@@ -112,51 +119,51 @@ this.shadowCascade=false;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);th
 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.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=k.crossOrigin;f.src=b}function f(a,c,d,f,g,h){var k=document.createElement("canvas");a[c]=new THREE.Texture(k);a[c].sourceFile=
-d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var k=this,m="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
-if(a.shading){var h=a.shading.toLowerCase();h==="phong"?m="MeshPhongMaterial":h==="basic"&&(m="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)i.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)i.transparent=a.transparent;if(a.depthTest!==void 0)i.depthTest=a.depthTest;if(a.depthWrite!==void 0)i.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")i.vertexColors=THREE.FaceColors;else if(a.vertexColors)i.vertexColors=THREE.VertexColors;
-if(a.colorDiffuse)i.color=g(a.colorDiffuse);else if(a.DbgColor)i.color=a.DbgColor;if(a.colorSpecular)i.specular=g(a.colorSpecular);if(a.colorAmbient)i.ambient=g(a.colorAmbient);if(a.transparency)i.opacity=a.transparency;if(a.specularCoef)i.shininess=a.specularCoef;a.mapDiffuse&&b&&f(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(i,"normalMap",a.mapNormal,a.mapNormalRepeat,
-a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){m=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(m.uniforms);h.tNormal.texture=i.normalMap;if(a.mapNormalFactor)h.uNormalScale.value=a.mapNormalFactor;if(i.map){h.tDiffuse.texture=i.map;h.enableDiffuse.value=true}if(i.specularMap){h.tSpecular.texture=i.specularMap;h.enableSpecular.value=true}if(i.lightMap){h.tAO.texture=i.lightMap;
-h.enableAO.value=true}h.uDiffuseColor.value.setHex(i.color);h.uSpecularColor.value.setHex(i.specular);h.uAmbientColor.value.setHex(i.ambient);h.uShininess.value=i.shininess;if(i.opacity!==void 0)h.uOpacity.value=i.opacity;i=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:h,lights:true,fog:true})}else i=new THREE[m](i);if(a.DbgName!==void 0)i.name=a.DbgName;return i}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),f=d(this.height);a.image.width=b;a.image.height=f;a.image.getContext("2d").drawImage(this,0,0,b,f)}else a.image=this;a.needsUpdate=true};f.crossOrigin=i.crossOrigin;f.src=b}function f(a,c,d,f,g,i){var h=document.createElement("canvas");a[c]=new THREE.Texture(h);a[c].sourceFile=
+d;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(i){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[i[0]]!==void 0)a[c].wrapS=f[i[0]];if(f[i[1]]!==void 0)a[c].wrapT=f[i[1]]}e(a[c],b+"/"+d)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var i=this,j="MeshLambertMaterial",l={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};
+if(a.shading){var h=a.shading.toLowerCase();h==="phong"?j="MeshPhongMaterial":h==="basic"&&(j="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)l.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)l.transparent=a.transparent;if(a.depthTest!==void 0)l.depthTest=a.depthTest;if(a.depthWrite!==void 0)l.depthWrite=a.depthWrite;if(a.vertexColors!==void 0)if(a.vertexColors=="face")l.vertexColors=THREE.FaceColors;else if(a.vertexColors)l.vertexColors=THREE.VertexColors;
+if(a.colorDiffuse)l.color=g(a.colorDiffuse);else if(a.DbgColor)l.color=a.DbgColor;if(a.colorSpecular)l.specular=g(a.colorSpecular);if(a.colorAmbient)l.ambient=g(a.colorAmbient);if(a.transparency)l.opacity=a.transparency;if(a.specularCoef)l.shininess=a.specularCoef;a.mapDiffuse&&b&&f(l,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(l,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(l,"normalMap",a.mapNormal,a.mapNormalRepeat,
+a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(l,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){j=THREE.ShaderUtils.lib.normal;h=THREE.UniformsUtils.clone(j.uniforms);h.tNormal.texture=l.normalMap;if(a.mapNormalFactor)h.uNormalScale.value=a.mapNormalFactor;if(l.map){h.tDiffuse.texture=l.map;h.enableDiffuse.value=true}if(l.specularMap){h.tSpecular.texture=l.specularMap;h.enableSpecular.value=true}if(l.lightMap){h.tAO.texture=l.lightMap;
+h.enableAO.value=true}h.uDiffuseColor.value.setHex(l.color);h.uSpecularColor.value.setHex(l.specular);h.uAmbientColor.value.setHex(l.ambient);h.uShininess.value=l.shininess;if(l.opacity!==void 0)h.uOpacity.value=l.opacity;l=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:h,lights:true,fog:true})}else l=new THREE[j](l);if(a.DbgName!==void 0)l.name=a.DbgName;return l}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
 THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
-THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var k=JSON.parse(g.responseText);a.loadAjaxBuffers(k,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,k=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){k==0&&(k=f.getResponseHeader("Content-Length"));e({total:k,loaded:f.responseText.length})}}else f.readyState==2&&(k=f.getResponseHeader("Content-Length"))};
+THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var i=JSON.parse(g.responseText);a.loadAjaxBuffers(i,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,i=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else if(f.readyState==3){if(e){i==0&&(i=f.getResponseHeader("Content-Length"));e({total:i,loaded:f.responseText.length})}}else f.readyState==2&&(i=f.getResponseHeader("Content-Length"))};
 f.open("GET",g,true);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,m,i,h,j,o,n,q,l,p,u,r,z,A;function v(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function G(b,c){var d,f,e,g,h,k,l,i,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=m[d*3];e=m[d*3+1];g=m[d*3+2];h=F[f*2];f=F[f*2+1];k=F[e*2];l=F[e*2+1];e=F[g*2];i=F[g*2+1];g=N.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,f));n.push(new THREE.UV(k,l));n.push(new THREE.UV(e,
-i));g.push(n)}}function s(b,c){var d,f,e,g,h,k,l,i,m,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[d*4];e=o[d*4+1];g=o[d*4+2];h=o[d*4+3];k=F[f*2];f=F[f*2+1];l=F[e*2];m=F[e*2+1];i=F[g*2];n=F[g*2+1];g=F[h*2];e=F[h*2+1];h=N.faceVertexUvs[0];var j=[];j.push(new THREE.UV(k,f));j.push(new THREE.UV(l,m));j.push(new THREE.UV(i,n));j.push(new THREE.UV(g,e));h.push(j)}}function y(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),k=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=k[d];
-N.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function C(b,c,d){for(var f,e,g,h,k,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];k=l[d];N.faces.push(new THREE.Face4(f,e,g,h,null,null,k))}}function H(b,c,d,f){for(var e,g,h,k,l,i,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];l=d[f*3];i=d[f*3+1];m=d[f*3+2];k=n[f];var j=E[i*3],o=E[i*3+1];i=E[i*3+2];var p=E[m*3],
-q=E[m*3+1];m=E[m*3+2];N.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(E[l*3],E[l*3+1],E[l*3+2]),new THREE.Vector3(j,o,i),new THREE.Vector3(p,q,m)],null,k))}}function R(b,c,d,f){for(var e,g,h,k,l,i,m,n,j,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];k=c[f*4+3];i=d[f*4];m=d[f*4+1];n=d[f*4+2];j=d[f*4+3];l=o[f];var p=E[m*3],q=E[m*3+1];m=E[m*3+2];var r=E[n*3],s=E[n*3+1];n=E[n*3+2];var t=E[j*3],u=E[j*3+1];j=E[j*3+2];N.faces.push(new THREE.Face4(e,
-g,h,k,[new THREE.Vector3(E[i*3],E[i*3+1],E[i*3+2]),new THREE.Vector3(p,q,m),new THREE.Vector3(r,s,n),new THREE.Vector3(t,u,j)],null,l))}}var N=this,t=0,E=[],F=[],I,Q,O;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(N,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,t,12);c=D(a,t+12);D(a,t+13);D(a,t+14);D(a,t+15);e=D(a,t+16);m=D(a,t+17);i=D(a,t+18);h=D(a,t+19);j=x(a,t+20);o=x(a,t+20+4);n=x(a,t+20+8);b=x(a,t+20+12);q=
-x(a,t+20+16);l=x(a,t+20+20);p=x(a,t+20+24);u=x(a,t+20+28);r=x(a,t+20+32);z=x(a,t+20+36);A=x(a,t+20+40);t=t+c;c=e*3+h;O=e*4+h;I=b*c;Q=q*(c+m*3);e=l*(c+i*3);h=p*(c+m*3+i*3);c=u*O;m=r*(O+m*4);i=z*(O+i*4);t=t+function(b){var b=new Float32Array(a,b,j*3),c,d,f,e;for(c=0;c<j;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];N.vertices.push(new THREE.Vector3(d,f,e))}return j*3*Float32Array.BYTES_PER_ELEMENT}(t);t=t+function(b){if(o){var b=new Int8Array(a,b,o*3),c,d,f,e;for(c=0;c<o;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];E.push(d/
-127,f/127,e/127)}}return o*3*Int8Array.BYTES_PER_ELEMENT}(t);t=t+v(o*3);t=t+function(b){if(n){var b=new Float32Array(a,b,n*2),c,d,f;for(c=0;c<n;c++){d=b[c*2];f=b[c*2+1];F.push(d,f)}}return n*2*Float32Array.BYTES_PER_ELEMENT}(t);I=t+I+v(b*2);Q=I+Q+v(q*2);e=Q+e+v(l*2);h=e+h+v(p*2);c=h+c+v(u*2);m=c+m+v(r*2);i=m+i+v(z*2);(function(a){if(l){var b=a+l*Uint32Array.BYTES_PER_ELEMENT*3;y(l,a,b+l*Uint32Array.BYTES_PER_ELEMENT*3);G(l,b)}})(Q);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
-p*Uint32Array.BYTES_PER_ELEMENT*3;H(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);G(p,c)}})(e);(function(a){if(z){var b=a+z*Uint32Array.BYTES_PER_ELEMENT*4;C(z,a,b+z*Uint32Array.BYTES_PER_ELEMENT*4);s(z,b)}})(m);(function(a){if(A){var b=a+A*Uint32Array.BYTES_PER_ELEMENT*4,c=b+A*Uint32Array.BYTES_PER_ELEMENT*4;R(A,a,b,c+A*Uint32Array.BYTES_PER_ELEMENT*4);s(A,c)}})(i);b&&y(b,t,t+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;H(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,j,l,h,k,o,n,q,m,p,u,r,z,A;function v(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function G(b,c){var d,f,e,g,i,h,j,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=m[d*3];e=m[d*3+1];g=m[d*3+2];i=F[f*2];f=F[f*2+1];h=F[e*2];j=F[e*2+1];e=F[g*2];l=F[g*2+1];g=N.faceVertexUvs[0];var k=[];k.push(new THREE.UV(i,f));k.push(new THREE.UV(h,j));k.push(new THREE.UV(e,
+l));g.push(k)}}function s(b,c){var d,f,e,g,i,h,j,l,m,k,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=n[d*4];e=n[d*4+1];g=n[d*4+2];i=n[d*4+3];h=F[f*2];f=F[f*2+1];j=F[e*2];m=F[e*2+1];l=F[g*2];k=F[g*2+1];g=F[i*2];e=F[i*2+1];i=N.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,f));o.push(new THREE.UV(j,m));o.push(new THREE.UV(l,k));o.push(new THREE.UV(g,e));i.push(o)}}function y(b,c,d){for(var f,e,g,i,c=new Uint32Array(a,c,3*b),h=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];i=h[d];
+N.faces.push(new THREE.Face3(f,e,g,null,null,i))}}function C(b,c,d){for(var f,e,g,i,h,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];i=c[d*4+3];h=j[d];N.faces.push(new THREE.Face4(f,e,g,i,null,null,h))}}function H(b,c,d,f){for(var e,g,i,h,j,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),k=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];i=c[f*3+2];j=d[f*3];l=d[f*3+1];m=d[f*3+2];h=k[f];var n=E[l*3],o=E[l*3+1];l=E[l*3+2];var p=E[m*3],
+q=E[m*3+1];m=E[m*3+2];N.faces.push(new THREE.Face3(e,g,i,[new THREE.Vector3(E[j*3],E[j*3+1],E[j*3+2]),new THREE.Vector3(n,o,l),new THREE.Vector3(p,q,m)],null,h))}}function R(b,c,d,f){for(var e,g,i,h,j,l,m,k,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];i=c[f*4+2];h=c[f*4+3];l=d[f*4];m=d[f*4+1];k=d[f*4+2];n=d[f*4+3];j=o[f];var p=E[m*3],q=E[m*3+1];m=E[m*3+2];var r=E[k*3],s=E[k*3+1];k=E[k*3+2];var t=E[n*3],u=E[n*3+1];n=E[n*3+2];N.faces.push(new THREE.Face4(e,
+g,i,h,[new THREE.Vector3(E[l*3],E[l*3+1],E[l*3+2]),new THREE.Vector3(p,q,m),new THREE.Vector3(r,s,k),new THREE.Vector3(t,u,n)],null,j))}}var N=this,t=0,E=[],F=[],I,Q,O;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(N,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d=d+String.fromCharCode(a[b+f]);return d})(a,t,12);c=D(a,t+12);D(a,t+13);D(a,t+14);D(a,t+15);e=D(a,t+16);j=D(a,t+17);l=D(a,t+18);h=D(a,t+19);k=x(a,t+20);o=x(a,t+20+4);n=x(a,t+20+8);b=x(a,t+20+12);q=
+x(a,t+20+16);m=x(a,t+20+20);p=x(a,t+20+24);u=x(a,t+20+28);r=x(a,t+20+32);z=x(a,t+20+36);A=x(a,t+20+40);t=t+c;c=e*3+h;O=e*4+h;I=b*c;Q=q*(c+j*3);e=m*(c+l*3);h=p*(c+j*3+l*3);c=u*O;j=r*(O+j*4);l=z*(O+l*4);t=t+function(b){var b=new Float32Array(a,b,k*3),c,d,f,e;for(c=0;c<k;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];N.vertices.push(new THREE.Vector3(d,f,e))}return k*3*Float32Array.BYTES_PER_ELEMENT}(t);t=t+function(b){if(o){var b=new Int8Array(a,b,o*3),c,d,f,e;for(c=0;c<o;c++){d=b[c*3];f=b[c*3+1];e=b[c*3+2];E.push(d/
+127,f/127,e/127)}}return o*3*Int8Array.BYTES_PER_ELEMENT}(t);t=t+v(o*3);t=t+function(b){if(n){var b=new Float32Array(a,b,n*2),c,d,f;for(c=0;c<n;c++){d=b[c*2];f=b[c*2+1];F.push(d,f)}}return n*2*Float32Array.BYTES_PER_ELEMENT}(t);I=t+I+v(b*2);Q=I+Q+v(q*2);e=Q+e+v(m*2);h=e+h+v(p*2);c=h+c+v(u*2);j=c+j+v(r*2);l=j+l+v(z*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;y(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);G(m,b)}})(Q);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*3,c=b+
+p*Uint32Array.BYTES_PER_ELEMENT*3;H(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);G(p,c)}})(e);(function(a){if(z){var b=a+z*Uint32Array.BYTES_PER_ELEMENT*4;C(z,a,b+z*Uint32Array.BYTES_PER_ELEMENT*4);s(z,b)}})(j);(function(a){if(A){var b=a+A*Uint32Array.BYTES_PER_ELEMENT*4,c=b+A*Uint32Array.BYTES_PER_ELEMENT*4;R(A,a,b,c+A*Uint32Array.BYTES_PER_ELEMENT*4);s(A,c)}})(l);b&&y(b,t,t+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(q){var b=a+q*Uint32Array.BYTES_PER_ELEMENT*3;H(q,a,b,b+q*Uint32Array.BYTES_PER_ELEMENT*
 3)}})(I);u&&C(u,h,h+u*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(r){var b=a+r*Uint32Array.BYTES_PER_ELEMENT*4;R(r,a,b,b+r*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
 THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
-THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var k=JSON.parse(f.responseText);a.createModel(k,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(f.status===200||f.status===0){if(f.responseText){var i=JSON.parse(f.responseText);a.createModel(i,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else if(f.readyState===f.LOADING){if(e){g===0&&(g=f.getResponseHeader("Content-Length"));
 e({total:g,loaded:f.responseText.length})}}else f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,true);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,m,i,h,j,o,n,q,l,p,u,r,z,A=a.faces;j=a.vertices;var v=a.normals,D=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}i=0;for(h=j.length;i<h;){o=new THREE.Vector3;o.x=j[i++]*b;o.y=j[i++]*b;o.z=j[i++]*b;d.vertices.push(o)}i=0;for(h=A.length;i<h;){b=A[i++];j=b&1;m=b&2;c=b&
-4;e=b&8;n=b&16;o=b&32;l=b&64;b=b&128;if(j){p=new THREE.Face4;p.a=A[i++];p.b=A[i++];p.c=A[i++];p.d=A[i++];j=4}else{p=new THREE.Face3;p.a=A[i++];p.b=A[i++];p.c=A[i++];j=3}if(m){m=A[i++];p.materialIndex=m}m=d.faces.length;if(c)for(c=0;c<x;c++){u=a.uvs[c];q=A[i++];z=u[q*2];q=u[q*2+1];d.faceUvs[c][m]=new THREE.UV(z,q)}if(e)for(c=0;c<x;c++){u=a.uvs[c];r=[];for(e=0;e<j;e++){q=A[i++];z=u[q*2];q=u[q*2+1];r[e]=new THREE.UV(z,q)}d.faceVertexUvs[c][m]=r}if(n){n=A[i++]*3;e=new THREE.Vector3;e.x=v[n++];e.y=v[n++];
-e.z=v[n];p.normal=e}if(o)for(c=0;c<j;c++){n=A[i++]*3;e=new THREE.Vector3;e.x=v[n++];e.y=v[n++];e.z=v[n];p.vertexNormals.push(e)}if(l){o=A[i++];o=new THREE.Color(D[o]);p.color=o}if(b)for(c=0;c<j;c++){o=A[i++];o=new THREE.Color(D[o]);p.vertexColors.push(o)}d.faces.push(p)}})(e);(function(){var b,c,e,m;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];m=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,m,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
-b+2){e=a.skinIndices[b];m=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,m,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,m,i,h,j;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];h=d.morphTargets[c].vertices;j=a.morphTargets[c].vertices;m=0;for(i=j.length;m<i;m=m+3){var o=new THREE.Vector3;o.x=j[m]*b;o.y=j[m+1]*b;o.z=j[m+2]*b;h.push(o)}}}if(a.morphColors!==
-void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];i=d.morphColors[c].colors;h=a.morphColors[c].colors;b=0;for(m=h.length;b<m;b=b+3){j=new THREE.Color(16755200);j.setRGB(h[b],h[b+1],h[b+2]);i.push(j)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,j,l,h,k,o,n,q,m,p,u,r,z,A=a.faces;k=a.vertices;var v=a.normals,D=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++){d.faceUvs[c]=[];d.faceVertexUvs[c]=[]}l=0;for(h=k.length;l<h;){o=new THREE.Vector3;o.x=k[l++]*b;o.y=k[l++]*b;o.z=k[l++]*b;d.vertices.push(o)}l=0;for(h=A.length;l<h;){b=A[l++];k=b&1;j=b&2;c=b&
+4;e=b&8;n=b&16;o=b&32;m=b&64;b=b&128;if(k){p=new THREE.Face4;p.a=A[l++];p.b=A[l++];p.c=A[l++];p.d=A[l++];k=4}else{p=new THREE.Face3;p.a=A[l++];p.b=A[l++];p.c=A[l++];k=3}if(j){j=A[l++];p.materialIndex=j}j=d.faces.length;if(c)for(c=0;c<x;c++){u=a.uvs[c];q=A[l++];z=u[q*2];q=u[q*2+1];d.faceUvs[c][j]=new THREE.UV(z,q)}if(e)for(c=0;c<x;c++){u=a.uvs[c];r=[];for(e=0;e<k;e++){q=A[l++];z=u[q*2];q=u[q*2+1];r[e]=new THREE.UV(z,q)}d.faceVertexUvs[c][j]=r}if(n){n=A[l++]*3;e=new THREE.Vector3;e.x=v[n++];e.y=v[n++];
+e.z=v[n];p.normal=e}if(o)for(c=0;c<k;c++){n=A[l++]*3;e=new THREE.Vector3;e.x=v[n++];e.y=v[n++];e.z=v[n];p.vertexNormals.push(e)}if(m){o=A[l++];o=new THREE.Color(D[o]);p.color=o}if(b)for(c=0;c<k;c++){o=A[l++];o=new THREE.Color(D[o]);p.vertexColors.push(o)}d.faces.push(p)}})(e);(function(){var b,c,e,j;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b=b+2){e=a.skinWeights[b];j=a.skinWeights[b+1];d.skinWeights.push(new THREE.Vector4(e,j,0,0))}}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b=
+b+2){e=a.skinIndices[b];j=a.skinIndices[b+1];d.skinIndices.push(new THREE.Vector4(e,j,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,j,l,h,k;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];h=d.morphTargets[c].vertices;k=a.morphTargets[c].vertices;j=0;for(l=k.length;j<l;j=j+3){var o=new THREE.Vector3;o.x=k[j]*b;o.y=k[j+1]*b;o.z=k[j+2]*b;h.push(o)}}}if(a.morphColors!==
+void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;h=a.morphColors[c].colors;b=0;for(j=h.length;b<j;b=b+3){k=new THREE.Color(16755200);k.setRGB(h[b],h[b+1],h[b+2]);l.push(k)}}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:i+"/"+a}function e(){var a;for(o in t.objects)if(!w.objects[o]){u=t.objects[o];if(u.geometry!==void 0){if(C=w.geometries[u.geometry]){a=false;H=w.materials[u.materials[0]];(a=H instanceof THREE.ShaderMaterial)&&C.computeTangents();v=u.position;D=u.rotation;x=u.quaternion;G=u.scale;r=u.matrix;x=0;u.materials.length==0&&(H=new THREE.MeshFaceMaterial);u.materials.length>1&&(H=new THREE.MeshFaceMaterial);
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function e(){var a;for(o in t.objects)if(!w.objects[o]){u=t.objects[o];if(u.geometry!==void 0){if(C=w.geometries[u.geometry]){a=false;H=w.materials[u.materials[0]];(a=H instanceof THREE.ShaderMaterial)&&C.computeTangents();v=u.position;D=u.rotation;x=u.quaternion;G=u.scale;r=u.matrix;x=0;u.materials.length==0&&(H=new THREE.MeshFaceMaterial);u.materials.length>1&&(H=new THREE.MeshFaceMaterial);
 a=new THREE.Mesh(C,H);a.name=o;if(r){a.matrixAutoUpdate=false;a.matrix.set(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}else{a.position.set(v[0],v[1],v[2]);if(x){a.quaternion.set(x[0],x[1],x[2],x[3]);a.useQuaternion=true}else a.rotation.set(D[0],D[1],D[2]);a.scale.set(G[0],G[1],G[2])}a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;w.scene.add(a);w.objects[o]=a}}else{v=u.position;D=u.rotation;x=u.quaternion;
-G=u.scale;x=0;a=new THREE.Object3D;a.name=o;a.position.set(v[0],v[1],v[2]);if(x){a.quaternion.set(x[0],x[1],x[2],x[3]);a.useQuaternion=true}else a.rotation.set(D[0],D[1],D[2]);a.scale.set(G[0],G[1],G[2]);a.visible=u.visible!==void 0?u.visible:false;w.scene.add(a);w.objects[o]=a;w.empties[o]=a}}}function f(a){return function(b){w.geometries[a]=b;e();F=F-1;m.onLoadComplete();k()}}function g(a){return function(b){w.geometries[a]=b}}function k(){m.callbackProgress({totalModels:Q,totalTextures:O,loadedModels:Q-
-F,loadedTextures:O-I},w);m.onLoadProgress();F==0&&I==0&&b(w)}var m=this,i=THREE.Loader.prototype.extractUrlBase(c),h,j,o,n,q,l,p,u,r,z,A,v,D,x,G,s,y,C,H,R,N,t,E,F,I,Q,O,w;t=a;c=new THREE.BinaryLoader;E=new THREE.JSONLoader;I=F=0;w={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(t.transform){a=t.transform.position;z=t.transform.rotation;s=t.transform.scale;a&&w.scene.position.set(a[0],a[1],a[2]);z&&w.scene.rotation.set(z[0],z[1],
-z[2]);s&&w.scene.scale.set(s[0],s[1],s[2]);if(a||z||s){w.scene.updateMatrix();w.scene.updateMatrixWorld()}}a=function(){I=I-1;k();m.onLoadComplete()};for(q in t.cameras){s=t.cameras[q];s.type=="perspective"?R=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):s.type=="ortho"&&(R=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far));v=s.position;z=s.target;s=s.up;R.position.set(v[0],v[1],v[2]);R.target=new THREE.Vector3(z[0],z[1],z[2]);s&&R.up.set(s[0],s[1],s[2]);w.cameras[q]=
-R}for(n in t.lights){z=t.lights[n];q=z.color!==void 0?z.color:16777215;R=z.intensity!==void 0?z.intensity:1;if(z.type=="directional"){v=z.direction;A=new THREE.DirectionalLight(q,R);A.position.set(v[0],v[1],v[2]);A.position.normalize()}else if(z.type=="point"){v=z.position;A=z.distance;A=new THREE.PointLight(q,R,A);A.position.set(v[0],v[1],v[2])}else z.type=="ambient"&&(A=new THREE.AmbientLight(q));w.scene.add(A);w.lights[n]=A}for(l in t.fogs){n=t.fogs[l];n.type=="linear"?N=new THREE.Fog(0,n.near,
-n.far):n.type=="exp2"&&(N=new THREE.FogExp2(0,n.density));s=n.color;N.color.setRGB(s[0],s[1],s[2]);w.fogs[l]=N}if(w.cameras&&t.defaults.camera)w.currentCamera=w.cameras[t.defaults.camera];if(w.fogs&&t.defaults.fog)w.scene.fog=w.fogs[t.defaults.fog];s=t.defaults.bgcolor;w.bgColor=new THREE.Color;w.bgColor.setRGB(s[0],s[1],s[2]);w.bgColorAlpha=t.defaults.bgalpha;for(h in t.geometries){l=t.geometries[h];if(l.type=="bin_mesh"||l.type=="ascii_mesh"){F=F+1;m.onLoadStart()}}Q=F;for(h in t.geometries){l=
-t.geometries[h];if(l.type=="cube"){C=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides);w.geometries[h]=C}else if(l.type=="plane"){C=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight);w.geometries[h]=C}else if(l.type=="sphere"){C=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight);w.geometries[h]=C}else if(l.type=="cylinder"){C=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,
-l.heightSegs);w.geometries[h]=C}else if(l.type=="torus"){C=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT);w.geometries[h]=C}else if(l.type=="icosahedron"){C=new THREE.IcosahedronGeometry(l.radius,l.subdivisions);w.geometries[h]=C}else if(l.type=="bin_mesh")c.load(d(l.url,t.urlBaseType),f(h));else if(l.type=="ascii_mesh")E.load(d(l.url,t.urlBaseType),f(h));else if(l.type=="embedded_mesh"){l=t.embeds[l.id];l.metadata=t.metadata;l&&E.createModel(l,g(h),"")}}for(p in t.textures){h=t.textures[p];
-if(h.url instanceof Array){I=I+h.url.length;for(l=0;l<h.url.length;l++)m.onLoadStart()}else{I=I+1;m.onLoadStart()}}O=I;for(p in t.textures){h=t.textures[p];if(h.mapping!=void 0&&THREE[h.mapping]!=void 0)h.mapping=new THREE[h.mapping];if(h.url instanceof Array){l=[];for(N=0;N<h.url.length;N++)l[N]=d(h.url[N],t.urlBaseType);l=THREE.ImageUtils.loadTextureCube(l,h.mapping,a)}else{l=THREE.ImageUtils.loadTexture(d(h.url,t.urlBaseType),h.mapping,a);if(THREE[h.minFilter]!=void 0)l.minFilter=THREE[h.minFilter];
-if(THREE[h.magFilter]!=void 0)l.magFilter=THREE[h.magFilter];if(h.repeat){l.repeat.set(h.repeat[0],h.repeat[1]);if(h.repeat[0]!=1)l.wrapS=THREE.RepeatWrapping;if(h.repeat[1]!=1)l.wrapT=THREE.RepeatWrapping}h.offset&&l.offset.set(h.offset[0],h.offset[1]);if(h.wrap){N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(N[h.wrap[0]]!==void 0)l.wrapS=N[h.wrap[0]];if(N[h.wrap[1]]!==void 0)l.wrapT=N[h.wrap[1]]}}w.textures[p]=l}for(j in t.materials){r=t.materials[j];for(y in r.parameters)if(y==
+G=u.scale;x=0;a=new THREE.Object3D;a.name=o;a.position.set(v[0],v[1],v[2]);if(x){a.quaternion.set(x[0],x[1],x[2],x[3]);a.useQuaternion=true}else a.rotation.set(D[0],D[1],D[2]);a.scale.set(G[0],G[1],G[2]);a.visible=u.visible!==void 0?u.visible:false;w.scene.add(a);w.objects[o]=a;w.empties[o]=a}}}function f(a){return function(b){w.geometries[a]=b;e();F=F-1;j.onLoadComplete();i()}}function g(a){return function(b){w.geometries[a]=b}}function i(){j.callbackProgress({totalModels:Q,totalTextures:O,loadedModels:Q-
+F,loadedTextures:O-I},w);j.onLoadProgress();F==0&&I==0&&b(w)}var j=this,l=THREE.Loader.prototype.extractUrlBase(c),h,k,o,n,q,m,p,u,r,z,A,v,D,x,G,s,y,C,H,R,N,t,E,F,I,Q,O,w;t=a;c=new THREE.BinaryLoader;E=new THREE.JSONLoader;I=F=0;w={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(t.transform){a=t.transform.position;z=t.transform.rotation;s=t.transform.scale;a&&w.scene.position.set(a[0],a[1],a[2]);z&&w.scene.rotation.set(z[0],z[1],
+z[2]);s&&w.scene.scale.set(s[0],s[1],s[2]);if(a||z||s){w.scene.updateMatrix();w.scene.updateMatrixWorld()}}a=function(){I=I-1;i();j.onLoadComplete()};for(q in t.cameras){s=t.cameras[q];s.type=="perspective"?R=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):s.type=="ortho"&&(R=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far));v=s.position;z=s.target;s=s.up;R.position.set(v[0],v[1],v[2]);R.target=new THREE.Vector3(z[0],z[1],z[2]);s&&R.up.set(s[0],s[1],s[2]);w.cameras[q]=
+R}for(n in t.lights){z=t.lights[n];q=z.color!==void 0?z.color:16777215;R=z.intensity!==void 0?z.intensity:1;if(z.type=="directional"){v=z.direction;A=new THREE.DirectionalLight(q,R);A.position.set(v[0],v[1],v[2]);A.position.normalize()}else if(z.type=="point"){v=z.position;A=z.distance;A=new THREE.PointLight(q,R,A);A.position.set(v[0],v[1],v[2])}else z.type=="ambient"&&(A=new THREE.AmbientLight(q));w.scene.add(A);w.lights[n]=A}for(m in t.fogs){n=t.fogs[m];n.type=="linear"?N=new THREE.Fog(0,n.near,
+n.far):n.type=="exp2"&&(N=new THREE.FogExp2(0,n.density));s=n.color;N.color.setRGB(s[0],s[1],s[2]);w.fogs[m]=N}if(w.cameras&&t.defaults.camera)w.currentCamera=w.cameras[t.defaults.camera];if(w.fogs&&t.defaults.fog)w.scene.fog=w.fogs[t.defaults.fog];s=t.defaults.bgcolor;w.bgColor=new THREE.Color;w.bgColor.setRGB(s[0],s[1],s[2]);w.bgColorAlpha=t.defaults.bgalpha;for(h in t.geometries){m=t.geometries[h];if(m.type=="bin_mesh"||m.type=="ascii_mesh"){F=F+1;j.onLoadStart()}}Q=F;for(h in t.geometries){m=
+t.geometries[h];if(m.type=="cube"){C=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);w.geometries[h]=C}else if(m.type=="plane"){C=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight);w.geometries[h]=C}else if(m.type=="sphere"){C=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight);w.geometries[h]=C}else if(m.type=="cylinder"){C=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,
+m.heightSegs);w.geometries[h]=C}else if(m.type=="torus"){C=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT);w.geometries[h]=C}else if(m.type=="icosahedron"){C=new THREE.IcosahedronGeometry(m.radius,m.subdivisions);w.geometries[h]=C}else if(m.type=="bin_mesh")c.load(d(m.url,t.urlBaseType),f(h));else if(m.type=="ascii_mesh")E.load(d(m.url,t.urlBaseType),f(h));else if(m.type=="embedded_mesh"){m=t.embeds[m.id];m.metadata=t.metadata;m&&E.createModel(m,g(h),"")}}for(p in t.textures){h=t.textures[p];
+if(h.url instanceof Array){I=I+h.url.length;for(m=0;m<h.url.length;m++)j.onLoadStart()}else{I=I+1;j.onLoadStart()}}O=I;for(p in t.textures){h=t.textures[p];if(h.mapping!=void 0&&THREE[h.mapping]!=void 0)h.mapping=new THREE[h.mapping];if(h.url instanceof Array){m=[];for(N=0;N<h.url.length;N++)m[N]=d(h.url[N],t.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,h.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(h.url,t.urlBaseType),h.mapping,a);if(THREE[h.minFilter]!=void 0)m.minFilter=THREE[h.minFilter];
+if(THREE[h.magFilter]!=void 0)m.magFilter=THREE[h.magFilter];if(h.repeat){m.repeat.set(h.repeat[0],h.repeat[1]);if(h.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(h.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}h.offset&&m.offset.set(h.offset[0],h.offset[1]);if(h.wrap){N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(N[h.wrap[0]]!==void 0)m.wrapS=N[h.wrap[0]];if(N[h.wrap[1]]!==void 0)m.wrapT=N[h.wrap[1]]}}w.textures[p]=m}for(k in t.materials){r=t.materials[k];for(y in r.parameters)if(y==
 "envMap"||y=="map"||y=="lightMap")r.parameters[y]=w.textures[r.parameters[y]];else if(y=="shading")r.parameters[y]=r.parameters[y]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(y=="blending")r.parameters[y]=THREE[r.parameters[y]]?THREE[r.parameters[y]]:THREE.NormalBlending;else if(y=="combine")r.parameters[y]=r.parameters[y]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(y=="vertexColors")if(r.parameters[y]=="face")r.parameters[y]=THREE.FaceColors;else if(r.parameters[y])r.parameters[y]=
-THREE.VertexColors;if(r.parameters.opacity!==void 0&&r.parameters.opacity<1)r.parameters.transparent=true;if(r.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);h=r.parameters.color;l=r.parameters.specular;N=r.parameters.ambient;c=r.parameters.shininess;a.tNormal.texture=w.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map){a.tDiffuse.texture=r.parameters.map;a.enableDiffuse.value=
-true}if(r.parameters.lightMap){a.tAO.texture=r.parameters.lightMap;a.enableAO.value=true}if(r.parameters.specularMap){a.tSpecular.texture=w.textures[r.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(h);a.uSpecularColor.value.setHex(l);a.uAmbientColor.value.setHex(N);a.uShininess.value=c;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:true,fog:true})}else H=
-new THREE[r.type](r.parameters);w.materials[j]=H}e();m.callbackSync(w);k()};
+THREE.VertexColors;if(r.parameters.opacity!==void 0&&r.parameters.opacity<1)r.parameters.transparent=true;if(r.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);h=r.parameters.color;m=r.parameters.specular;N=r.parameters.ambient;c=r.parameters.shininess;a.tNormal.texture=w.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map){a.tDiffuse.texture=r.parameters.map;a.enableDiffuse.value=
+true}if(r.parameters.lightMap){a.tAO.texture=r.parameters.lightMap;a.enableAO.value=true}if(r.parameters.specularMap){a.tSpecular.texture=w.textures[r.parameters.specularMap];a.enableSpecular.value=true}a.uDiffuseColor.value.setHex(h);a.uSpecularColor.value.setHex(m);a.uAmbientColor.value.setHex(N);a.uShininess.value=c;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:true,fog:true})}else H=
+new THREE[r.type](r.parameters);w.materials[k]=H}e();j.callbackSync(w);i()};
 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:false;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.blendSrc=a.blendSrc!==void 0?a.blendSrc:THREE.SrcAlphaFactor;this.blendDst=a.blendDst!==void 0?a.blendDst:THREE.OneMinusSrcAlphaFactor;this.blendEquation=a.blendEquation!==void 0?a.blendEquation:THREE.AddEquation;this.depthTest=a.depthTest!==void 0?
 a.depthTest:true;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:true;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:false;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:false;this.needsUpdate=this.visible=true};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.CustomBlending=6;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;
@@ -175,10 +182,10 @@ a.morphTargets:false;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:fa
 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:false;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:true;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:false;this.fog=a.fog!==void 0?a.fog:true};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.Texture=function(a,b,c,d,e,f,g,k){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=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=k!==void 0?k:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
+THREE.Texture=function(a,b,c,d,e,f,g,i){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=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=i!==void 0?i:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
 true;this.needsUpdate=this.premultiplyAlpha=false;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.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=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.UnsignedByteType=9;THREE.ByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;
-THREE.UnsignedShort4444Type=16;THREE.UnsignedShort5551Type=17;THREE.UnsignedShort565Type=18;THREE.AlphaFormat=19;THREE.RGBFormat=20;THREE.RGBAFormat=21;THREE.LuminanceFormat=22;THREE.LuminanceAlphaFormat=23;THREE.DataTexture=function(a,b,c,d,e,f,g,k,m,i){THREE.Texture.call(this,null,f,g,k,m,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedShort4444Type=16;THREE.UnsignedShort5551Type=17;THREE.UnsignedShort565Type=18;THREE.AlphaFormat=19;THREE.RGBFormat=20;THREE.RGBAFormat=21;THREE.LuminanceFormat=22;THREE.LuminanceAlphaFormat=23;THREE.DataTexture=function(a,b,c,d,e,f,g,i,j,l){THREE.Texture.call(this,null,f,g,i,j,l,d,e);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.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:true});if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(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);
@@ -191,35 +198,35 @@ THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topC
 THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=false;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 if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(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.CanvasRenderer=function(a){function b(a){if(r!=a)l.globalAlpha=r=a}function c(a){if(z!=a){switch(a){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}z=a}}function d(a){if(A!=a)l.strokeStyle=A=a}function e(a){if(v!=a)l.fillStyle=v=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,k,m,i=new THREE.Projector,h=a.canvas!==
-void 0?a.canvas:document.createElement("canvas"),j,o,n,q,l=h.getContext("2d"),p=new THREE.Color(0),u=0,r=1,z=0,A=null,v=null,D=null,x=null,G=null,s,y,C,H,R=new THREE.RenderableVertex,N=new THREE.RenderableVertex,t,E,F,I,Q,O,w,P,M,U,T,W,B=new THREE.Color,K=new THREE.Color,J=new THREE.Color,L=new THREE.Color,S=new THREE.Color,ja=[],da=[],ea,fa,ca,ka,za,Aa,Ba,Ca,Da,Ea,la=new THREE.Rectangle,$=new THREE.Rectangle,Z=new THREE.Rectangle,xa=false,Y=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,V=
-new THREE.Vector3,ra,sa,ya,aa,ta,ua,a=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);ya=sa.getImageData(0,0,2,2);aa=ya.data;ta=document.createElement("canvas");ta.width=ta.height=a;ua=ta.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){j=a;o=b;n=Math.floor(j/2);q=Math.floor(o/
-2);h.width=j;h.height=o;la.set(-n,-q,n,q);$.set(-n,-q,n,q);r=1;z=0;G=x=D=v=A=null};this.setClearColor=function(a,b){p.copy(a);u=b!==void 0?b:1;$.set(-n,-q,n,q)};this.setClearColorHex=function(a,b){p.setHex(a);u=b!==void 0?b:1;$.set(-n,-q,n,q)};this.clear=function(){l.setTransform(1,0,0,-1,n,q);if(!$.isEmpty()){$.minSelf(la);$.inflate(2);u<1&&l.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()));if(u>0){c(THREE.NormalBlending);b(1);e("rgba("+Math.floor(p.r*
-255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+u+")");l.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))}$.empty()}};this.render=function(a,h){function j(a){var b,c,d,e;Y.setRGB(0,0,0);ma.setRGB(0,0,0);na.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){Y.r=Y.r+e.r;Y.g=Y.g+e.g;Y.b=Y.b+e.b}else if(d instanceof THREE.DirectionalLight){ma.r=ma.r+e.r;ma.g=ma.g+e.g;ma.b=ma.b+e.b}else if(d instanceof
-THREE.PointLight){na.r=na.r+e.r;na.g=na.g+e.g;na.b=na.b+e.b}}}function o(a,b,c,d){var e,f,g,h,l,i;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){l=g.matrixWorld.getPosition();i=c.dot(l);if(!(i<=0)){i=i*g.intensity;d.r=d.r+h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}else if(g instanceof THREE.PointLight){l=g.matrixWorld.getPosition();i=c.dot(V.sub(l,b).normalize());if(!(i<=0)){i=i*(g.distance==0?1:1-Math.min(b.distanceTo(l)/g.distance,1));if(i!=0){i=i*g.intensity;d.r=d.r+
-h.r*i;d.g=d.g+h.g*i;d.b=d.b+h.b*i}}}}}function p(a,f,g){b(g.opacity);c(g.blending);var h,i,k,m,o,j;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){m=g.map.image;o=m.width>>1;j=m.height>>1;g=f.scale.x*n;k=f.scale.y*q;h=g*o;i=k*j;Z.set(a.x-h,a.y-i,a.x+h,a.y+i);if(la.intersects(Z)){l.save();l.translate(a.x,a.y);l.rotate(-f.rotation);l.scale(g,-k);l.translate(-o,-j);l.drawImage(m,0,0);l.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=f.scale.x*n;i=f.scale.y*q;Z.set(a.x-h,a.y-i,
-a.x+h,a.y+i);if(la.intersects(Z)){d(g.color.getContextStyle());e(g.color.getContextStyle());l.save();l.translate(a.x,a.y);l.rotate(-f.rotation);l.scale(h,i);g.program(l);l.restore()}}}function r(a,e,f,g){b(g.opacity);c(g.blending);l.beginPath();l.moveTo(a.positionScreen.x,a.positionScreen.y);l.lineTo(e.positionScreen.x,e.positionScreen.y);l.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(D!=a)l.lineWidth=D=a;a=g.linecap;if(x!=a)l.lineCap=x=a;a=g.linejoin;if(G!=a)l.lineJoin=G=
-a;d(g.color.getContextStyle());l.stroke();Z.inflate(g.linewidth*2)}}function u(a,d,e,g,i,l,k,j){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(j.opacity);c(j.blending);t=a.positionScreen.x;E=a.positionScreen.y;F=d.positionScreen.x;I=d.positionScreen.y;Q=e.positionScreen.x;O=e.positionScreen.y;z(t,E,F,I,Q,O);if(j instanceof THREE.MeshBasicMaterial)if(j.map){if(j.map.mapping instanceof THREE.UVMapping){ka=k.uvs[0];Fa(t,E,F,I,Q,O,ka[g].u,ka[g].v,ka[i].u,ka[i].v,ka[l].u,ka[l].v,
-j.map)}}else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=h.matrixWorldInverse;V.copy(k.vertexNormalsWorld[g]);za=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Aa=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(k.vertexNormalsWorld[i]);Ba=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ca=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(k.vertexNormalsWorld[l]);Da=(V.x*a.elements[0]+
-V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ea=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;Fa(t,E,F,I,Q,O,za,Aa,Ba,Ca,Da,Ea,j.envMap)}}else j.wireframe?ha(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(j.color);else if(j instanceof THREE.MeshLambertMaterial)if(xa)if(!j.wireframe&&j.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3){K.r=J.r=L.r=Y.r;K.g=J.g=L.g=Y.g;K.b=J.b=L.b=Y.b;o(m,k.v1.positionWorld,k.vertexNormalsWorld[0],K);o(m,k.v2.positionWorld,
-k.vertexNormalsWorld[1],J);o(m,k.v3.positionWorld,k.vertexNormalsWorld[2],L);K.r=Math.max(0,Math.min(j.color.r*K.r,1));K.g=Math.max(0,Math.min(j.color.g*K.g,1));K.b=Math.max(0,Math.min(j.color.b*K.b,1));J.r=Math.max(0,Math.min(j.color.r*J.r,1));J.g=Math.max(0,Math.min(j.color.g*J.g,1));J.b=Math.max(0,Math.min(j.color.b*J.b,1));L.r=Math.max(0,Math.min(j.color.r*L.r,1));L.g=Math.max(0,Math.min(j.color.g*L.g,1));L.b=Math.max(0,Math.min(j.color.b*L.b,1));S.r=(J.r+L.r)*0.5;S.g=(J.g+L.g)*0.5;S.b=(J.b+L.b)*
-0.5;ca=va(K,J,L,S);pa(t,E,F,I,Q,O,0,0,1,0,0,1,ca)}else{B.r=Y.r;B.g=Y.g;B.b=Y.b;o(m,k.centroidWorld,k.normalWorld,B);B.r=Math.max(0,Math.min(j.color.r*B.r,1));B.g=Math.max(0,Math.min(j.color.g*B.g,1));B.b=Math.max(0,Math.min(j.color.b*B.b,1));j.wireframe?ha(B,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(B)}else j.wireframe?ha(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(j.color);else if(j instanceof THREE.MeshDepthMaterial){ea=h.near;fa=h.far;K.r=K.g=K.b=
-1-oa(a.positionScreen.z,ea,fa);J.r=J.g=J.b=1-oa(d.positionScreen.z,ea,fa);L.r=L.g=L.b=1-oa(e.positionScreen.z,ea,fa);S.r=(J.r+L.r)*0.5;S.g=(J.g+L.g)*0.5;S.b=(J.b+L.b)*0.5;ca=va(K,J,L,S);pa(t,E,F,I,Q,O,0,0,1,0,0,1,ca)}else if(j instanceof THREE.MeshNormalMaterial){B.r=qa(k.normalWorld.x);B.g=qa(k.normalWorld.y);B.b=qa(k.normalWorld.z);j.wireframe?ha(B,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(B)}}function v(a,d,e,g,i,k,l,j,n){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;
-b(j.opacity);c(j.blending);if(j.map||j.envMap){u(a,d,g,0,1,3,l,j,n);u(i,e,k,1,2,3,l,j,n)}else{t=a.positionScreen.x;E=a.positionScreen.y;F=d.positionScreen.x;I=d.positionScreen.y;Q=e.positionScreen.x;O=e.positionScreen.y;w=g.positionScreen.x;P=g.positionScreen.y;M=i.positionScreen.x;U=i.positionScreen.y;T=k.positionScreen.x;W=k.positionScreen.y;if(j instanceof THREE.MeshBasicMaterial){A(t,E,F,I,Q,O,w,P);j.wireframe?ha(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(j.color)}else if(j instanceof
-THREE.MeshLambertMaterial)if(xa)if(!j.wireframe&&j.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==4){K.r=J.r=L.r=S.r=Y.r;K.g=J.g=L.g=S.g=Y.g;K.b=J.b=L.b=S.b=Y.b;o(m,l.v1.positionWorld,l.vertexNormalsWorld[0],K);o(m,l.v2.positionWorld,l.vertexNormalsWorld[1],J);o(m,l.v4.positionWorld,l.vertexNormalsWorld[3],L);o(m,l.v3.positionWorld,l.vertexNormalsWorld[2],S);K.r=Math.max(0,Math.min(j.color.r*K.r,1));K.g=Math.max(0,Math.min(j.color.g*K.g,1));K.b=Math.max(0,Math.min(j.color.b*K.b,1));J.r=
-Math.max(0,Math.min(j.color.r*J.r,1));J.g=Math.max(0,Math.min(j.color.g*J.g,1));J.b=Math.max(0,Math.min(j.color.b*J.b,1));L.r=Math.max(0,Math.min(j.color.r*L.r,1));L.g=Math.max(0,Math.min(j.color.g*L.g,1));L.b=Math.max(0,Math.min(j.color.b*L.b,1));S.r=Math.max(0,Math.min(j.color.r*S.r,1));S.g=Math.max(0,Math.min(j.color.g*S.g,1));S.b=Math.max(0,Math.min(j.color.b*S.b,1));ca=va(K,J,L,S);z(t,E,F,I,w,P);pa(t,E,F,I,w,P,0,0,1,0,0,1,ca);z(M,U,Q,O,T,W);pa(M,U,Q,O,T,W,1,0,1,1,0,1,ca)}else{B.r=Y.r;B.g=Y.g;
-B.b=Y.b;o(m,l.centroidWorld,l.normalWorld,B);B.r=Math.max(0,Math.min(j.color.r*B.r,1));B.g=Math.max(0,Math.min(j.color.g*B.g,1));B.b=Math.max(0,Math.min(j.color.b*B.b,1));A(t,E,F,I,Q,O,w,P);j.wireframe?ha(B,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(B)}else{A(t,E,F,I,Q,O,w,P);j.wireframe?ha(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(j.color)}else if(j instanceof THREE.MeshNormalMaterial){B.r=qa(l.normalWorld.x);B.g=qa(l.normalWorld.y);B.b=qa(l.normalWorld.z);
-A(t,E,F,I,Q,O,w,P);j.wireframe?ha(B,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(B)}else if(j instanceof THREE.MeshDepthMaterial){ea=h.near;fa=h.far;K.r=K.g=K.b=1-oa(a.positionScreen.z,ea,fa);J.r=J.g=J.b=1-oa(d.positionScreen.z,ea,fa);L.r=L.g=L.b=1-oa(g.positionScreen.z,ea,fa);S.r=S.g=S.b=1-oa(e.positionScreen.z,ea,fa);ca=va(K,J,L,S);z(t,E,F,I,w,P);pa(t,E,F,I,w,P,0,0,1,0,0,1,ca);z(M,U,Q,O,T,W);pa(M,U,Q,O,T,W,1,0,1,1,0,1,ca)}}}function z(a,b,c,d,e,f){l.beginPath();l.moveTo(a,b);
-l.lineTo(c,d);l.lineTo(e,f);l.lineTo(a,b)}function A(a,b,c,d,e,f,g,h){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,f);l.lineTo(g,h);l.lineTo(a,b)}function ha(a,b,c,e){if(D!=b)l.lineWidth=D=b;if(x!=c)l.lineCap=x=c;if(G!=e)l.lineJoin=G=e;d(a.getContextStyle());l.stroke();Z.inflate(b*2)}function ga(a){e(a.getContextStyle());l.fill()}function Fa(a,b,c,d,f,g,h,i,j,k,m,o,n){if(!(n.image===void 0||n.image.width===0)){if(n.needsUpdate===true||ja[n.id]===void 0){var p=n.wrapS==THREE.RepeatWrapping,
-q=n.wrapT==THREE.RepeatWrapping;ja[n.id]=l.createPattern(n.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");n.needsUpdate=false}e(ja[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,r=n.image.width*n.repeat.x,s=n.image.height*n.repeat.y,h=(h+p)*r,i=(i+q)*s,c=c-a,d=d-b,f=f-a,g=g-b,j=(j+p)*r-h,k=(k+q)*s-i,m=(m+p)*r-h,o=(o+q)*s-i,p=j*o-m*k;if(p==0){if(da[n.id]===void 0){b=document.createElement("canvas");b.width=n.image.width;b.height=n.image.height;b=b.getContext("2d");b.drawImage(n.image,
-0,0);da[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data}b=da[n.id];h=(Math.floor(h)+Math.floor(i)*n.image.width)*4;B.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ga(B)}else{p=1/p;n=(o*c-k*f)*p;k=(o*d-k*g)*p;c=(j*f-m*c)*p;d=(j*g-m*d)*p;a=a-n*h-c*i;h=b-k*h-d*i;l.save();l.transform(n,k,c,d,a,h);l.fill();l.restore()}}}function pa(a,b,c,d,e,f,g,h,i,j,k,m,n){var o,p;o=n.width-1;p=n.height-1;g=g*o;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;i=i*o-g;j=j*p-h;k=k*o-g;m=m*p-h;p=1/(i*m-k*j);o=(m*c-j*e)*p;j=(m*d-j*f)*
-p;c=(i*e-k*c)*p;d=(i*f-k*d)*p;a=a-o*g-c*h;b=b-j*g-d*h;l.save();l.transform(o,j,c,d,a,b);l.clip();l.drawImage(n,0,0);l.restore()}function va(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);aa[0]=e<0?0:e>255?255:e;aa[1]=f<0?0:f>255?255:f;aa[2]=a<0?0:a>255?255:a;aa[4]=g<0?0:g>255?255:g;aa[5]=h<0?0:h>255?255:h;aa[6]=b<0?0:b>255?255:b;aa[8]=i<0?0:i>255?255:i;aa[9]=j<0?0:
-j>255?255:j;aa[10]=c<0?0:c>255?255:c;aa[12]=k<0?0:k>255?255:k;aa[13]=l<0?0:l>255?255:l;aa[14]=d<0?0:d>255?255:d;sa.putImageData(ya,0,0);ua.drawImage(ra,0,0);return ta}function oa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function qa(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,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var wa,Ga,X,ba;this.autoClear?this.clear():l.setTransform(1,0,0,-1,n,q);f.info.render.vertices=0;f.info.render.faces=
-0;g=i.projectScene(a,h,this.sortElements);k=g.elements;m=g.lights;(xa=m.length>0)&&j(m);wa=0;for(Ga=k.length;wa<Ga;wa++){X=k[wa];ba=X.material;ba=ba instanceof THREE.MeshFaceMaterial?X.faceMaterial:ba;if(!(ba===void 0||ba.visible===false)){Z.empty();if(X instanceof THREE.RenderableParticle){s=X;s.x=s.x*n;s.y=s.y*q;p(s,X,ba,a)}else if(X instanceof THREE.RenderableLine){s=X.v1;y=X.v2;s.positionScreen.x=s.positionScreen.x*n;s.positionScreen.y=s.positionScreen.y*q;y.positionScreen.x=y.positionScreen.x*
+THREE.CanvasRenderer=function(a){function b(a){if(r!=a)m.globalAlpha=r=a}function c(a){if(z!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}z=a}}function d(a){if(A!=a)m.strokeStyle=A=a}function e(a){if(v!=a)m.fillStyle=v=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,i,j,l=new THREE.Projector,h=a.canvas!==
+void 0?a.canvas:document.createElement("canvas"),k,o,n,q,m=h.getContext("2d"),p=new THREE.Color(0),u=0,r=1,z=0,A=null,v=null,D=null,x=null,G=null,s,y,C,H,R=new THREE.RenderableVertex,N=new THREE.RenderableVertex,t,E,F,I,Q,O,w,P,M,U,T,W,B=new THREE.Color,K=new THREE.Color,J=new THREE.Color,L=new THREE.Color,S=new THREE.Color,ja=[],da=[],ea,fa,ca,ka,za,Aa,Ba,Ca,Da,Ea,la=new THREE.Rectangle,$=new THREE.Rectangle,Z=new THREE.Rectangle,xa=false,Y=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,V=
+new THREE.Vector3,ra,sa,ya,aa,ta,ua,a=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);ya=sa.getImageData(0,0,2,2);aa=ya.data;ta=document.createElement("canvas");ta.width=ta.height=a;ua=ta.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){k=a;o=b;n=Math.floor(k/2);q=Math.floor(o/
+2);h.width=k;h.height=o;la.set(-n,-q,n,q);$.set(-n,-q,n,q);r=1;z=0;G=x=D=v=A=null};this.setClearColor=function(a,b){p.copy(a);u=b!==void 0?b:1;$.set(-n,-q,n,q)};this.setClearColorHex=function(a,b){p.setHex(a);u=b!==void 0?b:1;$.set(-n,-q,n,q)};this.clear=function(){m.setTransform(1,0,0,-1,n,q);if(!$.isEmpty()){$.minSelf(la);$.inflate(2);u<1&&m.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()));if(u>0){c(THREE.NormalBlending);b(1);e("rgba("+Math.floor(p.r*
+255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+u+")");m.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))}$.empty()}};this.render=function(a,h){function k(a){var b,c,d,e;Y.setRGB(0,0,0);ma.setRGB(0,0,0);na.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++){d=a[b];e=d.color;if(d instanceof THREE.AmbientLight){Y.r=Y.r+e.r;Y.g=Y.g+e.g;Y.b=Y.b+e.b}else if(d instanceof THREE.DirectionalLight){ma.r=ma.r+e.r;ma.g=ma.g+e.g;ma.b=ma.b+e.b}else if(d instanceof
+THREE.PointLight){na.r=na.r+e.r;na.g=na.g+e.g;na.b=na.b+e.b}}}function o(a,b,c,d){var e,f,g,h,i,j;e=0;for(f=a.length;e<f;e++){g=a[e];h=g.color;if(g instanceof THREE.DirectionalLight){i=g.matrixWorld.getPosition();j=c.dot(i);if(!(j<=0)){j=j*g.intensity;d.r=d.r+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}else if(g instanceof THREE.PointLight){i=g.matrixWorld.getPosition();j=c.dot(V.sub(i,b).normalize());if(!(j<=0)){j=j*(g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1));if(j!=0){j=j*g.intensity;d.r=d.r+
+h.r*j;d.g=d.g+h.g*j;d.b=d.b+h.b*j}}}}}function p(a,f,g){b(g.opacity);c(g.blending);var h,i,j,l,k,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map){l=g.map.image;k=l.width>>1;o=l.height>>1;g=f.scale.x*n;j=f.scale.y*q;h=g*k;i=j*o;Z.set(a.x-h,a.y-i,a.x+h,a.y+i);if(la.intersects(Z)){m.save();m.translate(a.x,a.y);m.rotate(-f.rotation);m.scale(g,-j);m.translate(-k,-o);m.drawImage(l,0,0);m.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){h=f.scale.x*n;i=f.scale.y*q;Z.set(a.x-h,a.y-i,
+a.x+h,a.y+i);if(la.intersects(Z)){d(g.color.getContextStyle());e(g.color.getContextStyle());m.save();m.translate(a.x,a.y);m.rotate(-f.rotation);m.scale(h,i);g.program(m);m.restore()}}}function r(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(D!=a)m.lineWidth=D=a;a=g.linecap;if(x!=a)m.lineCap=x=a;a=g.linejoin;if(G!=a)m.lineJoin=G=
+a;d(g.color.getContextStyle());m.stroke();Z.inflate(g.linewidth*2)}}function u(a,d,e,g,i,l,m,k){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(k.opacity);c(k.blending);t=a.positionScreen.x;E=a.positionScreen.y;F=d.positionScreen.x;I=d.positionScreen.y;Q=e.positionScreen.x;O=e.positionScreen.y;z(t,E,F,I,Q,O);if(k instanceof THREE.MeshBasicMaterial)if(k.map){if(k.map.mapping instanceof THREE.UVMapping){ka=m.uvs[0];Fa(t,E,F,I,Q,O,ka[g].u,ka[g].v,ka[i].u,ka[i].v,ka[l].u,ka[l].v,
+k.map)}}else if(k.envMap){if(k.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=h.matrixWorldInverse;V.copy(m.vertexNormalsWorld[g]);za=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Aa=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(m.vertexNormalsWorld[i]);Ba=(V.x*a.elements[0]+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ca=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;V.copy(m.vertexNormalsWorld[l]);Da=(V.x*a.elements[0]+
+V.y*a.elements[4]+V.z*a.elements[8])*0.5+0.5;Ea=-(V.x*a.elements[1]+V.y*a.elements[5]+V.z*a.elements[9])*0.5+0.5;Fa(t,E,F,I,Q,O,za,Aa,Ba,Ca,Da,Ea,k.envMap)}}else k.wireframe?ha(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(k.color);else if(k instanceof THREE.MeshLambertMaterial)if(xa)if(!k.wireframe&&k.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3){K.r=J.r=L.r=Y.r;K.g=J.g=L.g=Y.g;K.b=J.b=L.b=Y.b;o(j,m.v1.positionWorld,m.vertexNormalsWorld[0],K);o(j,m.v2.positionWorld,
+m.vertexNormalsWorld[1],J);o(j,m.v3.positionWorld,m.vertexNormalsWorld[2],L);K.r=Math.max(0,Math.min(k.color.r*K.r,1));K.g=Math.max(0,Math.min(k.color.g*K.g,1));K.b=Math.max(0,Math.min(k.color.b*K.b,1));J.r=Math.max(0,Math.min(k.color.r*J.r,1));J.g=Math.max(0,Math.min(k.color.g*J.g,1));J.b=Math.max(0,Math.min(k.color.b*J.b,1));L.r=Math.max(0,Math.min(k.color.r*L.r,1));L.g=Math.max(0,Math.min(k.color.g*L.g,1));L.b=Math.max(0,Math.min(k.color.b*L.b,1));S.r=(J.r+L.r)*0.5;S.g=(J.g+L.g)*0.5;S.b=(J.b+L.b)*
+0.5;ca=va(K,J,L,S);pa(t,E,F,I,Q,O,0,0,1,0,0,1,ca)}else{B.r=Y.r;B.g=Y.g;B.b=Y.b;o(j,m.centroidWorld,m.normalWorld,B);B.r=Math.max(0,Math.min(k.color.r*B.r,1));B.g=Math.max(0,Math.min(k.color.g*B.g,1));B.b=Math.max(0,Math.min(k.color.b*B.b,1));k.wireframe?ha(B,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(B)}else k.wireframe?ha(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(k.color);else if(k instanceof THREE.MeshDepthMaterial){ea=h.near;fa=h.far;K.r=K.g=K.b=
+1-oa(a.positionScreen.z,ea,fa);J.r=J.g=J.b=1-oa(d.positionScreen.z,ea,fa);L.r=L.g=L.b=1-oa(e.positionScreen.z,ea,fa);S.r=(J.r+L.r)*0.5;S.g=(J.g+L.g)*0.5;S.b=(J.b+L.b)*0.5;ca=va(K,J,L,S);pa(t,E,F,I,Q,O,0,0,1,0,0,1,ca)}else if(k instanceof THREE.MeshNormalMaterial){B.r=qa(m.normalWorld.x);B.g=qa(m.normalWorld.y);B.b=qa(m.normalWorld.z);k.wireframe?ha(B,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(B)}}function v(a,d,e,g,i,l,m,k,n){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;
+b(k.opacity);c(k.blending);if(k.map||k.envMap){u(a,d,g,0,1,3,m,k,n);u(i,e,l,1,2,3,m,k,n)}else{t=a.positionScreen.x;E=a.positionScreen.y;F=d.positionScreen.x;I=d.positionScreen.y;Q=e.positionScreen.x;O=e.positionScreen.y;w=g.positionScreen.x;P=g.positionScreen.y;M=i.positionScreen.x;U=i.positionScreen.y;T=l.positionScreen.x;W=l.positionScreen.y;if(k instanceof THREE.MeshBasicMaterial){A(t,E,F,I,Q,O,w,P);k.wireframe?ha(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(k.color)}else if(k instanceof
+THREE.MeshLambertMaterial)if(xa)if(!k.wireframe&&k.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4){K.r=J.r=L.r=S.r=Y.r;K.g=J.g=L.g=S.g=Y.g;K.b=J.b=L.b=S.b=Y.b;o(j,m.v1.positionWorld,m.vertexNormalsWorld[0],K);o(j,m.v2.positionWorld,m.vertexNormalsWorld[1],J);o(j,m.v4.positionWorld,m.vertexNormalsWorld[3],L);o(j,m.v3.positionWorld,m.vertexNormalsWorld[2],S);K.r=Math.max(0,Math.min(k.color.r*K.r,1));K.g=Math.max(0,Math.min(k.color.g*K.g,1));K.b=Math.max(0,Math.min(k.color.b*K.b,1));J.r=
+Math.max(0,Math.min(k.color.r*J.r,1));J.g=Math.max(0,Math.min(k.color.g*J.g,1));J.b=Math.max(0,Math.min(k.color.b*J.b,1));L.r=Math.max(0,Math.min(k.color.r*L.r,1));L.g=Math.max(0,Math.min(k.color.g*L.g,1));L.b=Math.max(0,Math.min(k.color.b*L.b,1));S.r=Math.max(0,Math.min(k.color.r*S.r,1));S.g=Math.max(0,Math.min(k.color.g*S.g,1));S.b=Math.max(0,Math.min(k.color.b*S.b,1));ca=va(K,J,L,S);z(t,E,F,I,w,P);pa(t,E,F,I,w,P,0,0,1,0,0,1,ca);z(M,U,Q,O,T,W);pa(M,U,Q,O,T,W,1,0,1,1,0,1,ca)}else{B.r=Y.r;B.g=Y.g;
+B.b=Y.b;o(j,m.centroidWorld,m.normalWorld,B);B.r=Math.max(0,Math.min(k.color.r*B.r,1));B.g=Math.max(0,Math.min(k.color.g*B.g,1));B.b=Math.max(0,Math.min(k.color.b*B.b,1));A(t,E,F,I,Q,O,w,P);k.wireframe?ha(B,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(B)}else{A(t,E,F,I,Q,O,w,P);k.wireframe?ha(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(k.color)}else if(k instanceof THREE.MeshNormalMaterial){B.r=qa(m.normalWorld.x);B.g=qa(m.normalWorld.y);B.b=qa(m.normalWorld.z);
+A(t,E,F,I,Q,O,w,P);k.wireframe?ha(B,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(B)}else if(k instanceof THREE.MeshDepthMaterial){ea=h.near;fa=h.far;K.r=K.g=K.b=1-oa(a.positionScreen.z,ea,fa);J.r=J.g=J.b=1-oa(d.positionScreen.z,ea,fa);L.r=L.g=L.b=1-oa(g.positionScreen.z,ea,fa);S.r=S.g=S.b=1-oa(e.positionScreen.z,ea,fa);ca=va(K,J,L,S);z(t,E,F,I,w,P);pa(t,E,F,I,w,P,0,0,1,0,0,1,ca);z(M,U,Q,O,T,W);pa(M,U,Q,O,T,W,1,0,1,1,0,1,ca)}}}function z(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);
+m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b)}function A(a,b,c,d,e,f,g,h){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,h);m.lineTo(a,b)}function ha(a,b,c,e){if(D!=b)m.lineWidth=D=b;if(x!=c)m.lineCap=x=c;if(G!=e)m.lineJoin=G=e;d(a.getContextStyle());m.stroke();Z.inflate(b*2)}function ga(a){e(a.getContextStyle());m.fill()}function Fa(a,b,c,d,f,g,h,i,j,k,l,o,n){if(!(n.image===void 0||n.image.width===0)){if(n.needsUpdate===true||ja[n.id]===void 0){var p=n.wrapS==THREE.RepeatWrapping,
+q=n.wrapT==THREE.RepeatWrapping;ja[n.id]=m.createPattern(n.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");n.needsUpdate=false}e(ja[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,r=n.image.width*n.repeat.x,s=n.image.height*n.repeat.y,h=(h+p)*r,i=(i+q)*s,c=c-a,d=d-b,f=f-a,g=g-b,j=(j+p)*r-h,k=(k+q)*s-i,l=(l+p)*r-h,o=(o+q)*s-i,p=j*o-l*k;if(p==0){if(da[n.id]===void 0){b=document.createElement("canvas");b.width=n.image.width;b.height=n.image.height;b=b.getContext("2d");b.drawImage(n.image,
+0,0);da[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data}b=da[n.id];h=(Math.floor(h)+Math.floor(i)*n.image.width)*4;B.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ga(B)}else{p=1/p;n=(o*c-k*f)*p;k=(o*d-k*g)*p;c=(j*f-l*c)*p;d=(j*g-l*d)*p;a=a-n*h-c*i;h=b-k*h-d*i;m.save();m.transform(n,k,c,d,a,h);m.fill();m.restore()}}}function pa(a,b,c,d,e,f,g,h,i,j,k,l,n){var o,p;o=n.width-1;p=n.height-1;g=g*o;h=h*p;c=c-a;d=d-b;e=e-a;f=f-b;i=i*o-g;j=j*p-h;k=k*o-g;l=l*p-h;p=1/(i*l-k*j);o=(l*c-j*e)*p;j=(l*d-j*f)*
+p;c=(i*e-k*c)*p;d=(i*f-k*d)*p;a=a-o*g-c*h;b=b-j*g-d*h;m.save();m.transform(o,j,c,d,a,b);m.clip();m.drawImage(n,0,0);m.restore()}function va(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);aa[0]=e<0?0:e>255?255:e;aa[1]=f<0?0:f>255?255:f;aa[2]=a<0?0:a>255?255:a;aa[4]=g<0?0:g>255?255:g;aa[5]=h<0?0:h>255?255:h;aa[6]=b<0?0:b>255?255:b;aa[8]=i<0?0:i>255?255:i;aa[9]=j<0?0:
+j>255?255:j;aa[10]=c<0?0:c>255?255:c;aa[12]=k<0?0:k>255?255:k;aa[13]=l<0?0:l>255?255:l;aa[14]=d<0?0:d>255?255:d;sa.putImageData(ya,0,0);ua.drawImage(ra,0,0);return ta}function oa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function qa(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,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var wa,Ga,X,ba;this.autoClear?this.clear():m.setTransform(1,0,0,-1,n,q);f.info.render.vertices=0;f.info.render.faces=
+0;g=l.projectScene(a,h,this.sortElements);i=g.elements;j=g.lights;(xa=j.length>0)&&k(j);wa=0;for(Ga=i.length;wa<Ga;wa++){X=i[wa];ba=X.material;ba=ba instanceof THREE.MeshFaceMaterial?X.faceMaterial:ba;if(!(ba===void 0||ba.visible===false)){Z.empty();if(X instanceof THREE.RenderableParticle){s=X;s.x=s.x*n;s.y=s.y*q;p(s,X,ba,a)}else if(X instanceof THREE.RenderableLine){s=X.v1;y=X.v2;s.positionScreen.x=s.positionScreen.x*n;s.positionScreen.y=s.positionScreen.y*q;y.positionScreen.x=y.positionScreen.x*
 n;y.positionScreen.y=y.positionScreen.y*q;Z.addPoint(s.positionScreen.x,s.positionScreen.y);Z.addPoint(y.positionScreen.x,y.positionScreen.y);la.intersects(Z)&&r(s,y,X,ba,a)}else if(X instanceof THREE.RenderableFace3){s=X.v1;y=X.v2;C=X.v3;s.positionScreen.x=s.positionScreen.x*n;s.positionScreen.y=s.positionScreen.y*q;y.positionScreen.x=y.positionScreen.x*n;y.positionScreen.y=y.positionScreen.y*q;C.positionScreen.x=C.positionScreen.x*n;C.positionScreen.y=C.positionScreen.y*q;if(ba.overdraw){ia(s.positionScreen,
 y.positionScreen);ia(y.positionScreen,C.positionScreen);ia(C.positionScreen,s.positionScreen)}Z.add3Points(s.positionScreen.x,s.positionScreen.y,y.positionScreen.x,y.positionScreen.y,C.positionScreen.x,C.positionScreen.y);la.intersects(Z)&&u(s,y,C,0,1,2,X,ba,a)}else if(X instanceof THREE.RenderableFace4){s=X.v1;y=X.v2;C=X.v3;H=X.v4;s.positionScreen.x=s.positionScreen.x*n;s.positionScreen.y=s.positionScreen.y*q;y.positionScreen.x=y.positionScreen.x*n;y.positionScreen.y=y.positionScreen.y*q;C.positionScreen.x=
 C.positionScreen.x*n;C.positionScreen.y=C.positionScreen.y*q;H.positionScreen.x=H.positionScreen.x*n;H.positionScreen.y=H.positionScreen.y*q;R.positionScreen.copy(y.positionScreen);N.positionScreen.copy(H.positionScreen);if(ba.overdraw){ia(s.positionScreen,y.positionScreen);ia(y.positionScreen,H.positionScreen);ia(H.positionScreen,s.positionScreen);ia(C.positionScreen,R.positionScreen);ia(C.positionScreen,N.positionScreen)}Z.addPoint(s.positionScreen.x,s.positionScreen.y);Z.addPoint(y.positionScreen.x,
-y.positionScreen.y);Z.addPoint(C.positionScreen.x,C.positionScreen.y);Z.addPoint(H.positionScreen.x,H.positionScreen.y);la.intersects(Z)&&v(s,y,C,H,R,N,X,ba,a)}$.addRectangle(Z)}}l.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=true};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+y.positionScreen.y);Z.addPoint(C.positionScreen.x,C.positionScreen.y);Z.addPoint(H.positionScreen.x,H.positionScreen.y);la.intersects(Z)&&v(s,y,C,H,R,N,X,ba,a)}$.addRectangle(Z)}}m.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=true};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};

+ 1 - 1
build/custom/ThreeExtras.js

@@ -230,7 +230,7 @@ for(f=0;f<this.faces.length;f++){i=this.faces[f];this.faceVertexUvs[0].push([d(t
 THREE.AxisHelper=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3);b.vertices.push(new THREE.Vector3(0,100,0));var a=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(a,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(a,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(a,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=new THREE.Object3D;THREE.AxisHelper.prototype.constructor=THREE.AxisHelper;
 THREE.ArrowHelper=function(b,a,c,d){THREE.Object3D.call(this);d===void 0&&(d=16776960);c===void 0&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);if(a instanceof THREE.Vector3)this.position=
-a;this.setDirection(b);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(b){var a=(new THREE.Vector3(0,1,0)).crossSelf(b),b=Math.acos((new THREE.Vector3(0,1,0)).dot(b.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(a.normalize(),b);this.rotation.getRotationFromMatrix(this.matrix,this.scale)};
+a;this.setDirection(b);this.setLength(c)};THREE.ArrowHelper.prototype=new THREE.Object3D;THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper;THREE.ArrowHelper.prototype.setDirection=function(b){var a=(new THREE.Vector3(0,1,0)).crossSelf(b),b=Math.acos((new THREE.Vector3(0,1,0)).dot(b.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(a.normalize(),b);this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
 THREE.ArrowHelper.prototype.setLength=function(b){this.scale.set(b,b,b)};THREE.ArrowHelper.prototype.setColor=function(b){this.line.material.color.setHex(b);this.cone.material.color.setHex(b)};
 THREE.CameraHelper=function(b){function a(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vector3);d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(d.pointMap[a]=[]);d.pointMap[a].push(d.lineGeometry.vertices.length-1)}THREE.Object3D.call(this);var d=this;this.lineGeometry=new THREE.Geometry;this.lineMaterial=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.pointMap={};a("n1","n2",16755200);a("n2","n4",16755200);a("n4",
 "n3",16755200);a("n3","n1",16755200);a("f1","f2",16755200);a("f2","f4",16755200);a("f4","f3",16755200);a("f3","f1",16755200);a("n1","f1",16755200);a("n2","f2",16755200);a("n3","f3",16755200);a("n4","f4",16755200);a("p","n1",16711680);a("p","n2",16711680);a("p","n3",16711680);a("p","n4",16711680);a("u1","u2",43775);a("u2","u3",43775);a("u3","u1",43775);a("c","t",16777215);a("p","c",3355443);a("cn1","cn2",3355443);a("cn3","cn4",3355443);a("cf1","cf2",3355443);a("cf3","cf4",3355443);this.camera=b;this.update(b);

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 139 - 132
build/custom/ThreeWebGL.js


+ 276 - 276
examples/webgl_geometry_extrude_splines.html

@@ -1,394 +1,394 @@
 
 <!doctype html>
 <html lang="en">
-  <head>
-    <title>three.js webgl - geometry - shapes</title>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-    <style>
-      body {
-        font-family: Monospace;
-        background-color: #f0f0f0;
-        margin: 0px;
-        overflow: hidden;
-      }
-    </style>
-  </head>
-  <body>
-  
-    <script src="../build/Three.js"></script>
-    <script src="../src/extras/core/Curve.js"></script>
-    <script src="../src/extras/geometries/TubeGeometry.js"></script>
-    <script src="../src/extras/helpers/CameraHelper.js"></script>
-
-    <!-- where curves formulas are defined -->
-    <script src="js/CurveExtras.js"></script>
-
-    <script src="js/Stats.js"></script>
-
-
-    <script>
-    var container, stats;
+	<head>
+		<title>three.js webgl - geometry - shapes</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+		<style>
+			body {
+				font-family: Monospace;
+				background-color: #f0f0f0;
+				margin: 0px;
+				overflow: hidden;
+			}
+		</style>
+	</head>
+	<body>
+	
+		<script src="../build/Three.js"></script>
+		<script src="../src/extras/core/Curve.js"></script>
+		<script src="../src/extras/geometries/TubeGeometry.js"></script>
+		<script src="../src/extras/helpers/CameraHelper.js"></script>
+
+		<!-- where curves formulas are defined -->
+		<script src="js/CurveExtras.js"></script>
+
+		<script src="js/Stats.js"></script>
+
+
+		<script>
+		var container, stats;
 
-    var camera, scene, renderer, splineCamera, cameraHelper, cameraEye;
+		var camera, scene, renderer, splineCamera, cameraHelper, cameraEye;
 
-    var text, plane;
+		var text, plane;
 
-    var targetRotation = 0;
-    var targetRotationOnMouseDown = 0;
+		var targetRotation = 0;
+		var targetRotationOnMouseDown = 0;
 
-    var mouseX = 0;
-    var mouseXOnMouseDown = 0;
+		var mouseX = 0;
+		var mouseXOnMouseDown = 0;
 
-    var windowHalfX = window.innerWidth / 2;
-    var windowHalfY = window.innerHeight / 2;
-
-    var binormal = new THREE.Vector3();
-    var normal = new THREE.Vector3();
-
-
-    var pipeSpline = new THREE.SplineCurve3([
-        new THREE.Vector3(0, 10, -10), new THREE.Vector3(10, 0, -10), new THREE.Vector3(20, 0, 0), new THREE.Vector3(30, 0, 10), new THREE.Vector3(30, 0, 20), new THREE.Vector3(20, 0, 30), new THREE.Vector3(10, 0, 30), new THREE.Vector3(0, 0, 30), new THREE.Vector3(-10, 10, 30), new THREE.Vector3(-10, 20, 30), new THREE.Vector3(0, 30, 30), new THREE.Vector3(10, 30, 30), new THREE.Vector3(20, 30, 15), new THREE.Vector3(10, 30, 10), new THREE.Vector3(0, 30, 10), new THREE.Vector3(-10, 20, 10), new THREE.Vector3(-10, 10, 10), new THREE.Vector3(0, 0, 10), new THREE.Vector3(10, -10, 10), new THREE.Vector3(20, -15, 10), new THREE.Vector3(30, -15, 10), new THREE.Vector3(40, -15, 10), new THREE.Vector3(50, -15, 10), new THREE.Vector3(60, 0, 10), new THREE.Vector3(70, 0, 0), new THREE.Vector3(80, 0, 0), new THREE.Vector3(90, 0, 0), new THREE.Vector3(100, 0, 0)]);
-
-    var sampleClosedSpline = new THREE.ClosedSplineCurve3([
-      new THREE.Vector3(0, -40, -40),
-      new THREE.Vector3(0, 40, -40),
-      new THREE.Vector3(0, 140, -40),
-      new THREE.Vector3(0, 40, 40),
-      new THREE.Vector3(0, -40, 40),
-    ]);
+		var windowHalfX = window.innerWidth / 2;
+		var windowHalfY = window.innerHeight / 2;
+
+		var binormal = new THREE.Vector3();
+		var normal = new THREE.Vector3();
+
+
+		var pipeSpline = new THREE.SplineCurve3([
+				new THREE.Vector3(0, 10, -10), new THREE.Vector3(10, 0, -10), new THREE.Vector3(20, 0, 0), new THREE.Vector3(30, 0, 10), new THREE.Vector3(30, 0, 20), new THREE.Vector3(20, 0, 30), new THREE.Vector3(10, 0, 30), new THREE.Vector3(0, 0, 30), new THREE.Vector3(-10, 10, 30), new THREE.Vector3(-10, 20, 30), new THREE.Vector3(0, 30, 30), new THREE.Vector3(10, 30, 30), new THREE.Vector3(20, 30, 15), new THREE.Vector3(10, 30, 10), new THREE.Vector3(0, 30, 10), new THREE.Vector3(-10, 20, 10), new THREE.Vector3(-10, 10, 10), new THREE.Vector3(0, 0, 10), new THREE.Vector3(10, -10, 10), new THREE.Vector3(20, -15, 10), new THREE.Vector3(30, -15, 10), new THREE.Vector3(40, -15, 10), new THREE.Vector3(50, -15, 10), new THREE.Vector3(60, 0, 10), new THREE.Vector3(70, 0, 0), new THREE.Vector3(80, 0, 0), new THREE.Vector3(90, 0, 0), new THREE.Vector3(100, 0, 0)]);
+
+		var sampleClosedSpline = new THREE.ClosedSplineCurve3([
+			new THREE.Vector3(0, -40, -40),
+			new THREE.Vector3(0, 40, -40),
+			new THREE.Vector3(0, 140, -40),
+			new THREE.Vector3(0, 40, 40),
+			new THREE.Vector3(0, -40, 40),
+		]);
 
-    // Keep a diction of Curve instances
-    var splines = {
-      GrannyKnot: new THREE.Curves.GrannyKnot(),
-      HeartCurve: new THREE.Curves.HeartCurve(3.5),
-      VivianiCurve: new THREE.Curves.VivianiCurve(70),
-      KnotCurve: new THREE.Curves.KnotCurve(),
-      HelixCurve: new THREE.Curves.HelixCurve(),
-      TrefoilKnot: new THREE.Curves.TrefoilKnot(),
-      TorusKnot: new THREE.Curves.TorusKnot(20),
-      CinquefoilKnot: new THREE.Curves.CinquefoilKnot(20),
-      TrefoilPolynomialKnot: new THREE.Curves.TrefoilPolynomialKnot(14),
-      FigureEightPolynomialKnot: new THREE.Curves.FigureEightPolynomialKnot(),
-      DecoratedTorusKnot4a: new THREE.Curves.DecoratedTorusKnot4a(),
-      DecoratedTorusKnot4b: new THREE.Curves.DecoratedTorusKnot4b(),
-      DecoratedTorusKnot5a: new THREE.Curves.DecoratedTorusKnot5a(),
-      DecoratedTorusKnot5c: new THREE.Curves.DecoratedTorusKnot5c(),
-      PipeSpline: pipeSpline,
-      SampleClosedSpline: sampleClosedSpline
-    };
+		// Keep a dictionary of Curve instances
+		var splines = {
+			GrannyKnot: new THREE.Curves.GrannyKnot(),
+			HeartCurve: new THREE.Curves.HeartCurve(3.5),
+			VivianiCurve: new THREE.Curves.VivianiCurve(70),
+			KnotCurve: new THREE.Curves.KnotCurve(),
+			HelixCurve: new THREE.Curves.HelixCurve(),
+			TrefoilKnot: new THREE.Curves.TrefoilKnot(),
+			TorusKnot: new THREE.Curves.TorusKnot(20),
+			CinquefoilKnot: new THREE.Curves.CinquefoilKnot(20),
+			TrefoilPolynomialKnot: new THREE.Curves.TrefoilPolynomialKnot(14),
+			FigureEightPolynomialKnot: new THREE.Curves.FigureEightPolynomialKnot(),
+			DecoratedTorusKnot4a: new THREE.Curves.DecoratedTorusKnot4a(),
+			DecoratedTorusKnot4b: new THREE.Curves.DecoratedTorusKnot4b(),
+			DecoratedTorusKnot5a: new THREE.Curves.DecoratedTorusKnot5a(),
+			DecoratedTorusKnot5c: new THREE.Curves.DecoratedTorusKnot5c(),
+			PipeSpline: pipeSpline,
+			SampleClosedSpline: sampleClosedSpline
+		};
 
 
 
 
-    extrudePath = new THREE.Curves.TrefoilKnot();
+		extrudePath = new THREE.Curves.TrefoilKnot();
 
-    var dropdown = '<select id="dropdown" onchange="addTube(this.value)">';
+		var dropdown = '<select id="dropdown" onchange="addTube(this.value)">';
 
-    var s;
-    for ( s in splines ) {
-      dropdown += '<option value="' + s + '"';
-      dropdown += '>' + s + '</option>';
-    }
+		var s;
+		for ( s in splines ) {
+			dropdown += '<option value="' + s + '"';
+			dropdown += '>' + s + '</option>';
+		}
 
-    dropdown += '</select>';
+		dropdown += '</select>';
 
-    var closed2 = true;
-    var debug = true;
-    var parent;
-    var tube, tubeMesh;
-    var animation = false, lookAhead = false;
-    var scale;
-    var showCameraHelper = false;
+		var closed2 = true;
+		var debug = true;
+		var parent;
+		var tube, tubeMesh;
+		var animation = false, lookAhead = false;
+		var scale;
+		var showCameraHelper = false;
 
-    function addTube() {
+		function addTube() {
 
-      var value = document.getElementById('dropdown').value;
-      
-      var segments = parseInt(document.getElementById('segments').value);
-      closed2 = document.getElementById('closed').checked;
-      debug = document.getElementById('debug').checked;
+			var value = document.getElementById('dropdown').value;
+			
+			var segments = parseInt(document.getElementById('segments').value);
+			closed2 = document.getElementById('closed').checked;
+			debug = document.getElementById('debug').checked;
 
-      var radiusSegments = parseInt(document.getElementById('radiusSegments').value);
+			var radiusSegments = parseInt(document.getElementById('radiusSegments').value);
 
-      console.log('adding tube', value, closed2, debug, radiusSegments);
-      if (tubeMesh) parent.remove(tubeMesh);
+			console.log('adding tube', value, closed2, debug, radiusSegments);
+			if (tubeMesh) parent.remove(tubeMesh);
 
-      extrudePath = splines[value];
-      
-      tube = new THREE.TubeGeometry(extrudePath, segments, 2, radiusSegments, closed2, debug);
+			extrudePath = splines[value];
+			
+			tube = new THREE.TubeGeometry(extrudePath, segments, 2, radiusSegments, closed2, debug);
 
-      addGeometry(tube, 0xff00ff);
-      setScale();
-    
-    }
+			addGeometry(tube, 0xff00ff);
+			setScale();
+		
+		}
 
-    function setScale() {
+		function setScale() {
 
-      scale = parseInt(document.getElementById('scale').value);
-      tubeMesh.scale.set(scale, scale, scale);
+			scale = parseInt(document.getElementById('scale').value);
+			tubeMesh.scale.set(scale, scale, scale);
 
-    }
+		}
 
 
-    function addGeometry(geometry, color) {
+		function addGeometry(geometry, color) {
 
-        // 3d shape
-        tubeMesh = THREE.SceneUtils.createMultiMaterialObject(geometry, [
-          new THREE.MeshLambertMaterial({
-              color: color,
-              opacity: (geometry.debug) ? 0.2 : 0.8,
-              transparent: true
-          }),
-         new THREE.MeshBasicMaterial({
-            color: 0x000000,
-            opacity: 0.5,
-            wireframe: true
-        })]);
+				// 3d shape
+				tubeMesh = THREE.SceneUtils.createMultiMaterialObject(geometry, [
+					new THREE.MeshLambertMaterial({
+							color: color,
+							opacity: (geometry.debug) ? 0.2 : 0.8,
+							transparent: true
+					}),
+				 new THREE.MeshBasicMaterial({
+						color: 0x000000,
+						opacity: 0.5,
+						wireframe: true
+				})]);
 
-        if (geometry.debug) tubeMesh.add(geometry.debug);
+				if (geometry.debug) tubeMesh.add(geometry.debug);
 
-        //mesh.children[0].doubleSided = true;
-        parent.add(tubeMesh);
+				//mesh.children[0].doubleSided = true;
+				parent.add(tubeMesh);
 
-    }
+		}
 
-    function animateCamera(toggle) {
+		function animateCamera(toggle) {
 
-      if (toggle) {
-        animation = !animation;
-        document.getElementById('animation').value = 'Camera Spline Animation View: ' + (animation? 'ON': 'OFF');
-      }
-      
-      lookAhead = document.getElementById('lookAhead').checked;
+			if (toggle) {
+				animation = !animation;
+				document.getElementById('animation').value = 'Camera Spline Animation View: ' + (animation? 'ON': 'OFF');
+			}
+			
+			lookAhead = document.getElementById('lookAhead').checked;
 
-      showCameraHelper = document.getElementById('cameraHelper').checked;
+			showCameraHelper = document.getElementById('cameraHelper').checked;
 
-      cameraHelper.children[0].visible = showCameraHelper;
-      cameraEye.visible = showCameraHelper;
-    }
+			cameraHelper.children[0].visible = showCameraHelper;
+			cameraEye.visible = showCameraHelper;
+		}
 
 
-    init();
-    animate();
+		init();
+		animate();
 
-    function init() {
+		function init() {
 
-      container = document.createElement('div');
-      document.body.appendChild(container);
+			container = document.createElement('div');
+			document.body.appendChild(container);
 
-      var info = document.createElement('div');
-      info.style.position = 'absolute';
-      info.style.top = '10px';
-      info.style.width = '100%';
-      info.style.textAlign = 'center';
-      info.innerHTML = 'Spline Extrusion Examples by <a href="http://www.lab4games.net/zz85/blog">zz85</a><br/>Select spline:';
+			var info = document.createElement('div');
+			info.style.position = 'absolute';
+			info.style.top = '10px';
+			info.style.width = '100%';
+			info.style.textAlign = 'center';
+			info.innerHTML = 'Spline Extrusion Examples by <a href="http://www.lab4games.net/zz85/blog">zz85</a><br/>Select spline:';
 
-      info.innerHTML += dropdown;
+			info.innerHTML += dropdown;
 
-      info.innerHTML += '<br/>Scale: <select id="scale" onchange="setScale()"><option>1</option><option>2</option><option selected>4</option><option>6</option><option>10</option></select>';
-      info.innerHTML += '<br/>Extrusion Segments: <select onchange="addTube()" id="segments"><option>50</option><option selected>100</option><option>200</option><option>400</option></select>';
-      info.innerHTML += '<br/>Radius Segments: <select id="radiusSegments" onchange="addTube()"><option>1</option><option>2</option><option selected>3</option><option>4</option><option>5</option><option>6</option><option>8</option><option>12</option></select>';
-      info.innerHTML += '<br/>Debug normals: <input id="debug" type="checkbox" onchange="addTube()"  /> Closed:<input id="closed" onchange="addTube()" type="checkbox" checked />';
+			info.innerHTML += '<br/>Scale: <select id="scale" onchange="setScale()"><option>1</option><option>2</option><option selected>4</option><option>6</option><option>10</option></select>';
+			info.innerHTML += '<br/>Extrusion Segments: <select onchange="addTube()" id="segments"><option>50</option><option selected>100</option><option>200</option><option>400</option></select>';
+			info.innerHTML += '<br/>Radius Segments: <select id="radiusSegments" onchange="addTube()"><option>1</option><option>2</option><option selected>3</option><option>4</option><option>5</option><option>6</option><option>8</option><option>12</option></select>';
+			info.innerHTML += '<br/>Debug normals: <input id="debug" type="checkbox" onchange="addTube()"  /> Closed:<input id="closed" onchange="addTube()" type="checkbox" checked />';
 
-      info.innerHTML += '<br/><br/><input id="animation" type="button" onclick="animateCamera(true)" value="Camera Spline Animation View: OFF"/><br/> Look Ahead <input id="lookAhead" type="checkbox" onchange="animateCamera()" /> Camera Helper <input id="cameraHelper" type="checkbox" onchange="animateCamera()" />';
+			info.innerHTML += '<br/><br/><input id="animation" type="button" onclick="animateCamera(true)" value="Camera Spline Animation View: OFF"/><br/> Look Ahead <input id="lookAhead" type="checkbox" onchange="animateCamera()" /> Camera Helper <input id="cameraHelper" type="checkbox" onchange="animateCamera()" />';
 
-      container.appendChild(info);
+			container.appendChild(info);
 
-      scene = new THREE.Scene();
+			scene = new THREE.Scene();
 
-      // 
-      camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 1000);
-      splineCamera = new THREE.PerspectiveCamera(84, window.innerWidth / window.innerHeight, 0.01, 1000);
-      cameraHelper = new THREE.CameraHelper(splineCamera);
+			// 
+			camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 1000);
+			splineCamera = new THREE.PerspectiveCamera(84, window.innerWidth / window.innerHeight, 0.01, 1000);
+			cameraHelper = new THREE.CameraHelper(splineCamera);
 
-      camera.position.set(0, 50, 500);
-      
-      scene.add(camera);
+			camera.position.set(0, 50, 500);
+			
+			scene.add(camera);
 
-      
-      var light = new THREE.DirectionalLight(0xffffff);
-      light.position.set(0, 0, 1);
-      scene.add(light);
+			
+			var light = new THREE.DirectionalLight(0xffffff);
+			light.position.set(0, 0, 1);
+			scene.add(light);
 
-      parent = new THREE.Object3D();
-      parent.position.y = 100;
-      scene.add(parent);
+			parent = new THREE.Object3D();
+			parent.position.y = 100;
+			scene.add(parent);
 
-      addTube();
+			addTube();
 
-      // Debug point
-      cameraEye = new THREE.Mesh(new THREE.SphereGeometry(5), new THREE.MeshBasicMaterial({
-          color: 0xdddddd
-      }));
+			// Debug point
+			cameraEye = new THREE.Mesh(new THREE.SphereGeometry(5), new THREE.MeshBasicMaterial({
+					color: 0xdddddd
+			}));
 
-      cameraHelper.children[0].visible = showCameraHelper;
-      cameraEye.visible = showCameraHelper;
+			cameraHelper.children[0].visible = showCameraHelper;
+			cameraEye.visible = showCameraHelper;
 
-      parent.add(cameraEye);
+			parent.add(cameraEye);
 
-      cameraHelper.scale.multiplyScalar(0.1);
-      splineCamera.add(cameraHelper);
-      parent.add(splineCamera);
+			cameraHelper.scale.multiplyScalar(0.1);
+			splineCamera.add(cameraHelper);
+			parent.add(splineCamera);
 
-      //
-      renderer = new THREE.WebGLRenderer({
-          antialias: true
-      });
-      renderer.setSize(window.innerWidth, window.innerHeight);
+			//
+			renderer = new THREE.WebGLRenderer({
+					antialias: true
+			});
+			renderer.setSize(window.innerWidth, window.innerHeight);
 
-      container.appendChild(renderer.domElement);
+			container.appendChild(renderer.domElement);
 
-      stats = new Stats();
-      stats.domElement.style.position = 'absolute';
-      stats.domElement.style.top = '0px';
-      container.appendChild(stats.domElement);
+			stats = new Stats();
+			stats.domElement.style.position = 'absolute';
+			stats.domElement.style.top = '0px';
+			container.appendChild(stats.domElement);
 
-      renderer.domElement.addEventListener('mousedown', onDocumentMouseDown, false);
-      renderer.domElement.addEventListener('touchstart', onDocumentTouchStart, false);
-      renderer.domElement.addEventListener('touchmove', onDocumentTouchMove, false);
+			renderer.domElement.addEventListener('mousedown', onDocumentMouseDown, false);
+			renderer.domElement.addEventListener('touchstart', onDocumentTouchStart, false);
+			renderer.domElement.addEventListener('touchmove', onDocumentTouchMove, false);
 
-    }
+		}
 
-    //
+		//
 
-    function onDocumentMouseDown(event) {
+		function onDocumentMouseDown(event) {
 
-      event.preventDefault();
+			event.preventDefault();
 
-      renderer.domElement.addEventListener('mousemove', onDocumentMouseMove, false);
-      renderer.domElement.addEventListener('mouseup', onDocumentMouseUp, false);
-      renderer.domElement.addEventListener('mouseout', onDocumentMouseOut, false);
+			renderer.domElement.addEventListener('mousemove', onDocumentMouseMove, false);
+			renderer.domElement.addEventListener('mouseup', onDocumentMouseUp, false);
+			renderer.domElement.addEventListener('mouseout', onDocumentMouseOut, false);
 
-      mouseXOnMouseDown = event.clientX - windowHalfX;
-      targetRotationOnMouseDown = targetRotation;
+			mouseXOnMouseDown = event.clientX - windowHalfX;
+			targetRotationOnMouseDown = targetRotation;
 
-    }
+		}
 
-    function onDocumentMouseMove(event) {
+		function onDocumentMouseMove(event) {
 
-      mouseX = event.clientX - windowHalfX;
+			mouseX = event.clientX - windowHalfX;
 
-      targetRotation = targetRotationOnMouseDown + (mouseX - mouseXOnMouseDown) * 0.02;
+			targetRotation = targetRotationOnMouseDown + (mouseX - mouseXOnMouseDown) * 0.02;
 
-    }
+		}
 
-    function onDocumentMouseUp(event) {
+		function onDocumentMouseUp(event) {
 
-      renderer.domElement.removeEventListener('mousemove', onDocumentMouseMove, false);
-      renderer.domElement.removeEventListener('mouseup', onDocumentMouseUp, false);
-      renderer.domElement.removeEventListener('mouseout', onDocumentMouseOut, false);
+			renderer.domElement.removeEventListener('mousemove', onDocumentMouseMove, false);
+			renderer.domElement.removeEventListener('mouseup', onDocumentMouseUp, false);
+			renderer.domElement.removeEventListener('mouseout', onDocumentMouseOut, false);
 
-    }
+		}
 
-    function onDocumentMouseOut(event) {
+		function onDocumentMouseOut(event) {
 
-      renderer.domElement.removeEventListener('mousemove', onDocumentMouseMove, false);
-      renderer.domElement.removeEventListener('mouseup', onDocumentMouseUp, false);
-      renderer.domElement.removeEventListener('mouseout', onDocumentMouseOut, false);
+			renderer.domElement.removeEventListener('mousemove', onDocumentMouseMove, false);
+			renderer.domElement.removeEventListener('mouseup', onDocumentMouseUp, false);
+			renderer.domElement.removeEventListener('mouseout', onDocumentMouseOut, false);
 
-    }
+		}
 
-    function onDocumentTouchStart(event) {
+		function onDocumentTouchStart(event) {
 
-      if (event.touches.length == 1) {
+			if (event.touches.length == 1) {
 
-          event.preventDefault();
+					event.preventDefault();
 
-          mouseXOnMouseDown = event.touches[0].pageX - windowHalfX;
-          targetRotationOnMouseDown = targetRotation;
+					mouseXOnMouseDown = event.touches[0].pageX - windowHalfX;
+					targetRotationOnMouseDown = targetRotation;
 
-      }
+			}
 
-    }
+		}
 
-    function onDocumentTouchMove(event) {
+		function onDocumentTouchMove(event) {
 
-      if (event.touches.length == 1) {
+			if (event.touches.length == 1) {
 
-          event.preventDefault();
+					event.preventDefault();
 
-          mouseX = event.touches[0].pageX - windowHalfX;
-          targetRotation = targetRotationOnMouseDown + (mouseX - mouseXOnMouseDown) * 0.05;
+					mouseX = event.touches[0].pageX - windowHalfX;
+					targetRotation = targetRotationOnMouseDown + (mouseX - mouseXOnMouseDown) * 0.05;
 
-      }
+			}
 
-    }
+		}
 
-    //
+		//
 
-    function animate() {
+		function animate() {
 
-      requestAnimationFrame(animate);
+			requestAnimationFrame(animate);
 
-      render();
-      stats.update();
+			render();
+			stats.update();
 
-    }
+		}
 
-    function render() {
+		function render() {
 
-      // Try Animate Camera Along Spline
-      var time = Date.now();
-      var looptime = 20 * 1000;
-      var t = (time % looptime) / looptime;
+			// Try Animate Camera Along Spline
+			var time = Date.now();
+			var looptime = 20 * 1000;
+			var t = (time % looptime) / looptime;
 
-      var pos = tube.path.getPointAt(t);
-      pos.multiplyScalar(scale);
+			var pos = tube.path.getPointAt(t);
+			pos.multiplyScalar(scale);
 
-      // interpolation
-      var segments = tube.tangents.length;
-      var pickt = t * segments;
-      var pick = Math.floor(pickt);
-      var pickNext = (pick + 1) % segments;
+			// interpolation
+			var segments = tube.tangents.length;
+			var pickt = t * segments;
+			var pick = Math.floor(pickt);
+			var pickNext = (pick + 1) % segments;
 
-      binormal.sub(tube.binormals[pickNext], tube.binormals[pick]);
-      binormal.multiplyScalar(pickt - pick).addSelf(tube.binormals[pick]);
+			binormal.sub(tube.binormals[pickNext], tube.binormals[pick]);
+			binormal.multiplyScalar(pickt - pick).addSelf(tube.binormals[pick]);
 
 
-      var dir = tube.path.getTangentAt(t);
+			var dir = tube.path.getTangentAt(t);
 
-      var offset = 15;
+			var offset = 15;
 
-      normal.copy(binormal).crossSelf(dir);
+			normal.copy(binormal).crossSelf(dir);
 
-      // We move on a offset on its binormal
-      pos.addSelf(normal.clone().multiplyScalar(offset));
+			// We move on a offset on its binormal
+			pos.addSelf(normal.clone().multiplyScalar(offset));
 
-      splineCamera.position = pos;
-      cameraEye.position = pos;
+			splineCamera.position = pos;
+			cameraEye.position = pos;
 
 
-      // Camera Orientation 1 - default look at
-      // splineCamera.lookAt(lookAt);
+			// Camera Orientation 1 - default look at
+			// splineCamera.lookAt(lookAt);
 
-      // Using arclength for stablization in look ahead.
-      var lookAt = tube.path.getPointAt((t + 30/tube.path.getLength()) % 1).multiplyScalar(scale);
-      
-      // Camera Orientation 2 - up orientation via normal
-      if (!lookAhead)
-      lookAt.copy(pos).addSelf(dir);
-      splineCamera.matrix.lookAt(splineCamera.position, lookAt, normal);
-      splineCamera.rotation.setEulerFromRotationMatrix(splineCamera.matrix, splineCamera.eulerOrder);
+			// Using arclength for stablization in look ahead.
+			var lookAt = tube.path.getPointAt((t + 30/tube.path.getLength()) % 1).multiplyScalar(scale);
+			
+			// Camera Orientation 2 - up orientation via normal
+			if (!lookAhead)
+			lookAt.copy(pos).addSelf(dir);
+			splineCamera.matrix.lookAt(splineCamera.position, lookAt, normal);
+			splineCamera.rotation.setEulerFromRotationMatrix(splineCamera.matrix, splineCamera.eulerOrder);
 
-      cameraHelper.update();
+			cameraHelper.update();
 
-      parent.rotation.y += (targetRotation - parent.rotation.y) * 0.05;
+			parent.rotation.y += (targetRotation - parent.rotation.y) * 0.05;
 
-      if (animation) {
+			if (animation) {
 
-        renderer.render(scene, splineCamera);
+				renderer.render(scene, splineCamera);
 
-      } else {
+			} else {
 
-        renderer.render(scene, camera);
+				renderer.render(scene, camera);
 
-      }
+			}
 
-      
-      
-    }
+			
+			
+		}
 	</script>
 
-  </body>
+	</body>
 </html>

+ 1 - 1
examples/webgl_geometry_extrude_uvs2.html

@@ -25,7 +25,7 @@ THREE.Camera.prototype.lookAt = function ( vector ) {
 
 	if ( this.rotationAutoUpdate ) {
 
-		this.rotation.setEulerFromRotationMatrix( this.matrix, this.order );
+		this.rotation.setEulerFromRotationMatrix( this.matrix, this.eulerOrder );
 
 	}
 

+ 19 - 11
src/core/Vector3.js

@@ -276,7 +276,12 @@ THREE.Vector3.prototype = {
 		// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
 	
 		// clamp, to handle numerical problems
-		function clamp( x ) { return Math.min( Math.max( x, -1 ), 1 ) };
+
+		function clamp( x ) {
+
+			return Math.min( Math.max( x, -1 ), 1 );
+
+		}
 		
 		var _order = order || 'XYZ',
 		
@@ -404,19 +409,22 @@ THREE.Vector3.prototype = {
 
 	setEulerFromQuaternion: function ( q, order ) {
 
-		// http://www.mathworks.com/matlabcentral/fileexchange/
-		// 	20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
-		//	content/SpinCalc.m
-	
 		// q is assumed to be normalized
-	
+
 		// clamp, to handle numerical problems
-		function clamp( x ) { return Math.min( Math.max( x, -1 ), 1 ) };
+
+		function clamp( x ) {
+
+			return Math.min( Math.max( x, -1 ), 1 );
+
+		}
+
+		// http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/content/SpinCalc.m
 	
-		var sqx = q.x * q.x,
-			sqy = q.y * q.y,
-			sqz = q.z * q.z,
-			sqw = q.w * q.w;
+		var sqx = q.x * q.x;
+		var sqy = q.y * q.y;
+		var sqz = q.z * q.z;
+		var sqw = q.w * q.w;
 	
 		switch ( order ) {
 	

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно