Browse Source

Fixed bug preventing re-adding of objects removed from the scene.

Problem was that objects could be added to WebGLRenderer's internal render list only once (because of `webglInit` flag).

Now there are two separate internal states (`webglInit` and `webglActive`) so that object can be initialized just once (expensive operation) but added / removed from the scene many times (cheap operation).
alteredq 14 years ago
parent
commit
0033a97542
4 changed files with 260 additions and 242 deletions
  1. 86 85
      build/Three.js
  2. 144 143
      build/custom/ThreeWebGL.js
  3. 2 1
      src/core/Object3D.js
  4. 28 13
      src/renderers/WebGLRenderer.js

File diff suppressed because it is too large
+ 86 - 85
build/Three.js


+ 144 - 143
build/custom/ThreeWebGL.js

@@ -16,35 +16,35 @@ c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,f=[];c=0;for(d=b.length;c<d;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,d){var f;f=d.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return d.distanceTo(b)}function d(b,c,d,f){var f=f.clone().subSelf(c),
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,f=[];c=0;for(d=b.length;c<d;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,d){var f;f=d.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return d.distanceTo(b)}function d(b,c,d,f){var f=f.clone().subSelf(c),
 d=d.clone().subSelf(c),j=b.clone().subSelf(c),b=f.dot(f),c=f.dot(d),f=f.dot(j),h=d.dot(d),d=d.dot(j),j=1/(b*h-c*c),h=(h*f-c*d)*j,b=(b*d-c*f)*j;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
 d=d.clone().subSelf(c),j=b.clone().subSelf(c),b=f.dot(f),c=f.dot(d),f=f.dot(j),h=d.dot(d),d=d.dot(j),j=1/(b*h-c*c),h=(h*f-c*d)*j,b=(b*d-c*f)*j;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
-Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,q,o,r,n,u,w,B=b.geometry,y=B.vertices,I=[],f=0;for(j=B.faces.length;f<j;f++)if(h=B.faces[f],u=this.origin.clone(),w=this.direction.clone(),o=b.matrixWorld,k=o.multiplyVector3(h.centroid.clone()).subSelf(u),n=k.dot(w),!(n<=0)&&(k=o.multiplyVector3(y[h.a].position.clone()),m=o.multiplyVector3(y[h.b].position.clone()),q=o.multiplyVector3(y[h.c].position.clone()),o=h instanceof THREE.Face4?o.multiplyVector3(y[h.d].position.clone()):null,r=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
-n=w.dot(r),b.doubleSided||(b.flipSided?n>0:n<0)))if(n=r.dot((new THREE.Vector3).sub(k,u))/n,u=u.addSelf(w.multiplyScalar(n)),h instanceof THREE.Face3)d(u,k,m,q)&&(h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},I.push(h));else if(h instanceof THREE.Face4&&(d(u,k,m,o)||d(u,m,q,o)))h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},I.push(h);I.sort(function(b,c){return b.distance-c.distance});return I}else return[]}};
-THREE.Rectangle=function(){function b(){h=f-c;k=j-d}var c,d,f,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return j};this.set=function(h,k,r,n){m=!1;c=h;d=k;f=r;j=n;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,f=h,j=k):(c=c<h?c:h,d=d<k?d:k,f=f>h?f:h,j=j>k?j:k);b()};this.add3Points=
-function(h,k,r,n,u,w){m?(m=!1,c=h<r?h<u?h:u:r<u?r:u,d=k<n?k<w?k:w:n<w?n:w,f=h>r?h>u?h:u:r>u?r:u,j=k>n?k>w?k:w:n>w?n:w):(c=h<r?h<u?h<c?h:c:u<c?u:c:r<u?r<c?r:c:u<c?u:c,d=k<n?k<w?k<d?k:d:w<d?w:d:n<w?n<d?n:d:w<d?w:d,f=h>r?h>u?h>f?h:f:u>f?u:f:r>u?r>f?r:f:u>f?u:f,j=k>n?k>w?k>j?k:j:w>j?w:j:n>w?n>j?n:j:w>j?w:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),j=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),f=f>h.getRight()?f:h.getRight(),j=j>
+Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,q,o,u,r,v,s,z=b.geometry,y=z.vertices,E=[],f=0;for(j=z.faces.length;f<j;f++)if(h=z.faces[f],v=this.origin.clone(),s=this.direction.clone(),o=b.matrixWorld,k=o.multiplyVector3(h.centroid.clone()).subSelf(v),r=k.dot(s),!(r<=0)&&(k=o.multiplyVector3(y[h.a].position.clone()),m=o.multiplyVector3(y[h.b].position.clone()),q=o.multiplyVector3(y[h.c].position.clone()),o=h instanceof THREE.Face4?o.multiplyVector3(y[h.d].position.clone()):null,u=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
+r=s.dot(u),b.doubleSided||(b.flipSided?r>0:r<0)))if(r=u.dot((new THREE.Vector3).sub(k,v))/r,v=v.addSelf(s.multiplyScalar(r)),h instanceof THREE.Face3)d(v,k,m,q)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},E.push(h));else if(h instanceof THREE.Face4&&(d(v,k,m,o)||d(v,m,q,o)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},E.push(h);E.sort(function(b,c){return b.distance-c.distance});return E}else return[]}};
+THREE.Rectangle=function(){function b(){h=f-c;k=j-d}var c,d,f,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return j};this.set=function(h,k,u,r){m=!1;c=h;d=k;f=u;j=r;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,f=h,j=k):(c=c<h?c:h,d=d<k?d:k,f=f>h?f:h,j=j>k?j:k);b()};this.add3Points=
+function(h,k,u,r,v,s){m?(m=!1,c=h<u?h<v?h:v:u<v?u:v,d=k<r?k<s?k:s:r<s?r:s,f=h>u?h>v?h:v:u>v?u:v,j=k>r?k>s?k:s:r>s?r:s):(c=h<u?h<v?h<c?h:c:v<c?v:c:u<v?u<c?u:c:v<c?v:c,d=k<r?k<s?k<d?k:d:s<d?s:d:r<s?r<d?r:d:s<d?s:d,f=h>u?h>v?h>f?h:f:v>f?v:f:u>v?u>f?u:f:v>f?v:f,j=k>r?k>s?k>j?k:j:s>j?s:j:r>s?r>j?r:j:s>j?s:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),j=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),f=f>h.getRight()?f:h.getRight(),j=j>
 h.getBottom()?j:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;f+=h;j+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();f=f<h.getRight()?f:h.getRight();j=j<h.getBottom()?j:h.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(j,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){m=!0;j=f=d=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
 h.getBottom()?j:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;f+=h;j+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();f=f<h.getRight()?f:h.getRight();j=j<h.getBottom()?j:h.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(j,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){m=!0;j=f=d=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
-THREE.Matrix4=function(b,c,d,f,j,h,k,m,q,o,r,n,u,w,B,y){this.set(b!==void 0?b:1,c||0,d||0,f||0,j||0,h!==void 0?h:1,k||0,m||0,q||0,o||0,r!==void 0?r:1,n||0,u||0,w||0,B||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,j,h,k,m,q,o,r,n,u,w,B,y){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=q;this.n32=o;this.n33=r;this.n34=n;this.n41=u;this.n42=w;this.n43=B;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
+THREE.Matrix4=function(b,c,d,f,j,h,k,m,q,o,u,r,v,s,z,y){this.set(b!==void 0?b:1,c||0,d||0,f||0,j||0,h!==void 0?h:1,k||0,m||0,q||0,o||0,u!==void 0?u:1,r||0,v||0,s||0,z||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,j,h,k,m,q,o,u,r,v,s,z,y){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=q;this.n32=o;this.n33=u;this.n34=r;this.n41=v;this.n42=s;this.n43=z;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
 c,d){var f=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(d,h).normalize());j.cross(h,f).normalize();this.n11=f.x;this.n12=j.x;this.n13=h.x;this.n21=f.y;this.n22=j.y;this.n23=h.y;this.n31=f.z;this.n32=j.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,j=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*j;
 c,d){var f=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(d,h).normalize());j.cross(h,f).normalize();this.n11=f.x;this.n12=j.x;this.n13=h.x;this.n21=f.y;this.n22=j.y;this.n23=h.y;this.n31=f.z;this.n32=j.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,j=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*j;
 b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*j;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*j;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,j=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*j;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*j;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*j;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*j;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+
 b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*j;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*j;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,j=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*j;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*j;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*j;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*j;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+
-d*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,q=b.n23,o=b.n24,r=b.n31,n=b.n32,u=b.n33,w=b.n34,B=b.n41,y=b.n42,I=b.n43,C=b.n44,xa=c.n11,ya=
-c.n12,pa=c.n13,ra=c.n14,fa=c.n21,L=c.n22,v=c.n23,ia=c.n24,M=c.n31,ja=c.n32,Y=c.n33,ua=c.n34,R=c.n41,O=c.n42,e=c.n43,Ca=c.n44;this.n11=d*xa+f*fa+j*M+h*R;this.n12=d*ya+f*L+j*ja+h*O;this.n13=d*pa+f*v+j*Y+h*e;this.n14=d*ra+f*ia+j*ua+h*Ca;this.n21=k*xa+m*fa+q*M+o*R;this.n22=k*ya+m*L+q*ja+o*O;this.n23=k*pa+m*v+q*Y+o*e;this.n24=k*ra+m*ia+q*ua+o*Ca;this.n31=r*xa+n*fa+u*M+w*R;this.n32=r*ya+n*L+u*ja+w*O;this.n33=r*pa+n*v+u*Y+w*e;this.n34=r*ra+n*ia+u*ua+w*Ca;this.n41=B*xa+y*fa+I*M+C*R;this.n42=B*ya+y*L+I*ja+
-C*O;this.n43=B*pa+y*v+I*Y+C*e;this.n44=B*ra+y*ia+I*ua+C*Ca;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;
-this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,q=this.n31,o=this.n32,r=this.n33,n=this.n34,u=this.n41,w=this.n42,B=this.n43,y=this.n44;return f*k*o*u-d*m*o*u-f*h*r*u+c*m*r*u+d*h*n*u-c*k*n*u-f*k*q*w+d*m*q*w+f*j*r*w-b*m*r*w-d*j*n*w+b*k*n*w+f*h*q*B-c*m*q*B-f*j*o*B+b*m*o*B+c*j*n*
-B-b*h*n*B-d*h*q*y+c*k*q*y+d*j*o*y-b*k*o*y-c*j*r*y+b*h*r*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=
-this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;
-return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=
-this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=
-Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),j=1-d,h=b.x,k=b.y,m=b.z,q=j*h,o=j*k;this.set(q*h+d,q*k-f*m,q*m+f*k,0,q*k+f*m,o*k+d,o*m-f*h,0,q*m-f*k,o*m+f*h,j*m*m+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},
-getColumnX:function(){if(!this.columnX)this.columnX=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 d=b.x,f=b.y,j=b.z,h=Math.cos(d),d=Math.sin(d),k=Math.cos(f),
-f=Math.sin(f),m=Math.cos(j),j=Math.sin(j);switch(c){case "YXZ":var q=k*m,o=k*j,r=f*m,n=f*j;this.n11=q+n*d;this.n12=r*d-o;this.n13=h*f;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=o*d-r;this.n32=n+q*d;this.n33=h*k;break;case "ZXY":q=k*m;o=k*j;r=f*m;n=f*j;this.n11=q-n*d;this.n12=-h*j;this.n13=r+o*d;this.n21=o+r*d;this.n22=h*m;this.n23=n-q*d;this.n31=-h*f;this.n32=d;this.n33=h*k;break;case "ZYX":q=h*m;o=h*j;r=d*m;n=d*j;this.n11=k*m;this.n12=r*f-o;this.n13=q*f+n;this.n21=k*j;this.n22=n*f+q;this.n23=
-o*f-r;this.n31=-f;this.n32=d*k;this.n33=h*k;break;case "YZX":q=h*k;o=h*f;r=d*k;n=d*f;this.n11=k*m;this.n12=n-q*j;this.n13=r*j+o;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-f*m;this.n32=o*j+r;this.n33=q-n*j;break;case "XZY":q=h*k;o=h*f;r=d*k;n=d*f;this.n11=k*m;this.n12=-j;this.n13=f*m;this.n21=q*j+n;this.n22=h*m;this.n23=o*j-r;this.n31=r*j-o;this.n32=d*m;this.n33=n*j+q;break;default:q=h*m,o=h*j,r=d*m,n=d*j,this.n11=k*m,this.n12=-k*j,this.n13=f,this.n21=o+r*f,this.n22=q-n*f,this.n23=-d*k,this.n31=
-n-q*f,this.n32=r+o*f,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,j=b.w,h=c+c,k=d+d,m=f+f,b=c*h,q=c*k;c*=m;var o=d*k;d*=m;f*=m;h*=j;k*=j;j*=m;this.n11=1-(o+f);this.n12=q-j;this.n13=c+k;this.n21=q+j;this.n22=1-(b+f);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=
-b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(c);j.setScale(d.x,d.y,d.z);this.multiply(f,j);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);j.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:
-new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=f.length();d.y=j.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,j=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=
-b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*j;this.n23=b.n23*j;this.n33=b.n33*j}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,q=b.n23,o=b.n24,r=b.n31,n=b.n32,u=b.n33,w=b.n34,B=b.n41,y=b.n42,I=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=q*w*y-o*u*y+o*n*I-m*w*I-q*n*C+m*u*C;c.n12=h*u*y-j*w*y-h*n*I+f*w*I+j*n*C-f*u*C;c.n13=j*o*y-h*q*y+h*m*I-f*o*I-j*m*C+f*q*C;c.n14=h*q*n-j*o*n-h*m*u+f*o*u+j*m*w-f*q*w;c.n21=o*u*B-q*w*B-o*r*I+k*w*I+q*r*C-k*u*C;c.n22=j*w*B-h*u*B+h*r*I-d*w*I-j*r*C+d*u*C;c.n23=h*q*B-j*o*B-h*k*I+d*o*I+j*k*C-d*q*C;c.n24=
-j*o*r-h*q*r+h*k*u-d*o*u-j*k*w+d*q*w;c.n31=m*w*B-o*n*B+o*r*y-k*w*y-m*r*C+k*n*C;c.n32=h*n*B-f*w*B-h*r*y+d*w*y+f*r*C-d*n*C;c.n33=j*o*B-h*m*B+h*k*y-d*o*y-f*k*C+d*m*C;c.n34=h*m*r-f*o*r-h*k*n+d*o*n+f*k*w-d*m*w;c.n41=q*n*B-m*u*B-q*r*y+k*u*y+m*r*I-k*n*I;c.n42=f*u*B-j*n*B+j*r*y-d*u*y-f*r*I+d*n*I;c.n43=j*m*B-f*q*B-j*k*y+d*q*y+f*k*I-d*m*I;c.n44=f*q*r-j*m*r+j*k*n-d*q*n-f*k*u+d*m*u;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,r=-b.n23*b.n11+b.n21*b.n13,n=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*q;d[6]=b*o;d[7]=b*r;d[8]=b*n;return c};
+d*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,q=b.n23,o=b.n24,u=b.n31,r=b.n32,v=b.n33,s=b.n34,z=b.n41,y=b.n42,E=b.n43,G=b.n44,va=c.n11,wa=
+c.n12,pa=c.n13,qa=c.n14,ha=c.n21,F=c.n22,w=c.n23,R=c.n24,O=c.n31,ia=c.n32,X=c.n33,xa=c.n34,S=c.n41,M=c.n42,e=c.n43,Ba=c.n44;this.n11=d*va+f*ha+j*O+h*S;this.n12=d*wa+f*F+j*ia+h*M;this.n13=d*pa+f*w+j*X+h*e;this.n14=d*qa+f*R+j*xa+h*Ba;this.n21=k*va+m*ha+q*O+o*S;this.n22=k*wa+m*F+q*ia+o*M;this.n23=k*pa+m*w+q*X+o*e;this.n24=k*qa+m*R+q*xa+o*Ba;this.n31=u*va+r*ha+v*O+s*S;this.n32=u*wa+r*F+v*ia+s*M;this.n33=u*pa+r*w+v*X+s*e;this.n34=u*qa+r*R+v*xa+s*Ba;this.n41=z*va+y*ha+E*O+G*S;this.n42=z*wa+y*F+E*ia+G*M;
+this.n43=z*pa+y*w+E*X+G*e;this.n44=z*qa+y*R+E*xa+G*Ba;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=
+b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,q=this.n31,o=this.n32,u=this.n33,r=this.n34,v=this.n41,s=this.n42,z=this.n43,y=this.n44;return f*k*o*v-d*m*o*v-f*h*u*v+c*m*u*v+d*h*r*v-c*k*r*v-f*k*q*s+d*m*q*s+f*j*u*s-b*m*u*s-d*j*r*s+b*k*r*s+f*h*q*z-c*m*q*z-f*j*o*z+b*m*o*z+c*j*r*z-b*h*r*z-
+d*h*q*y+c*k*q*y+d*j*o*y-b*k*o*y-c*j*u*y+b*h*u*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;
+b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},
+flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=
+this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),
+b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),j=1-d,h=b.x,k=b.y,m=b.z,q=j*h,o=j*k;this.set(q*h+d,q*k-f*m,q*m+f*k,0,q*k+f*m,o*k+d,o*m-f*h,0,q*m-f*k,o*m+f*h,j*m*m+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
+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 d=b.x,f=b.y,j=b.z,h=Math.cos(d),d=Math.sin(d),k=Math.cos(f),f=Math.sin(f),m=Math.cos(j),j=Math.sin(j);switch(c){case "YXZ":var q=
+k*m,o=k*j,u=f*m,r=f*j;this.n11=q+r*d;this.n12=u*d-o;this.n13=h*f;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=o*d-u;this.n32=r+q*d;this.n33=h*k;break;case "ZXY":q=k*m;o=k*j;u=f*m;r=f*j;this.n11=q-r*d;this.n12=-h*j;this.n13=u+o*d;this.n21=o+u*d;this.n22=h*m;this.n23=r-q*d;this.n31=-h*f;this.n32=d;this.n33=h*k;break;case "ZYX":q=h*m;o=h*j;u=d*m;r=d*j;this.n11=k*m;this.n12=u*f-o;this.n13=q*f+r;this.n21=k*j;this.n22=r*f+q;this.n23=o*f-u;this.n31=-f;this.n32=d*k;this.n33=h*k;break;case "YZX":q=h*k;o=
+h*f;u=d*k;r=d*f;this.n11=k*m;this.n12=r-q*j;this.n13=u*j+o;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-f*m;this.n32=o*j+u;this.n33=q-r*j;break;case "XZY":q=h*k;o=h*f;u=d*k;r=d*f;this.n11=k*m;this.n12=-j;this.n13=f*m;this.n21=q*j+r;this.n22=h*m;this.n23=o*j-u;this.n31=u*j-o;this.n32=d*m;this.n33=r*j+q;break;default:q=h*m,o=h*j,u=d*m,r=d*j,this.n11=k*m,this.n12=-k*j,this.n13=f,this.n21=o+u*f,this.n22=q-r*f,this.n23=-d*k,this.n31=r-q*f,this.n32=u+o*f,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c=
+b.x,d=b.y,f=b.z,j=b.w,h=c+c,k=d+d,m=f+f,b=c*h,q=c*k;c*=m;var o=d*k;d*=m;f*=m;h*=j;k*=j;j*=m;this.n11=1-(o+f);this.n12=q-j;this.n13=c+k;this.n21=q+j;this.n22=1-(b+f);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2;
+f.identity();f.setRotationFromQuaternion(c);j.setScale(d.x,d.y,d.z);this.multiply(f,j);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);j.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=f.length();
+d.y=j.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,j=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*j;this.n23=
+b.n23*j;this.n33=b.n33*j}};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,q=b.n23,o=b.n24,u=b.n31,r=b.n32,v=b.n33,s=b.n34,z=b.n41,y=b.n42,E=b.n43,G=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=q*s*y-o*v*y+o*r*E-m*s*E-q*r*G+m*v*G;c.n12=h*v*y-j*s*y-h*r*E+f*s*E+j*r*G-f*v*G;c.n13=j*o*y-h*q*y+h*m*E-f*o*E-j*m*G+f*q*G;c.n14=h*q*r-j*o*r-h*m*v+f*o*v+j*m*s-f*q*s;c.n21=o*v*z-q*s*z-o*u*E+k*s*E+q*u*G-k*v*G;c.n22=j*s*z-h*v*z+h*u*E-d*s*E-j*u*G+d*v*G;c.n23=h*q*z-j*o*z-h*k*E+d*o*E+j*k*G-d*q*G;c.n24=
+j*o*u-h*q*u+h*k*v-d*o*v-j*k*s+d*q*s;c.n31=m*s*z-o*r*z+o*u*y-k*s*y-m*u*G+k*r*G;c.n32=h*r*z-f*s*z-h*u*y+d*s*y+f*u*G-d*r*G;c.n33=j*o*z-h*m*z+h*k*y-d*o*y-f*k*G+d*m*G;c.n34=h*m*u-f*o*u-h*k*r+d*o*r+f*k*s-d*m*s;c.n41=q*r*z-m*v*z-q*u*y+k*v*y+m*u*E-k*r*E;c.n42=f*v*z-j*r*z+j*u*y-d*v*y-f*u*E+d*r*E;c.n43=j*m*z-f*q*z-j*k*y+d*q*y+f*k*E-d*m*E;c.n44=f*q*u-j*m*u+j*k*r-d*q*r-f*k*v+d*m*v;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,u=-b.n23*b.n11+b.n21*b.n13,r=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*q;d[6]=b*o;d[7]=b*u;d[8]=b*r;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,f,j,h){var k;k=new THREE.Matrix4;k.n11=2*j/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*j/(f-d);k.n23=(f+d)/(f-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+j)/(h-j);k.n34=-2*h*j/(h-j);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,d,f){var j,b=d*Math.tan(b*Math.PI/360);j=-b;return THREE.Matrix4.makeFrustum(j*c,b*c,j,b,d,f)};
 THREE.Matrix4.makeFrustum=function(b,c,d,f,j,h){var k;k=new THREE.Matrix4;k.n11=2*j/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*j/(f-d);k.n23=(f+d)/(f-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+j)/(h-j);k.n34=-2*h*j/(h-j);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,d,f){var j,b=d*Math.tan(b*Math.PI/360);j=-b;return THREE.Matrix4.makeFrustum(j*c,b*c,j,b,d,f)};
 THREE.Matrix4.makeOrtho=function(b,c,d,f,j,h){var k,m,q,o;k=new THREE.Matrix4;m=c-b;q=d-f;o=h-j;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/q;k.n23=0;k.n24=-((d+f)/q);k.n31=0;k.n32=0;k.n33=-2/o;k.n34=-((h+j)/o);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Matrix4.makeOrtho=function(b,c,d,f,j,h){var k,m,q,o;k=new THREE.Matrix4;m=c-b;q=d-f;o=h-j;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/q;k.n23=0;k.n24=-((d+f)/q);k.n31=0;k.n32=0;k.n33=-2/o;k.n34=-((h+j)/o);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
@@ -54,22 +54,22 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
 b)return j;if(c&&(j=j.getChildByName(b,c),j!==void 0))return j}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&
 b)return j;if(c&&(j=j.getChildByName(b,c),j!==void 0))return j}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){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,d)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 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,d)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(b)}};THREE.Object3DCount=0;
 this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=q[m]=q[m]||new THREE.RenderableVertex;m++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return f>=0&&j>=0&&h>=0&&k>=0?!0:f<0&&j<0||h<0&&k<0?!1:(f<0?d=Math.max(d,f/(f-j)):j<0&&(e=Math.min(e,f/(f-j))),h<0?d=Math.max(d,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,j,h=[],k,m,q=[],o,r,n=[],u,w=[],B,y,I=[],C,xa,ya=[],pa=[],ra=[],fa=new THREE.Vector4,
-L=new THREE.Vector4,v=new THREE.Matrix4,ia=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Vector4,Y=new THREE.Vector4;this.projectVector=function(b,c){v.multiply(c.projectionMatrix,c.matrixWorldInverse);v.multiplyVector3(b);return b};this.unprojectVector=function(b,c){v.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));v.multiplyVector3(b);return b};this.projectObjects=function(b,d,k){var e,
-m;j=pa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){m=e[b];var o;if(!(o=!m.visible))if(o=m instanceof THREE.Mesh)if(o=m.frustumCulled){a:{o=void 0;for(var q=m.matrixWorld,r=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),n=0;n<6;n++)if(o=M[n].x*q.n14+M[n].y*q.n24+M[n].z*q.n34+M[n].w,o<=r){o=!1;break a}o=!0}o=!o}if(!o)o=h[j]=h[j]||new THREE.RenderableObject,j++,f=o,fa.copy(m.position),v.multiplyVector3(fa),f.object=m,f.z=fa.z,pa.push(f)}k&&pa.sort(c);return pa};
-this.projectScene=function(f,j,h){var e=j.near,pa=j.far,fa,va,U,Z,G,W,T,V,wa,Q,sa,Ga,za,Ea,S,Aa,Da;xa=y=u=r=ra.length=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);v.multiply(j.projectionMatrix,j.matrixWorldInverse);M[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);M[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);M[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);M[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);M[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-
-v.n33,v.n44-v.n34);M[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(fa=0;fa<6;fa++)wa=M[fa],wa.divideScalar(Math.sqrt(wa.x*wa.x+wa.y*wa.y+wa.z*wa.z));wa=this.projectObjects(f,j,!0);f=0;for(fa=wa.length;f<fa;f++)if(Q=wa[f].object,Q.visible)if(sa=Q.matrixWorld,Ga=Q.matrixRotationWorld,za=Q.materials,Ea=Q.overdraw,m=0,Q instanceof THREE.Mesh){S=Q.geometry;Z=S.vertices;Aa=S.faces;S=S.faceVertexUvs;va=0;for(U=Z.length;va<U;va++)k=b(),k.positionWorld.copy(Z[va].position),sa.multiplyVector3(k.positionWorld),
-k.positionScreen.copy(k.positionWorld),v.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>e&&k.positionScreen.z<pa;Z=0;for(va=Aa.length;Z<va;Z++){U=Aa[Z];if(U instanceof THREE.Face3)if(G=q[U.a],W=q[U.b],T=q[U.c],G.visible&&W.visible&&T.visible&&(Q.doubleSided||Q.flipSided!=(T.positionScreen.x-G.positionScreen.x)*(W.positionScreen.y-G.positionScreen.y)-(T.positionScreen.y-G.positionScreen.y)*(W.positionScreen.x-
-G.positionScreen.x)<0))V=n[r]=n[r]||new THREE.RenderableFace3,r++,o=V,o.v1.copy(G),o.v2.copy(W),o.v3.copy(T);else continue;else if(U instanceof THREE.Face4)if(G=q[U.a],W=q[U.b],T=q[U.c],V=q[U.d],G.visible&&W.visible&&T.visible&&V.visible&&(Q.doubleSided||Q.flipSided!=((V.positionScreen.x-G.positionScreen.x)*(W.positionScreen.y-G.positionScreen.y)-(V.positionScreen.y-G.positionScreen.y)*(W.positionScreen.x-G.positionScreen.x)<0||(W.positionScreen.x-T.positionScreen.x)*(V.positionScreen.y-T.positionScreen.y)-
-(W.positionScreen.y-T.positionScreen.y)*(V.positionScreen.x-T.positionScreen.x)<0)))Da=w[u]=w[u]||new THREE.RenderableFace4,u++,o=Da,o.v1.copy(G),o.v2.copy(W),o.v3.copy(T),o.v4.copy(V);else continue;o.normalWorld.copy(U.normal);Ga.multiplyVector3(o.normalWorld);o.centroidWorld.copy(U.centroid);sa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);v.multiplyVector3(o.centroidScreen);T=U.vertexNormals;G=0;for(W=T.length;G<W;G++)V=o.vertexNormalsWorld[G],V.copy(T[G]),Ga.multiplyVector3(V);
-G=0;for(W=S.length;G<W;G++)if(Da=S[G][Z]){T=0;for(V=Da.length;T<V;T++)o.uvs[G][T]=Da[T]}o.meshMaterials=za;o.faceMaterials=U.materials;o.overdraw=Ea;o.z=o.centroidScreen.z;ra.push(o)}}else if(Q instanceof THREE.Line){ia.multiply(v,sa);Z=Q.geometry.vertices;G=b();G.positionScreen.copy(Z[0].position);ia.multiplyVector4(G.positionScreen);va=1;for(U=Z.length;va<U;va++)if(G=b(),G.positionScreen.copy(Z[va].position),ia.multiplyVector4(G.positionScreen),W=q[m-2],ja.copy(G.positionScreen),Y.copy(W.positionScreen),
-d(ja,Y))ja.multiplyScalar(1/ja.w),Y.multiplyScalar(1/Y.w),sa=I[y]=I[y]||new THREE.RenderableLine,y++,B=sa,B.v1.positionScreen.copy(ja),B.v2.positionScreen.copy(Y),B.z=Math.max(ja.z,Y.z),B.materials=Q.materials,ra.push(B)}else if(Q instanceof THREE.Particle&&(L.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),v.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))sa=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,C=sa,C.x=L.x/L.w,C.y=L.y/L.w,C.z=L.z,C.rotation=Q.rotation.z,C.scale.x=Q.scale.x*Math.abs(C.x-
-(L.x+j.projectionMatrix.n11)/(L.w+j.projectionMatrix.n14)),C.scale.y=Q.scale.y*Math.abs(C.y-(L.y+j.projectionMatrix.n22)/(L.w+j.projectionMatrix.n24)),C.materials=Q.materials,ra.push(C);h&&ra.sort(c);return ra}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
+THREE.Projector=function(){function b(){var b=q[m]=q[m]||new THREE.RenderableVertex;m++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return f>=0&&j>=0&&h>=0&&k>=0?!0:f<0&&j<0||h<0&&k<0?!1:(f<0?d=Math.max(d,f/(f-j)):j<0&&(e=Math.min(e,f/(f-j))),h<0?d=Math.max(d,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,j,h=[],k,m,q=[],o,u,r=[],v,s=[],z,y,E=[],G,va,wa=[],pa=[],qa=[],ha=new THREE.Vector4,
+F=new THREE.Vector4,w=new THREE.Matrix4,R=new THREE.Matrix4,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ia=new THREE.Vector4,X=new THREE.Vector4;this.projectVector=function(b,c){w.multiply(c.projectionMatrix,c.matrixWorldInverse);w.multiplyVector3(b);return b};this.unprojectVector=function(b,c){w.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));w.multiplyVector3(b);return b};this.projectObjects=function(b,d,k){var e,
+m;j=pa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){m=e[b];var o;if(!(o=!m.visible))if(o=m instanceof THREE.Mesh)if(o=m.frustumCulled){a:{o=void 0;for(var q=m.matrixWorld,u=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),r=0;r<6;r++)if(o=O[r].x*q.n14+O[r].y*q.n24+O[r].z*q.n34+O[r].w,o<=u){o=!1;break a}o=!0}o=!o}if(!o)o=h[j]=h[j]||new THREE.RenderableObject,j++,f=o,ha.copy(m.position),w.multiplyVector3(ha),f.object=m,f.z=ha.z,pa.push(f)}k&&pa.sort(c);return pa};
+this.projectScene=function(f,j,h){var e=j.near,pa=j.far,ha,ua,Y,ra,I,T,P,ka,fa,K,ya,za,Ea,Da,Q,ta,Ca;va=y=v=u=qa.length=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);w.multiply(j.projectionMatrix,j.matrixWorldInverse);O[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);O[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);O[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);O[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);O[4].set(w.n41-w.n31,w.n42-w.n32,
+w.n43-w.n33,w.n44-w.n34);O[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(ha=0;ha<6;ha++)fa=O[ha],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(f,j,!0);f=0;for(ha=fa.length;f<ha;f++)if(K=fa[f].object,K.visible)if(ya=K.matrixWorld,za=K.matrixRotationWorld,Ea=K.materials,Da=K.overdraw,m=0,K instanceof THREE.Mesh){Q=K.geometry;ra=Q.vertices;ta=Q.faces;Q=Q.faceVertexUvs;ua=0;for(Y=ra.length;ua<Y;ua++)k=b(),k.positionWorld.copy(ra[ua].position),ya.multiplyVector3(k.positionWorld),
+k.positionScreen.copy(k.positionWorld),w.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>e&&k.positionScreen.z<pa;ra=0;for(ua=ta.length;ra<ua;ra++){Y=ta[ra];if(Y instanceof THREE.Face3)if(I=q[Y.a],T=q[Y.b],P=q[Y.c],I.visible&&T.visible&&P.visible&&(K.doubleSided||K.flipSided!=(P.positionScreen.x-I.positionScreen.x)*(T.positionScreen.y-I.positionScreen.y)-(P.positionScreen.y-I.positionScreen.y)*(T.positionScreen.x-
+I.positionScreen.x)<0))ka=r[u]=r[u]||new THREE.RenderableFace3,u++,o=ka,o.v1.copy(I),o.v2.copy(T),o.v3.copy(P);else continue;else if(Y instanceof THREE.Face4)if(I=q[Y.a],T=q[Y.b],P=q[Y.c],ka=q[Y.d],I.visible&&T.visible&&P.visible&&ka.visible&&(K.doubleSided||K.flipSided!=((ka.positionScreen.x-I.positionScreen.x)*(T.positionScreen.y-I.positionScreen.y)-(ka.positionScreen.y-I.positionScreen.y)*(T.positionScreen.x-I.positionScreen.x)<0||(T.positionScreen.x-P.positionScreen.x)*(ka.positionScreen.y-P.positionScreen.y)-
+(T.positionScreen.y-P.positionScreen.y)*(ka.positionScreen.x-P.positionScreen.x)<0)))Ca=s[v]=s[v]||new THREE.RenderableFace4,v++,o=Ca,o.v1.copy(I),o.v2.copy(T),o.v3.copy(P),o.v4.copy(ka);else continue;o.normalWorld.copy(Y.normal);za.multiplyVector3(o.normalWorld);o.centroidWorld.copy(Y.centroid);ya.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);w.multiplyVector3(o.centroidScreen);P=Y.vertexNormals;I=0;for(T=P.length;I<T;I++)ka=o.vertexNormalsWorld[I],ka.copy(P[I]),za.multiplyVector3(ka);
+I=0;for(T=Q.length;I<T;I++)if(Ca=Q[I][ra]){P=0;for(ka=Ca.length;P<ka;P++)o.uvs[I][P]=Ca[P]}o.meshMaterials=Ea;o.faceMaterials=Y.materials;o.overdraw=Da;o.z=o.centroidScreen.z;qa.push(o)}}else if(K instanceof THREE.Line){R.multiply(w,ya);ra=K.geometry.vertices;I=b();I.positionScreen.copy(ra[0].position);R.multiplyVector4(I.positionScreen);ua=1;for(Y=ra.length;ua<Y;ua++)if(I=b(),I.positionScreen.copy(ra[ua].position),R.multiplyVector4(I.positionScreen),T=q[m-2],ia.copy(I.positionScreen),X.copy(T.positionScreen),
+d(ia,X))ia.multiplyScalar(1/ia.w),X.multiplyScalar(1/X.w),ya=E[y]=E[y]||new THREE.RenderableLine,y++,z=ya,z.v1.positionScreen.copy(ia),z.v2.positionScreen.copy(X),z.z=Math.max(ia.z,X.z),z.materials=K.materials,qa.push(z)}else if(K instanceof THREE.Particle&&(F.set(K.matrixWorld.n14,K.matrixWorld.n24,K.matrixWorld.n34,1),w.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))ya=wa[va]=wa[va]||new THREE.RenderableParticle,va++,G=ya,G.x=F.x/F.w,G.y=F.y/F.w,G.z=F.z,G.rotation=K.rotation.z,G.scale.x=K.scale.x*Math.abs(G.x-
+(F.x+j.projectionMatrix.n11)/(F.w+j.projectionMatrix.n14)),G.scale.y=K.scale.y*Math.abs(G.y-(F.y+j.projectionMatrix.n22)/(F.w+j.projectionMatrix.n24)),G.materials=K.materials,qa.push(G);h&&qa.sort(c);return qa}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;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,d=b.x*c,f=b.y*c,j=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-j),j=Math.sin(-j),h=Math.cos(d),d=Math.sin(d),k=b*c,m=f*j;this.w=k*h-m*d;this.x=k*d+m*h;this.y=f*c*h+b*j*d;this.z=b*j*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;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,d=b.x*c,f=b.y*c,j=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-j),j=Math.sin(-j),h=Math.cos(d),d=Math.sin(d),k=b*c,m=f*j;this.w=k*h-m*d;this.x=k*d+m*h;this.y=f*c*h+b*j*d;this.z=b*j*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(d);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.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(d);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.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,d=this.y,f=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-f*k;this.y=d*b+j*k+f*h-c*m;this.z=f*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-f*m;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 d=b.x,f=b.y,j=b.z,h=this.x,k=this.y,m=this.z,q=this.w,o=q*d+k*j-m*f,r=q*f+m*d-h*j,n=q*j+h*f-k*d,d=-h*
-d-k*f-m*j;c.x=o*q+d*-h+r*-m-n*-k;c.y=r*q+d*-k+n*-h-o*-m;c.z=n*q+d*-m+o*-k-r*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;d.w=b.w*j+c.w*f;d.x=b.x*j+c.x*f;d.y=b.y*j+c.y*f;d.z=b.z*j+c.z*f;return d};
+this.x,d=this.y,f=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-f*k;this.y=d*b+j*k+f*h-c*m;this.z=f*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-f*m;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 d=b.x,f=b.y,j=b.z,h=this.x,k=this.y,m=this.z,q=this.w,o=q*d+k*j-m*f,u=q*f+m*d-h*j,r=q*j+h*f-k*d,d=-h*
+d-k*f-m*j;c.x=o*q+d*-h+u*-m-r*-k;c.y=u*q+d*-k+r*-h-o*-m;c.z=r*q+d*-m+o*-k-u*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;d.w=b.w*j+c.w*f;d.x=b.x*j+c.x*f;d.y=b.y*j+c.y*f;d.z=b.z*j+c.z*f;return d};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,j,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];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.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,j,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];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.Face4=function(b,c,d,f,j,h,k){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.Face4=function(b,c,d,f,j,h,k){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -79,15 +79,15 @@ c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid
 d,f,j,h,k,m=new THREE.Vector3,q=new THREE.Vector3;f=0;for(j=this.faces.length;f<j;f++){h=this.faces[f];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],k=this.vertices[h.c],m.sub(k.position,d.position),q.sub(c.position,d.position),m.crossSelf(q);m.isZero()||m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 d,f,j,h,k,m=new THREE.Vector3,q=new THREE.Vector3;f=0;for(j=this.faces.length;f<j;f++){h=this.faces[f];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],k=this.vertices[h.c],m.sub(k.position,d.position),q.sub(c.position,d.position),m.crossSelf(q);m.isZero()||m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof
 Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof
 THREE.Face3?(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal),f[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(f[d.a]),d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(f[d.a]),
 THREE.Face3?(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal),f[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(f[d.a]),d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(f[d.a]),
-d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,j,h){m=b.vertices[e].position;q=b.vertices[c].position;o=b.vertices[d].position;r=k[f];n=k[j];u=k[h];w=q.x-m.x;B=o.x-m.x;y=q.y-m.y;I=o.y-m.y;C=q.z-m.z;xa=o.z-m.z;ya=n.u-r.u;pa=u.u-r.u;ra=n.v-r.v;fa=u.v-r.v;L=1/(ya*fa-pa*ra);ja.set((fa*w-ra*B)*L,(fa*y-ra*I)*L,(fa*C-ra*xa)*L);Y.set((ya*B-pa*w)*L,(ya*I-pa*y)*L,(ya*xa-pa*C)*L);ia[e].addSelf(ja);ia[c].addSelf(ja);
-ia[d].addSelf(ja);M[e].addSelf(Y);M[c].addSelf(Y);M[d].addSelf(Y)}var c,d,f,j,h,k,m,q,o,r,n,u,w,B,y,I,C,xa,ya,pa,ra,fa,L,v,ia=[],M=[],ja=new THREE.Vector3,Y=new THREE.Vector3,ua=new THREE.Vector3,R=new THREE.Vector3,O=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)ia[c]=new THREE.Vector3,M[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,
-2),b(this,h.a,h.b,h.d,0,1,3));var e=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)O.copy(h.vertexNormals[f]),j=h[e[f]],v=ia[j],ua.copy(v),ua.subSelf(O.multiplyScalar(O.dot(v))).normalize(),R.cross(h.vertexNormals[f],v),j=R.dot(M[j]),j=j<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(ua.x,ua.y,ua.z,j)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
+d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,j,h){m=b.vertices[e].position;q=b.vertices[c].position;o=b.vertices[d].position;u=k[f];r=k[j];v=k[h];s=q.x-m.x;z=o.x-m.x;y=q.y-m.y;E=o.y-m.y;G=q.z-m.z;va=o.z-m.z;wa=r.u-u.u;pa=v.u-u.u;qa=r.v-u.v;ha=v.v-u.v;F=1/(wa*ha-pa*qa);ia.set((ha*s-qa*z)*F,(ha*y-qa*E)*F,(ha*G-qa*va)*F);X.set((wa*z-pa*s)*F,(wa*E-pa*y)*F,(wa*va-pa*G)*F);R[e].addSelf(ia);R[c].addSelf(ia);
+R[d].addSelf(ia);O[e].addSelf(X);O[c].addSelf(X);O[d].addSelf(X)}var c,d,f,j,h,k,m,q,o,u,r,v,s,z,y,E,G,va,wa,pa,qa,ha,F,w,R=[],O=[],ia=new THREE.Vector3,X=new THREE.Vector3,xa=new THREE.Vector3,S=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)R[c]=new THREE.Vector3,O[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),
+b(this,h.a,h.b,h.d,0,1,3));var e=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)M.copy(h.vertexNormals[f]),j=h[e[f]],w=R[j],xa.copy(w),xa.subSelf(M.multiplyScalar(M.dot(w))).normalize(),S.cross(h.vertexNormals[f],w),j=S.dot(O[j]),j=j<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(xa.x,xa.y,xa.z,j)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
 y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<
 y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<
 this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,d){b[c]===void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=
 this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,d){b[c]===void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=
 1,b[c].array.push(d))}var d,f,j,h,k,m={};d=0;for(f=this.faces.length;d<f;d++)k=this.faces[d],k instanceof THREE.Face3?(j=b(k.a,k.b),c(m,j,d),j=b(k.b,k.c),c(m,j,d),j=b(k.a,k.c),c(m,j,d)):k instanceof THREE.Face4&&(j=b(k.b,k.d),c(m,j,d),j=b(k.a,k.b),c(m,j,d),j=b(k.a,k.d),c(m,j,d),j=b(k.b,k.c),c(m,j,d),j=b(k.c,k.d),c(m,j,d));d=0;for(f=this.edges.length;d<f;d++){k=this.edges[d];j=k.vertexIndices[0];h=k.vertexIndices[1];k.faceIndices=m[b(j,h)].array;for(j=0;j<k.faceIndices.length;j++)h=k.faceIndices[j],
 1,b[c].array.push(d))}var d,f,j,h,k,m={};d=0;for(f=this.faces.length;d<f;d++)k=this.faces[d],k instanceof THREE.Face3?(j=b(k.a,k.b),c(m,j,d),j=b(k.b,k.c),c(m,j,d),j=b(k.a,k.c),c(m,j,d)):k instanceof THREE.Face4&&(j=b(k.b,k.d),c(m,j,d),j=b(k.a,k.b),c(m,j,d),j=b(k.a,k.d),c(m,j,d),j=b(k.b,k.c),c(m,j,d),j=b(k.c,k.d),c(m,j,d));d=0;for(f=this.edges.length;d<f;d++){k=this.edges[d];j=k.vertexIndices[0];h=k.vertexIndices[1];k.faceIndices=m[b(j,h)].array;for(j=0;j<k.faceIndices.length;j++)h=k.faceIndices[j],
 k.faces.push(this.faces[h])}}};THREE.GeometryCount=0;
 k.faces.push(this.faces[h])}}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,c,d,f,j,h,k){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*k+(-3*(c-d)-2*b-f)*h+b*j+c}this.points=b;var d=[],f={x:0,y:0,z:0},j,h,k,m,q,o,r,n,u;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){j=(this.points.length-1)*b;h=Math.floor(j);k=j-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;o=this.points[d[0]];r=this.points[d[1]];
-n=this.points[d[2]];u=this.points[d[3]];m=k*k;q=k*m;f.x=c(o.x,r.x,n.x,u.x,k,m,q);f.y=c(o.y,r.y,n.y,u.y,k,m,q);f.z=c(o.z,r.z,n.z,u.z,k,m,q);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b<d;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,d,f=c=c=0,j=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);d=this.points.length*b;j.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
+THREE.Spline=function(b){function c(b,c,d,f,j,h,k){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*k+(-3*(c-d)-2*b-f)*h+b*j+c}this.points=b;var d=[],f={x:0,y:0,z:0},j,h,k,m,q,o,u,r,v;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){j=(this.points.length-1)*b;h=Math.floor(j);k=j-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;o=this.points[d[0]];u=this.points[d[1]];
+r=this.points[d[2]];v=this.points[d[3]];m=k*k;q=k*m;f.x=c(o.x,u.x,r.x,v.x,k,m,q);f.y=c(o.y,u.y,r.y,v.y,k,m,q);f.z=c(o.z,u.z,r.z,v.z,k,m,q);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b<d;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,d,f=c=c=0,j=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);d=this.points.length*b;j.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
 m+=h.distanceTo(j),j.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(k[c]=m,f=c);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var c,d,f,j,h,k,m=[],o=new THREE.Vector3,q=this.getLength();m.push(o.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=q.chunks[c]-q.chunks[c-1];k=Math.ceil(b*d/q.total);j=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<k-1;d++)f=j+d*(1/k)*(h-j),position=this.getPoint(f),m.push(o.copy(position).clone());
 m+=h.distanceTo(j),j.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(k[c]=m,f=c);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var c,d,f,j,h,k,m=[],o=new THREE.Vector3,q=this.getLength();m.push(o.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=q.chunks[c]-q.chunks[c-1];k=Math.ceil(b*d/q.total);j=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<k-1;d++)f=j+d*(1/k)*(h-j),position=this.getPoint(f),m.push(o.copy(position).clone());
 m.push(o.copy(this.points[c]).clone())}this.points=m}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,f,j){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d!==void 0?d:0.1;this.far=f!==void 0?f:2E3;this.target=j||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 m.push(o.copy(this.points[c]).clone())}this.points=m}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,f,j){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d!==void 0?d:0.1;this.far=f!==void 0?f:2E3;this.target=j||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
@@ -182,119 +182,120 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,c,d){var f,j,h,k=b.vertices,m=k.length,D=b.colors,o=D.length,F=b.__vertexArray,q=b.__colorArray,n=b.__sortArray,r=b.__dirtyVertices,u=b.__dirtyColors,t=b.__webglCustomAttributes,v,E;if(t)for(v in t)t[v].offset=0;if(d.sortParticles){Aa.multiplySelf(d.matrixWorld);for(f=0;f<m;f++)j=k[f].position,Ja.copy(j),Aa.multiplyVector3(Ja),n[f]=[Ja.z,f];n.sort(function(b,c){return c[0]-b[0]});for(f=0;f<m;f++)j=k[n[f][1]].position,h=f*3,F[h]=j.x,F[h+1]=j.y,F[h+2]=j.z;
-for(f=0;f<o;f++)h=f*3,color=D[n[f][1]],q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(t)for(v in t){f=t[v];D=f.value.length;for(h=0;h<D;h++){index=n[h][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")E=f.value[index];f.size===2?(f.array[o]=E.x,f.array[o+1]=E.y):f.size===3?f.type==="c"?(f.array[o]=E.r,f.array[o+1]=E.g,f.array[o+2]=E.b):(f.array[o]=E.x,f.array[o+1]=E.y,f.array[o+2]=E.z):(f.array[o]=
-E.x,f.array[o+1]=E.y,f.array[o+2]=E.z,f.array[o+3]=E.w)}f.offset+=f.size}}}else{if(r)for(f=0;f<m;f++)j=k[f].position,h=f*3,F[h]=j.x,F[h+1]=j.y,F[h+2]=j.z;if(u)for(f=0;f<o;f++)color=D[f],h=f*3,q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(t)for(v in t)if(f=t[v],f.__original.needsUpdate){D=f.value.length;for(h=0;h<D;h++){o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")E=f.value[h];f.size===2?(f.array[o]=
-E.x,f.array[o+1]=E.y):f.size===3?f.type==="c"?(f.array[o]=E.r,f.array[o+1]=E.g,f.array[o+2]=E.b):(f.array[o]=E.x,f.array[o+1]=E.y,f.array[o+2]=E.z):(f.array[o]=E.x,f.array[o+1]=E.y,f.array[o+2]=E.z,f.array[o+3]=E.w)}f.offset+=f.size}}}if(r||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,F,c);if(u||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,q,c);if(t)for(v in t)if(f=t[v],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
-f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,j){f.program||O.initMaterial(f,c,d,j);if(f.morphTargets&&!j.__webglMorphTargetInfluences){j.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets);for(var h=0,k=O.maxMorphTargets;h<k;h++)j.__webglMorphTargetInfluences[h]=0}var h=f.program,k=h.uniforms,m=f.uniforms;h!=Va&&(e.useProgram(h),Va=h);e.uniformMatrix4fv(k.projectionMatrix,!1,Da);if(d&&f.fog)if(m.fogColor.value=d.color,d instanceof THREE.Fog)m.fogNear.value=d.near,
-m.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)m.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var D,o,F,q=0,n=0,r=0,u,t,w,E=Wa,H=E.directional.colors,K=E.directional.positions,B=E.point.colors,A=E.point.positions,y=E.point.distances,C=0,I=0,d=o=w=0;for(D=c.length;d<D;d++)if(o=c[d],F=o.color,u=o.position,t=o.intensity,w=o.distance,o instanceof THREE.AmbientLight)q+=F.r,n+=F.g,r+=F.b;else if(o instanceof THREE.DirectionalLight)w=
-C*3,H[w]=F.r*t,H[w+1]=F.g*t,H[w+2]=F.b*t,K[w]=u.x,K[w+1]=u.y,K[w+2]=u.z,C+=1;else if(o instanceof THREE.SpotLight)w=C*3,H[w]=F.r*t,H[w+1]=F.g*t,H[w+2]=F.b*t,F=1/u.length(),K[w]=u.x*F,K[w+1]=u.y*F,K[w+2]=u.z*F,C+=1;else if(o instanceof THREE.PointLight)o=I*3,B[o]=F.r*t,B[o+1]=F.g*t,B[o+2]=F.b*t,A[o]=u.x,A[o+1]=u.y,A[o+2]=u.z,y[I]=w,I+=1;for(d=C*3;d<H.length;d++)H[d]=0;for(d=I*3;d<B.length;d++)B[d]=0;E.point.length=I;E.directional.length=C;E.ambient[0]=q;E.ambient[1]=n;E.ambient[2]=r;c=Wa;m.enableLighting.value=
+THREE.WebGLRenderer=function(b){function c(b,c,d){var f,j,h,k=b.vertices,m=k.length,C=b.colors,o=C.length,D=b.__vertexArray,q=b.__colorArray,r=b.__sortArray,u=b.__dirtyVertices,v=b.__dirtyColors,n=b.__webglCustomAttributes,w,s;if(n)for(w in n)n[w].offset=0;if(d.sortParticles){ta.multiplySelf(d.matrixWorld);for(f=0;f<m;f++)j=k[f].position,Ia.copy(j),ta.multiplyVector3(Ia),r[f]=[Ia.z,f];r.sort(function(b,c){return c[0]-b[0]});for(f=0;f<m;f++)j=k[r[f][1]].position,h=f*3,D[h]=j.x,D[h+1]=j.y,D[h+2]=j.z;
+for(f=0;f<o;f++)h=f*3,color=C[r[f][1]],q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(n)for(w in n){f=n[w];C=f.value.length;for(h=0;h<C;h++){index=r[h][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")s=f.value[index];f.size===2?(f.array[o]=s.x,f.array[o+1]=s.y):f.size===3?f.type==="c"?(f.array[o]=s.r,f.array[o+1]=s.g,f.array[o+2]=s.b):(f.array[o]=s.x,f.array[o+1]=s.y,f.array[o+2]=s.z):(f.array[o]=
+s.x,f.array[o+1]=s.y,f.array[o+2]=s.z,f.array[o+3]=s.w)}f.offset+=f.size}}}else{if(u)for(f=0;f<m;f++)j=k[f].position,h=f*3,D[h]=j.x,D[h+1]=j.y,D[h+2]=j.z;if(v)for(f=0;f<o;f++)color=C[f],h=f*3,q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(n)for(w in n)if(f=n[w],f.__original.needsUpdate){C=f.value.length;for(h=0;h<C;h++){o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")s=f.value[h];f.size===2?(f.array[o]=
+s.x,f.array[o+1]=s.y):f.size===3?f.type==="c"?(f.array[o]=s.r,f.array[o+1]=s.g,f.array[o+2]=s.b):(f.array[o]=s.x,f.array[o+1]=s.y,f.array[o+2]=s.z):(f.array[o]=s.x,f.array[o+1]=s.y,f.array[o+2]=s.z,f.array[o+3]=s.w)}f.offset+=f.size}}}if(u||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,D,c);if(v||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,q,c);if(n)for(w in n)if(f=n[w],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
+f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,j){f.program||M.initMaterial(f,c,d,j);if(f.morphTargets&&!j.__webglMorphTargetInfluences){j.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var h=0,k=M.maxMorphTargets;h<k;h++)j.__webglMorphTargetInfluences[h]=0}var h=f.program,k=h.uniforms,m=f.uniforms;h!=Va&&(e.useProgram(h),Va=h);e.uniformMatrix4fv(k.projectionMatrix,!1,Ca);if(d&&f.fog)if(m.fogColor.value=d.color,d instanceof THREE.Fog)m.fogNear.value=d.near,
+m.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)m.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var C,o,D,q=0,r=0,u=0,s,v,n,z=Wa,H=z.directional.colors,y=z.directional.positions,A=z.point.colors,G=z.point.positions,E=z.point.distances,F=0,J=0,d=o=n=0;for(C=c.length;d<C;d++)if(o=c[d],D=o.color,s=o.position,v=o.intensity,n=o.distance,o instanceof THREE.AmbientLight)q+=D.r,r+=D.g,u+=D.b;else if(o instanceof THREE.DirectionalLight)n=
+F*3,H[n]=D.r*v,H[n+1]=D.g*v,H[n+2]=D.b*v,y[n]=s.x,y[n+1]=s.y,y[n+2]=s.z,F+=1;else if(o instanceof THREE.SpotLight)n=F*3,H[n]=D.r*v,H[n+1]=D.g*v,H[n+2]=D.b*v,D=1/s.length(),y[n]=s.x*D,y[n+1]=s.y*D,y[n+2]=s.z*D,F+=1;else if(o instanceof THREE.PointLight)o=J*3,A[o]=D.r*v,A[o+1]=D.g*v,A[o+2]=D.b*v,G[o]=s.x,G[o+1]=s.y,G[o+2]=s.z,E[J]=n,J+=1;for(d=F*3;d<H.length;d++)H[d]=0;for(d=J*3;d<A.length;d++)A[d]=0;z.point.length=J;z.directional.length=F;z.ambient[0]=q;z.ambient[1]=r;z.ambient[2]=u;c=Wa;m.enableLighting.value=
 c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&
 c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&
 m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=
 m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=
