Browse Source

Merging with @timknip2's mater.

Mr.doob 14 years ago
parent
commit
f0ef2532b8

+ 74 - 72
build/Three.js

@@ -37,8 +37,9 @@ this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,
 new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var o=
 h*k,m=h*g,p=f*k,u=f*g;this.n11=o+u*e;this.n12=p*e-m;this.n13=j*f;this.n21=j*g;this.n22=j*k;this.n23=-e;this.n31=m*e-p;this.n32=u+o*e;this.n33=j*h;break;case "ZXY":o=h*k;m=h*g;p=f*k;u=f*g;this.n11=o-u*e;this.n12=-j*g;this.n13=p+m*e;this.n21=m+p*e;this.n22=j*k;this.n23=u-o*e;this.n31=-j*f;this.n32=e;this.n33=j*h;break;case "ZYX":o=j*k;m=j*g;p=e*k;u=e*g;this.n11=h*k;this.n12=p*f-m;this.n13=o*f+u;this.n21=h*g;this.n22=u*f+o;this.n23=m*f-p;this.n31=-f;this.n32=e*h;this.n33=j*h;break;case "YZX":o=j*h;m=
 j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=u-o*g;this.n13=p*g+m;this.n21=g;this.n22=j*k;this.n23=-e*k;this.n31=-f*k;this.n32=m*g+p;this.n33=o-u*g;break;case "XZY":o=j*h;m=j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=-g;this.n13=f*k;this.n21=o*g+u;this.n22=j*k;this.n23=m*g-p;this.n31=p*g-m;this.n32=e*k;this.n33=u*g+o;break;default:o=j*k,m=j*g,p=e*k,u=e*g,this.n11=h*k,this.n12=-h*g,this.n13=f,this.n21=m+p*f,this.n22=o-u*f,this.n23=-e*h,this.n31=u-o*f,this.n32=p+m*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=
-b.x,e=b.y,f=b.z,g=b.w,j=c+c,h=e+e,k=f+f,b=c*j,o=c*h;c*=k;var m=e*h;e*=k;f*=k;j*=g;h*=g;g*=k;this.n11=1-(m+f);this.n12=o-g;this.n13=c+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+m);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
-extractRotation:function(b,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
+b.x,e=b.y,f=b.z,g=b.w,j=c+c,h=e+e,k=f+f,b=c*j,o=c*h;c*=k;var m=e*h;e*=k;f*=k;j*=g;h*=g;g*=k;this.n11=1-(m+f);this.n12=o-g;this.n13=c+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+m);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=new THREE.Matrix4,g=new THREE.Matrix4;f.setRotationFromQuaternion(c);
+g.setScale(e.x,e.y,e.z);this.multiply(f,g);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=new THREE.Vector3(this.n11,this.n21,this.n31),g=new THREE.Vector3(this.n12,this.n22,this.n32),j=new THREE.Vector3(this.n13,this.n23,this.n33),b=b instanceof THREE.Vector3?b:new THREE.Vector3,c=c instanceof THREE.Quaternion?c:new THREE.Quaternion,e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length();e.y=g.length();e.z=j.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;
+b=this.clone();b.n11/=e.x;b.n21/=e.x;b.n31/=e.x;b.n12/=e.y;b.n22/=e.y;b.n32/=e.y;b.n13/=e.z;b.n23/=e.z;b.n33/=e.z;c.setFromRotationMatrix(b)},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
 THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,o=b.n23,m=b.n24,p=b.n31,u=b.n32,v=b.n33,t=b.n34,w=b.n41,x=b.n42,B=b.n43,A=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*t*x-m*v*x+m*u*B-k*t*B-o*u*A+k*v*A;c.n12=j*v*x-g*t*x-j*u*B+f*t*B+g*u*A-f*v*A;c.n13=g*m*x-j*o*x+j*k*B-f*m*B-g*k*A+f*o*A;c.n14=j*o*u-g*m*u-j*k*v+f*m*v+g*k*t-f*o*t;c.n21=m*v*w-o*t*w-m*p*B+h*t*B+o*p*A-h*v*A;c.n22=g*t*w-j*v*w+j*p*B-e*t*B-g*p*A+e*v*A;c.n23=j*o*w-g*m*w-j*h*B+e*m*B+g*h*A-e*o*A;c.n24=
 g*m*p-j*o*p+j*h*v-e*m*v-g*h*t+e*o*t;c.n31=k*t*w-m*u*w+m*p*x-h*t*x-k*p*A+h*u*A;c.n32=j*u*w-f*t*w-j*p*x+e*t*x+f*p*A-e*u*A;c.n33=g*m*w-j*k*w+j*h*x-e*m*x-f*h*A+e*k*A;c.n34=j*k*p-f*m*p-j*h*u+e*m*u+f*h*t-e*k*t;c.n41=o*u*w-k*v*w-o*p*x+h*v*x+k*p*B-h*u*B;c.n42=f*v*w-g*u*w+g*p*x-e*v*x-f*p*B+e*u*B;c.n43=g*k*w-f*o*w-g*h*x+e*o*x+f*h*B-e*k*B;c.n44=f*o*p-g*k*p+g*h*u-e*o*u-f*h*v+e*k*v;c.multiplyScalar(1/b.determinant());return c};
 THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,m=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*m;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*h;e[4]=b*k;e[5]=b*o;e[6]=b*m;e[7]=b*p;e[8]=b*u;return c};
@@ -51,11 +52,11 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
 this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),j=Math.cos(e),e=Math.sin(e),h=b*c,k=f*g;this.w=h*j-k*e;this.x=h*e+k*j;this.y=f*c*j+b*g*e;this.z=b*g*j-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
-this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=
-b,this.w*=b);return this},multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,j=b.x,h=b.y,k=b.z,b=b.w;this.x=c*b+g*j+e*k-f*h;this.y=e*b+g*h+f*j-c*k;this.z=f*b+g*k+c*h-e*j;this.w=g*b-c*j-e*h-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,j=this.x,h=this.y,k=this.z,
-o=this.w,m=o*e+h*g-k*f,p=o*f+k*e-j*g,u=o*g+j*f-h*e,e=-j*e-h*f-k*g;c.x=m*o+e*-j+p*-k-u*-h;c.y=p*o+e*-h+u*-j-m*-k;c.z=u*o+e*-k+m*-h-p*-j;return c}};
-THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
-THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
+this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
+this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
+this.x,e=this.y,f=this.z,g=this.w,j=b.x,h=b.y,k=b.z,b=b.w;this.x=c*b+g*j+e*k-f*h;this.y=e*b+g*h+f*j-c*k;this.z=f*b+g*k+c*h-e*j;this.w=g*b-c*j-e*h-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,j=this.x,h=this.y,k=this.z,o=this.w,m=o*e+h*g-k*f,p=o*f+k*e-j*g,u=o*g+j*f-h*e,e=-j*
+e-h*f-k*g;c.x=m*o+e*-j+p*-k-u*-h;c.y=p*o+e*-h+u*-j-m*-k;c.z=u*o+e*-k+m*-h-p*-j;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};
+THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,e,f,g,j,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
@@ -218,39 +219,39 @@ THREE.WebGLRenderer=function(b){function c(b,c,e){var f,h,g,j=b.vertices,k=j.len
 for(f=0;f<o;f++)g=f*3,color=m[p[f][1]],t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b;if(x)for(A in x){f=x[A];m=f.value.length;for(g=0;g<m;g++){index=p[g][1];o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")B=f.value[index];f.size===2?(f.array[o]=B.x,f.array[o+1]=B.y):f.size===3?f.type==="c"?(f.array[o]=B.r,f.array[o+1]=B.g,f.array[o+2]=B.b):(f.array[o]=B.x,f.array[o+1]=B.y,f.array[o+2]=B.z):(f.array[o]=
 B.x,f.array[o+1]=B.y,f.array[o+2]=B.z,f.array[o+3]=B.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<k;f++)h=j[f].position,g=f*3,u[g]=h.x,u[g+1]=h.y,u[g+2]=h.z;if(w)for(f=0;f<o;f++)color=m[f],g=f*3,t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b;if(x)for(A in x)if(f=x[A],f.__original.needsUpdate){m=f.value.length;for(g=0;g<m;g++){o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")B=f.value[g];f.size===2?(f.array[o]=
 B.x,f.array[o+1]=B.y):f.size===3?f.type==="c"?(f.array[o]=B.r,f.array[o+1]=B.g,f.array[o+2]=B.b):(f.array[o]=B.x,f.array[o+1]=B.y,f.array[o+2]=B.z):(f.array[o]=B.x,f.array[o+1]=B.y,f.array[o+2]=B.z,f.array[o+3]=B.w)}f.offset+=f.size}}}if(v||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,u,c);if(w||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,t,c);if(x)for(A in x)if(f=x[A],f.__original.needsUpdate||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,
-f.buffer),n.bufferData(n.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,h){f.program||C.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(C.maxMorphTargets);for(var g=0,j=C.maxMorphTargets;g<j;g++)h.__webglMorphTargetInfluences[g]=0}var g=f.program,j=g.uniforms,k=f.uniforms;g!=V&&(n.useProgram(g),V=g);n.uniformMatrix4fv(j.projectionMatrix,!1,la);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
+f.buffer),n.bufferData(n.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,g){f.program||C.initMaterial(f,c,e,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array(C.maxMorphTargets);for(var h=0,j=C.maxMorphTargets;h<j;h++)g.__webglMorphTargetInfluences[h]=0}var h=f.program,j=h.uniforms,k=f.uniforms;h!=V&&(n.useProgram(h),V=h);n.uniformMatrix4fv(j.projectionMatrix,!1,la);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
 f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(k.fogColor.value=e.color,e instanceof THREE.Fog)k.fogNear.value=e.near,k.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)k.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var m,o,u,t=0,p=0,v=0,w,B,x,A=sa,y=A.directional.colors,G=A.directional.positions,H=A.point.colors,I=A.point.positions,ja=A.point.distances,
 E=0,J=0,e=o=x=0;for(m=c.length;e<m;e++)if(o=c[e],u=o.color,w=o.position,B=o.intensity,x=o.distance,o instanceof THREE.AmbientLight)t+=u.r,p+=u.g,v+=u.b;else if(o instanceof THREE.DirectionalLight)x=E*3,y[x]=u.r*B,y[x+1]=u.g*B,y[x+2]=u.b*B,G[x]=w.x,G[x+1]=w.y,G[x+2]=w.z,E+=1;else if(o instanceof THREE.SpotLight)x=E*3,y[x]=u.r*B,y[x+1]=u.g*B,y[x+2]=u.b*B,u=1/w.length(),G[x]=w.x*u,G[x+1]=w.y*u,G[x+2]=w.z*u,E+=1;else if(o instanceof THREE.PointLight)o=J*3,H[o]=u.r*B,H[o+1]=u.g*B,H[o+2]=u.b*B,I[o]=w.x,
 I[o+1]=w.y,I[o+2]=w.z,ja[J]=x,J+=1;for(e=E*3;e<y.length;e++)y[e]=0;for(e=J*3;e<H.length;e++)H[e]=0;A.point.length=J;A.directional.length=E;A.ambient[0]=t;A.ambient[1]=p;A.ambient[2]=v;c=sa;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=
 c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity,(k.map.texture=f.map)&&k.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),k.lightMap.texture=f.lightMap,k.envMap.texture=f.envMap,k.reflectivity.value=f.reflectivity,k.refractionRatio.value=f.refractionRatio,k.combine.value=f.combine,k.useRefract.value=f.envMap&&f.envMap.mapping instanceof
 THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)k.psColor.value=f.color,k.opacity.value=f.opacity,k.size.value=f.size,k.scale.value=ua.height/2,k.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)k.ambient.value=f.ambient,k.specular.value=f.specular,k.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=