-f.opacity,m.size.value=f.size,m.scale.value=Ka.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(j.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<Sa.length;c++)m.shadowMatrix.value[c]=Sa[c],m.shadowMap.texture[c]=
-O.shadowMap[c];m.shadowDarkness.value=O.shadowMapDarkness;m.shadowBias.value=O.shadowMapBias}for(var N in m)if(D=h.uniforms[N])if(d=m[N],q=d.type,c=d.value,q=="i")e.uniform1i(D,c);else if(q=="f")e.uniform1f(D,c);else if(q=="v2")e.uniform2f(D,c.x,c.y);else if(q=="v3")e.uniform3f(D,c.x,c.y,c.z);else if(q=="v4")e.uniform4f(D,c.x,c.y,c.z,c.w);else if(q=="c")e.uniform3f(D,c.r,c.g,c.b);else if(q=="fv1")e.uniform1fv(D,c);else if(q=="fv")e.uniform3fv(D,c);else if(q=="v3v"){if(!d._array)d._array=new Float32Array(3*
-c.length);q=0;for(n=c.length;q<n;q++)r=q*3,d._array[r]=c[q].x,d._array[r+1]=c[q].y,d._array[r+2]=c[q].z;e.uniform3fv(D,d._array)}else if(q=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);e.uniformMatrix4fv(D,!1,d._array)}else if(q=="m4v"){if(!d._array)d._array=new Float32Array(16*c.length);q=0;for(n=c.length;q<n;q++)c[q].flattenToArrayOffset(d._array,q*16);e.uniformMatrix4fv(D,!1,d._array)}else if(q=="t"){if(e.uniform1i(D,c),D=d.texture)if(D.image instanceof Array&&D.image.length==
-6){if(d=D,d.image.length==6)if(d.needsUpdate){if(!d.image.__webglTextureCube)d.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_CUBE_MAP,d.image.__webglTextureCube);for(c=0;c<6;c++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,d.image[c]);v(e.TEXTURE_CUBE_MAP,d,d.image[0]);d.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,d.image.__webglTextureCube)}else D instanceof THREE.WebGLRenderTargetCube?
-(d=D,e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,d.__webglTexture)):ia(D,c)}else if(q=="tv"){if(!d._array){d._array=[];q=0;for(n=d.texture.length;q<n;q++)d._array[q]=c+q}e.uniform1iv(D,d._array);q=0;for(n=d.texture.length;q<n;q++)(D=d.texture[q])&&ia(D,d._array[q])}e.uniformMatrix4fv(k.modelViewMatrix,!1,j._modelViewMatrixArray);k.normalMatrix&&e.uniformMatrix3fv(k.normalMatrix,!1,j._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&
+f.opacity,m.size.value=f.size,m.scale.value=Ga.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(j.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<La.length;c++)m.shadowMatrix.value[c]=La[c],m.shadowMap.texture[c]=
+M.shadowMap[c];m.shadowDarkness.value=M.shadowMapDarkness;m.shadowBias.value=M.shadowMapBias}for(var L in m)if(C=h.uniforms[L])if(d=m[L],q=d.type,c=d.value,q=="i")e.uniform1i(C,c);else if(q=="f")e.uniform1f(C,c);else if(q=="v2")e.uniform2f(C,c.x,c.y);else if(q=="v3")e.uniform3f(C,c.x,c.y,c.z);else if(q=="v4")e.uniform4f(C,c.x,c.y,c.z,c.w);else if(q=="c")e.uniform3f(C,c.r,c.g,c.b);else if(q=="fv1")e.uniform1fv(C,c);else if(q=="fv")e.uniform3fv(C,c);else if(q=="v3v"){if(!d._array)d._array=new Float32Array(3*
+c.length);q=0;for(r=c.length;q<r;q++)u=q*3,d._array[u]=c[q].x,d._array[u+1]=c[q].y,d._array[u+2]=c[q].z;e.uniform3fv(C,d._array)}else if(q=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);e.uniformMatrix4fv(C,!1,d._array)}else if(q=="m4v"){if(!d._array)d._array=new Float32Array(16*c.length);q=0;for(r=c.length;q<r;q++)c[q].flattenToArrayOffset(d._array,q*16);e.uniformMatrix4fv(C,!1,d._array)}else if(q=="t"){if(e.uniform1i(C,c),C=d.texture)if(C.image instanceof Array&&C.image.length==
+6){if(d=C,d.image.length==6)if(d.needsUpdate){if(!d.image.__webglTextureCube)d.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_CUBE_MAP,d.image.__webglTextureCube);for(c=0;c<6;c++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,d.image[c]);w(e.TEXTURE_CUBE_MAP,d,d.image[0]);d.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,d.image.__webglTextureCube)}else C instanceof THREE.WebGLRenderTargetCube?
+(d=C,e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,d.__webglTexture)):R(C,c)}else if(q=="tv"){if(!d._array){d._array=[];q=0;for(r=d.texture.length;q<r;q++)d._array[q]=c+q}e.uniform1iv(C,d._array);q=0;for(r=d.texture.length;q<r;q++)(C=d.texture[q])&&R(C,d._array[q])}e.uniformMatrix4fv(k.modelViewMatrix,!1,j._modelViewMatrixArray);k.normalMatrix&&e.uniformMatrix3fv(k.normalMatrix,!1,j._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&
 k.cameraPosition!==null&&e.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||j.receiveShadow)&&k.objectMatrix!==null&&e.uniformMatrix4fv(k.objectMatrix,!1,j._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&k.viewMatrix!==null&&e.uniformMatrix4fv(k.viewMatrix,!1,Ta);f.skinning&&(e.uniformMatrix4fv(k.cameraInverseMatrix,!1,Ta),e.uniformMatrix4fv(k.boneGlobalMatrices,
 k.cameraPosition!==null&&e.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||j.receiveShadow)&&k.objectMatrix!==null&&e.uniformMatrix4fv(k.objectMatrix,!1,j._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&k.viewMatrix!==null&&e.uniformMatrix4fv(k.viewMatrix,!1,Ta);f.skinning&&(e.uniformMatrix4fv(k.cameraInverseMatrix,!1,Ta),e.uniformMatrix4fv(k.boneGlobalMatrices,
 !1,j.boneMatrices));return h}function f(b,c,f,j,h,k){if(j.opacity!=0){var m,b=d(b,c,f,j,k).attributes;if(!j.morphTargets&&b.position>=0)e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),
 !1,j.boneMatrices));return h}function f(b,c,f,j,h,k){if(j.opacity!=0){var m,b=d(b,c,f,j,k).attributes;if(!j.morphTargets&&b.position>=0)e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),
-e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,D=k.morphTargetInfluences;f<j.numSupportedMorphTargets&&f<o.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o[f]]),e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=D[o[f]],f++;else{var o=[],q=-1,F=0,D=k.morphTargetInfluences,n,r=D.length,f=0;for(k.morphTargetBase!==-1&&(o[k.morphTargetBase]=!0);f<j.numSupportedMorphTargets;){for(n=
-0;n<r;n++)!o[n]&&D[n]>q&&(F=n,q=D[F]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[F]);e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=q;o[F]=1;q=-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[m],
+e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,C=k.morphTargetInfluences;f<j.numSupportedMorphTargets&&f<o.length;)e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o[f]]),e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=C[o[f]],f++;else{var o=[],q=-1,D=0,C=k.morphTargetInfluences,r,u=C.length,f=0;for(k.morphTargetBase!==-1&&(o[k.morphTargetBase]=!0);f<j.numSupportedMorphTargets;){for(r=
+0;r<u;r++)!o[r]&&C[r]>q&&(D=r,q=C[D]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[D]);e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=q;o[D]=1;q=-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[m],
 c.size,e.FLOAT,!1,0,0));b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):
 c.size,e.FLOAT,!1,0,0));b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):
 e.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,
 e.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,
 4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(e.lineWidth(j.wireframeLinewidth),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),e.drawElements(e.LINES,h.__webglLineCount,e.UNSIGNED_SHORT,0)):(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),e.drawElements(e.TRIANGLES,
 4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(e.lineWidth(j.wireframeLinewidth),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),e.drawElements(e.LINES,h.__webglLineCount,e.UNSIGNED_SHORT,0)):(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),e.drawElements(e.TRIANGLES,
-h.__webglFaceCount,e.UNSIGNED_SHORT,0)),O.info.render.calls++,O.info.render.vertices+=h.__webglFaceCount,O.info.render.faces+=h.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(j.linewidth),e.drawArrays(k,0,h.__webglLineCount),O.info.render.calls++):k instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),O.info.render.calls++):k instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),O.info.render.calls++)}}
-function j(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,j,k,m,o,q,n,r,u,t=b.count*
-3;for(u=0;u<t;u+=9)d=b.normalArray,f=d[u],h=d[u+1],j=d[u+2],k=d[u+3],o=d[u+4],n=d[u+5],m=d[u+6],q=d[u+7],r=d[u+8],f=(f+k+m)/3,h=(h+o+q)/3,j=(j+n+r)/3,d[u]=f,d[u+1]=h,d[u+2]=j,d[u+3]=f,d[u+4]=h,d[u+5]=j,d[u+6]=f,d[u+7]=h,d[u+8]=j}e.bufferData(e.ARRAY_BUFFER,b.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(c.attributes.normal);e.vertexAttribPointer(c.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,b.count);b.count=0}function h(b){if(U!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):
-e.enable(e.CULL_FACE),U=b.doubleSided;if(Z!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),Z=b.flipSided}function k(b){W!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),W=b)}function m(b){T!=b&&(e.depthMask(b),T=b)}function q(b,c,d){V!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),V=b);if(b&&(wa!=c||Q!=d))e.polygonOffset(c,d),wa=c,Q=d}function o(b){S[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);S[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+
-b.n14);S[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);S[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);S[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);S[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=S[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function r(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=S[e].x*c.n14+S[e].y*c.n24+S[e].z*c.n34+S[e].w,
-b<=d)return!1;return!0}function n(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,d,e=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?n(h,d):n(f,d)}function w(b){var c,d,e,f,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(e=h.materials.length;b<e;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=j.materials.length;c<d;c++)(f=j.materials[c])&&(f.transparent?n(m,f):n(k,f))}else(f=
-c)&&(f.transparent?n(m,f):n(k,f))}function B(b,c){return c.z-b.z}function y(b){var c,m,q,J=0,n,u,t,D,w=b.lights;qa||(qa=new THREE.Camera(O.shadowCameraFov,O.shadowMapWidth/O.shadowMapHeight,O.shadowCameraNear,O.shadowCameraFar));c=0;for(m=w.length;c<m;c++)if(q=w[c],q instanceof THREE.SpotLight&&q.castShadow){O.shadowMap[J]||(O.shadowMap[J]=new THREE.WebGLRenderTarget(O.shadowMapWidth,O.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Sa[J]||(Sa[J]=
-new THREE.Matrix4);n=O.shadowMap[J];u=Sa[J];qa.position.copy(q.position);qa.target.position.copy(q.target.position);qa.update(void 0,!0);b.update(void 0,!1,qa);u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiplySelf(qa.projectionMatrix);u.multiplySelf(qa.matrixWorldInverse);qa.matrixWorldInverse.flattenToArray(Ta);qa.projectionMatrix.flattenToArray(Da);Aa.multiply(qa.projectionMatrix,qa.matrixWorldInverse);o(Aa);O.initWebGLObjects(b);M(n);e.clearColor(1,1,1,1);O.clear();e.clearColor(ga.r,
-ga.g,ga.b,Ha);u=b.__webglObjects.length;q=b.__webglObjectsImmediate.length;for(n=0;n<u;n++)t=b.__webglObjects[n],D=t.object,D.visible&&D.castShadow?!(D instanceof THREE.Mesh)||!D.frustumCulled||r(D)?(D.matrixWorld.flattenToArray(D._objectMatrixArray),C(D,qa,!1),t.render=!0):t.render=!1:t.render=!1;k(!0);L(THREE.NormalBlending);for(n=0;n<u;n++)if(t=b.__webglObjects[n],t.render)D=t.object,buffer=t.buffer,h(D),t=D.customDepthMaterial?D.customDepthMaterial:D.geometry.morphTargets.length?Xa:Ua,f(qa,w,
-null,t,buffer,D);for(n=0;n<q;n++)t=b.__webglObjectsImmediate[n],D=t.object,D.visible&&D.castShadow&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),C(D,qa,!1),h(D),program=d(qa,w,null,Ua,D),D.render(function(b){j(b,program,Ua.shading)}));J++}}function I(b,c){var d,f,h;d=t.attributes;var j=t.uniforms,k=Ea/za,m,o=[],q=za*0.5,n=Ea*0.5,u=!0;e.useProgram(t.program);Va=t.program;W=G=-1;Ya||(e.enableVertexAttribArray(t.attributes.position),e.enableVertexAttribArray(t.attributes.uv),
-Ya=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer);e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.elementBuffer);e.uniformMatrix4fv(j.projectionMatrix,!1,Da);e.activeTexture(e.TEXTURE0);e.uniform1i(j.map,0);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
-h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(B);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(j.useScreenCoordinates,1),e.uniform3f(j.screenPosition,(h.position.x-q)/q,(n-h.position.y)/n,Math.max(0,Math.min(1,h.position.z)))):(e.uniform1i(j.useScreenCoordinates,0),e.uniform1i(j.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(j.modelViewMatrix,!1,
-h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Ea:1),o[0]=m*k*h.scale.x,o[1]=m*h.scale.y,e.uniform2f(j.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(j.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(j.alignment,h.alignment.x,h.alignment.y),e.uniform1f(j.opacity,h.opacity),e.uniform3f(j.color,h.color.r,h.color.g,h.color.b),e.uniform1f(j.rotation,h.rotation),e.uniform2fv(j.scale,o),h.mergeWith3D&&!u?(e.enable(e.DEPTH_TEST),u=!0):!h.mergeWith3D&&u&&(e.disable(e.DEPTH_TEST),u=!1),L(h.blending),
-ia(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(T)}function C(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function xa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)if(e.attributes[c].needsUpdate)return!0;return!1}function ya(b){var c,
-d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)e.attributes[c].needsUpdate=!1}function pa(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function ra(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,h,j,k,m,o,q={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)j=b.faces[f],k=j.materials,m=c(k),q[m]==
-void 0&&(q[m]={hash:m,counter:0}),o=q[m].hash+"_"+q[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:n}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+j>65535&&(q[m].counter+=1,o=q[m].hash+"_"+q[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:n})),b.geometryGroups[o].faces.push(f),b.geometryGroups[o].vertices+=j;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])}
-function fa(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=G){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,
-e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}G=b}}function v(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,R(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,R(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,R(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,R(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,ua(c.magFilter)),
-e.texParameteri(b,e.TEXTURE_MIN_FILTER,ua(c.minFilter)))}function ia(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),O.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,R(b.format),b.image.width,b.image.height,0,R(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);v(e.TEXTURE_2D,b,b.image);b.needsUpdate=
-!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function M(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);v(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),
-e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,R(b.format),b.width,b.height,0,R(b.format),R(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),v(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,R(b.format),b.width,b.height,0,R(b.format),R(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+
+h.__webglFaceCount,e.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=h.__webglFaceCount,M.info.render.faces+=h.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(j.linewidth),e.drawArrays(k,0,h.__webglLineCount),M.info.render.calls++):k instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),M.info.render.calls++):k instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),M.info.render.calls++)}}
+function j(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,j,k,m,o,q,r,u,s,n=b.count*
+3;for(s=0;s<n;s+=9)d=b.normalArray,f=d[s],h=d[s+1],j=d[s+2],k=d[s+3],o=d[s+4],r=d[s+5],m=d[s+6],q=d[s+7],u=d[s+8],f=(f+k+m)/3,h=(h+o+q)/3,j=(j+r+u)/3,d[s]=f,d[s+1]=h,d[s+2]=j,d[s+3]=f,d[s+4]=h,d[s+5]=j,d[s+6]=f,d[s+7]=h,d[s+8]=j}e.bufferData(e.ARRAY_BUFFER,b.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(c.attributes.normal);e.vertexAttribPointer(c.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,b.count);b.count=0}function h(b){if(Y!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):
+e.enable(e.CULL_FACE),Y=b.doubleSided;if(ra!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),ra=b.flipSided}function k(b){T!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),T=b)}function m(b){P!=b&&(e.depthMask(b),P=b)}function q(b,c,d){ka!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),ka=b);if(b&&(fa!=c||K!=d))e.polygonOffset(c,d),fa=c,K=d}function o(b){Q[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Q[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,
+b.n44+b.n14);Q[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);Q[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Q[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);Q[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=Q[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function u(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=Q[e].x*c.n14+Q[e].y*c.n24+Q[e].z*c.n34+
+Q[e].w,b<=d)return!1;return!0}function r(b,c){b.list[b.count]=c;b.count+=1}function v(b){var c,d,e=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?r(h,d):r(f,d)}function s(b){var c,d,e,f,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(e=h.materials.length;b<e;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=j.materials.length;c<d;c++)(f=j.materials[c])&&(f.transparent?r(m,f):
+r(k,f))}else(f=c)&&(f.transparent?r(m,f):r(k,f))}function z(b,c){return c.z-b.z}function y(b){var c,m,q,Ma=0,r,s,n,C,v=b.lights;V||(V=new THREE.Camera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));c=0;for(m=v.length;c<m;c++)if(q=v[c],q instanceof THREE.SpotLight&&q.castShadow){M.shadowMap[Ma]||(M.shadowMap[Ma]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
+La[Ma]||(La[Ma]=new THREE.Matrix4);r=M.shadowMap[Ma];s=La[Ma];V.position.copy(q.position);V.target.position.copy(q.target.position);V.update(void 0,!0);b.update(void 0,!1,V);s.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);s.multiplySelf(V.projectionMatrix);s.multiplySelf(V.matrixWorldInverse);V.matrixWorldInverse.flattenToArray(Ta);V.projectionMatrix.flattenToArray(Ca);ta.multiply(V.projectionMatrix,V.matrixWorldInverse);o(ta);M.initWebGLObjects(b);O(r);e.clearColor(1,1,1,1);M.clear();e.clearColor(Z.r,
+Z.g,Z.b,Ja);s=b.__webglObjects.length;q=b.__webglObjectsImmediate.length;for(r=0;r<s;r++)n=b.__webglObjects[r],C=n.object,C.visible&&C.castShadow?!(C instanceof THREE.Mesh)||!C.frustumCulled||u(C)?(C.matrixWorld.flattenToArray(C._objectMatrixArray),G(C,V,!1),n.render=!0):n.render=!1:n.render=!1;k(!0);F(THREE.NormalBlending);for(r=0;r<s;r++)if(n=b.__webglObjects[r],n.render)C=n.object,buffer=n.buffer,h(C),n=C.customDepthMaterial?C.customDepthMaterial:C.geometry.morphTargets.length?Xa:Ua,f(V,v,null,
+n,buffer,C);for(r=0;r<q;r++)n=b.__webglObjectsImmediate[r],C=n.object,C.visible&&C.castShadow&&(C.matrixAutoUpdate&&C.matrixWorld.flattenToArray(C._objectMatrixArray),G(C,V,!1),h(C),program=d(V,v,null,Ua,C),C.render(function(b){j(b,program,Ua.shading)}));Ma++}}function E(b,c){var d,f,h;d=n.attributes;var j=n.uniforms,k=Da/Ea,m,o=[],q=Ea*0.5,r=Da*0.5,s=!0;e.useProgram(n.program);Va=n.program;T=I=-1;Ya||(e.enableVertexAttribArray(n.attributes.position),e.enableVertexAttribArray(n.attributes.uv),Ya=
+!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer);e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.elementBuffer);e.uniformMatrix4fv(j.projectionMatrix,!1,Ca);e.activeTexture(e.TEXTURE0);e.uniform1i(j.map,0);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
+h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(z);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(j.useScreenCoordinates,1),e.uniform3f(j.screenPosition,(h.position.x-q)/q,(r-h.position.y)/r,Math.max(0,Math.min(1,h.position.z)))):(e.uniform1i(j.useScreenCoordinates,0),e.uniform1i(j.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(j.modelViewMatrix,!1,
+h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Da:1),o[0]=m*k*h.scale.x,o[1]=m*h.scale.y,e.uniform2f(j.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(j.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(j.alignment,h.alignment.x,h.alignment.y),e.uniform1f(j.opacity,h.opacity),e.uniform3f(j.color,h.color.r,h.color.g,h.color.b),e.uniform1f(j.rotation,h.rotation),e.uniform2fv(j.scale,o),h.mergeWith3D&&!s?(e.enable(e.DEPTH_TEST),s=!0):!h.mergeWith3D&&s&&(e.disable(e.DEPTH_TEST),s=!1),F(h.blending),
+R(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(P)}function G(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function va(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)if(e.attributes[c].needsUpdate)return!0;return!1}function wa(b){var c,
+d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)e.attributes[c].needsUpdate=!1}function pa(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function qa(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,h,j,k,m,o,q={},r=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)j=b.faces[f],k=j.materials,m=c(k),q[m]==
+void 0&&(q[m]={hash:m,counter:0}),o=q[m].hash+"_"+q[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:r}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+j>65535&&(q[m].counter+=1,o=q[m].hash+"_"+q[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:r})),b.geometryGroups[o].faces.push(f),b.geometryGroups[o].vertices+=j;b.geometryGroupsList=[];for(var s in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[s])}
+function ha(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(b){if(b!=I){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,
+e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}I=b}}function w(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,S(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,S(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,S(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,S(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,xa(c.magFilter)),
+e.texParameteri(b,e.TEXTURE_MIN_FILTER,xa(c.minFilter)))}function R(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),M.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);w(e.TEXTURE_2D,b,b.image);b.needsUpdate=
+!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function O(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);w(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),
+e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),w(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+
 d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,
 d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,
-e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=za,b=Ea,f=sa,h=Ga);c!=va&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),va=c)}function ja(b){b instanceof
-THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null))}function Y(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),
-console.error(c),null;return d}function ua(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function R(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
+e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Ea,b=Da,f=ya,h=za);c!=ua&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),ua=c)}function ia(b){b instanceof
+THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null))}function X(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),
+console.error(c),null;return d}function xa(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
 case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
-case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var O=this,e,Ca=[],Va=null,va=null,U=null,Z=null,G=null,W=null,T=null,V=null,wa=null,Q=null,sa=0,Ga=0,za=0,Ea=0,S=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,Da=new Float32Array(16),Ta=new Float32Array(16),Ja=new THREE.Vector4,Wa={ambient:[0,
-0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ka=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ab=b.stencil!==void 0?b.stencil:!0,bb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,cb=b.antialias!==void 0?b.antialias:!1,ga=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ha=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,
-geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ka;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 qa,Sa=[],b=THREE.ShaderLib.depthRGBA,Za=THREE.UniformsUtils.clone(b.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,
-vertexShader:b.vertexShader,uniforms:Za}),Xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Za,morphTargets:!0});Ua._shadowPass=!0;Xa._shadowPass=!0;try{if(!(e=Ka.getContext("experimental-webgl",{antialias:cb,stencil:ab,preserveDrawingBuffer:bb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(db){console.error(db)}e.clearColor(0,
-0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(ga.r,ga.g,ga.b,Ha);this.context=e;var $a=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);i=0;t.vertices[i++]=-1;t.vertices[i++]=-1;t.vertices[i++]=0;t.vertices[i++]=1;t.vertices[i++]=
-1;t.vertices[i++]=-1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=0;t.vertices[i++]=-1;t.vertices[i++]=1;t.vertices[i++]=0;i=t.vertices[i++]=0;t.faces[i++]=0;t.faces[i++]=1;t.faces[i++]=2;t.faces[i++]=0;t.faces[i++]=2;t.faces[i++]=3;t.vertexBuffer=e.createBuffer();t.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,t.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.elementBuffer);
-e.bufferData(e.ELEMENT_ARRAY_BUFFER,t.faces,e.STATIC_DRAW);t.program=e.createProgram();e.attachShader(t.program,Y("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(t.program,Y("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.position=e.getAttribLocation(t.program,"position");t.attributes.uv=e.getAttribLocation(t.program,"uv");t.uniforms.uvOffset=e.getUniformLocation(t.program,"uvOffset");t.uniforms.uvScale=e.getUniformLocation(t.program,
-"uvScale");t.uniforms.rotation=e.getUniformLocation(t.program,"rotation");t.uniforms.scale=e.getUniformLocation(t.program,"scale");t.uniforms.alignment=e.getUniformLocation(t.program,"alignment");t.uniforms.color=e.getUniformLocation(t.program,"color");t.uniforms.map=e.getUniformLocation(t.program,"map");t.uniforms.opacity=e.getUniformLocation(t.program,"opacity");t.uniforms.useScreenCoordinates=e.getUniformLocation(t.program,"useScreenCoordinates");t.uniforms.affectedByDistance=e.getUniformLocation(t.program,
-"affectedByDistance");t.uniforms.screenPosition=e.getUniformLocation(t.program,"screenPosition");t.uniforms.modelViewMatrix=e.getUniformLocation(t.program,"modelViewMatrix");t.uniforms.projectionMatrix=e.getUniformLocation(t.program,"projectionMatrix");var Ya=!1;this.setSize=function(b,c){Ka.width=b;Ka.height=c;this.setViewport(0,0,Ka.width,Ka.height)};this.setViewport=function(b,c,d,f){sa=b;Ga=c;za=d;Ea=f;e.viewport(sa,Ga,za,Ea)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=
-function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(b,c){ga.setHex(b);Ha=c;e.clearColor(ga.r,ga.g,ga.b,Ha)};this.setClearColor=function(b,c){ga.copy(b);Ha=c;e.clearColor(ga.r,ga.g,ga.b,Ha)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return Ha};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=
+case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=this,e,Ba=[],Va=null,ua=null,Y=null,ra=null,I=null,T=null,P=null,ka=null,fa=null,K=null,ya=0,za=0,Ea=0,Da=0,Q=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ca=new Float32Array(16),Ta=new Float32Array(16),Ia=new THREE.Vector4,Wa=
+{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ab=b.stencil!==void 0?b.stencil:!0,bb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,cb=b.antialias!==void 0?b.antialias:!1,Z=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ja=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,
+geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ga;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 V,La=[],b=THREE.ShaderLib.depthRGBA,Za=THREE.UniformsUtils.clone(b.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,
+vertexShader:b.vertexShader,uniforms:Za}),Xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Za,morphTargets:!0});Ua._shadowPass=!0;Xa._shadowPass=!0;try{if(!(e=Ga.getContext("experimental-webgl",{antialias:cb,stencil:ab,preserveDrawingBuffer:bb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(db){console.error(db)}e.clearColor(0,
+0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(Z.r,Z.g,Z.b,Ja);this.context=e;var $a=e.getParameter(e.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=e.createBuffer();n.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.elementBuffer);
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,n.faces,e.STATIC_DRAW);n.program=e.createProgram();e.attachShader(n.program,X("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(n.program,X("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(n.program);n.attributes={};n.uniforms={};n.attributes.position=e.getAttribLocation(n.program,"position");n.attributes.uv=e.getAttribLocation(n.program,"uv");n.uniforms.uvOffset=e.getUniformLocation(n.program,"uvOffset");n.uniforms.uvScale=e.getUniformLocation(n.program,
+"uvScale");n.uniforms.rotation=e.getUniformLocation(n.program,"rotation");n.uniforms.scale=e.getUniformLocation(n.program,"scale");n.uniforms.alignment=e.getUniformLocation(n.program,"alignment");n.uniforms.color=e.getUniformLocation(n.program,"color");n.uniforms.map=e.getUniformLocation(n.program,"map");n.uniforms.opacity=e.getUniformLocation(n.program,"opacity");n.uniforms.useScreenCoordinates=e.getUniformLocation(n.program,"useScreenCoordinates");n.uniforms.affectedByDistance=e.getUniformLocation(n.program,
+"affectedByDistance");n.uniforms.screenPosition=e.getUniformLocation(n.program,"screenPosition");n.uniforms.modelViewMatrix=e.getUniformLocation(n.program,"modelViewMatrix");n.uniforms.projectionMatrix=e.getUniformLocation(n.program,"projectionMatrix");var Ya=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,f){ya=b;za=c;Ea=d;Da=f;e.viewport(ya,za,Ea,Da)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=
+function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(b,c){Z.setHex(b);Ja=c;e.clearColor(Z.r,Z.g,Z.b,Ja)};this.setClearColor=function(b,c){Z.copy(b);Ja=c;e.clearColor(Z.r,Z.g,Z.b,Ja)};this.getClearColor=function(){return Z};this.getClearAlpha=function(){return Ja};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=
 !1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);
 !1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);
-e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);O.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),O.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),
-e.deleteBuffer(b.__webglColorBuffer),O.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),O.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),O.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof
-THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var o,q,n;o=n=m=0;for(q=c.length;o<q;o++)j=c[o],j instanceof THREE.SpotLight&&n++,j instanceof THREE.DirectionalLight&&
-n++,j instanceof THREE.PointLight&&m++;m+n<=_maxLights?o=n:(o=Math.ceil(_maxLights*n/(m+n)),m=_maxLights-o);j={directional:o,point:m};m=n=0;for(o=c.length;m<o;m++)q=c[m],q instanceof THREE.SpotLight&&q.castShadow&&n++;var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var r;a:{o=b.fragmentShader;q=b.vertexShader;var m=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,
-skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:n,alphaTest:b.alphaTest},t,f=[];k?f.push(k):(f.push(o),f.push(q));for(t in d)f.push(t),f.push(d[t]);k=f.join();t=0;for(f=Ca.length;t<f;t++)if(Ca[t].code==k){r=Ca[t].program;break a}t=
+e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),
+e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),M.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof
+THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var o,q,r;o=r=m=0;for(q=c.length;o<q;o++)j=c[o],j instanceof THREE.SpotLight&&r++,j instanceof THREE.DirectionalLight&&
+r++,j instanceof THREE.PointLight&&m++;m+r<=_maxLights?o=r:(o=Math.ceil(_maxLights*r/(m+r)),m=_maxLights-o);j={directional:o,point:m};m=r=0;for(o=c.length;m<o;m++)q=c[m],q instanceof THREE.SpotLight&&q.castShadow&&r++;var s=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)s=f.bones.length;var n;a:{o=b.fragmentShader;q=b.vertexShader;var m=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,
+skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:s,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:r,alphaTest:b.alphaTest},u,f=[];k?f.push(k):(f.push(o),f.push(q));for(u in d)f.push(u),f.push(d[u]);k=f.join();u=0;for(f=Ba.length;u<f;u++)if(Ba[u].code==k){n=Ba[u].program;break a}u=
 e.createProgram();f=[$a?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":
 e.createProgram();f=[$a?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":
 "",d.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");
 "",d.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");
 j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",
 j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",
-d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(t,Y("fragment",j+o));e.attachShader(t,Y("vertex",f+q));e.linkProgram(t);e.getProgramParameter(t,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(t,e.VALIDATE_STATUS)+", gl error ["+
-e.getError()+"]");t.uniforms={};t.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)f.push(w);w=f;f=0;for(m=w.length;f<m;f++)o=w[f],t.uniforms[o]=e.getUniformLocation(t,o);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<d.maxMorphTargets;w++)f.push("morphTarget"+w);for(r in c)f.push(r);
-r=f;w=0;for(c=r.length;w<c;w++)d=r[w],t.attributes[d]=e.getAttribLocation(t,d);Ca.push({program:t,code:k});O.info.memory.programs=Ca.length;r=t}b.program=r;r=b.program.attributes;r.position>=0&&e.enableVertexAttribArray(r.position);r.color>=0&&e.enableVertexAttribArray(r.color);r.normal>=0&&e.enableVertexAttribArray(r.normal);r.tangent>=0&&e.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(e.enableVertexAttribArray(r.skinVertexA),
-e.enableVertexAttribArray(r.skinVertexB),e.enableVertexAttribArray(r.skinIndex),e.enableVertexAttribArray(r.skinWeight));if(b.attributes)for(h in b.attributes)r[h]!==void 0&&r[h]>=0&&e.enableVertexAttribArray(r[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)w="morphTarget"+h,r[w]>=0&&(e.enableVertexAttribArray(r[w]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,f){M(b);b=0;c&&(b|=e.COLOR_BUFFER_BIT);d&&(b|=e.DEPTH_BUFFER_BIT);f&&(b|=e.STENCIL_BUFFER_BIT);
-e.clear(b)};this.render=function(b,c,e,n){var J,t,Fa,v,D,G,F,Pa,Qa=b.lights,Ra=b.fog;this.shadowMapEnabled&&y(b,c);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ta);c.projectionMatrix.flattenToArray(Da);Aa.multiply(c.projectionMatrix,c.matrixWorldInverse);o(Aa);this.initWebGLObjects(b);M(e);(this.autoClear||n)&&this.clear();D=b.__webglObjects.length;for(n=0;n<D;n++)if(J=b.__webglObjects[n],
-F=J.object,F.visible)if(!(F instanceof THREE.Mesh)||!F.frustumCulled||r(F)){if(F.matrixWorld.flattenToArray(F._objectMatrixArray),C(F,c,!0),w(J),J.render=!0,this.sortObjects)J.object.renderDepth?J.z=J.object.renderDepth:(Ja.copy(F.position),Aa.multiplyVector3(Ja),J.z=Ja.z)}else J.render=!1;else J.render=!1;this.sortObjects&&b.__webglObjects.sort(B);G=b.__webglObjectsImmediate.length;for(n=0;n<G;n++)J=b.__webglObjectsImmediate[n],F=J.object,F.visible&&(F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray),
-C(F,c,!0),u(J));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);L(b.overrideMaterial.blending);for(n=0;n<D;n++)if(J=b.__webglObjects[n],J.render)F=J.object,Pa=J.buffer,h(F),f(c,Qa,Ra,b.overrideMaterial,Pa,F);for(n=0;n<G;n++)J=b.__webglObjectsImmediate[n],F=J.object,F.visible&&(h(F),t=d(c,Qa,Ra,b.overrideMaterial,F),F.render(function(c){j(c,t,b.overrideMaterial.shading)}))}else{L(THREE.NormalBlending);for(n=D-1;n>=0;n--)if(J=b.__webglObjects[n],J.render){F=J.object;Pa=J.buffer;Fa=J.opaque;h(F);
-for(J=0;J<Fa.count;J++)v=Fa.list[J],k(v.depthTest),m(v.depthWrite),q(v.polygonOffset,v.polygonOffsetFactor,v.polygonOffsetUnits),f(c,Qa,Ra,v,Pa,F)}for(n=0;n<G;n++)if(J=b.__webglObjectsImmediate[n],F=J.object,F.visible){Fa=J.opaque;h(F);for(J=0;J<Fa.count;J++)v=Fa.list[J],k(v.depthTest),m(v.depthWrite),q(v.polygonOffset,v.polygonOffsetFactor,v.polygonOffsetUnits),t=d(c,Qa,Ra,v,F),F.render(function(b){j(b,t,v.shading)})}for(n=0;n<D;n++)if(J=b.__webglObjects[n],J.render){F=J.object;Pa=J.buffer;Fa=J.transparent;
-h(F);for(J=0;J<Fa.count;J++)v=Fa.list[J],L(v.blending),k(v.depthTest),m(v.depthWrite),q(v.polygonOffset,v.polygonOffsetFactor,v.polygonOffsetUnits),f(c,Qa,Ra,v,Pa,F)}for(n=0;n<G;n++)if(J=b.__webglObjectsImmediate[n],F=J.object,F.visible){Fa=J.transparent;h(F);for(J=0;J<Fa.count;J++)v=Fa.list[J],L(v.blending),k(v.depthTest),m(v.depthWrite),q(v.polygonOffset,v.polygonOffsetFactor,v.polygonOffsetUnits),t=d(c,Qa,Ra,v,F),F.render(function(b){j(b,t,v.shading)})}}b.__webglSprites.length&&I(b,c);e&&e.minFilter!==
-THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&ja(e)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],f=b,h=void 0,j=void 0,k=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),
-d instanceof THREE.Mesh)for(h in j=d.geometry,j.geometryGroups==void 0&&ra(j),j.geometryGroups){k=j.geometryGroups[h];if(!k.__webglVertexBuffer){var m=k;m.__webglVertexBuffer=e.createBuffer();m.__webglNormalBuffer=e.createBuffer();m.__webglTangentBuffer=e.createBuffer();m.__webglColorBuffer=e.createBuffer();m.__webglUVBuffer=e.createBuffer();m.__webglUV2Buffer=e.createBuffer();m.__webglSkinVertexABuffer=e.createBuffer();m.__webglSkinVertexBBuffer=e.createBuffer();m.__webglSkinIndicesBuffer=e.createBuffer();
-m.__webglSkinWeightsBuffer=e.createBuffer();m.__webglFaceBuffer=e.createBuffer();m.__webglLineBuffer=e.createBuffer();if(m.numMorphTargets){var o=void 0,n=void 0;m.__webglMorphTargetsBuffers=[];o=0;for(n=m.numMorphTargets;o<n;o++)m.__webglMorphTargetsBuffers.push(e.createBuffer())}O.info.memory.geometries++;for(var m=k,o=d,q=void 0,r=void 0,t=void 0,u=t=void 0,v=void 0,w=void 0,B=w=n=0,y=t=r=void 0,E=y=r=q=void 0,t=void 0,u=o.geometry,v=u.faces,y=m.faces,q=0,r=y.length;q<r;q++)t=y[q],t=v[t],t instanceof
-THREE.Face3?(n+=3,w+=1,B+=3):t instanceof THREE.Face4&&(n+=4,w+=2,B+=4);for(var q=m,r=o,H=y=v=void 0,K=void 0,H=void 0,t=[],v=0,y=r.materials.length;v<y;v++)if(H=r.materials[v],H instanceof THREE.MeshFaceMaterial){H=0;for(l=q.materials.length;H<l;H++)(K=q.materials[H])&&t.push(K)}else(K=H)&&t.push(K);q=t;m.__materials=q;a:{v=r=void 0;y=q.length;for(r=0;r<y;r++)if(v=q[r],v.map||v.lightMap||v instanceof THREE.ShaderMaterial){r=!0;break a}r=!1}a:{y=v=void 0;t=q.length;for(v=0;v<t;v++)if(y=q[v],!(y instanceof
-THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{t=v=void 0;H=q.length;for(v=0;v<H;v++)if(t=q[v],t.vertexColors){t=t.vertexColors;break a}t=!1}m.__vertexArray=new Float32Array(n*3);if(y)m.__normalArray=new Float32Array(n*3);if(u.hasTangents)m.__tangentArray=new Float32Array(n*4);if(t)m.__colorArray=new Float32Array(n*3);if(r){if(u.faceUvs.length>0||u.faceVertexUvs.length>
-0)m.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(n*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(n*4),m.__skinVertexBArray=new Float32Array(n*4),m.__skinIndexArray=new Float32Array(n*4),m.__skinWeightArray=new Float32Array(n*4);m.__faceArray=new Uint16Array(w*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=
-[];u=0;for(v=m.numMorphTargets;u<v;u++)m.__morphTargetsArrays.push(new Float32Array(n*3))}m.__needsSmoothNormals=y==THREE.SmoothShading;m.__uvType=r;m.__vertexColorType=t;m.__normalType=y;m.__webglFaceCount=w*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0);m.__webglLineCount=B*2;u=0;for(v=q.length;u<v;u++)if(r=q[u],r.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in r.attributes){t=r.attributes[a];y={};for(E in t)y[E]=t[E];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=
-!0,w=1,y.type==="v2"?w=2:y.type==="v3"?w=3:y.type==="v4"?w=4:y.type==="c"&&(w=3),y.size=w,y.array=new Float32Array(n*w),y.buffer=e.createBuffer(),y.buffer.belongsToAttribute=a,t.needsUpdate=!0,y.__original=t;m.__webglCustomAttributes[a]=y}}m.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}fa(f.__webglObjects,k,d)}else if(d instanceof THREE.Ribbon){j=d.geometry;if(!j.__webglVertexBuffer)h=
-j,h.__webglVertexBuffer=e.createBuffer(),h.__webglColorBuffer=e.createBuffer(),O.info.memory.geometries++,h=j,k=h.vertices.length,h.__vertexArray=new Float32Array(k*3),h.__colorArray=new Float32Array(k*3),h.__webglVertexCount=k,j.__dirtyVertices=!0,j.__dirtyColors=!0;fa(f.__webglObjects,j,d)}else if(d instanceof THREE.Line){j=d.geometry;if(!j.__webglVertexBuffer)h=j,h.__webglVertexBuffer=e.createBuffer(),h.__webglColorBuffer=e.createBuffer(),O.info.memory.geometries++,h=j,k=h.vertices.length,h.__vertexArray=
-new Float32Array(k*3),h.__colorArray=new Float32Array(k*3),h.__webglLineCount=k,j.__dirtyVertices=!0,j.__dirtyColors=!0;fa(f.__webglObjects,j,d)}else if(d instanceof THREE.ParticleSystem){j=d.geometry;if(!j.__webglVertexBuffer){h=j;h.__webglVertexBuffer=e.createBuffer();h.__webglColorBuffer=e.createBuffer();O.info.geometries++;h=j;k=d;m=h.vertices.length;h.__vertexArray=new Float32Array(m*3);h.__colorArray=new Float32Array(m*3);h.__sortArray=[];h.__webglParticleCount=m;h.__materials=k.materials;E=
-n=o=void 0;o=0;for(n=k.materials.length;o<n;o++)if(E=k.materials[o],E.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in E.attributes){originalAttribute=E.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(m*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;h.__webglCustomAttributes[a]=attribute}}j.__dirtyVertices=!0;j.__dirtyColors=!0}fa(f.__webglObjects,j,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof
-THREE.Sprite&&f.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];d=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)pa(d.__webglObjects,f);else if(f instanceof THREE.Sprite){d=d.__webglSprites;j=void 0;for(j=d.length-1;j>=0;j--)d[j]==f&&d.splice(j,1)}else f instanceof THREE.MarchingCubes&&pa(d.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<
-f;d++)if(h=b.__webglObjects[d].object,n=k=j=void 0,h instanceof THREE.Mesh){j=h.geometry;m=0;for(o=j.geometryGroupsList.length;m<o;m++)if(k=j.geometryGroupsList[m],n=xa(k),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||n)if(n=k,E=e.DYNAMIC_DRAW,w=!j.dynamic,n.__inittedArrays){var C=u=B=void 0,A=void 0,I=C=void 0,G=void 0,L=void 0,N=void 0,P=K=H=t=y=v=r=q=void 0,M=void 0,s=A=N=A=L=G=void 0,p=void 0,z=p=s=G=void 0,Q=void 0,
-T=z=p=s=C=C=I=N=A=z=p=s=Q=z=p=s=Q=z=p=s=void 0,ha=0,la=0,W=0,Y=0,U=0,R=0,X=0,S=0,ka=0,x=0,ma=0,z=s=0,z=void 0,na=n.__vertexArray,ia=n.__uvArray,ja=n.__uv2Array,V=n.__normalArray,$=n.__tangentArray,oa=n.__colorArray,aa=n.__skinVertexAArray,ca=n.__skinVertexBArray,da=n.__skinIndexArray,ea=n.__skinWeightArray,qa=n.__morphTargetsArrays,Z=n.__webglCustomAttributes,p=void 0,ga=n.__faceArray,Ba=n.__lineArray,wa=n.__needsSmoothNormals,r=n.__vertexColorType,q=n.__uvType,v=n.__normalType,ta=h.geometry,ua=ta.__dirtyVertices,
-va=ta.__dirtyElements,sa=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ca=ta.__dirtyTangents,Da=ta.__dirtyColors,Ea=ta.__dirtyMorphTargets,za=ta.vertices,Ga=n.faces,Ka=ta.faces,Ha=ta.faceVertexUvs[0],Ja=ta.faceVertexUvs[1],Ma=ta.skinVerticesA,Na=ta.skinVerticesB,Oa=ta.skinIndices,La=ta.skinWeights,Ia=ta.morphTargets;if(Z)for(T in Z)Z[T].offset=0,Z[T].offsetSrc=0;B=0;for(u=Ga.length;B<u;B++)if(C=Ga[B],A=Ka[C],Ha&&(y=Ha[C]),Ja&&(t=Ja[C]),C=A.vertexNormals,I=A.normal,G=A.vertexColors,L=A.color,N=A.vertexTangents,
-A instanceof THREE.Face3){if(ua)H=za[A.a].position,K=za[A.b].position,P=za[A.c].position,na[la]=H.x,na[la+1]=H.y,na[la+2]=H.z,na[la+3]=K.x,na[la+4]=K.y,na[la+5]=K.z,na[la+6]=P.x,na[la+7]=P.y,na[la+8]=P.z,la+=9;if(Z)for(T in Z)if(p=Z[T],p.__original.needsUpdate)s=p.offset,z=p.offsetSrc,p.size===1?(p.boundTo===void 0||p.boundTo==="vertices"?(p.array[s]=p.value[A.a],p.array[s+1]=p.value[A.b],p.array[s+2]=p.value[A.c]):p.boundTo==="faces"?(z=p.value[z],p.array[s]=z,p.array[s+1]=z,p.array[s+2]=z,p.offsetSrc++):
-p.boundTo==="faceVertices"&&(p.array[s]=p.value[z],p.array[s+1]=p.value[z+1],p.array[s+2]=p.value[z+2],p.offsetSrc+=3),p.offset+=3):(p.boundTo===void 0||p.boundTo==="vertices"?(H=p.value[A.a],K=p.value[A.b],P=p.value[A.c]):p.boundTo==="faces"?(P=K=H=z=p.value[z],p.offsetSrc++):p.boundTo==="faceVertices"&&(H=p.value[z],K=p.value[z+1],P=p.value[z+2],p.offsetSrc+=3),p.size===2?(p.array[s]=H.x,p.array[s+1]=H.y,p.array[s+2]=K.x,p.array[s+3]=K.y,p.array[s+4]=P.x,p.array[s+5]=P.y,p.offset+=6):p.size===3?
-(p.type==="c"?(p.array[s]=H.r,p.array[s+1]=H.g,p.array[s+2]=H.b,p.array[s+3]=K.r,p.array[s+4]=K.g,p.array[s+5]=K.b,p.array[s+6]=P.r,p.array[s+7]=P.g,p.array[s+8]=P.b):(p.array[s]=H.x,p.array[s+1]=H.y,p.array[s+2]=H.z,p.array[s+3]=K.x,p.array[s+4]=K.y,p.array[s+5]=K.z,p.array[s+6]=P.x,p.array[s+7]=P.y,p.array[s+8]=P.z),p.offset+=9):(p.array[s]=H.x,p.array[s+1]=H.y,p.array[s+2]=H.z,p.array[s+3]=H.w,p.array[s+4]=K.x,p.array[s+5]=K.y,p.array[s+6]=K.z,p.array[s+7]=K.w,p.array[s+8]=P.x,p.array[s+9]=P.y,
-p.array[s+10]=P.z,p.array[s+11]=P.w,p.offset+=12));if(Ea){s=0;for(p=Ia.length;s<p;s++)H=Ia[s].vertices[A.a].position,K=Ia[s].vertices[A.b].position,P=Ia[s].vertices[A.c].position,z=qa[s],z[ma]=H.x,z[ma+1]=H.y,z[ma+2]=H.z,z[ma+3]=K.x,z[ma+4]=K.y,z[ma+5]=K.z,z[ma+6]=P.x,z[ma+7]=P.y,z[ma+8]=P.z;ma+=9}if(La.length)s=La[A.a],p=La[A.b],z=La[A.c],ea[x]=s.x,ea[x+1]=s.y,ea[x+2]=s.z,ea[x+3]=s.w,ea[x+4]=p.x,ea[x+5]=p.y,ea[x+6]=p.z,ea[x+7]=p.w,ea[x+8]=z.x,ea[x+9]=z.y,ea[x+10]=z.z,ea[x+11]=z.w,s=Oa[A.a],p=Oa[A.b],
-z=Oa[A.c],da[x]=s.x,da[x+1]=s.y,da[x+2]=s.z,da[x+3]=s.w,da[x+4]=p.x,da[x+5]=p.y,da[x+6]=p.z,da[x+7]=p.w,da[x+8]=z.x,da[x+9]=z.y,da[x+10]=z.z,da[x+11]=z.w,s=Ma[A.a],p=Ma[A.b],z=Ma[A.c],aa[x]=s.x,aa[x+1]=s.y,aa[x+2]=s.z,aa[x+3]=1,aa[x+4]=p.x,aa[x+5]=p.y,aa[x+6]=p.z,aa[x+7]=1,aa[x+8]=z.x,aa[x+9]=z.y,aa[x+10]=z.z,aa[x+11]=1,s=Na[A.a],p=Na[A.b],z=Na[A.c],ca[x]=s.x,ca[x+1]=s.y,ca[x+2]=s.z,ca[x+3]=1,ca[x+4]=p.x,ca[x+5]=p.y,ca[x+6]=p.z,ca[x+7]=1,ca[x+8]=z.x,ca[x+9]=z.y,ca[x+10]=z.z,ca[x+11]=1,x+=12;if(Da&&
-r)G.length==3&&r==THREE.VertexColors?(A=G[0],s=G[1],p=G[2]):p=s=A=L,oa[ka]=A.r,oa[ka+1]=A.g,oa[ka+2]=A.b,oa[ka+3]=s.r,oa[ka+4]=s.g,oa[ka+5]=s.b,oa[ka+6]=p.r,oa[ka+7]=p.g,oa[ka+8]=p.b,ka+=9;if(Ca&&ta.hasTangents)G=N[0],L=N[1],A=N[2],$[X]=G.x,$[X+1]=G.y,$[X+2]=G.z,$[X+3]=G.w,$[X+4]=L.x,$[X+5]=L.y,$[X+6]=L.z,$[X+7]=L.w,$[X+8]=A.x,$[X+9]=A.y,$[X+10]=A.z,$[X+11]=A.w,X+=12;if(Aa&&v)if(C.length==3&&wa)for(N=0;N<3;N++)I=C[N],V[R]=I.x,V[R+1]=I.y,V[R+2]=I.z,R+=3;else for(N=0;N<3;N++)V[R]=I.x,V[R+1]=I.y,V[R+
-2]=I.z,R+=3;if(sa&&y!==void 0&&q)for(N=0;N<3;N++)C=y[N],ia[W]=C.u,ia[W+1]=C.v,W+=2;if(sa&&t!==void 0&&q)for(N=0;N<3;N++)C=t[N],ja[Y]=C.u,ja[Y+1]=C.v,Y+=2;va&&(ga[U]=ha,ga[U+1]=ha+1,ga[U+2]=ha+2,U+=3,Ba[S]=ha,Ba[S+1]=ha+1,Ba[S+2]=ha,Ba[S+3]=ha+2,Ba[S+4]=ha+1,Ba[S+5]=ha+2,S+=6,ha+=3)}else if(A instanceof THREE.Face4){if(ua)H=za[A.a].position,K=za[A.b].position,P=za[A.c].position,M=za[A.d].position,na[la]=H.x,na[la+1]=H.y,na[la+2]=H.z,na[la+3]=K.x,na[la+4]=K.y,na[la+5]=K.z,na[la+6]=P.x,na[la+7]=P.y,
-na[la+8]=P.z,na[la+9]=M.x,na[la+10]=M.y,na[la+11]=M.z,la+=12;if(Z)for(T in Z)if(p=Z[T],p.__original.needsUpdate)s=p.offset,z=p.offsetSrc,p.size===1?(p.boundTo===void 0||p.boundTo==="vertices"?(p.array[s]=p.value[A.a],p.array[s+1]=p.value[A.b],p.array[s+2]=p.value[A.c],p.array[s+3]=p.value[A.d]):p.boundTo==="faces"?(z=p.value[z],p.array[s]=z,p.array[s+1]=z,p.array[s+2]=z,p.array[s+3]=z,p.offsetSrc++):p.boundTo==="faceVertices"&&(p.array[s]=p.value[z],p.array[s+1]=p.value[z+1],p.array[s+2]=p.value[z+
-2],p.array[s+3]=p.value[z+3],p.offsetSrc+=4),p.offset+=4):(p.boundTo===void 0||p.boundTo==="vertices"?(H=p.value[A.a],K=p.value[A.b],P=p.value[A.c],M=p.value[A.d]):p.boundTo==="faces"?(M=P=K=H=z=p.value[z],p.offsetSrc++):p.boundTo==="faceVertices"&&(H=p.value[z],K=p.value[z+1],P=p.value[z+2],M=p.value[z+3],p.offsetSrc+=4),p.size===2?(p.array[s]=H.x,p.array[s+1]=H.y,p.array[s+2]=K.x,p.array[s+3]=K.y,p.array[s+4]=P.x,p.array[s+5]=P.y,p.array[s+6]=M.x,p.array[s+7]=M.y,p.offset+=8):p.size===3?(p.type===
-"c"?(p.array[s]=H.r,p.array[s+1]=H.g,p.array[s+2]=H.b,p.array[s+3]=K.r,p.array[s+4]=K.g,p.array[s+5]=K.b,p.array[s+6]=P.r,p.array[s+7]=P.g,p.array[s+8]=P.b,p.array[s+9]=M.r,p.array[s+10]=M.g,p.array[s+11]=M.b):(p.array[s]=H.x,p.array[s+1]=H.y,p.array[s+2]=H.z,p.array[s+3]=K.x,p.array[s+4]=K.y,p.array[s+5]=K.z,p.array[s+6]=P.x,p.array[s+7]=P.y,p.array[s+8]=P.z,p.array[s+9]=M.x,p.array[s+10]=M.y,p.array[s+11]=M.z),p.offset+=12):(p.array[s]=H.x,p.array[s+1]=H.y,p.array[s+2]=H.z,p.array[s+3]=H.w,p.array[s+
-4]=K.x,p.array[s+5]=K.y,p.array[s+6]=K.z,p.array[s+7]=K.w,p.array[s+8]=P.x,p.array[s+9]=P.y,p.array[s+10]=P.z,p.array[s+11]=P.w,p.array[s+12]=M.x,p.array[s+13]=M.y,p.array[s+14]=M.z,p.array[s+15]=M.w,p.offset+=16));if(Ea){s=0;for(p=Ia.length;s<p;s++)H=Ia[s].vertices[A.a].position,K=Ia[s].vertices[A.b].position,P=Ia[s].vertices[A.c].position,M=Ia[s].vertices[A.d].position,z=qa[s],z[ma]=H.x,z[ma+1]=H.y,z[ma+2]=H.z,z[ma+3]=K.x,z[ma+4]=K.y,z[ma+5]=K.z,z[ma+6]=P.x,z[ma+7]=P.y,z[ma+8]=P.z,z[ma+9]=M.x,z[ma+
-10]=M.y,z[ma+11]=M.z;ma+=12}if(La.length)s=La[A.a],p=La[A.b],z=La[A.c],Q=La[A.d],ea[x]=s.x,ea[x+1]=s.y,ea[x+2]=s.z,ea[x+3]=s.w,ea[x+4]=p.x,ea[x+5]=p.y,ea[x+6]=p.z,ea[x+7]=p.w,ea[x+8]=z.x,ea[x+9]=z.y,ea[x+10]=z.z,ea[x+11]=z.w,ea[x+12]=Q.x,ea[x+13]=Q.y,ea[x+14]=Q.z,ea[x+15]=Q.w,s=Oa[A.a],p=Oa[A.b],z=Oa[A.c],Q=Oa[A.d],da[x]=s.x,da[x+1]=s.y,da[x+2]=s.z,da[x+3]=s.w,da[x+4]=p.x,da[x+5]=p.y,da[x+6]=p.z,da[x+7]=p.w,da[x+8]=z.x,da[x+9]=z.y,da[x+10]=z.z,da[x+11]=z.w,da[x+12]=Q.x,da[x+13]=Q.y,da[x+14]=Q.z,da[x+
-15]=Q.w,s=Ma[A.a],p=Ma[A.b],z=Ma[A.c],Q=Ma[A.d],aa[x]=s.x,aa[x+1]=s.y,aa[x+2]=s.z,aa[x+3]=1,aa[x+4]=p.x,aa[x+5]=p.y,aa[x+6]=p.z,aa[x+7]=1,aa[x+8]=z.x,aa[x+9]=z.y,aa[x+10]=z.z,aa[x+11]=1,aa[x+12]=Q.x,aa[x+13]=Q.y,aa[x+14]=Q.z,aa[x+15]=1,s=Na[A.a],p=Na[A.b],z=Na[A.c],A=Na[A.d],ca[x]=s.x,ca[x+1]=s.y,ca[x+2]=s.z,ca[x+3]=1,ca[x+4]=p.x,ca[x+5]=p.y,ca[x+6]=p.z,ca[x+7]=1,ca[x+8]=z.x,ca[x+9]=z.y,ca[x+10]=z.z,ca[x+11]=1,ca[x+12]=A.x,ca[x+13]=A.y,ca[x+14]=A.z,ca[x+15]=1,x+=16;if(Da&&r)G.length==4&&r==THREE.VertexColors?
-(A=G[0],s=G[1],p=G[2],G=G[3]):G=p=s=A=L,oa[ka]=A.r,oa[ka+1]=A.g,oa[ka+2]=A.b,oa[ka+3]=s.r,oa[ka+4]=s.g,oa[ka+5]=s.b,oa[ka+6]=p.r,oa[ka+7]=p.g,oa[ka+8]=p.b,oa[ka+9]=G.r,oa[ka+10]=G.g,oa[ka+11]=G.b,ka+=12;if(Ca&&ta.hasTangents)G=N[0],L=N[1],A=N[2],N=N[3],$[X]=G.x,$[X+1]=G.y,$[X+2]=G.z,$[X+3]=G.w,$[X+4]=L.x,$[X+5]=L.y,$[X+6]=L.z,$[X+7]=L.w,$[X+8]=A.x,$[X+9]=A.y,$[X+10]=A.z,$[X+11]=A.w,$[X+12]=N.x,$[X+13]=N.y,$[X+14]=N.z,$[X+15]=N.w,X+=16;if(Aa&&v)if(C.length==4&&wa)for(N=0;N<4;N++)I=C[N],V[R]=I.x,V[R+
-1]=I.y,V[R+2]=I.z,R+=3;else for(N=0;N<4;N++)V[R]=I.x,V[R+1]=I.y,V[R+2]=I.z,R+=3;if(sa&&y!==void 0&&q)for(N=0;N<4;N++)C=y[N],ia[W]=C.u,ia[W+1]=C.v,W+=2;if(sa&&t!==void 0&&q)for(N=0;N<4;N++)C=t[N],ja[Y]=C.u,ja[Y+1]=C.v,Y+=2;va&&(ga[U]=ha,ga[U+1]=ha+1,ga[U+2]=ha+3,ga[U+3]=ha+1,ga[U+4]=ha+2,ga[U+5]=ha+3,U+=6,Ba[S]=ha,Ba[S+1]=ha+1,Ba[S+2]=ha,Ba[S+3]=ha+3,Ba[S+4]=ha+1,Ba[S+5]=ha+2,Ba[S+6]=ha+2,Ba[S+7]=ha+3,S+=8,ha+=4)}ua&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,na,
-E));if(Z)for(T in Z)p=Z[T],p.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,p.buffer),e.bufferData(e.ARRAY_BUFFER,p.array,E));if(Ea){s=0;for(p=Ia.length;s<p;s++)e.bindBuffer(e.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[s]),e.bufferData(e.ARRAY_BUFFER,qa[s],E)}Da&&ka>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,oa,E));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,V,E));Ca&&ta.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglTangentBuffer),
-e.bufferData(e.ARRAY_BUFFER,$,E));sa&&W>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ia,E));sa&&Y>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ja,E));va&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ga,E),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ba,E));x>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,
-aa,E),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ca,E),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,da,E),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ea,E));w&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,
-delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;ya(k)}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=e.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;o=h.colors;q=u.length;n=o.length;r=h.__vertexArray;E=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<q;w++)B=u[w].position,
-m=w*3,r[m]=B.x,r[m+1]=B.y,r[m+2]=B.z;e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,r,k)}if(v){for(w=0;w<n;w++)color=o[w],m=w*3,E[m]=color.r,E[m+1]=color.g,E[m+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,E,k)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.Line){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=e.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;o=h.colors;q=u.length;n=o.length;r=h.__vertexArray;
-E=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<q;w++)B=u[w].position,m=w*3,r[m]=B.x,r[m+1]=B.y,r[m+2]=B.z;e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,r,k)}if(v){for(w=0;w<n;w++)color=o[w],m=w*3,E[m]=color.r,E[m+1]=color.g,E[m+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,E,k)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)j=h.geometry,n=xa(j),(j.__dirtyVertices||j.__dirtyColors||
-h.sortParticles||n)&&c(j,e.DYNAMIC_DRAW,h),j.__dirtyVertices=!1,j.__dirtyColors=!1,ya(j)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return $a}};
+d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(u,X("fragment",j+o));e.attachShader(u,X("vertex",f+q));e.linkProgram(u);e.getProgramParameter(u,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(u,e.VALIDATE_STATUS)+", gl error ["+
+e.getError()+"]");u.uniforms={};u.attributes={};var v,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)f.push(v);v=f;f=0;for(m=v.length;f<m;f++)o=v[f],u.uniforms[o]=e.getUniformLocation(u,o);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<d.maxMorphTargets;v++)f.push("morphTarget"+v);for(n in c)f.push(n);
+n=f;v=0;for(c=n.length;v<c;v++)d=n[v],u.attributes[d]=e.getAttribLocation(u,d);Ba.push({program:u,code:k});M.info.memory.programs=Ba.length;n=u}b.program=n;n=b.program.attributes;n.position>=0&&e.enableVertexAttribArray(n.position);n.color>=0&&e.enableVertexAttribArray(n.color);n.normal>=0&&e.enableVertexAttribArray(n.normal);n.tangent>=0&&e.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(e.enableVertexAttribArray(n.skinVertexA),
+e.enableVertexAttribArray(n.skinVertexB),e.enableVertexAttribArray(n.skinIndex),e.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(h in b.attributes)n[h]!==void 0&&n[h]>=0&&e.enableVertexAttribArray(n[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)v="morphTarget"+h,n[v]>=0&&(e.enableVertexAttribArray(n[v]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,f){O(b);b=0;c&&(b|=e.COLOR_BUFFER_BIT);d&&(b|=e.DEPTH_BUFFER_BIT);f&&(b|=e.STENCIL_BUFFER_BIT);
+e.clear(b)};this.render=function(b,c,e,r){var n,w,Fa,U,C,I,D,Qa,Ra=b.lights,Sa=b.fog;this.shadowMapEnabled&&y(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ta);c.projectionMatrix.flattenToArray(Ca);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);o(ta);this.initWebGLObjects(b);O(e);(this.autoClear||r)&&this.clear();C=b.__webglObjects.length;for(r=0;r<C;r++)if(n=b.__webglObjects[r],
+D=n.object,D.visible)if(!(D instanceof THREE.Mesh)||!D.frustumCulled||u(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),G(D,c,!0),s(n),n.render=!0,this.sortObjects)n.object.renderDepth?n.z=n.object.renderDepth:(Ia.copy(D.position),ta.multiplyVector3(Ia),n.z=Ia.z)}else n.render=!1;else n.render=!1;this.sortObjects&&b.__webglObjects.sort(z);I=b.__webglObjectsImmediate.length;for(r=0;r<I;r++)n=b.__webglObjectsImmediate[r],D=n.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),
+G(D,c,!0),v(n));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);F(b.overrideMaterial.blending);for(r=0;r<C;r++)if(n=b.__webglObjects[r],n.render)D=n.object,Qa=n.buffer,h(D),f(c,Ra,Sa,b.overrideMaterial,Qa,D);for(r=0;r<I;r++)n=b.__webglObjectsImmediate[r],D=n.object,D.visible&&(h(D),w=d(c,Ra,Sa,b.overrideMaterial,D),D.render(function(c){j(c,w,b.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(r=C-1;r>=0;r--)if(n=b.__webglObjects[r],n.render){D=n.object;Qa=n.buffer;Fa=n.opaque;h(D);
+for(n=0;n<Fa.count;n++)U=Fa.list[n],k(U.depthTest),m(U.depthWrite),q(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),f(c,Ra,Sa,U,Qa,D)}for(r=0;r<I;r++)if(n=b.__webglObjectsImmediate[r],D=n.object,D.visible){Fa=n.opaque;h(D);for(n=0;n<Fa.count;n++)U=Fa.list[n],k(U.depthTest),m(U.depthWrite),q(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),w=d(c,Ra,Sa,U,D),D.render(function(b){j(b,w,U.shading)})}for(r=0;r<C;r++)if(n=b.__webglObjects[r],n.render){D=n.object;Qa=n.buffer;Fa=n.transparent;
+h(D);for(n=0;n<Fa.count;n++)U=Fa.list[n],F(U.blending),k(U.depthTest),m(U.depthWrite),q(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),f(c,Ra,Sa,U,Qa,D)}for(r=0;r<I;r++)if(n=b.__webglObjectsImmediate[r],D=n.object,D.visible){Fa=n.transparent;h(D);for(n=0;n<Fa.count;n++)U=Fa.list[n],F(U.blending),k(U.depthTest),m(U.depthWrite),q(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),w=d(c,Ra,Sa,U,D),D.render(function(b){j(b,w,U.shading)})}}b.__webglSprites.length&&E(b,c);e&&e.minFilter!==
+THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&ia(e)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],f=b,h=void 0,j=void 0,k=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),
+d instanceof THREE.Mesh)for(h in j=d.geometry,j.geometryGroups==void 0&&qa(j),j.geometryGroups){if(k=j.geometryGroups[h],!k.__webglVertexBuffer){var m=k;m.__webglVertexBuffer=e.createBuffer();m.__webglNormalBuffer=e.createBuffer();m.__webglTangentBuffer=e.createBuffer();m.__webglColorBuffer=e.createBuffer();m.__webglUVBuffer=e.createBuffer();m.__webglUV2Buffer=e.createBuffer();m.__webglSkinVertexABuffer=e.createBuffer();m.__webglSkinVertexBBuffer=e.createBuffer();m.__webglSkinIndicesBuffer=e.createBuffer();
+m.__webglSkinWeightsBuffer=e.createBuffer();m.__webglFaceBuffer=e.createBuffer();m.__webglLineBuffer=e.createBuffer();if(m.numMorphTargets){var o=void 0,n=void 0;m.__webglMorphTargetsBuffers=[];o=0;for(n=m.numMorphTargets;o<n;o++)m.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var m=d,r=void 0,q=void 0,s=void 0,u=s=void 0,v=void 0,w=void 0,z=w=o=0,y=s=q=void 0,s=n=y=q=r=void 0,u=m.geometry,v=u.faces,y=k.faces,r=0,q=y.length;r<q;r++)s=y[r],s=v[s],s instanceof THREE.Face3?
+(o+=3,w+=1,z+=3):s instanceof THREE.Face4&&(o+=4,w+=2,z+=4);for(var r=k,q=m,G=y=v=void 0,H=void 0,G=void 0,s=[],v=0,y=q.materials.length;v<y;v++)if(G=q.materials[v],G instanceof THREE.MeshFaceMaterial){G=0;for(l=r.materials.length;G<l;G++)(H=r.materials[G])&&s.push(H)}else(H=G)&&s.push(H);r=s;k.__materials=r;a:{v=q=void 0;y=r.length;for(q=0;q<y;q++)if(v=r[q],v.map||v.lightMap||v instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{y=v=void 0;s=r.length;for(v=0;v<s;v++)if(y=r[v],!(y instanceof THREE.MeshBasicMaterial&&
+!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{s=v=void 0;G=r.length;for(v=0;v<G;v++)if(s=r[v],s.vertexColors){s=s.vertexColors;break a}s=!1}k.__vertexArray=new Float32Array(o*3);if(y)k.__normalArray=new Float32Array(o*3);if(u.hasTangents)k.__tangentArray=new Float32Array(o*4);if(s)k.__colorArray=new Float32Array(o*3);if(q){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*
+2);if(u.faceUvs.length>1||u.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(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(z*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=
+k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=y==THREE.SmoothShading;k.__uvType=q;k.__vertexColorType=s;k.__normalType=y;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=z*2;u=0;for(v=r.length;u<v;u++)if(q=r[u],q.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in q.attributes){s=q.attributes[a];y={};for(n in s)y[n]=s[n];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=
+!0,w=1,y.type==="v2"?w=2:y.type==="v3"?w=3:y.type==="v4"?w=4:y.type==="c"&&(w=3),y.size=w,y.array=new Float32Array(o*w),y.buffer=e.createBuffer(),y.buffer.belongsToAttribute=a,s.needsUpdate=!0,y.__original=s;k.__webglCustomAttributes[a]=y}}k.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(j=d.geometry,!j.__webglVertexBuffer)k=j,k.__webglVertexBuffer=
+e.createBuffer(),k.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,k=j,m=k.vertices.length,k.__vertexArray=new Float32Array(m*3),k.__colorArray=new Float32Array(m*3),k.__webglVertexCount=m,j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(d instanceof THREE.Line){if(j=d.geometry,!j.__webglVertexBuffer)k=j,k.__webglVertexBuffer=e.createBuffer(),k.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,k=j,m=k.vertices.length,k.__vertexArray=new Float32Array(m*3),k.__colorArray=
+new Float32Array(m*3),k.__webglLineCount=m,j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(j=d.geometry,!j.__webglVertexBuffer)){k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();M.info.geometries++;k=j;m=d;o=k.vertices.length;k.__vertexArray=new Float32Array(o*3);k.__colorArray=new Float32Array(o*3);k.__sortArray=[];k.__webglParticleCount=o;k.__materials=m.materials;z=w=n=void 0;n=0;for(w=m.materials.length;n<w;n++)if(z=m.materials[n],
+z.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=z.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(o*
+size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;k.__webglCustomAttributes[a]=attribute}}j.__dirtyVertices=!0;j.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in j=d.geometry,j.geometryGroups)k=j.geometryGroups[h],ha(f.__webglObjects,k,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(j=d.geometry,ha(f.__webglObjects,j,d)):THREE.MarchingCubes!==
+void 0&&d instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)pa(f.__webglObjects,d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;j=void 0;
+for(j=f.length-1;j>=0;j--)f[j]==h&&f.splice(j,1)}else d instanceof THREE.MarchingCubes&&pa(f.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(j=b.__webglObjects[d].object,n=k=h=void 0,j instanceof THREE.Mesh){h=j.geometry;m=0;for(o=h.geometryGroupsList.length;m<o;m++)if(k=h.geometryGroupsList[m],n=va(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
+n)if(n=k,w=e.DYNAMIC_DRAW,z=!h.dynamic,n.__inittedArrays){var F=r=u=void 0,A=void 0,I=F=void 0,E=void 0,O=void 0,J=void 0,L=H=G=s=y=v=q=void 0,N=void 0,K=void 0,t=A=J=A=O=E=void 0,p=void 0,B=p=t=E=void 0,P=void 0,T=B=p=t=F=F=I=J=A=B=p=t=P=B=p=t=P=B=p=t=void 0,ga=0,la=0,X=0,Y=0,S=0,Q=0,W=0,R=0,ja=0,x=0,ma=0,B=t=0,B=void 0,na=n.__vertexArray,ia=n.__uvArray,ka=n.__uv2Array,V=n.__normalArray,$=n.__tangentArray,oa=n.__colorArray,aa=n.__skinVertexAArray,ca=n.__skinVertexBArray,da=n.__skinIndexArray,ea=
+n.__skinWeightArray,ra=n.__morphTargetsArrays,Z=n.__webglCustomAttributes,p=void 0,fa=n.__faceArray,Aa=n.__lineArray,xa=n.__needsSmoothNormals,v=n.__vertexColorType,q=n.__uvType,y=n.__normalType,sa=j.geometry,ua=sa.__dirtyVertices,ya=sa.__dirtyElements,ta=sa.__dirtyUvs,Ba=sa.__dirtyNormals,Ca=sa.__dirtyTangents,Da=sa.__dirtyColors,Ea=sa.__dirtyMorphTargets,za=sa.vertices,Ga=n.faces,Ja=sa.faces,Ia=sa.faceVertexUvs[0],La=sa.faceVertexUvs[1],Na=sa.skinVerticesA,Oa=sa.skinVerticesB,Pa=sa.skinIndices,
+Ka=sa.skinWeights,Ha=sa.morphTargets;if(Z)for(T in Z)Z[T].offset=0,Z[T].offsetSrc=0;u=0;for(r=Ga.length;u<r;u++)if(F=Ga[u],A=Ja[F],Ia&&(s=Ia[F]),La&&(G=La[F]),F=A.vertexNormals,I=A.normal,E=A.vertexColors,O=A.color,J=A.vertexTangents,A instanceof THREE.Face3){if(ua)H=za[A.a].position,L=za[A.b].position,N=za[A.c].position,na[la]=H.x,na[la+1]=H.y,na[la+2]=H.z,na[la+3]=L.x,na[la+4]=L.y,na[la+5]=L.z,na[la+6]=N.x,na[la+7]=N.y,na[la+8]=N.z,la+=9;if(Z)for(T in Z)if(p=Z[T],p.__original.needsUpdate)t=p.offset,
+B=p.offsetSrc,p.size===1?(p.boundTo===void 0||p.boundTo==="vertices"?(p.array[t]=p.value[A.a],p.array[t+1]=p.value[A.b],p.array[t+2]=p.value[A.c]):p.boundTo==="faces"?(B=p.value[B],p.array[t]=B,p.array[t+1]=B,p.array[t+2]=B,p.offsetSrc++):p.boundTo==="faceVertices"&&(p.array[t]=p.value[B],p.array[t+1]=p.value[B+1],p.array[t+2]=p.value[B+2],p.offsetSrc+=3),p.offset+=3):(p.boundTo===void 0||p.boundTo==="vertices"?(H=p.value[A.a],L=p.value[A.b],N=p.value[A.c]):p.boundTo==="faces"?(N=L=H=B=p.value[B],
+p.offsetSrc++):p.boundTo==="faceVertices"&&(H=p.value[B],L=p.value[B+1],N=p.value[B+2],p.offsetSrc+=3),p.size===2?(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=L.x,p.array[t+3]=L.y,p.array[t+4]=N.x,p.array[t+5]=N.y,p.offset+=6):p.size===3?(p.type==="c"?(p.array[t]=H.r,p.array[t+1]=H.g,p.array[t+2]=H.b,p.array[t+3]=L.r,p.array[t+4]=L.g,p.array[t+5]=L.b,p.array[t+6]=N.r,p.array[t+7]=N.g,p.array[t+8]=N.b):(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=H.z,p.array[t+3]=L.x,p.array[t+4]=L.y,p.array[t+5]=
+L.z,p.array[t+6]=N.x,p.array[t+7]=N.y,p.array[t+8]=N.z),p.offset+=9):(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=H.z,p.array[t+3]=H.w,p.array[t+4]=L.x,p.array[t+5]=L.y,p.array[t+6]=L.z,p.array[t+7]=L.w,p.array[t+8]=N.x,p.array[t+9]=N.y,p.array[t+10]=N.z,p.array[t+11]=N.w,p.offset+=12));if(Ea){t=0;for(p=Ha.length;t<p;t++)H=Ha[t].vertices[A.a].position,L=Ha[t].vertices[A.b].position,N=Ha[t].vertices[A.c].position,B=ra[t],B[ma]=H.x,B[ma+1]=H.y,B[ma+2]=H.z,B[ma+3]=L.x,B[ma+4]=L.y,B[ma+5]=L.z,B[ma+6]=
+N.x,B[ma+7]=N.y,B[ma+8]=N.z;ma+=9}if(Ka.length)t=Ka[A.a],p=Ka[A.b],B=Ka[A.c],ea[x]=t.x,ea[x+1]=t.y,ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=p.x,ea[x+5]=p.y,ea[x+6]=p.z,ea[x+7]=p.w,ea[x+8]=B.x,ea[x+9]=B.y,ea[x+10]=B.z,ea[x+11]=B.w,t=Pa[A.a],p=Pa[A.b],B=Pa[A.c],da[x]=t.x,da[x+1]=t.y,da[x+2]=t.z,da[x+3]=t.w,da[x+4]=p.x,da[x+5]=p.y,da[x+6]=p.z,da[x+7]=p.w,da[x+8]=B.x,da[x+9]=B.y,da[x+10]=B.z,da[x+11]=B.w,t=Na[A.a],p=Na[A.b],B=Na[A.c],aa[x]=t.x,aa[x+1]=t.y,aa[x+2]=t.z,aa[x+3]=1,aa[x+4]=p.x,aa[x+5]=p.y,aa[x+6]=
+p.z,aa[x+7]=1,aa[x+8]=B.x,aa[x+9]=B.y,aa[x+10]=B.z,aa[x+11]=1,t=Oa[A.a],p=Oa[A.b],B=Oa[A.c],ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=p.x,ca[x+5]=p.y,ca[x+6]=p.z,ca[x+7]=1,ca[x+8]=B.x,ca[x+9]=B.y,ca[x+10]=B.z,ca[x+11]=1,x+=12;if(Da&&v)E.length==3&&v==THREE.VertexColors?(A=E[0],t=E[1],p=E[2]):p=t=A=O,oa[ja]=A.r,oa[ja+1]=A.g,oa[ja+2]=A.b,oa[ja+3]=t.r,oa[ja+4]=t.g,oa[ja+5]=t.b,oa[ja+6]=p.r,oa[ja+7]=p.g,oa[ja+8]=p.b,ja+=9;if(Ca&&sa.hasTangents)E=J[0],O=J[1],A=J[2],$[W]=E.x,$[W+1]=E.y,$[W+2]=
+E.z,$[W+3]=E.w,$[W+4]=O.x,$[W+5]=O.y,$[W+6]=O.z,$[W+7]=O.w,$[W+8]=A.x,$[W+9]=A.y,$[W+10]=A.z,$[W+11]=A.w,W+=12;if(Ba&&y)if(F.length==3&&xa)for(J=0;J<3;J++)I=F[J],V[Q]=I.x,V[Q+1]=I.y,V[Q+2]=I.z,Q+=3;else for(J=0;J<3;J++)V[Q]=I.x,V[Q+1]=I.y,V[Q+2]=I.z,Q+=3;if(ta&&s!==void 0&&q)for(J=0;J<3;J++)F=s[J],ia[X]=F.u,ia[X+1]=F.v,X+=2;if(ta&&G!==void 0&&q)for(J=0;J<3;J++)F=G[J],ka[Y]=F.u,ka[Y+1]=F.v,Y+=2;ya&&(fa[S]=ga,fa[S+1]=ga+1,fa[S+2]=ga+2,S+=3,Aa[R]=ga,Aa[R+1]=ga+1,Aa[R+2]=ga,Aa[R+3]=ga+2,Aa[R+4]=ga+1,
+Aa[R+5]=ga+2,R+=6,ga+=3)}else if(A instanceof THREE.Face4){if(ua)H=za[A.a].position,L=za[A.b].position,N=za[A.c].position,K=za[A.d].position,na[la]=H.x,na[la+1]=H.y,na[la+2]=H.z,na[la+3]=L.x,na[la+4]=L.y,na[la+5]=L.z,na[la+6]=N.x,na[la+7]=N.y,na[la+8]=N.z,na[la+9]=K.x,na[la+10]=K.y,na[la+11]=K.z,la+=12;if(Z)for(T in Z)if(p=Z[T],p.__original.needsUpdate)t=p.offset,B=p.offsetSrc,p.size===1?(p.boundTo===void 0||p.boundTo==="vertices"?(p.array[t]=p.value[A.a],p.array[t+1]=p.value[A.b],p.array[t+2]=p.value[A.c],
+p.array[t+3]=p.value[A.d]):p.boundTo==="faces"?(B=p.value[B],p.array[t]=B,p.array[t+1]=B,p.array[t+2]=B,p.array[t+3]=B,p.offsetSrc++):p.boundTo==="faceVertices"&&(p.array[t]=p.value[B],p.array[t+1]=p.value[B+1],p.array[t+2]=p.value[B+2],p.array[t+3]=p.value[B+3],p.offsetSrc+=4),p.offset+=4):(p.boundTo===void 0||p.boundTo==="vertices"?(H=p.value[A.a],L=p.value[A.b],N=p.value[A.c],K=p.value[A.d]):p.boundTo==="faces"?(K=N=L=H=B=p.value[B],p.offsetSrc++):p.boundTo==="faceVertices"&&(H=p.value[B],L=p.value[B+
+1],N=p.value[B+2],K=p.value[B+3],p.offsetSrc+=4),p.size===2?(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=L.x,p.array[t+3]=L.y,p.array[t+4]=N.x,p.array[t+5]=N.y,p.array[t+6]=K.x,p.array[t+7]=K.y,p.offset+=8):p.size===3?(p.type==="c"?(p.array[t]=H.r,p.array[t+1]=H.g,p.array[t+2]=H.b,p.array[t+3]=L.r,p.array[t+4]=L.g,p.array[t+5]=L.b,p.array[t+6]=N.r,p.array[t+7]=N.g,p.array[t+8]=N.b,p.array[t+9]=K.r,p.array[t+10]=K.g,p.array[t+11]=K.b):(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=H.z,p.array[t+3]=
+L.x,p.array[t+4]=L.y,p.array[t+5]=L.z,p.array[t+6]=N.x,p.array[t+7]=N.y,p.array[t+8]=N.z,p.array[t+9]=K.x,p.array[t+10]=K.y,p.array[t+11]=K.z),p.offset+=12):(p.array[t]=H.x,p.array[t+1]=H.y,p.array[t+2]=H.z,p.array[t+3]=H.w,p.array[t+4]=L.x,p.array[t+5]=L.y,p.array[t+6]=L.z,p.array[t+7]=L.w,p.array[t+8]=N.x,p.array[t+9]=N.y,p.array[t+10]=N.z,p.array[t+11]=N.w,p.array[t+12]=K.x,p.array[t+13]=K.y,p.array[t+14]=K.z,p.array[t+15]=K.w,p.offset+=16));if(Ea){t=0;for(p=Ha.length;t<p;t++)H=Ha[t].vertices[A.a].position,
+L=Ha[t].vertices[A.b].position,N=Ha[t].vertices[A.c].position,K=Ha[t].vertices[A.d].position,B=ra[t],B[ma]=H.x,B[ma+1]=H.y,B[ma+2]=H.z,B[ma+3]=L.x,B[ma+4]=L.y,B[ma+5]=L.z,B[ma+6]=N.x,B[ma+7]=N.y,B[ma+8]=N.z,B[ma+9]=K.x,B[ma+10]=K.y,B[ma+11]=K.z;ma+=12}if(Ka.length)t=Ka[A.a],p=Ka[A.b],B=Ka[A.c],P=Ka[A.d],ea[x]=t.x,ea[x+1]=t.y,ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=p.x,ea[x+5]=p.y,ea[x+6]=p.z,ea[x+7]=p.w,ea[x+8]=B.x,ea[x+9]=B.y,ea[x+10]=B.z,ea[x+11]=B.w,ea[x+12]=P.x,ea[x+13]=P.y,ea[x+14]=P.z,ea[x+15]=P.w,
+t=Pa[A.a],p=Pa[A.b],B=Pa[A.c],P=Pa[A.d],da[x]=t.x,da[x+1]=t.y,da[x+2]=t.z,da[x+3]=t.w,da[x+4]=p.x,da[x+5]=p.y,da[x+6]=p.z,da[x+7]=p.w,da[x+8]=B.x,da[x+9]=B.y,da[x+10]=B.z,da[x+11]=B.w,da[x+12]=P.x,da[x+13]=P.y,da[x+14]=P.z,da[x+15]=P.w,t=Na[A.a],p=Na[A.b],B=Na[A.c],P=Na[A.d],aa[x]=t.x,aa[x+1]=t.y,aa[x+2]=t.z,aa[x+3]=1,aa[x+4]=p.x,aa[x+5]=p.y,aa[x+6]=p.z,aa[x+7]=1,aa[x+8]=B.x,aa[x+9]=B.y,aa[x+10]=B.z,aa[x+11]=1,aa[x+12]=P.x,aa[x+13]=P.y,aa[x+14]=P.z,aa[x+15]=1,t=Oa[A.a],p=Oa[A.b],B=Oa[A.c],A=Oa[A.d],
+ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=p.x,ca[x+5]=p.y,ca[x+6]=p.z,ca[x+7]=1,ca[x+8]=B.x,ca[x+9]=B.y,ca[x+10]=B.z,ca[x+11]=1,ca[x+12]=A.x,ca[x+13]=A.y,ca[x+14]=A.z,ca[x+15]=1,x+=16;if(Da&&v)E.length==4&&v==THREE.VertexColors?(A=E[0],t=E[1],p=E[2],E=E[3]):E=p=t=A=O,oa[ja]=A.r,oa[ja+1]=A.g,oa[ja+2]=A.b,oa[ja+3]=t.r,oa[ja+4]=t.g,oa[ja+5]=t.b,oa[ja+6]=p.r,oa[ja+7]=p.g,oa[ja+8]=p.b,oa[ja+9]=E.r,oa[ja+10]=E.g,oa[ja+11]=E.b,ja+=12;if(Ca&&sa.hasTangents)E=J[0],O=J[1],A=J[2],J=J[3],$[W]=E.x,$[W+
+1]=E.y,$[W+2]=E.z,$[W+3]=E.w,$[W+4]=O.x,$[W+5]=O.y,$[W+6]=O.z,$[W+7]=O.w,$[W+8]=A.x,$[W+9]=A.y,$[W+10]=A.z,$[W+11]=A.w,$[W+12]=J.x,$[W+13]=J.y,$[W+14]=J.z,$[W+15]=J.w,W+=16;if(Ba&&y)if(F.length==4&&xa)for(J=0;J<4;J++)I=F[J],V[Q]=I.x,V[Q+1]=I.y,V[Q+2]=I.z,Q+=3;else for(J=0;J<4;J++)V[Q]=I.x,V[Q+1]=I.y,V[Q+2]=I.z,Q+=3;if(ta&&s!==void 0&&q)for(J=0;J<4;J++)F=s[J],ia[X]=F.u,ia[X+1]=F.v,X+=2;if(ta&&G!==void 0&&q)for(J=0;J<4;J++)F=G[J],ka[Y]=F.u,ka[Y+1]=F.v,Y+=2;ya&&(fa[S]=ga,fa[S+1]=ga+1,fa[S+2]=ga+3,fa[S+
+3]=ga+1,fa[S+4]=ga+2,fa[S+5]=ga+3,S+=6,Aa[R]=ga,Aa[R+1]=ga+1,Aa[R+2]=ga,Aa[R+3]=ga+3,Aa[R+4]=ga+1,Aa[R+5]=ga+2,Aa[R+6]=ga+2,Aa[R+7]=ga+3,R+=8,ga+=4)}ua&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,na,w));if(Z)for(T in Z)p=Z[T],p.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,p.buffer),e.bufferData(e.ARRAY_BUFFER,p.array,w));if(Ea){t=0;for(p=Ha.length;t<p;t++)e.bindBuffer(e.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[t]),e.bufferData(e.ARRAY_BUFFER,ra[t],w)}Da&&
+ja>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,oa,w));Ba&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,V,w));Ca&&sa.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,$,w));ta&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ia,w));ta&&Y>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ka,w));ya&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
+n.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa,w),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Aa,w));x>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,aa,w),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ca,w),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,da,w),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,
+ea,w));z&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;wa(k)}else if(j instanceof THREE.Ribbon){h=
+j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=e.DYNAMIC_DRAW;m=u=z=z=void 0;r=j.vertices;o=j.colors;q=r.length;n=o.length;v=j.__vertexArray;w=j.__colorArray;y=j.__dirtyColors;if(j.__dirtyVertices){for(z=0;z<q;z++)u=r[z].position,m=z*3,v[m]=u.x,v[m+1]=u.y,v[m+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,j.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,v,k)}if(y){for(z=0;z<n;z++)color=o[z],m=z*3,w[m]=color.r,w[m+1]=color.g,w[m+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,j.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
+w,k)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(j instanceof THREE.Line){h=j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=e.DYNAMIC_DRAW;m=u=z=z=void 0;r=j.vertices;o=j.colors;q=r.length;n=o.length;v=j.__vertexArray;w=j.__colorArray;y=j.__dirtyColors;if(j.__dirtyVertices){for(z=0;z<q;z++)u=r[z].position,m=z*3,v[m]=u.x,v[m+1]=u.y,v[m+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,j.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,v,k)}if(y){for(z=0;z<n;z++)color=o[z],m=z*3,w[m]=color.r,w[m+1]=color.g,
+w[m+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,j.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,w,k)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem)h=j.geometry,n=va(h),(h.__dirtyVertices||h.__dirtyColors||j.sortParticles||n)&&c(h,e.DYNAMIC_DRAW,j),h.__dirtyVertices=!1,h.__dirtyColors=!1,wa(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),
+e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return $a}};
 THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
 THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
 THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
 THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};