-f.opacity;else if(f instanceof THREE.MeshNormalMaterial)k.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&k.shadowMatrix){for(c=0;c<ta.length;c++)k.shadowMatrix.value[c]=ta[c],k.shadowMap.texture[c]=C.shadowMap[c];k.shadowDarkness.value=C.shadowMapDarkness;k.shadowBias.value=C.shadowMapBias}for(var L in k)if(m=g.uniforms[L])if(e=k[L],t=e.type,c=e.value,t=="i")n.uniform1i(m,c);else if(t=="f")n.uniform1f(m,c);else if(t=="fv1")n.uniform1fv(m,c);else if(t=="fv")n.uniform3fv(m,c);else if(t==
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)k.opacity.value=f.opacity;if(g.receiveShadow&&!f._shadowPass&&k.shadowMatrix){for(c=0;c<ta.length;c++)k.shadowMatrix.value[c]=ta[c],k.shadowMap.texture[c]=C.shadowMap[c];k.shadowDarkness.value=C.shadowMapDarkness;k.shadowBias.value=C.shadowMapBias}for(var L in k)if(m=h.uniforms[L])if(e=k[L],t=e.type,c=e.value,t=="i")n.uniform1i(m,c);else if(t=="f")n.uniform1f(m,c);else if(t=="fv1")n.uniform1fv(m,c);else if(t=="fv")n.uniform3fv(m,c);else if(t==
 "v2")n.uniform2f(m,c.x,c.y);else if(t=="v3")n.uniform3f(m,c.x,c.y,c.z);else if(t=="v4")n.uniform4f(m,c.x,c.y,c.z,c.w);else if(t=="m4"){if(!e._array)e._array=new Float32Array(16);c.flattenToArray(e._array);n.uniformMatrix4fv(m,!1,e._array)}else if(t=="m4v"){if(!e._array)e._array=new Float32Array(16*c.length);t=0;for(p=c.length;t<p;t++)c[t].flattenToArrayOffset(e._array,t*16);n.uniformMatrix4fv(m,!1,e._array)}else if(t=="c")n.uniform3f(m,c.r,c.g,c.b);else if(t=="t"){if(n.uniform1i(m,c),m=e.texture)if(m.image instanceof
 Array&&m.image.length==6){if(e=m,e.image.length==6){if(e.needsUpdate){if(e.__webglInit){n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(m=0;m<6;++m)n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,0,0,n.RGBA,n.UNSIGNED_BYTE,e.image[m])}else{e.image.__webglTextureCube=n.createTexture();n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(m=0;m<6;++m)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e.image[m]);e.__webglInit=!0}K(n.TEXTURE_CUBE_MAP,
-e,e.image[0]);n.bindTexture(n.TEXTURE_CUBE_MAP,null);e.needsUpdate=!1}n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else D(m,c)}else if(t=="tv"){if(!e._array){e._array=[];t=0;for(p=e.texture.length;t<p;t++)e._array[t]=c+t}n.uniform1iv(m,e._array);t=0;for(p=e.texture.length;t<p;t++)(m=e.texture[t])&&D(m,e._array[t])}n.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);n.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
-f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&n.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&j.objectMatrix!==null&&n.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&n.uniformMatrix4fv(j.viewMatrix,!1,ka);f.skinning&&
-(n.uniformMatrix4fv(j.cameraInverseMatrix,!1,ka),n.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,c,f,h,g,j){if(h.opacity!=0){var k,b=e(b,c,f,h,j).attributes;if(!h.morphTargets&&b.position>=0)n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer),n.vertexAttribPointer(b.position,3,n.FLOAT,!1,0,0);else if(j.morphTargetBase){c=h.program.attributes;j.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),n.vertexAttribPointer(c.position,
-3,n.FLOAT,!1,0,0)):c.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,m=j.morphTargetForcedOrder,o=j.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<m.length;)n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[m[f]]),n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=o[m[f]],f++;else{var m=[],u=-1,t=0,o=j.morphTargetInfluences,p,v=
-o.length,f=0;for(j.morphTargetBase!==-1&&(m[j.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(p=0;p<v;p++)!m[p]&&o[p]>u&&(t=p,u=o[t]);n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[t]);n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=u;m[t]=1;u=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&n.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=
-0&&(c=g.__webglCustomAttributes[k],n.bindBuffer(n.ARRAY_BUFFER,c.buffer),n.vertexAttribPointer(b[k],c.size,n.FLOAT,!1,0,0));b.color>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer),n.vertexAttribPointer(b.color,3,n.FLOAT,!1,0,0));b.normal>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglNormalBuffer),n.vertexAttribPointer(b.normal,3,n.FLOAT,!1,0,0));b.tangent>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglTangentBuffer),n.vertexAttribPointer(b.tangent,4,n.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(n.bindBuffer(n.ARRAY_BUFFER,
-g.__webglUVBuffer),n.vertexAttribPointer(b.uv,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv)):n.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(n.bindBuffer(n.ARRAY_BUFFER,g.__webglUV2Buffer),n.vertexAttribPointer(b.uv2,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv2)):n.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinVertexABuffer),n.vertexAttribPointer(b.skinVertexA,4,
-n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),n.vertexAttribPointer(b.skinVertexB,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),n.vertexAttribPointer(b.skinIndex,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),n.vertexAttribPointer(b.skinWeight,4,n.FLOAT,!1,0,0));j instanceof THREE.Mesh?(h.wireframe?(n.lineWidth(h.wireframeLinewidth),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),n.drawElements(n.LINES,g.__webglLineCount,
-n.UNSIGNED_SHORT,0)):(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),n.drawElements(n.TRIANGLES,g.__webglFaceCount,n.UNSIGNED_SHORT,0)),C.data.vertices+=g.__webglFaceCount,C.data.faces+=g.__webglFaceCount/3,C.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?n.LINE_STRIP:n.LINES,n.lineWidth(h.linewidth),n.drawArrays(j,0,g.__webglLineCount),C.data.drawCalls++):j instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,g.__webglParticleCount),C.data.drawCalls++):j instanceof
-THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,g.__webglVertexCount),C.data.drawCalls++)}}function g(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=n.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=n.createBuffer();b.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(c.attributes.position),n.vertexAttribPointer(c.attributes.position,3,n.FLOAT,!1,0,0));if(b.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,
-b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,j,k,m,o,u,t,p,v=b.count*3;for(p=0;p<v;p+=9)e=b.normalArray,f=e[p],g=e[p+1],h=e[p+2],j=e[p+3],m=e[p+4],u=e[p+5],k=e[p+6],o=e[p+7],t=e[p+8],f=(f+j+k)/3,g=(g+m+o)/3,h=(h+u+t)/3,e[p]=f,e[p+1]=g,e[p+2]=h,e[p+3]=f,e[p+4]=g,e[p+5]=h,e[p+6]=f,e[p+7]=g,e[p+8]=h}n.bufferData(n.ARRAY_BUFFER,b.normalArray,n.DYNAMIC_DRAW);n.enableVertexAttribArray(c.attributes.normal);n.vertexAttribPointer(c.attributes.normal,3,n.FLOAT,!1,0,0)}n.drawArrays(n.TRIANGLES,
+e,e.image[0]);n.bindTexture(n.TEXTURE_CUBE_MAP,null);e.needsUpdate=!1}n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else D(m,c)}else if(t=="tv"){if(!e._array){e._array=[];t=0;for(p=e.texture.length;t<p;t++)e._array[t]=c+t}n.uniform1iv(m,e._array);t=0;for(p=e.texture.length;t<p;t++)(m=e.texture[t])&&D(m,e._array[t])}n.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray);n.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
+f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&n.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||g.receiveShadow)&&j.objectMatrix!==null&&n.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&n.uniformMatrix4fv(j.viewMatrix,!1,ka);f.skinning&&
+(n.uniformMatrix4fv(j.cameraInverseMatrix,!1,ka),n.uniformMatrix4fv(j.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,j){if(g.opacity!=0){var k,b=e(b,c,f,g,j).attributes;if(!g.morphTargets&&b.position>=0)n.bindBuffer(n.ARRAY_BUFFER,h.__webglVertexBuffer),n.vertexAttribPointer(b.position,3,n.FLOAT,!1,0,0);else if(j.morphTargetBase){c=g.program.attributes;j.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),n.vertexAttribPointer(c.position,
+3,n.FLOAT,!1,0,0)):c.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,h.__webglVertexBuffer),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,m=j.morphTargetForcedOrder,o=j.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<m.length;)n.bindBuffer(n.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m[f]]),n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=o[m[f]],f++;else{var m=[],u=-1,t=0,o=j.morphTargetInfluences,p,v=
+o.length,f=0;for(j.morphTargetBase!==-1&&(m[j.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(p=0;p<v;p++)!m[p]&&o[p]>u&&(t=p,u=o[t]);n.bindBuffer(n.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t]);n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=u;m[t]=1;u=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&n.uniform1fv(g.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=
+0&&(c=h.__webglCustomAttributes[k],n.bindBuffer(n.ARRAY_BUFFER,c.buffer),n.vertexAttribPointer(b[k],c.size,n.FLOAT,!1,0,0));b.color>=0&&(n.bindBuffer(n.ARRAY_BUFFER,h.__webglColorBuffer),n.vertexAttribPointer(b.color,3,n.FLOAT,!1,0,0));b.normal>=0&&(n.bindBuffer(n.ARRAY_BUFFER,h.__webglNormalBuffer),n.vertexAttribPointer(b.normal,3,n.FLOAT,!1,0,0));b.tangent>=0&&(n.bindBuffer(n.ARRAY_BUFFER,h.__webglTangentBuffer),n.vertexAttribPointer(b.tangent,4,n.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(n.bindBuffer(n.ARRAY_BUFFER,
+h.__webglUVBuffer),n.vertexAttribPointer(b.uv,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv)):n.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(n.bindBuffer(n.ARRAY_BUFFER,h.__webglUV2Buffer),n.vertexAttribPointer(b.uv2,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv2)):n.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(n.bindBuffer(n.ARRAY_BUFFER,h.__webglSkinVertexABuffer),n.vertexAttribPointer(b.skinVertexA,4,
+n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),n.vertexAttribPointer(b.skinVertexB,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),n.vertexAttribPointer(b.skinIndex,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),n.vertexAttribPointer(b.skinWeight,4,n.FLOAT,!1,0,0));j instanceof THREE.Mesh?(g.wireframe?(n.lineWidth(g.wireframeLinewidth),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),n.drawElements(n.LINES,h.__webglLineCount,
+n.UNSIGNED_SHORT,0)):(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),n.drawElements(n.TRIANGLES,h.__webglFaceCount,n.UNSIGNED_SHORT,0)),C.data.vertices+=h.__webglFaceCount,C.data.faces+=h.__webglFaceCount/3,C.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?n.LINE_STRIP:n.LINES,n.lineWidth(g.linewidth),n.drawArrays(j,0,h.__webglLineCount),C.data.drawCalls++):j instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,h.__webglParticleCount),C.data.drawCalls++):j instanceof
+THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,h.__webglVertexCount),C.data.drawCalls++)}}function g(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=n.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=n.createBuffer();b.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(c.attributes.position),n.vertexAttribPointer(c.attributes.position,3,n.FLOAT,!1,0,0));if(b.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,
+b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,g,j,k,m,o,u,t,p,v=b.count*3;for(p=0;p<v;p+=9)e=b.normalArray,f=e[p],h=e[p+1],g=e[p+2],j=e[p+3],m=e[p+4],u=e[p+5],k=e[p+6],o=e[p+7],t=e[p+8],f=(f+j+k)/3,h=(h+m+o)/3,g=(g+u+t)/3,e[p]=f,e[p+1]=h,e[p+2]=g,e[p+3]=f,e[p+4]=h,e[p+5]=g,e[p+6]=f,e[p+7]=h,e[p+8]=g}n.bufferData(n.ARRAY_BUFFER,b.normalArray,n.DYNAMIC_DRAW);n.enableVertexAttribArray(c.attributes.normal);n.vertexAttribPointer(c.attributes.normal,3,n.FLOAT,!1,0,0)}n.drawArrays(n.TRIANGLES,
 0,b.count);b.count=0}function j(b){if(ea!=b.doubleSided)b.doubleSided?n.disable(n.CULL_FACE):n.enable(n.CULL_FACE),ea=b.doubleSided;if(T!=b.flipSided)b.flipSided?n.frontFace(n.CW):n.frontFace(n.CCW),T=b.flipSided}function h(b){da!=b&&(b?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),da=b)}function k(b,c,e){ha!=b&&(b?n.enable(n.POLYGON_OFFSET_FILL):n.disable(n.POLYGON_OFFSET_FILL),ha=b);if(b&&(ia!=c||M!=e))n.polygonOffset(c,e),ia=c,M=e}function o(b){ca[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
 b.n14);ca[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ca[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ca[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ca[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ca[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=ca[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function m(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),
-f=0;f<6;f++)if(b=ca[f].x*c.n14+ca[f].y*c.n24+ca[f].z*c.n34+ca[f].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,e,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(h,e):p(g,e)}function v(b){var c,e,f,g,h=b.object,j=b.buffer,k=b.opaque,n=b.transparent;n.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<
-e;c++)(g=j.materials[c])&&(g.transparent?p(n,g):p(k,g))}else(g=c)&&(g.transparent?p(n,g):p(k,g))}function t(b,c){return c.z-b.z}function w(b,c){var k,u,t,p=0,v,w,x,A,y=b.lights;$||($=new THREE.Camera(C.shadowCameraFov,c.aspect,C.shadowCameraNear,C.shadowCameraFar));k=0;for(u=y.length;k<u;k++)if(t=y[k],t instanceof THREE.SpotLight&&t.castShadow){C.shadowMap[p]||(C.shadowMap[p]=new THREE.WebGLRenderTarget(C.shadowMapWidth,C.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+f=0;f<6;f++)if(b=ca[f].x*c.n14+ca[f].y*c.n24+ca[f].z*c.n34+ca[f].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,e,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(g,e):p(h,e)}function v(b){var c,e,f,h,g=b.object,j=b.buffer,k=b.opaque,n=b.transparent;n.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<
+e;c++)(h=j.materials[c])&&(h.transparent?p(n,h):p(k,h))}else(h=c)&&(h.transparent?p(n,h):p(k,h))}function t(b,c){return c.z-b.z}function w(b,c){var k,u,t,p=0,v,w,x,A,y=b.lights;$||($=new THREE.Camera(C.shadowCameraFov,c.aspect,C.shadowCameraNear,C.shadowCameraFar));k=0;for(u=y.length;k<u;k++)if(t=y[k],t instanceof THREE.SpotLight&&t.castShadow){C.shadowMap[p]||(C.shadowMap[p]=new THREE.WebGLRenderTarget(C.shadowMapWidth,C.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
 format:THREE.RGBAFormat}));ta[p]||(ta[p]=new THREE.Matrix4);v=C.shadowMap[p];w=ta[p];$.position.copy(t.position);$.target.position.copy(t.target.position);$.update(void 0,!0);b.update(void 0,!1,$);w.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);w.multiplySelf($.projectionMatrix);w.multiplySelf($.matrixWorldInverse);$.matrixWorldInverse.flattenToArray(ka);$.projectionMatrix.flattenToArray(la);ja.multiply($.projectionMatrix,$.matrixWorldInverse);o(ja);C.initWebGLObjects(b);J(v);n.clearColor(1,1,
 1,1);C.clear();n.clearColor(va.r,va.g,va.b,ya);w=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(v=0;v<w;v++)x=b.__webglObjects[v],A=x.object,A.visible&&A.castShadow?!(A instanceof THREE.Mesh)||m(A)?(A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,$,!1),x.render=!0):x.render=!1:x.render=!1;h(!0);E(THREE.NormalBlending);for(v=0;v<w;v++)if(x=b.__webglObjects[v],x.render)A=x.object,buffer=x.buffer,j(A),x=A.customDepthMaterial?A.customDepthMaterial:A.geometry.morphTargets.length?
-ma:oa,f($,y,null,x,buffer,A);for(v=0;v<t;v++)x=b.__webglObjectsImmediate[v],A=x.object,A.visible&&A.castShadow&&(A.matrixAutoUpdate&&A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,$,!1),j(A),program=e($,y,null,oa,A),A.render(function(b){g(b,program,oa.shading)}));p++}}function x(b,c){var e,f,g;e=N.attributes;var h=N.uniforms,j=Z/Y,k,m=[],o=Y*0.5,u=Z*0.5,p=!0;n.useProgram(N.program);V=N.program;da=U=-1;za||(n.enableVertexAttribArray(N.attributes.position),n.enableVertexAttribArray(N.attributes.uv),
-za=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,N.vertexBuffer);n.vertexAttribPointer(e.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(e.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,N.elementBuffer);n.uniformMatrix4fv(h.projectionMatrix,!1,la);n.activeTexture(n.TEXTURE0);n.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
-g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(t);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(n.uniform1i(h.useScreenCoordinates,1),n.uniform3f(h.screenPosition,(g.position.x-o)/o,(u-g.position.y)/u,Math.max(0,Math.min(1,g.position.z)))):(n.uniform1i(h.useScreenCoordinates,0),n.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),n.uniformMatrix4fv(h.modelViewMatrix,
-!1,g._modelViewMatrixArray)),k=g.map.image.width/(g.scaleByViewport?Z:1),m[0]=k*j*g.scale.x,m[1]=k*g.scale.y,n.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),n.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),n.uniform2f(h.alignment,g.alignment.x,g.alignment.y),n.uniform1f(h.opacity,g.opacity),n.uniform1f(h.rotation,g.rotation),n.uniform2fv(h.scale,m),g.mergeWith3D&&!p?(n.enable(n.DEPTH_TEST),p=!0):!g.mergeWith3D&&p&&(n.disable(n.DEPTH_TEST),p=!1),E(g.blending),D(g.map,0),n.drawElements(n.TRIANGLES,
-6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(L)}function B(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function A(b){var c,e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function H(b){var c,e,f,g;g=b.__materials;b=0;for(e=
-g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function y(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function G(b){function c(b){var g=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?g.push("undefined"):g.push(b[e].id);return g.join("_")}var e,f,g,h,j,k,n,m,o={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,n=c(k),o[n]==void 0&&(o[n]={hash:n,counter:0}),
-m=o[n].hash+"_"+o[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+j>65535&&(o[n].counter+=1,m=o[n].hash+"_"+o[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u})),b.geometryGroups[m].faces.push(g),b.geometryGroups[m].vertices+=j}function I(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],
+ma:oa,f($,y,null,x,buffer,A);for(v=0;v<t;v++)x=b.__webglObjectsImmediate[v],A=x.object,A.visible&&A.castShadow&&(A.matrixAutoUpdate&&A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,$,!1),j(A),program=e($,y,null,oa,A),A.render(function(b){g(b,program,oa.shading)}));p++}}function x(b,c){var e,f,h;e=N.attributes;var g=N.uniforms,j=Z/Y,k,m=[],o=Y*0.5,u=Z*0.5,p=!0;n.useProgram(N.program);V=N.program;da=U=-1;za||(n.enableVertexAttribArray(N.attributes.position),n.enableVertexAttribArray(N.attributes.uv),
+za=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,N.vertexBuffer);n.vertexAttribPointer(e.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(e.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,N.elementBuffer);n.uniformMatrix4fv(g.projectionMatrix,!1,la);n.activeTexture(n.TEXTURE0);n.uniform1i(g.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
+h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(t);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(n.uniform1i(g.useScreenCoordinates,1),n.uniform3f(g.screenPosition,(h.position.x-o)/o,(u-h.position.y)/u,Math.max(0,Math.min(1,h.position.z)))):(n.uniform1i(g.useScreenCoordinates,0),n.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),n.uniformMatrix4fv(g.modelViewMatrix,
+!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?Z:1),m[0]=k*j*h.scale.x,m[1]=k*h.scale.y,n.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),n.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),n.uniform2f(g.alignment,h.alignment.x,h.alignment.y),n.uniform1f(g.opacity,h.opacity),n.uniform1f(g.rotation,h.rotation),n.uniform2fv(g.scale,m),h.mergeWith3D&&!p?(n.enable(n.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(n.disable(n.DEPTH_TEST),p=!1),E(h.blending),D(h.map,0),n.drawElements(n.TRIANGLES,
+6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(L)}function B(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function A(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function H(b){var c,e,f,h;h=b.__materials;b=0;for(e=
+h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function y(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function G(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}var e,f,h,g,j,k,n,m,o={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,n=c(k),o[n]==void 0&&(o[n]={hash:n,counter:0}),
+m=o[n].hash+"_"+o[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+j>65535&&(o[n].counter+=1,m=o[n].hash+"_"+o[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u})),b.geometryGroups[m].faces.push(h),b.geometryGroups[m].vertices+=j}function I(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],
 count:0}})}function E(b){if(b!=U){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}U=b}}function K(b,c,e){(e.width&
 e.width-1)==0&&(e.height&e.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,R(c.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,R(c.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,R(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,R(c.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,X(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,X(c.minFilter)))}function D(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
 n.createTexture(),b.__webglInit=!0;n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b.image.data?n.texImage2D(n.TEXTURE_2D,0,R(b.format),b.image.width,b.image.height,0,R(b.format),n.UNSIGNED_BYTE,b.image.data):n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);K(n.TEXTURE_2D,b,b.image);n.bindTexture(n.TEXTURE_2D,null);b.needsUpdate=!1}n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function J(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
@@ -261,43 +262,44 @@ b=="vertex"&&(e=n.createShader(n.VERTEX_SHADER));n.shaderSource(e,c);n.compileSh
 case THREE.NearestFilter:return n.NEAREST;case THREE.NearestMipMapNearestFilter:return n.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return n.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return n.LINEAR;case THREE.LinearMipMapNearestFilter:return n.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return n.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return n.BYTE;case THREE.UnsignedByteType:return n.UNSIGNED_BYTE;case THREE.ShortType:return n.SHORT;case THREE.UnsignedShortType:return n.UNSIGNED_SHORT;
 case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0}var C=this,n,W=[],V=null,fa=null,L=!0,ea=null,T=null,U=null,da=null,ha=null,ia=null,M=null,P=0,aa=0,Y=0,Z=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
 new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,la=new Float32Array(16),ka=new Float32Array(16),pa=new THREE.Vector4,sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ua=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ia=b.stencil!==void 0?b.stencil:!0,Ja=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Ka=b.antialias!==void 0?b.antialias:!1,va=b.clearColor!==void 0?new THREE.Color(b.clearColor):
-new THREE.Color(0),ya=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ua;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var $,ta=[],b=THREE.ShaderLib.depthRGBA,Ea=THREE.UniformsUtils.clone(b.uniforms),oa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
-vertexShader:b.vertexShader,uniforms:Ea}),ma=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ea,morphTargets:!0});oa._shadowPass=!0;ma._shadowPass=!0;try{if(!(n=ua.getContext("experimental-webgl",{antialias:Ka,stencil:Ia,preserveDrawingBuffer:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}n.clearColor(0,
-0,0,1);n.clearDepth(1);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(va.r,va.g,va.b,ya);this.context=n;var Da=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,N={};N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);i=0;N.vertices[i++]=-1;N.vertices[i++]=-1;N.vertices[i++]=0;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=
--1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=0;N.vertices[i++]=-1;N.vertices[i++]=1;N.vertices[i++]=0;i=N.vertices[i++]=0;N.faces[i++]=0;N.faces[i++]=1;N.faces[i++]=2;N.faces[i++]=0;N.faces[i++]=2;N.faces[i++]=3;N.vertexBuffer=n.createBuffer();N.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,N.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,N.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,N.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,
-N.faces,n.STATIC_DRAW);N.program=n.createProgram();n.attachShader(N.program,S("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(N.program,S("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=n.getAttribLocation(N.program,"position");N.attributes.uv=n.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=n.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=n.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=
-n.getUniformLocation(N.program,"rotation");N.uniforms.scale=n.getUniformLocation(N.program,"scale");N.uniforms.alignment=n.getUniformLocation(N.program,"alignment");N.uniforms.map=n.getUniformLocation(N.program,"map");N.uniforms.opacity=n.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=n.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=n.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=n.getUniformLocation(N.program,
-"screenPosition");N.uniforms.modelViewMatrix=n.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=n.getUniformLocation(N.program,"projectionMatrix");var za=!1;this.setSize=function(b,c){ua.width=b;ua.height=c;this.setViewport(0,0,ua.width,ua.height)};this.setViewport=function(b,c,e,f){P=b;aa=c;Y=e;Z=f;n.viewport(P,aa,Y,Z)};this.setScissor=function(b,c,e,f){n.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=
-function(b){L=b;n.depthMask(b)};this.setClearColorHex=function(b,c){va.setHex(b);ya=c;n.clearColor(va.r,va.g,va.b,ya)};this.setClearColor=function(b,c){va.copy(b);ya=c;n.clearColor(va.r,va.g,va.b,ya)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};this.getContext=function(){return n};this.initMaterial=function(b,c,e,f){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?
-j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,o,u;m=u=k=0;for(o=c.length;m<o;m++)h=c[m],h instanceof THREE.SpotLight&&u++,h instanceof THREE.DirectionalLight&&u++,h instanceof THREE.PointLight&&
-k++;k+u<=4?m=u:(m=Math.ceil(4*u/(k+u)),k=4-m);h={directional:m,point:k};k=u=0;for(m=c.length;k<m;k++)o=c[k],o instanceof THREE.SpotLight&&o.castShadow&&u++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var p;a:{m=b.fragmentShader;o=b.vertexShader;var k=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
-maxDirLights:h.directional,maxPointLights:h.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(m),f.push(o));for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=W.length;v<f;v++)if(W[v].code==j){p=W[v].program;break a}v=n.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
-"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\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;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
-"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");n.attachShader(v,S("fragment",h+m));n.attachShader(v,S("vertex",f+o));n.linkProgram(v);n.getProgramParameter(v,n.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+n.getProgramParameter(v,n.VALIDATE_STATUS)+", gl error ["+n.getError()+"]");v.uniforms=
+new THREE.Color(0),ya=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ua;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var $,ta=[],b=THREE.ShaderLib.depthRGBA,
+Ea=THREE.UniformsUtils.clone(b.uniforms),oa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ea}),ma=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ea,morphTargets:!0});oa._shadowPass=!0;ma._shadowPass=!0;try{if(!(n=ua.getContext("experimental-webgl",{antialias:Ka,stencil:Ia,preserveDrawingBuffer:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+
+" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}n.clearColor(0,0,0,1);n.clearDepth(1);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(va.r,va.g,va.b,ya);this.context=n;var Da=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,N={};N.vertices=new Float32Array(16);
+N.faces=new Uint16Array(6);i=0;N.vertices[i++]=-1;N.vertices[i++]=-1;N.vertices[i++]=0;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=-1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=1;N.vertices[i++]=0;N.vertices[i++]=-1;N.vertices[i++]=1;N.vertices[i++]=0;i=N.vertices[i++]=0;N.faces[i++]=0;N.faces[i++]=1;N.faces[i++]=2;N.faces[i++]=0;N.faces[i++]=2;N.faces[i++]=3;N.vertexBuffer=n.createBuffer();N.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,
+N.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,N.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,N.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,N.faces,n.STATIC_DRAW);N.program=n.createProgram();n.attachShader(N.program,S("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(N.program,S("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=n.getAttribLocation(N.program,"position");N.attributes.uv=n.getAttribLocation(N.program,
+"uv");N.uniforms.uvOffset=n.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=n.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=n.getUniformLocation(N.program,"rotation");N.uniforms.scale=n.getUniformLocation(N.program,"scale");N.uniforms.alignment=n.getUniformLocation(N.program,"alignment");N.uniforms.map=n.getUniformLocation(N.program,"map");N.uniforms.opacity=n.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=n.getUniformLocation(N.program,"useScreenCoordinates");
+N.uniforms.affectedByDistance=n.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=n.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=n.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=n.getUniformLocation(N.program,"projectionMatrix");var za=!1;this.setSize=function(b,c){ua.width=b;ua.height=c;this.setViewport(0,0,ua.width,ua.height)};this.setViewport=function(b,c,e,f){P=b;aa=c;Y=e;Z=f;n.viewport(P,aa,Y,Z)};this.setScissor=
+function(b,c,e,f){n.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){L=b;n.depthMask(b)};this.setClearColorHex=function(b,c){va.setHex(b);ya=c;n.clearColor(va.r,va.g,va.b,ya)};this.setClearColor=function(b,c){va.copy(b);ya=c;n.clearColor(va.r,va.g,va.b,ya)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};this.getContext=function(){return n};this.initMaterial=
+function(b,c,e,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=
+k.fragmentShader}var m,o,u;m=u=k=0;for(o=c.length;m<o;m++)g=c[m],g instanceof THREE.SpotLight&&u++,g instanceof THREE.DirectionalLight&&u++,g instanceof THREE.PointLight&&k++;k+u<=_maxLights?m=u:(m=Math.ceil(_maxLights*u/(k+u)),k=_maxLights-m);g={directional:m,point:k};k=u=0;for(m=c.length;k<m;k++)o=c[k],o instanceof THREE.SpotLight&&o.castShadow&&u++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var p;a:{m=b.fragmentShader;o=b.vertexShader;var k=b.uniforms,c=b.attributes,
+e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(m),f.push(o));
+for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=W.length;v<f;v++)if(W[v].code==j){p=W[v].program;break a}v=n.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?
+"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\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;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
+"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");n.attachShader(v,S("fragment",g+m));n.attachShader(v,S("vertex",f+o));n.linkProgram(v);n.getProgramParameter(v,n.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+n.getProgramParameter(v,n.VALIDATE_STATUS)+", gl error ["+n.getError()+"]");v.uniforms=
 {};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in k)f.push(w);w=f;f=0;for(k=w.length;f<k;f++)m=w[f],v.uniforms[m]=n.getUniformLocation(v,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<e.maxMorphTargets;w++)f.push("morphTarget"+w);for(p in c)f.push(p);p=f;w=0;for(c=p.length;w<c;w++)e=
 p[w],v.attributes[e]=n.getAttribLocation(v,e);W.push({program:v,code:j});p=v}b.program=p;p=b.program.attributes;p.position>=0&&n.enableVertexAttribArray(p.position);p.color>=0&&n.enableVertexAttribArray(p.color);p.normal>=0&&n.enableVertexAttribArray(p.normal);p.tangent>=0&&n.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(n.enableVertexAttribArray(p.skinVertexA),n.enableVertexAttribArray(p.skinVertexB),n.enableVertexAttribArray(p.skinIndex),
-n.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&n.enableVertexAttribArray(p[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)w="morphTarget"+g,p[w]>=0&&(n.enableVertexAttribArray(p[w]),b.numSupportedMorphTargets++)};this.render=function(b,c,p,A){var y,G,H,I,D,L,K,N,M=b.lights,P=b.fog;this.shadowMapEnabled&&w(b,c);C.data.vertices=0;C.data.faces=0;C.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
+n.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&n.enableVertexAttribArray(p[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)w="morphTarget"+h,p[w]>=0&&(n.enableVertexAttribArray(p[w]),b.numSupportedMorphTargets++)};this.render=function(b,c,p,A){var y,G,H,I,D,L,K,N,M=b.lights,P=b.fog;this.shadowMapEnabled&&w(b,c);C.data.vertices=0;C.data.faces=0;C.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
 !1,c);c.matrixWorldInverse.flattenToArray(ka);c.projectionMatrix.flattenToArray(la);ja.multiply(c.projectionMatrix,c.matrixWorldInverse);o(ja);this.initWebGLObjects(b);J(p);(this.autoClear||A)&&this.clear();D=b.__webglObjects.length;for(A=0;A<D;A++)if(y=b.__webglObjects[A],K=y.object,K.visible)if(!(K instanceof THREE.Mesh)||m(K)){if(K.matrixWorld.flattenToArray(K._objectMatrixArray),B(K,c,!0),v(y),y.render=!0,this.sortObjects)y.object.renderDepth?y.z=y.object.renderDepth:(pa.copy(K.position),ja.multiplyVector3(pa),
 y.z=pa.z)}else y.render=!1;else y.render=!1;this.sortObjects&&b.__webglObjects.sort(t);L=b.__webglObjectsImmediate.length;for(A=0;A<L;A++)y=b.__webglObjectsImmediate[A],K=y.object,K.visible&&(K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray),B(K,c,!0),u(y));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);E(b.overrideMaterial.blending);for(A=0;A<D;A++)if(y=b.__webglObjects[A],y.render)K=y.object,N=y.buffer,j(K),f(c,M,P,b.overrideMaterial,N,K);for(A=0;A<L;A++)y=b.__webglObjectsImmediate[A],
 K=y.object,K.visible&&(j(K),G=e(c,M,P,b.overrideMaterial,K),K.render(function(c){g(c,G,b.overrideMaterial.shading)}))}else{E(THREE.NormalBlending);for(A=D-1;A>=0;A--)if(y=b.__webglObjects[A],y.render){K=y.object;N=y.buffer;H=y.opaque;j(K);for(y=0;y<H.count;y++)I=H.list[y],h(I.depthTest),k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,M,P,I,N,K)}for(A=0;A<L;A++)if(y=b.__webglObjectsImmediate[A],K=y.object,K.visible){H=y.opaque;j(K);for(y=0;y<H.count;y++)I=H.list[y],h(I.depthTest),
 k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),G=e(c,M,P,I,K),K.render(function(b){g(b,G,I.shading)})}for(A=0;A<D;A++)if(y=b.__webglObjects[A],y.render){K=y.object;N=y.buffer;H=y.transparent;j(K);for(y=0;y<H.count;y++)I=H.list[y],E(I.blending),h(I.depthTest),k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,M,P,I,N,K)}for(A=0;A<L;A++)if(y=b.__webglObjectsImmediate[A],K=y.object,K.visible){H=y.transparent;j(K);for(y=0;y<H.count;y++)I=H.list[y],E(I.blending),h(I.depthTest),
 k(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),G=e(c,M,P,I,K),K.render(function(b){g(b,G,I.shading)})}}b.__webglSprites.length&&x(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&(n.bindTexture(n.TEXTURE_2D,p.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
-f=b,g=void 0,h=void 0,j=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups==void 0&&G(h),h.geometryGroups){j=h.geometryGroups[g];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=n.createBuffer();k.__webglNormalBuffer=n.createBuffer();
+f=b,h=void 0,g=void 0,j=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(h in g=e.geometry,g.geometryGroups==void 0&&G(g),g.geometryGroups){j=g.geometryGroups[h];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=n.createBuffer();k.__webglNormalBuffer=n.createBuffer();
 k.__webglTangentBuffer=n.createBuffer();k.__webglColorBuffer=n.createBuffer();k.__webglUVBuffer=n.createBuffer();k.__webglUV2Buffer=n.createBuffer();k.__webglSkinVertexABuffer=n.createBuffer();k.__webglSkinVertexBBuffer=n.createBuffer();k.__webglSkinIndicesBuffer=n.createBuffer();k.__webglSkinWeightsBuffer=n.createBuffer();k.__webglFaceBuffer=n.createBuffer();k.__webglLineBuffer=n.createBuffer();if(k.numMorphTargets){var m=void 0,o=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(o=k.numMorphTargets;m<
 o;m++)k.__webglMorphTargetsBuffers.push(n.createBuffer())}for(var k=j,m=e,u=void 0,p=void 0,t=void 0,v=t=void 0,w=void 0,x=void 0,B=x=o=0,D=t=p=void 0,ja=D=p=u=void 0,t=void 0,v=m.geometry,w=v.faces,D=k.faces,u=0,p=D.length;u<p;u++)t=D[u],t=w[t],t instanceof THREE.Face3?(o+=3,x+=1,B+=3):t instanceof THREE.Face4&&(o+=4,x+=2,B+=4);for(var u=k,p=m,E=D=w=void 0,J=void 0,E=void 0,t=[],w=0,D=p.materials.length;w<D;w++)if(E=p.materials[w],E instanceof THREE.MeshFaceMaterial){E=0;for(l=u.materials.length;E<
 l;E++)(J=u.materials[E])&&t.push(J)}else(J=E)&&t.push(J);u=t;k.__materials=u;a:{w=p=void 0;D=u.length;for(p=0;p<D;p++)if(w=u[p],w.map||w.lightMap||w instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{D=w=void 0;t=u.length;for(w=0;w<t;w++)if(D=u[w],!(D instanceof THREE.MeshBasicMaterial&&!D.envMap||D instanceof THREE.MeshDepthMaterial)){D=D&&D.shading!=void 0&&D.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}D=!1}a:{t=w=void 0;E=u.length;for(w=0;w<E;w++)if(t=u[w],
 t.vertexColors){t=t.vertexColors;break a}t=!1}k.__vertexArray=new Float32Array(o*3);if(D)k.__normalArray=new Float32Array(o*3);if(v.hasTangents)k.__tangentArray=new Float32Array(o*4);if(t)k.__colorArray=new Float32Array(o*3);if(p){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),
 k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(B*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(w=k.numMorphTargets;v<w;v++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=D==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=t;k.__normalType=D;k.__webglFaceCount=
 x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=B*2;v=0;for(w=u.length;v<w;v++)if(p=u[v],p.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in p.attributes){t=p.attributes[a];D={};for(ja in t)D[ja]=t[ja];if(!D.__webglInitialized||D.createUniqueBuffers)D.__webglInitialized=!0,x=1,D.type==="v2"?x=2:D.type==="v3"?x=3:D.type==="v4"?x=4:D.type==="c"&&(x=3),D.size=x,D.array=new Float32Array(o*x),D.buffer=n.createBuffer(),D.buffer.belongsToAttribute=
-a,t.needsUpdate=!0,D.__original=t;k.__webglCustomAttributes[a]=D}}k.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}I(f.__webglObjects,j,e)}else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*
-3),g.__webglVertexCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;I(f.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglLineCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;I(f.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;if(!h.__webglVertexBuffer){g=
-h;g.__webglVertexBuffer=n.createBuffer();g.__webglColorBuffer=n.createBuffer();g=h;j=e;k=g.vertices.length;g.__vertexArray=new Float32Array(k*3);g.__colorArray=new Float32Array(k*3);g.__sortArray=[];g.__webglParticleCount=k;g.__materials=j.materials;ja=o=m=void 0;m=0;for(o=j.materials.length;m<o;m++)if(ja=j.materials[m],ja.attributes){if(g.__webglCustomAttributes===void 0)g.__webglCustomAttributes={};for(a in ja.attributes){originalAttribute=ja.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
-originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=n.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;g.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=
-!0;h.__dirtyColors=!0}I(f.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)y(e.__webglObjects,f);else if(f instanceof
-THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&y(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(g=b.__webglObjects[e].object,m=k=h=j=void 0,g instanceof THREE.Mesh){h=g.geometry;for(j in h.geometryGroups)if(k=h.geometryGroups[j],m=A(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
-m)if(m=k,o=n.DYNAMIC_DRAW,ja=!h.dynamic,m.__inittedArrays){var K=B=x=void 0,C=void 0,la=K=void 0,L=void 0,N=void 0,M=void 0,P=J=E=t=D=w=p=u=v=void 0,F=C=M=C=N=L=void 0,z=void 0,Q=z=F=L=void 0,S=void 0,R=Q=z=F=K=K=la=M=C=Q=z=F=S=Q=z=F=S=Q=z=F=void 0,ka=0,U=0,pa=0,X=0,W=0,ha=0,T=0,aa=0,V=0,O=0,Y=0,Q=F=0,Q=void 0,ia=m.__vertexArray,ea=m.__uvArray,fa=m.__uv2Array,da=m.__normalArray,Z=m.__tangentArray,sa=m.__colorArray,ca=m.__skinVertexAArray,$=m.__skinVertexBArray,qa=m.__skinIndexArray,ra=m.__skinWeightArray,
-ta=m.__morphTargetsArrays,ua=m.__webglCustomAttributes,z=void 0,oa=m.__faceArray,ma=m.__lineArray,va=m.__needsSmoothNormals,u=m.__vertexColorType,v=m.__uvType,p=m.__normalType,xa=g.geometry,ya=xa.__dirtyVertices,Ia=xa.__dirtyElements,za=xa.__dirtyUvs,Ja=xa.__dirtyNormals,Ka=xa.__dirtyTangents,Da=xa.__dirtyColors,Ea=xa.__dirtyMorphTargets,Pa=xa.vertices,Ga=m.faces,cb=xa.faces,ab=xa.faceVertexUvs[0],bb=xa.faceVertexUvs[1],Qa=xa.skinVerticesA,Ra=xa.skinVerticesB,Sa=xa.skinIndices,Ha=xa.skinWeights,Fa=
+a,t.needsUpdate=!0,D.__original=t;k.__webglCustomAttributes[a]=D}}k.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}I(f.__webglObjects,j,e)}else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)h=g,h.__webglVertexBuffer=n.createBuffer(),h.__webglColorBuffer=n.createBuffer(),h=g,j=h.vertices.length,h.__vertexArray=new Float32Array(j*3),h.__colorArray=new Float32Array(j*
+3),h.__webglVertexCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;I(f.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)h=g,h.__webglVertexBuffer=n.createBuffer(),h.__webglColorBuffer=n.createBuffer(),h=g,j=h.vertices.length,h.__vertexArray=new Float32Array(j*3),h.__colorArray=new Float32Array(j*3),h.__webglLineCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;I(f.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer){h=
+g;h.__webglVertexBuffer=n.createBuffer();h.__webglColorBuffer=n.createBuffer();h=g;j=e;k=h.vertices.length;h.__vertexArray=new Float32Array(k*3);h.__colorArray=new Float32Array(k*3);h.__sortArray=[];h.__webglParticleCount=k;h.__materials=j.materials;ja=o=m=void 0;m=0;for(o=j.materials.length;m<o;m++)if(ja=j.materials[m],ja.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in ja.attributes){originalAttribute=ja.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
+originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=n.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;h.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=
+!0;g.__dirtyColors=!0}I(f.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)y(e.__webglObjects,f);else if(f instanceof
+THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==f&&e.splice(g,1)}else f instanceof THREE.MarchingCubes&&y(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,m=k=g=j=void 0,h instanceof THREE.Mesh){g=h.geometry;for(j in g.geometryGroups)if(k=g.geometryGroups[j],m=A(k),g.__dirtyVertices||g.__dirtyMorphTargets||g.__dirtyElements||g.__dirtyUvs||g.__dirtyNormals||g.__dirtyColors||g.__dirtyTangents||
+m)if(m=k,o=n.DYNAMIC_DRAW,ja=!g.dynamic,m.__inittedArrays){var K=B=x=void 0,C=void 0,la=K=void 0,L=void 0,N=void 0,M=void 0,P=J=E=t=D=w=p=u=v=void 0,F=C=M=C=N=L=void 0,z=void 0,Q=z=F=L=void 0,S=void 0,R=Q=z=F=K=K=la=M=C=Q=z=F=S=Q=z=F=S=Q=z=F=void 0,ka=0,U=0,pa=0,X=0,W=0,ha=0,T=0,aa=0,V=0,O=0,Y=0,Q=F=0,Q=void 0,ia=m.__vertexArray,ea=m.__uvArray,fa=m.__uv2Array,da=m.__normalArray,Z=m.__tangentArray,sa=m.__colorArray,ca=m.__skinVertexAArray,$=m.__skinVertexBArray,qa=m.__skinIndexArray,ra=m.__skinWeightArray,
+ta=m.__morphTargetsArrays,ua=m.__webglCustomAttributes,z=void 0,oa=m.__faceArray,ma=m.__lineArray,va=m.__needsSmoothNormals,u=m.__vertexColorType,v=m.__uvType,p=m.__normalType,xa=h.geometry,ya=xa.__dirtyVertices,Ia=xa.__dirtyElements,za=xa.__dirtyUvs,Ja=xa.__dirtyNormals,Ka=xa.__dirtyTangents,Da=xa.__dirtyColors,Ea=xa.__dirtyMorphTargets,Pa=xa.vertices,Ga=m.faces,cb=xa.faces,ab=xa.faceVertexUvs[0],bb=xa.faceVertexUvs[1],Qa=xa.skinVerticesA,Ra=xa.skinVerticesB,Sa=xa.skinIndices,Ha=xa.skinWeights,Fa=
 xa.morphTargets;if(ua)for(R in ua)ua[R].offset=0,ua[R].offsetSrc=0;x=0;for(B=Ga.length;x<B;x++)if(K=Ga[x],C=cb[K],ab&&(w=ab[K]),bb&&(D=bb[K]),K=C.vertexNormals,la=C.normal,L=C.vertexColors,N=C.color,M=C.vertexTangents,C instanceof THREE.Face3){if(ya)t=Pa[C.a].position,E=Pa[C.b].position,J=Pa[C.c].position,ia[U]=t.x,ia[U+1]=t.y,ia[U+2]=t.z,ia[U+3]=E.x,ia[U+4]=E.y,ia[U+5]=E.z,ia[U+6]=J.x,ia[U+7]=J.y,ia[U+8]=J.z,U+=9;if(ua)for(R in ua)if(z=ua[R],z.__original.needsUpdate)F=z.offset,Q=z.offsetSrc,z.size===
 1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F]=z.value[C.a],z.array[F+1]=z.value[C.b],z.array[F+2]=z.value[C.c]):z.boundTo==="faces"?(Q=z.value[Q],z.array[F]=Q,z.array[F+1]=Q,z.array[F+2]=Q,z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F]=z.value[Q],z.array[F+1]=z.value[Q+1],z.array[F+2]=z.value[Q+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(t=z.value[C.a],E=z.value[C.b],J=z.value[C.c]):z.boundTo==="faces"?(J=E=t=Q=z.value[Q],z.offsetSrc++):z.boundTo===
 "faceVertices"&&(t=z.value[Q],E=z.value[Q+1],J=z.value[Q+2],z.offsetSrc+=3),z.size===2?(z.array[F]=t.x,z.array[F+1]=t.y,z.array[F+2]=E.x,z.array[F+3]=E.y,z.array[F+4]=J.x,z.array[F+5]=J.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[F]=t.r,z.array[F+1]=t.g,z.array[F+2]=t.b,z.array[F+3]=E.r,z.array[F+4]=E.g,z.array[F+5]=E.b,z.array[F+6]=J.r,z.array[F+7]=J.g,z.array[F+8]=J.b):(z.array[F]=t.x,z.array[F+1]=t.y,z.array[F+2]=t.z,z.array[F+3]=E.x,z.array[F+4]=E.y,z.array[F+5]=E.z,z.array[F+6]=J.x,z.array[F+
@@ -316,10 +318,10 @@ C.z,Z[T+11]=C.w,Z[T+12]=M.x,Z[T+13]=M.y,Z[T+14]=M.z,Z[T+15]=M.w,T+=16;if(Ja&&p)i
 3]=ka+3,ma[aa+4]=ka+1,ma[aa+5]=ka+2,ma[aa+6]=ka+2,ma[aa+7]=ka+3,aa+=8,ka+=4)}ya&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,ia,o));if(ua)for(R in ua)z=ua[R],z.__original.needsUpdate&&(n.bindBuffer(n.ARRAY_BUFFER,z.buffer),n.bufferData(n.ARRAY_BUFFER,z.array,o));if(Ea){F=0;for(z=Fa.length;F<z;F++)n.bindBuffer(n.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[F]),n.bufferData(n.ARRAY_BUFFER,ta[F],o)}Da&&V>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,
 sa,o));Ja&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,da,o));Ka&&xa.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,Z,o));za&&pa>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ea,o));za&&X>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,fa,o));Ia&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,oa,o),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,
 m.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,ma,o));O>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,ca,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,$,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,qa,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,ra,o));ja&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,
-delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;H(k)}else if(g instanceof THREE.Ribbon){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=B=x=x=
-void 0;v=g.vertices;m=g.colors;u=v.length;o=m.length;p=g.__vertexArray;ja=g.__colorArray;w=g.__dirtyColors;if(g.__dirtyVertices){for(x=0;x<u;x++)B=v[x].position,k=x*3,p[k]=B.x,p[k+1]=B.y,p[k+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,p,j)}if(w){for(x=0;x<o;x++)color=m[x],k=x*3,ja[k]=color.r,ja[k+1]=color.g,ja[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,ja,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof
-THREE.Line){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=B=x=x=void 0;v=g.vertices;m=g.colors;u=v.length;o=m.length;p=g.__vertexArray;ja=g.__colorArray;w=g.__dirtyColors;if(g.__dirtyVertices){for(x=0;x<u;x++)B=v[x].position,k=x*3,p[k]=B.x,p[k+1]=B.y,p[k+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,p,j)}if(w){for(x=0;x<o;x++)color=m[x],k=x*3,ja[k]=color.r,ja[k+1]=color.g,ja[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer);
-n.bufferData(n.ARRAY_BUFFER,ja,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem)h=g.geometry,m=A(h),(h.__dirtyVertices||h.__dirtyColors||g.sortParticles||m)&&c(h,n.DYNAMIC_DRAW,g),h.__dirtyVertices=!1,h.__dirtyColors=!1,H(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?n.frontFace(n.CCW):n.frontFace(n.CW),b=="back"?n.cullFace(n.BACK):b=="front"?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK),n.enable(n.CULL_FACE)):n.disable(n.CULL_FACE)};this.supportsVertexTextures=
+delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}g.__dirtyVertices=!1;g.__dirtyMorphTargets=!1;g.__dirtyElements=!1;g.__dirtyUvs=!1;g.__dirtyNormals=!1;g.__dirtyTangents=!1;g.__dirtyColors=!1;H(k)}else if(h instanceof THREE.Ribbon){g=h.geometry;if(g.__dirtyVertices||g.__dirtyColors){h=g;j=n.DYNAMIC_DRAW;k=B=x=x=
+void 0;v=h.vertices;m=h.colors;u=v.length;o=m.length;p=h.__vertexArray;ja=h.__colorArray;w=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<u;x++)B=v[x].position,k=x*3,p[k]=B.x,p[k+1]=B.y,p[k+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,h.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,p,j)}if(w){for(x=0;x<o;x++)color=m[x],k=x*3,ja[k]=color.r,ja[k+1]=color.g,ja[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,h.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,ja,j)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(h instanceof
+THREE.Line){g=h.geometry;if(g.__dirtyVertices||g.__dirtyColors){h=g;j=n.DYNAMIC_DRAW;k=B=x=x=void 0;v=h.vertices;m=h.colors;u=v.length;o=m.length;p=h.__vertexArray;ja=h.__colorArray;w=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<u;x++)B=v[x].position,k=x*3,p[k]=B.x,p[k+1]=B.y,p[k+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,h.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,p,j)}if(w){for(x=0;x<o;x++)color=m[x],k=x*3,ja[k]=color.r,ja[k+1]=color.g,ja[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,h.__webglColorBuffer);
+n.bufferData(n.ARRAY_BUFFER,ja,j)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)g=h.geometry,m=A(g),(g.__dirtyVertices||g.__dirtyColors||h.sortParticles||m)&&c(g,n.DYNAMIC_DRAW,h),g.__dirtyVertices=!1,g.__dirtyColors=!1,H(g)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?n.frontFace(n.CCW):n.frontFace(n.CW),b=="back"?n.cullFace(n.BACK):b=="front"?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK),n.enable(n.CULL_FACE)):n.disable(n.CULL_FACE)};this.supportsVertexTextures=
 function(){return Da}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