+ 2 - 1
src/core/Object3D.js

@@ -130,6 +130,7 @@ THREE.Object3D.prototype = {
 	},
 	},
 
 
 	remove: function ( object ) {
 	remove: function ( object ) {
+
 		var scene = this;
 		var scene = this;
 
 
 		var childIndex = this.children.indexOf( object );
 		var childIndex = this.children.indexOf( object );
@@ -161,7 +162,7 @@ THREE.Object3D.prototype = {
 
 
 		var c, cl, child, recurseResult;
 		var c, cl, child, recurseResult;
 
 
-		for ( c = 0, cl = this.children.length; c < cl; c++ ) {
+		for ( c = 0, cl = this.children.length; c < cl; c ++ ) {
 
 
 			child = this.children[ c ];
 			child = this.children[ c ];
 
 

+ 28 - 13
src/renderers/WebGLRenderer.js

@@ -4114,7 +4114,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			object.matrixWorld.flattenToArray( object._objectMatrixArray );
 			object.matrixWorld.flattenToArray( object._objectMatrixArray );
 
 
-
 			if ( object instanceof THREE.Mesh ) {
 			if ( object instanceof THREE.Mesh ) {
 
 
 				geometry = object.geometry;
 				geometry = object.geometry;
@@ -4148,8 +4147,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 					}
 					}
 
 
-					addBuffer( scene.__webglObjects, geometryGroup, object );
-
 				}
 				}
 
 
 			} else if ( object instanceof THREE.Ribbon ) {
 			} else if ( object instanceof THREE.Ribbon ) {
@@ -4166,8 +4163,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				}
 				}
 
 
-				addBuffer( scene.__webglObjects, geometry, object );
-
 			} else if ( object instanceof THREE.Line ) {
 			} else if ( object instanceof THREE.Line ) {
 
 
 				geometry = object.geometry;
 				geometry = object.geometry;
@@ -4182,8 +4177,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				}
 				}
 
 