@@ -333,7 +335,7 @@ f):h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));t.norm
 j=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var h=new THREE.Vertex(f[b].position.clone());c.vertices.push(h)}b=0;for(e=g.length;b<e;b++){var k=g[b],o,m,p=k.vertexNormals,u=k.vertexColors;k instanceof THREE.Face3?o=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(o=new THREE.Face4(k.a,k.b,k.c,k.d));o.normal.copy(k.normal);f=0;for(h=p.length;f<h;f++)m=p[f],o.vertexNormals.push(m.clone());o.color.copy(k.color);f=0;for(h=u.length;f<h;f++)m=u[f],o.vertexColors.push(m.clone());o.materials=k.materials.slice();
 o.centroid.copy(k.centroid);c.faces.push(o)}b=0;for(e=j.length;b<e;b++){g=j[b];o=[];f=0;for(h=g.length;f<h;f++)o.push(new THREE.UV(g[f].u,g[f].v));c.faceVertexUvs[0].push(o)}return c},randomPointInTriangle:function(b,c,e){var f,g,j,h=new THREE.Vector3,k=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();f+g>1&&(f=1-f,g=1-g);j=1-f-g;h.copy(b);h.multiplyScalar(f);k.copy(c);k.multiplyScalar(g);h.addSelf(k);k.copy(e);k.multiplyScalar(j);h.addSelf(k);return h},randomPointInFace:function(b,
 c,e){var f,g,j;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,g=c.vertices[b.b].position,j=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,g,j);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;g=c.vertices[b.b].position;j=c.vertices[b.c].position;var c=c.vertices[b.d].position,h;e?b._area1&&b._area2?(e=b._area1,h=b._area2):(e=THREE.GeometryUtils.triangleArea(f,g,c),h=THREE.GeometryUtils.triangleArea(g,j,c),b._area1=e,b._area2=h):(e=THREE.GeometryUtils.triangleArea(f,
-g,c),h=THREE.GeometryUtils.triangleArea(g,j,c));return THREE.GeometryUtils.random()*(e+h)<e?THREE.GeometryUtils.randomPointInTriangle(f,g,c):THREE.GeometryUtils.randomPointInTriangle(g,j,c)}},randomPointsInGeometry:function(b,c){function e(b){function c(e,f){if(f<e)return e;var g=e+Math.floor((f-e)/2);return m[g]>b?c(e,g-1):m[g]<b?c(g+1,f):g}return c(0,m.length-1)}var f,g,j=b.faces,h=b.vertices,k=j.length,o=0,m=[],p,u,v,t;for(g=0;g<k;g++){f=j[g];if(f instanceof THREE.Face3)p=h[f.a].position,u=h[f.b].position,
+g,c),h=THREE.GeometryUtils.triangleArea(g,j,c));return THREE.GeometryUtils.random()*(e+h)<e?THREE.GeometryUtils.randomPointInTriangle(f,g,c):THREE.GeometryUtils.randomPointInTriangle(g,j,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var h=c+Math.floor((f-c)/2);return m[h]>b?e(c,h-1):m[h]<b?e(h+1,f):h}return e(0,m.length-1)}var f,g,j=b.faces,h=b.vertices,k=j.length,o=0,m=[],p,u,v,t;for(g=0;g<k;g++){f=j[g];if(f instanceof THREE.Face3)p=h[f.a].position,u=h[f.b].position,
 v=h[f.c].position,f._area=THREE.GeometryUtils.triangleArea(p,u,v);else if(f instanceof THREE.Face4)p=h[f.a].position,u=h[f.b].position,v=h[f.c].position,t=h[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(p,u,t),f._area2=THREE.GeometryUtils.triangleArea(u,v,t),f._area=f._area1+f._area2;o+=f._area;m[g]=o}f=[];h={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*o,k=e(k),f[g]=THREE.GeometryUtils.randomPointInFace(j[k],b,!0),h[k]?h[k]+=1:h[k]=1;return f},triangleArea:function(b,c,e){var f,g=THREE.GeometryUtils.__v1;
 g.sub(b,c);f=g.length();g.sub(b,e);b=g.length();g.sub(c,e);e=g.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],j=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)j.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return j}};
@@ -348,7 +350,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,j=2*Math.ceil(b*3)+1;j>25&&(j=25);g=(j-1)*0.5;e=Array(j);for(c=f=0;c<j;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<j;++c)e[c]/=f;return e}};
-THREE.AnimationHandler=function(){var b=[],c={},e={update:function(c){for(var e=0;e<b.length;e++)b[e].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
+THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
 0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var k=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){k={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++){var m=b.hierarchy[e].keys[f].morphTargets[o];k[m]=-1}b.hierarchy[e].usedMorphTargets=k;for(f=0;f<b.hierarchy[e].keys.length;f++){var p=
 {};for(m in k){for(o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++)if(b.hierarchy[e].keys[f].morphTargets[o]===m){p[m]=b.hierarchy[e].keys[f].morphTargetsInfluences[o];break}o===b.hierarchy[e].keys[f].morphTargets.length&&(p[m]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=p}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
@@ -375,9 +377,9 @@ this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown
 1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*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=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*
 Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
 THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
-THREE.PathCamera=function(b){function c(b,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},h,j=c.getControlPointsArray(),k=c.getLength(),o=j.length,H=0;h=o-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<o-1;h++)H=f*k.chunks[h]/k.total,c.keys[h]={time:H,pos:j[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
-f,g=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,h);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);g=new THREE.SphereGeometry(1,
-16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,h),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
+THREE.PathCamera=function(b){function c(b,c,e,f){var h={name:e,fps:0.6,length:f,hierarchy:[]},g,j=c.getControlPointsArray(),k=c.getLength(),o=j.length,H=0;g=o-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[g]={time:f,pos:j[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<o-1;g++)H=f*k.chunks[g]/k.total,c.keys[g]={time:H,pos:j[g]};h.hierarchy[0]=c;THREE.AnimationHandler.add(h);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
+f,h=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),h.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
+16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;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=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
 window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,j=Math.PI/180;this.update=function(b,c,e){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);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)*j;this.theta=this.lon*j;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var k=h[1]-h[0];this.phi=
@@ -458,15 +460,15 @@ THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.se
 THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
 THREE.CubeGeometry=function(b,c,e,f,g,j,h,k,o){function m(b,c,e,h,k,m,o,t){var u,v,w=f||1,x=g||1,R=k/2,C=m/2,n=p.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",x=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=j||1;var W=w+1,V=x+1;k/=w;var fa=m/x;for(v=0;v<V;v++)for(m=0;m<W;m++){var L=new THREE.Vector3;L[b]=(m*k-R)*e;L[c]=(v*fa-C)*h;L[u]=o;p.vertices.push(new THREE.Vertex(L))}for(v=0;v<x;v++)for(m=0;m<w;m++)p.faces.push(new THREE.Face4(m+W*
 v+n,m+W*(v+1)+n,m+1+W*(v+1)+n,m+1+W*v+n,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(m/w,v/x),new THREE.UV(m/w,(v+1)/x),new THREE.UV((m+1)/w,(v+1)/x),new THREE.UV((m+1)/w,v/x)])}THREE.Geometry.call(this);var p=this,u=b/2,v=c/2,t=e/2,k=k?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(o!=void 0)for(var x in o)this.sides[x]!=void 0&&(this.sides[x]=
-o[x]);this.sides.px&&m("z","y",1*k,-1,e,c,-u,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,e,c,u,this.materials[1]);this.sides.py&&m("x","z",1*k,1,b,e,v,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,b,e,-v,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,b,c,t,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,b,c,-t,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var g=p.vertices[e],h=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(g.position.x==m.position.x&&
-g.position.y==m.position.y&&g.position.z==m.position.z){c[e]=j;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)g=p.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+o[x]);this.sides.px&&m("z","y",1*k,-1,e,c,-u,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,e,c,u,this.materials[1]);this.sides.py&&m("x","z",1*k,1,b,e,v,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,b,e,-v,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,b,c,t,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,b,c,-t,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var h=p.vertices[e],g=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(h.position.x==m.position.x&&
+h.position.y==m.position.y&&h.position.z==m.position.z){c[e]=j;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)h=p.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,c,e){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var k=this,o,m=Math.PI*2,p=f/2;for(o=0;o<b;o++)h(Math.sin(m*o/b)*c,Math.cos(m*o/b)*c,-p);for(o=0;o<b;o++)h(Math.sin(m*o/b)*e,Math.cos(m*o/b)*e,p);for(o=0;o<b;o++)k.faces.push(new THREE.Face4(o,o+b,b+(o+1)%b,(o+1)%b));if(e>0){h(0,0,-p-(j||0));for(o=b;o<b+b/2;o++)k.faces.push(new THREE.Face4(2*b,(2*o-2*b)%b,(2*o-2*b+1)%b,(2*o-2*b+2)%b))}if(c>0){h(0,0,p+
 (g||0));for(o=b+b/2;o<2*b;o++)k.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b))}o=0;for(b=this.faces.length;o<b;o++){var c=[],e=this.faces[o],g=this.vertices[e.a],j=this.vertices[e.b],p=this.vertices[e.c],u=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/m,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/m,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/m,0.5+p.position.z/
 f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/m,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;for(e=0;e<f;e++)g=b[e],this.addShape(g,c)}};
 THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);g.set(b.x-e.x,b.y-e.y);f=f.normalize();g=g.normalize();h.set(-f.y,f.x);j.set(g.y,-g.x);k.copy(b).addSelf(h);m.copy(b).addSelf(j);if(k.equals(m))return j.clone();
-k.copy(c).addSelf(h);m.copy(e).addSelf(j);h=f.dot(j);j=m.subSelf(k).dot(j);h==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=h;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(D=b.length;--D>=0;){T=D;U=D-1;U<0&&(U=b.length-
-1);for(var c=0,c=0;c<t+p*2;c++){var e=n*c,f=n*(c+1),g=da+T+e,e=da+U+e,h=da+U+f,f=da+T+f;g+=K;e+=K;h+=K;f+=K;E.faces.push(new THREE.Face4(g,e,h,f))}}}function j(b,c,e){E.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=K;c+=K;e+=K;E.faces.push(new THREE.Face3(b,c,e))}var k=c.amount!==void 0?c.amount:100,o=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:o-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
+THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,g=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();g.set(-f.y,f.x);j.set(h.y,-h.x);k.copy(b).addSelf(g);m.copy(b).addSelf(j);if(k.equals(m))return j.clone();
+k.copy(c).addSelf(g);m.copy(e).addSelf(j);g=f.dot(j);j=m.subSelf(k).dot(j);g==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=g;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(D=b.length;--D>=0;){T=D;U=D-1;U<0&&(U=b.length-
+1);for(var c=0,c=0;c<t+p*2;c++){var e=n*c,f=n*(c+1),h=da+T+e,e=da+U+e,g=da+U+f,f=da+T+f;h+=K;e+=K;g+=K;f+=K;E.faces.push(new THREE.Face4(h,e,g,f))}}}function j(b,c,e){E.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=K;c+=K;e+=K;E.faces.push(new THREE.Face3(b,c,e))}var k=c.amount!==void 0?c.amount:100,o=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:o-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
 !0,v=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,w=c.bendPath,x=c.extrudePath,B,A=!1,H=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1;if(x)B=x.getPoints(v),t=B.length,A=!0,u=!1;u||(m=o=p=0);var y,G,I,E=this,K=this.vertices.length;w&&b.addWrapPath(w);v=H?b.extractAllSpacedPoints(v):b.extractAllPoints(v);w=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(w)){w=w.reverse();G=0;for(I=v.length;G<I;G++)y=v[G],THREE.Shape.Utils.isClockWise(y)&&(v[G]=y.reverse());x=!1}x=
 THREE.Shape.Utils.triangulateShape(w,v);H=w;G=0;for(I=v.length;G<I;G++)y=v[G],w=w.concat(y);var D,J,S,X,R,C,n=w.length,W=x.length,V=[];D=0;J=H.length;T=J-1;for(U=D+1;D<J;D++,T++,U++)T==J&&(T=0),U==J&&(U=0),V[D]=f(H[D],H[T],H[U]);var fa=[],L,ea=V.concat();G=0;for(I=v.length;G<I;G++){y=v[G];L=[];D=0;J=y.length;T=J-1;for(U=D+1;D<J;D++,T++,U++)T==J&&(T=0),U==J&&(U=0),L[D]=f(y[D],y[T],y[U]);fa.push(L);ea=ea.concat(L)}for(S=0;S<p;S++){X=S/p;R=o*(1-X);X=m*Math.sin(X*Math.PI/2);D=0;for(J=H.length;D<J;D++)C=
 e(H[D],V[D],X),j(C.x,C.y,-R);G=0;for(I=v.length;G<I;G++){y=v[G];L=fa[G];D=0;for(J=y.length;D<J;D++)C=e(y[D],L[D],X),j(C.x,C.y,-R)}}X=m;for(D=0;D<n;D++)C=u?e(w[D],ea[D],X):w[D],A?j(C.x,C.y+B[0].y,B[0].x):j(C.x,C.y,0);for(S=1;S<=t;S++)for(D=0;D<n;D++)C=u?e(w[D],ea[D],X):w[D],A?j(C.x,C.y+B[S-1].y,B[S-1].x):j(C.x,C.y,k/t*S);for(S=p-1;S>=0;S--){X=S/p;R=o*(1-X);X=m*Math.sin(X*Math.PI/2);D=0;for(J=H.length;D<J;D++)C=e(H[D],V[D],X),j(C.x,C.y,k+R);G=0;for(I=v.length;G<I;G++){y=v[G];L=fa[G];D=0;for(J=y.length;D<
@@ -492,17 +494,17 @@ v,t,w,x),h=j[j.length-1]){p=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisi
 (function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],k=[],o,m,p;if(c(b)>0)for(m=0;m<g;m++)h[m]=m;else for(m=0;m<g;m++)h[m]=g-1-m;var u=2*g;for(m=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return k;return j}o=m;g<=o&&(o=0);m=o+1;g<=m&&(m=0);p=m+1;g<=p&&(p=0);var v;a:{v=b;var t=o,w=m,x=p,B=g,A=h,H=void 0,y=void 0,G=void 0,
 I=void 0,E=void 0,K=void 0,D=void 0,J=void 0,S=void 0,y=v[A[t]].x,G=v[A[t]].y,I=v[A[w]].x,E=v[A[w]].y,K=v[A[x]].x,D=v[A[x]].y;if(1.0E-10>(I-y)*(D-G)-(E-G)*(K-y))v=!1;else{for(H=0;H<B;H++)if(!(H==t||H==w||H==x)){var J=v[A[H]].x,S=v[A[H]].y,X=void 0,R=void 0,C=void 0,n=void 0,W=void 0,V=void 0,fa=void 0,L=void 0,ea=void 0,T=void 0,U=void 0,da=void 0,X=C=W=void 0,X=K-I,R=D-E,C=y-K,n=G-D,W=I-y,V=E-G,fa=J-y,L=S-G,ea=J-I,T=S-E,U=J-K,da=S-D,X=X*T-R*ea,W=W*L-V*fa,C=C*da-n*U;if(X>=0&&C>=0&&W>=0){v=!1;break a}}v=
 !0}}if(v){j.push([b[h[o]],b[h[m]],b[h[p]]]);k.push([h[o],h[m],h[p]]);o=m;for(p=m+1;p<g;o++,p++)h[o]=h[p];g--;u=2*g}}if(f)return k;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
-THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
-1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
+THREE.TorusGeometry=function(b,c,e,f,g){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=g||2*Math.PI;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e)f=e/this.segmentsT*this.arc,g=c/this.segmentsR*2*Math.PI,this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g)))),b.push([e/this.segmentsT,1-c/this.segmentsR]);
+for(c=1;c<=this.segmentsR;++c)for(e=1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(b,c,e,f,g,j,h){function k(b,c,e,f,g,h){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,h*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=j||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
+THREE.TorusKnotGeometry=function(b,c,e,f,g,j,h){function k(b,c,e,f,h,g){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(h*(2+e)*0.5*Math.cos(b),h*(2+e)*Math.sin(b)*0.5,g*h*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=j||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var o=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=k(o,h,this.q,this.p,this.radius,this.heightScale),o=k(o+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=o.x-g.x;e.y=o.y-g.y;e.z=o.z-g.z;f.x=o.x+g.x;f.y=o.y+g.y;f.z=o.z+g.z;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();o=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=o*f.x+h*j.x;g.y+=o*f.y+h*j.y;g.z+=o*f.z+h*j.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
 g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,j=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,j));this.faceVertexUvs[0].push([h,o,m,p])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
 this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
-new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,g,h,j,k){var m=document.createElement("canvas");b[e]=new THREE.Texture(m);b[e].sourceFile=g;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(h[1]!=
-1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)b[e].wrapS=h[k[0]];if(h[k[1]]!==void 0)b[e].wrapT=h[k[1]]}f(b[e],c+"/"+g)}function j(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,k,o;k="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?k="MeshPhongMaterial":b.shading=="Basic"&&(k="MeshBasicMaterial"));
+new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,j,k){var m=document.createElement("canvas");b[e]=new THREE.Texture(m);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
+1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(k){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[k[0]]!==void 0)b[e].wrapS=g[k[0]];if(g[k[1]]!==void 0)b[e].wrapT=g[k[1]]}f(b[e],c+"/"+h)}function j(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,k,o;k="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?k="MeshPhongMaterial":b.shading=="Basic"&&(k="MeshBasicMaterial"));
 if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.colorDiffuse)h.color=j(b.colorDiffuse);
 else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=j(b.colorSpecular);if(b.colorAmbient)h.ambient=j(b.colorAmbient);if(b.transparency)h.opacity=b.transparency;if(b.specularCoef)h.shininess=b.specularCoef;b.mapDiffuse&&c&&g(h,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(h,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(h,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
 b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var m=THREE.ShaderUtils.lib.normal,p=THREE.UniformsUtils.clone(m.uniforms),u=h.color;k=h.specular;o=h.ambient;var v=h.shininess;p.tNormal.texture=h.normalMap;if(b.mapNormalFactor)p.uNormalScale.value=b.mapNormalFactor;if(h.map)p.tDiffuse.texture=h.map,p.enableDiffuse.value=!0;if(h.specularMap)p.tSpecular.texture=h.specularMap,p.enableSpecular.value=!0;if(h.lightMap)p.tAO.texture=

BIN
examples/models/monster.jpg


+ 1 - 1
examples/models/skin_and_morph.dae

@@ -359,7 +359,7 @@ A regular skin controller would point at a geometry we wanted to skin.  In this
 taking the output of a morph controller (which is geometry) and skinning that.
 *******************************************************************************************
     	-->
-     <skin source="#pCylinderShape1-morph">
+     <skin source="#pCylinderShape1">
        <!--
 *******************************************************************************************
 The bind shape matrix describes how to transform the pCylinderShape1-morph geometry into the

+ 4 - 2
examples/webgl_collada.html

@@ -6,7 +6,7 @@
 		<style type="text/css">
 			body {
 				font-family: Monospace;
-				background-color: #ffffff;
+				background-color: #000000;
 				margin: 0px;
 				overflow: hidden;
 			}
@@ -37,7 +37,9 @@
 			
 			function colladaReady(collada) {
 				dae = collada.scene;
-				dae.scale.x = dae.scale.y = dae.scale.z = 0.002;
+				dae.scale.x = dae.scale.y = dae.scale.z = 0.003;
+				//dae.rotation.x = -Math.PI/2;
+				dae.updateMatrix();
 
 				init();
 				animate();

+ 55 - 1
src/core/Matrix4.js

@@ -6,6 +6,7 @@
  * @author D1plo1d / http://github.com/D1plo1d
  * @author alteredq / http://alteredqualia.com/
  * @author mikael emtinger / http://gomo.se/
+ * @author timknip / http://www.floorplanner.com/
  */
 
 THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
@@ -667,6 +668,59 @@ THREE.Matrix4.prototype = {
 
 	},
 
+	compose: function ( translation, rotation, scale ) {
+		var mr = new THREE.Matrix4();
+		var ms = new THREE.Matrix4();
+		
+		mr.setRotationFromQuaternion(rotation);
+		ms.setScale(scale.x, scale.y, scale.z);
+		
+		this.multiply(mr, ms);
+		this.n14 = translation.x;
+		this.n24 = translation.y;
+		this.n34 = translation.z;
+		
+		return this;
+	},
+	
+	decompose: function ( translation, rotation, scale ) {
+		// grab the axis vecs
+		var x = new THREE.Vector3(this.n11, this.n21, this.n31);
+		var y = new THREE.Vector3(this.n12, this.n22, this.n32);
+		var z = new THREE.Vector3(this.n13, this.n23, this.n33);
+	
+		translation = (translation instanceof THREE.Vector3) ? translation : new THREE.Vector3();
+		rotation = (rotation instanceof THREE.Quaternion) ? rotation : new THREE.Quaternion();
+		scale = (scale instanceof THREE.Vector3) ? scale : new THREE.Vector3();
+	
+		scale.x = x.length();
+		scale.y = y.length();
+		scale.z = z.length();
+	
+		translation.x = this.n14;
+		translation.y = this.n24;
+		translation.z = this.n34;
+	
+		// scale the rotation part
+		var matrix = this.clone();
+	
+		matrix.n11 /= scale.x;
+		matrix.n21 /= scale.x;
+		matrix.n31 /= scale.x;
+	
+		matrix.n12 /= scale.y;
+		matrix.n22 /= scale.y;
+		matrix.n32 /= scale.y;
+	
+		matrix.n13 /= scale.z;
+		matrix.n23 /= scale.z;
+		matrix.n33 /= scale.z;
+	
+		rotation.setFromRotationMatrix(matrix);
+		
+		return [translation, rotation, scale];
+	},
+
 	extractPosition: function ( m ) {
 
 		this.n14 = m.n14;
@@ -674,7 +728,7 @@ THREE.Matrix4.prototype = {
 		this.n34 = m.n34;
 
 	},
-
+	
 	extractRotation: function ( m, s ) {
 
 		var invScaleX = 1 / s.x, invScaleY = 1 / s.y, invScaleZ = 1 / s.z;

+ 17 - 0
src/core/Quaternion.js

@@ -85,6 +85,23 @@ THREE.Quaternion.prototype = {
 
 	},
 	
+	setFromRotationMatrix: function ( m ) {
+		// Adapted from: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
+		function copySign(a, b) {
+			return b < 0 ? -Math.abs(a) : Math.abs(a);
+		}
+		var absQ = Math.pow(m.determinant(), 1.0 / 3.0);
+		this.w = Math.sqrt( Math.max( 0, absQ + m.n11 + m.n22 + m.n33 ) ) / 2; 
+		this.x = Math.sqrt( Math.max( 0, absQ + m.n11 - m.n22 - m.n33 ) ) / 2; 
+		this.y = Math.sqrt( Math.max( 0, absQ - m.n11 + m.n22 - m.n33 ) ) / 2; 
+		this.z = Math.sqrt( Math.max( 0, absQ - m.n11 - m.n22 + m.n33 ) ) / 2; 
+		this.x = copySign( this.x, ( m.n32 - m.n23 ) );
+		this.y = copySign( this.y, ( m.n13 - m.n31 ) );
+		this.z = copySign( this.z, ( m.n21 - m.n12 ) );
+		this.normalize();
+		return this;
+	},
+	
 	calculateW : function () {
 
 		this.w = - Math.sqrt( Math.abs( 1.0 - this.x * this.x - this.y * this.y - this.z * this.z ) );

File diff suppressed because it is too large
+ 459 - 308
src/extras/collada/dae.js


Some files were not shown because too many files changed in this diff