-				addBuffer( scene.__webglObjects, geometry, object );
-
 			} else if ( object instanceof THREE.ParticleSystem ) {
 			} else if ( object instanceof THREE.ParticleSystem ) {
 
 
 				geometry = object.geometry;
 				geometry = object.geometry;
@@ -4198,6 +4191,29 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				}
 				}
 
 
+			}
+
+		}
+
+		if ( ! object.__webglActive ) {
+
+			if ( object instanceof THREE.Mesh ) {
+
+				geometry = object.geometry;
+
+				for ( g in geometry.geometryGroups ) {
+
+					geometryGroup = geometry.geometryGroups[ g ];
+
+					addBuffer( scene.__webglObjects, geometryGroup, object );
+
+				}
+
+			} else if ( object instanceof THREE.Ribbon ||
+						object instanceof THREE.Line ||
+						object instanceof THREE.ParticleSystem ) {
+
+				geometry = object.geometry;
 				addBuffer( scene.__webglObjects, geometry, object );
 				addBuffer( scene.__webglObjects, geometry, object );
 
 
 			} else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes ) {
 			} else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes ) {
@@ -4210,9 +4226,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			}
 			}
 
 
-			/*else if ( object instanceof THREE.Particle ) {
-
-			}*/
+			object.__webglActive = true;
 
 
 		}
 		}
 
 
@@ -4351,9 +4365,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			// it updates itself in render callback
 			// it updates itself in render callback
 
 
-		} else if ( object instanceof THREE.Particle ) {
-
-		}*/
+		}
+		*/
 
 
 		/*
 		/*
 		delete geometry.vertices;
 		delete geometry.vertices;
@@ -4414,6 +4427,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		}
 		}
 
 
+		object.__webglActive = false;
+
 	};
 	};
 
 
 	function sortFacesByMaterial( geometry ) {
 	function sortFacesByMaterial( geometry ) {

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