From 2d7833d32e147d07c5e158bcedfc7655c1c4f807 Mon Sep 17 00:00:00 2001 From: alteredq Date: Fri, 1 Apr 2011 03:34:26 +0200 Subject: [PATCH] Fixed runaway globals in JSONLoader. --- build/Three.js | 376 ++++++++++++++++++------------------ build/custom/ThreeExtras.js | 96 ++++----- build/custom/ThreeWebGL.js | 4 +- src/extras/io/JSONLoader.js | 2 + 4 files changed, 240 insertions(+), 238 deletions(-) diff --git a/build/Three.js b/build/Three.js index 4252bcc3..54c6382e 100755 --- a/build/Three.js +++ b/build/Three.js @@ -12,21 +12,21 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,c,f){this.set(b||0,d||0,c||0,f||1)}; THREE.Vector4.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x* b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b0&&H>0&&O+H<1}var c,f,g,h,j,k,n,p,o,t, -A,y=b.geometry,B=y.vertices,F=[];c=0;for(f=y.faces.length;cn?f:n;g=g>p?g:p}b()}; -this.add3Points=function(n,p,o,t,A,y){if(k){k=!1;d=no?n>A?n:A:o>A?o:A;g=p>t?p>y?p:y:t>y?t:y}else{d=no?n>A?n>f?n:f:A>f?A:f:o>A?o>f?o:f:A>f?A:f;g=p>t?p>y?p>g?p:g:y>g?y:g:t>y?t>g?t:g:y>g?y:g}b()};this.addRectangle=function(n){if(k){k=!1;d=n.getLeft();c=n.getTop();f=n.getRight();g=n.getBottom()}else{d=dn.getRight()? +THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b0&&G>0&&O+G<1}var c,f,g,h,j,k,n,p,o,x, +A,t=b.geometry,C=t.vertices,E=[];c=0;for(f=t.faces.length;cn?f:n;g=g>p?g:p}b()}; +this.add3Points=function(n,p,o,x,A,t){if(k){k=!1;d=no?n>A?n:A:o>A?o:A;g=p>x?p>t?p:t:x>t?x:t}else{d=no?n>A?n>f?n:f:A>f?A:f:o>A?o>f?o:f:A>f?A:f;g=p>x?p>t?p>g?p:g:t>g?t:g:x>t?x>g?x:g:t>g?t:g}b()};this.addRectangle=function(n){if(k){k=!1;d=n.getLeft();c=n.getTop();f=n.getRight();g=n.getBottom()}else{d=dn.getRight()? f:n.getRight();g=g>n.getBottom()?g:n.getBottom()}b()};this.inflate=function(n){d-=n;c-=n;f+=n;g+=n;b()};this.minSelf=function(n){d=d>n.getLeft()?d:n.getLeft();c=c>n.getTop()?c:n.getTop();f=f=0&&Math.min(g,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){k=!0;g=f=c=d=0;b()};this.isEmpty=function(){return k}}; THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}}; -THREE.Matrix4=function(b,d,c,f,g,h,j,k,n,p,o,t,A,y,B,F){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,t||0,A||0,y||0,B||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,n,p,o,t,A,y,B,F){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=o;this.n34=t;this.n41=A;this.n42=y;this.n43=B;this.n44=F;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,d,c){var f=THREE.Matrix4.__v1, +THREE.Matrix4=function(b,d,c,f,g,h,j,k,n,p,o,x,A,t,C,E){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,x||0,A||0,t||0,C||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,n,p,o,x,A,t,C,E){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=o;this.n34=x;this.n41=A;this.n42=t;this.n43=C;this.n44=E;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,d,c){var f=THREE.Matrix4.__v1, g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23* f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize(); -return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,A=b.n33,y=b.n34,B=b.n41,F=b.n42,H=b.n43,L=b.n44,V=d.n11,D=d.n12,M=d.n13,O=d.n14,Q=d.n21,Ia=d.n22, -ua=d.n23,Aa=d.n24,da=d.n31,e=d.n32,ga=d.n33,Ba=d.n34;this.n11=c*V+f*Q+g*da;this.n12=c*D+f*Ia+g*e;this.n13=c*M+f*ua+g*ga;this.n14=c*O+f*Aa+g*Ba+h;this.n21=j*V+k*Q+n*da;this.n22=j*D+k*Ia+n*e;this.n23=j*M+k*ua+n*ga;this.n24=j*O+k*Aa+n*Ba+p;this.n31=o*V+t*Q+A*da;this.n32=o*D+t*Ia+A*e;this.n33=o*M+t*ua+A*ga;this.n34=o*O+t*Aa+A*Ba+y;this.n41=B*V+F*Q+H*da;this.n42=B*D+F*Ia+H*e;this.n43=B*M+F*ua+H*ga;this.n44=B*O+F*Aa+H*Ba+L;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]= +return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,A=b.n33,t=b.n34,C=b.n41,E=b.n42,G=b.n43,L=b.n44,V=d.n11,D=d.n12,M=d.n13,O=d.n14,Q=d.n21,Ia=d.n22, +ua=d.n23,Aa=d.n24,da=d.n31,e=d.n32,ga=d.n33,Ba=d.n34;this.n11=c*V+f*Q+g*da;this.n12=c*D+f*Ia+g*e;this.n13=c*M+f*ua+g*ga;this.n14=c*O+f*Aa+g*Ba+h;this.n21=j*V+k*Q+n*da;this.n22=j*D+k*Ia+n*e;this.n23=j*M+k*ua+n*ga;this.n24=j*O+k*Aa+n*Ba+p;this.n31=o*V+x*Q+A*da;this.n32=o*D+x*Ia+A*e;this.n33=o*M+x*ua+A*ga;this.n34=o*O+x*Aa+A*Ba+t;this.n41=C*V+E*Q+G*da;this.n42=C*D+E*Ia+G*e;this.n43=C*M+E*ua+G*ga;this.n44=C*O+E*Aa+G*Ba+L;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]= this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,t=this.n34,A=this.n41,y=this.n42,B=this.n43,F=this.n44;return f*j*p*A-c*k*p*A-f*h*o*A+d*k*o*A+c*h*t*A-d*j*t*A-f*j*n*y+c*k*n*y+f*g*o*y-b*k*o*y-c*g*t*y+b*j*t*y+f*h*n*B-d*k*n*B-f*g*p*B+b*k*p*B+d*g*t*B-b*h*t*B-c*h*n*F+d*j*n*F+c*g*p*F-b*j*p*F-d*g*o*F+b*h*o*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31= +b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,x=this.n34,A=this.n41,t=this.n42,C=this.n43,E=this.n44;return f*j*p*A-c*k*p*A-f*h*o*A+d*k*o*A+c*h*x*A-d*j*x*A-f*j*n*t+c*k*n*t+f*g*o*t-b*k*o*t-c*g*x*t+b*j*x*t+f*h*n*C-d*k*n*C-f*g*p*C+b*k*p*C+d*g*x*C-b*h*x*C-c*h*n*E+d*j*n*E+c*g*p*E-b*j*p*E-d*g*o*E+b*h*o*E},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,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0, @@ -34,9 +34,9 @@ b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=t 1-c,h=b.x,j=b.y,k=b.z,n=g*h,p=g*j;this.set(n*h+c,n*j-f*k,n*k+f*j,0,n*j+f*k,p*j+c,p*k-f*h,0,n*k-f*j,p*k+f*h,g*k*k+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+d*h;this.n33= b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var n=d*j;d*=k;var p=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=n-g;this.n13=d+j;this.n21=n+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+p);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},extractPosition:function(b){this.n14= b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; -THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,A=b.n33,y=b.n34,B=b.n41,F=b.n42,H=b.n43,L=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=n*y*F-p*A*F+p*t*H-k*y*H-n*t*L+k*A*L;d.n12=h*A*F-g*y*F-h*t*H+f*y*H+g*t*L-f*A*L;d.n13=g*p*F-h*n*F+h*k*H-f*p*H-g*k*L+f*n*L;d.n14=h*n*t-g*p*t-h*k*A+f*p*A+g*k*y-f*n*y;d.n21=p*A*B-n*y*B-p*o*H+j*y*H+n*o*L-j*A*L;d.n22=g*y*B-h*A*B+h*o*H-c*y*H-g*o*L+c*A*L;d.n23=h*n*B-g*p*B-h*j*H+c*p*H+g*j*L-c*n*L; -d.n24=g*p*o-h*n*o+h*j*A-c*p*A-g*j*y+c*n*y;d.n31=k*y*B-p*t*B+p*o*F-j*y*F-k*o*L+j*t*L;d.n32=h*t*B-f*y*B-h*o*F+c*y*F+f*o*L-c*t*L;d.n33=g*p*B-h*k*B+h*j*F-c*p*F-f*j*L+c*k*L;d.n34=h*k*o-f*p*o-h*j*t+c*p*t+f*j*y-c*k*y;d.n41=n*t*B-k*A*B-n*o*F+j*A*F+k*o*H-j*t*H;d.n42=f*A*B-g*t*B+g*o*F-c*A*F-f*o*H+c*t*H;d.n43=g*k*B-f*n*B-g*j*F+c*n*F+f*j*H-c*k*H;d.n44=f*n*o-g*k*o+g*j*t-c*n*t-f*j*A+c*k*A;d.multiplyScalar(1/b.determinant());return d}; -THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*n;c[6]=b*p;c[7]=b*o;c[8]=b*t;return d}; +THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,A=b.n33,t=b.n34,C=b.n41,E=b.n42,G=b.n43,L=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=n*t*E-p*A*E+p*x*G-k*t*G-n*x*L+k*A*L;d.n12=h*A*E-g*t*E-h*x*G+f*t*G+g*x*L-f*A*L;d.n13=g*p*E-h*n*E+h*k*G-f*p*G-g*k*L+f*n*L;d.n14=h*n*x-g*p*x-h*k*A+f*p*A+g*k*t-f*n*t;d.n21=p*A*C-n*t*C-p*o*G+j*t*G+n*o*L-j*A*L;d.n22=g*t*C-h*A*C+h*o*G-c*t*G-g*o*L+c*A*L;d.n23=h*n*C-g*p*C-h*j*G+c*p*G+g*j*L-c*n*L; +d.n24=g*p*o-h*n*o+h*j*A-c*p*A-g*j*t+c*n*t;d.n31=k*t*C-p*x*C+p*o*E-j*t*E-k*o*L+j*x*L;d.n32=h*x*C-f*t*C-h*o*E+c*t*E+f*o*L-c*x*L;d.n33=g*p*C-h*k*C+h*j*E-c*p*E-f*j*L+c*k*L;d.n34=h*k*o-f*p*o-h*j*x+c*p*x+f*j*t-c*k*t;d.n41=n*x*C-k*A*C-n*o*E+j*A*E+k*o*G-j*x*G;d.n42=f*A*C-g*x*C+g*o*E-c*A*E-f*o*G+c*x*G;d.n43=g*k*C-f*n*C-g*j*E+c*n*E+f*j*G-c*k*G;d.n44=f*n*o-g*k*o+g*j*x-c*n*x-f*j*A+c*k*A;d.multiplyScalar(1/b.determinant());return d}; +THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,x=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*n;c[6]=b*p;c[7]=b*o;c[8]=b*x;return d}; THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,c,f){var g;b=c*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,c,f)}; THREE.Matrix4.makeOrtho=function(b,d,c,f,g,h){var j,k,n,p;j=new THREE.Matrix4;k=d-b;n=c-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((d+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible= @@ -47,7 +47,7 @@ undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d d,c)}};THREE.Quaternion=function(b,d,c,f){this.set(b||0,d||0,c||0,f!==undefined?f:1)}; THREE.Quaternion.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,c=b.x*d,f=b.y*d,g=b.z*d;b=Math.cos(f);f=Math.sin(f);d=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(c);c=Math.sin(c);var j=b*d,k=f*g;this.w=j*h-k*c;this.x=j*c+k*h;this.y=f*d*h+b*g*c;this.z=b*g*h-f*d*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-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);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var d=this.x,c=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=d*b+g*h+c*k-f*j;this.y=c*b+g*j+f*h-d*k;this.z=f*b+g*k+d*j-c*h;this.w=g*b-d*h-c*j-f*k;return this}, -multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*c+j*g-k*f,o=n*f+k*c-h*g,t=n*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=p*n+c*-h+o*-k-t*-j;d.y=o*n+c*-j+t*-h-p*-k;d.z=t*n+c*-k+p*-j-o*-h;return d}}; +multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*c+j*g-k*f,o=n*f+k*c-h*g,x=n*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=p*n+c*-h+o*-k-x*-j;d.y=o*n+c*-j+x*-h-p*-k;d.z=x*n+c*-k+p*-j-o*-h;return d}}; THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; @@ -56,15 +56,15 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,c;b=0;for(d=this.f c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,f,g,h,j,k=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f0){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 d=1,c=this.vertices.length;dthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x; if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;dthis.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];o=this.points[c[1]]; -t=this.points[c[2]];A=this.points[c[3]];k=j*j;n=j*k;f.x=d(p.x,o.x,t.x,A.x,j,k,n);f.y=d(p.y,o.y,t.y,A.y,j,k,n);f.z=d(p.z,o.z,t.z,A.z,j,k,n);return f};this.getControlPointsArray=function(){var y,B,F=this.points.length,H=[];for(y=0;ythis.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];o=this.points[c[1]]; +x=this.points[c[2]];A=this.points[c[3]];k=j*j;n=j*k;f.x=d(p.x,o.x,x.x,A.x,j,k,n);f.y=d(p.y,o.y,x.y,A.y,j,k,n);f.z=d(p.z,o.z,x.z,A.z,j,k,n);return f};this.getControlPointsArray=function(){var t,C,E=this.points.length,G=[];for(t=0;t1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+y);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= -this.getPrevKeyWith("pos",y,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",y,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c=== -"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+t);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= +this.getPrevKeyWith("pos",t,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c=== +"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(t=0;tb.length-2?h:h+1;c[3]=h>b.length-3?h:h+2;h=b[c[0]];k=b[c[1]];n=b[c[2]];p=b[c[3]];c=g*g;j=g*c;f[0]=this.interpolate(h[0],k[0],n[0],p[0],g,c,j);f[1]=this.interpolate(h[1],k[1],n[1],p[1],g,c,j);f[2]=this.interpolate(h[2],k[2],n[2],p[2],g,c,j);return f}; THREE.Animation.prototype.interpolate=function(b,d,c,f,g,h,j){b=(c-b)*0.5;f=(f-d)*0.5;return(2*(d-c)+b+f)*j+(-3*(d-c)-2*b-f)*h+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[f.length-1]}; @@ -138,65 +138,65 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi THREE.LOD.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=c.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible= !1;this.LODs[f].object3D.visible=!0}else break;for(;f=0&&wa>=0&&ea>=0&&va>=0)return!0;else if(Ka<0&&wa<0||ea<0&&va<0)return!1;else{if(Ka<0)Ba=Math.max(Ba,Ka/(Ka-wa));else wa<0&&(Ja=Math.min(Ja,Ka/(Ka-wa)));if(ea<0)Ba=Math.max(Ba,ea/(ea-va));else va<0&&(Ja=Math.min(Ja,ea/(ea-va)));if(JaKa&&j.positionScreen.z0&&O.z<1){Ta=D[V]=D[V]||new THREE.RenderableParticle;V++;L=Ta;L.x=O.x/O.w;L.y=O.y/O.w;L.z=O.z;L.rotation=Ha.rotation.z;L.scale.x=Ha.scale.x*Math.abs(L.x-(O.x+ga.projectionMatrix.n11)/(O.w+ga.projectionMatrix.n14));L.scale.y=Ha.scale.y*Math.abs(L.y-(O.y+ga.projectionMatrix.n22)/(O.w+ga.projectionMatrix.n24));L.materials=Ha.materials;Ja.push(L)}}}}Ba&&Ja.sort(d);return Ja}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var n,p,o,t,A,y,B,F;b=d.projectScene(j,k);n=0;for(p=b.length;n>1;Ma=ha.height>>1;na=ja.scale.x*n;xa=ja.scale.y*p;Y=na*U;ya=xa*Ma;z.set(T.x-Y,T.y-ya,T.x+Y,T.y+ya);if(m.instersects(z)){o.save();o.translate(T.x,T.y);o.rotate(-ja.rotation); -o.scale(na,-xa);o.translate(-U,-Ma);o.drawImage(ha,0,0);o.restore()}}}else if(na instanceof THREE.ParticleCanvasMaterial){Y=ja.scale.x*n;ya=ja.scale.y*p;z.set(T.x-Y,T.y-ya,T.x+Y,T.y+ya);if(m.instersects(z)){c(na.color.__styleString);xa=na.color.__styleString;if(H!=xa)o.fillStyle=H=xa;o.save();o.translate(T.x,T.y);o.rotate(-ja.rotation);o.scale(Y,ya);na.program(o);o.restore()}}}function oa(T,ja,na,Y){b(Y.opacity);d(Y.blending);o.beginPath();o.moveTo(T.positionScreen.x,T.positionScreen.y);o.lineTo(ja.positionScreen.x, +o.scale(na,-xa);o.translate(-U,-Ma);o.drawImage(ha,0,0);o.restore()}}}else if(na instanceof THREE.ParticleCanvasMaterial){Y=ja.scale.x*n;ya=ja.scale.y*p;z.set(T.x-Y,T.y-ya,T.x+Y,T.y+ya);if(m.instersects(z)){c(na.color.__styleString);xa=na.color.__styleString;if(G!=xa)o.fillStyle=G=xa;o.save();o.translate(T.x,T.y);o.rotate(-ja.rotation);o.scale(Y,ya);na.program(o);o.restore()}}}function oa(T,ja,na,Y){b(Y.opacity);d(Y.blending);o.beginPath();o.moveTo(T.positionScreen.x,T.positionScreen.y);o.lineTo(ja.positionScreen.x, ja.positionScreen.y);o.closePath();if(Y instanceof THREE.LineBasicMaterial){ra.__styleString=Y.color.__styleString;T=Y.linewidth;if(L!=T)o.lineWidth=L=T;T=Y.linecap;if(V!=T)o.lineCap=V=T;T=Y.linejoin;if(D!=T)o.lineJoin=D=T;c(ra.__styleString);o.stroke();z.inflate(Y.linewidth*2)}}function Na(T,ja,na,Y,ya,xa,ha,U,Ma){b(U.opacity);d(U.blending);da=T.positionScreen.x;e=T.positionScreen.y;ga=ja.positionScreen.x;Ba=ja.positionScreen.y;Ja=na.positionScreen.x;Ka=na.positionScreen.y;R(da,e,ga,Ba,Ja,Ka);if(U instanceof THREE.MeshBasicMaterial)if(U.map){if(U.map.mapping instanceof THREE.UVMapping){Ua=ha.uvs[0];Qa(da,e,ga,Ba,Ja,Ka,U.map.image,Ua[Y].u,Ua[Y].v,Ua[ya].u,Ua[ya].v,Ua[xa].u,Ua[xa].v)}}else if(U.envMap){if(U.envMap.mapping instanceof THREE.SphericalReflectionMapping){T=za.matrixWorldInverse;J.copy(ha.vertexNormalsWorld[0]);N=(J.x*T.n11+J.y*T.n12+J.z*T.n13)*0.5+0.5;ca=-(J.x*T.n21+J.y*T.n22+J.z*T.n23)*0.5+0.5;J.copy(ha.vertexNormalsWorld[1]);sa=(J.x*T.n11+J.y*T.n12+J.z*T.n13)*0.5+0.5;Ea=-(J.x*T.n21+J.y*T.n22+ J.z*T.n23)*0.5+0.5;J.copy(ha.vertexNormalsWorld[2]);ia=(J.x*T.n11+J.y*T.n12+J.z*T.n13)*0.5+0.5;ma=-(J.x*T.n21+J.y*T.n22+J.z*T.n23)*0.5+0.5;Qa(da,e,ga,Ba,Ja,Ka,U.envMap.image,N,ca,sa,Ea,ia,ma)}}else U.wireframe?fb(U.color.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){if(U.map.mapping instanceof THREE.UVMapping){Ua=ha.uvs[0];Qa(da,e,ga,Ba,Ja,Ka,U.map.image,Ua[Y].u,Ua[Y].v,Ua[ya].u, -Ua[ya].v,Ua[xa].u,Ua[xa].v)}d(THREE.SubtractiveBlending)}if(w)if(!U.wireframe&&U.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ga.r=la.r=pa.r=P.r;Ga.g=la.g=pa.g=P.g;Ga.b=la.b=pa.b=P.b;Z(Ma,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Z(Ma,ha.v2.positionWorld,ha.vertexNormalsWorld[1],la);Z(Ma,ha.v3.positionWorld,ha.vertexNormalsWorld[2],pa);Ha.r=(la.r+pa.r)*0.5;Ha.g=(la.g+pa.g)*0.5;Ha.b=(la.b+pa.b)*0.5;Xa=jb(Ga,la,pa,Ha);Qa(da,e,ga,Ba,Ja,Ka,Xa,0,0,1,0,0,1)}else{x.r=P.r;x.g=P.g; -x.b=P.b;Z(Ma,ha.centroidWorld,ha.normalWorld,x);ra.r=U.color.r*x.r;ra.g=U.color.g*x.g;ra.b=U.color.b*x.b;ra.updateStyleString();U.wireframe?fb(ra.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(ra.__styleString)}else U.wireframe?fb(U.color.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){Ta=za.near;ab=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ta,ab);la.r=la.g=la.b=1- +Ua[ya].v,Ua[xa].u,Ua[xa].v)}d(THREE.SubtractiveBlending)}if(w)if(!U.wireframe&&U.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ga.r=la.r=pa.r=P.r;Ga.g=la.g=pa.g=P.g;Ga.b=la.b=pa.b=P.b;Z(Ma,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Z(Ma,ha.v2.positionWorld,ha.vertexNormalsWorld[1],la);Z(Ma,ha.v3.positionWorld,ha.vertexNormalsWorld[2],pa);Ha.r=(la.r+pa.r)*0.5;Ha.g=(la.g+pa.g)*0.5;Ha.b=(la.b+pa.b)*0.5;Xa=jb(Ga,la,pa,Ha);Qa(da,e,ga,Ba,Ja,Ka,Xa,0,0,1,0,0,1)}else{y.r=P.r;y.g=P.g; +y.b=P.b;Z(Ma,ha.centroidWorld,ha.normalWorld,y);ra.r=U.color.r*y.r;ra.g=U.color.g*y.g;ra.b=U.color.b*y.b;ra.updateStyleString();U.wireframe?fb(ra.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(ra.__styleString)}else U.wireframe?fb(U.color.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){Ta=za.near;ab=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ta,ab);la.r=la.g=la.b=1- gb(ja.positionScreen.z,Ta,ab);pa.r=pa.g=pa.b=1-gb(na.positionScreen.z,Ta,ab);Ha.r=(la.r+pa.r)*0.5;Ha.g=(la.g+pa.g)*0.5;Ha.b=(la.b+pa.b)*0.5;Xa=jb(Ga,la,pa,Ha);Qa(da,e,ga,Ba,Ja,Ka,Xa,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){ra.r=bb(ha.normalWorld.x);ra.g=bb(ha.normalWorld.y);ra.b=bb(ha.normalWorld.z);ra.updateStyleString();U.wireframe?fb(ra.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(ra.__styleString)}}function $(T,ja,na,Y,ya,xa,ha,U,Ma){b(U.opacity); d(U.blending);if(U.map||U.envMap){Na(T,ja,Y,0,1,3,ha,U,Ma);Na(ya,na,xa,1,2,3,ha,U,Ma)}else{da=T.positionScreen.x;e=T.positionScreen.y;ga=ja.positionScreen.x;Ba=ja.positionScreen.y;Ja=na.positionScreen.x;Ka=na.positionScreen.y;wa=Y.positionScreen.x;ea=Y.positionScreen.y;va=ya.positionScreen.x;Ca=ya.positionScreen.y;ka=xa.positionScreen.x;aa=xa.positionScreen.y;if(U instanceof THREE.MeshBasicMaterial){Sa(da,e,ga,Ba,Ja,Ka,wa,ea);U.wireframe?fb(U.color.__styleString,U.wireframeLinewidth,U.wireframeLinecap, U.wireframeLinejoin):Pa(U.color.__styleString)}else if(U instanceof THREE.MeshLambertMaterial)if(w)if(!U.wireframe&&U.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Ga.r=la.r=pa.r=Ha.r=P.r;Ga.g=la.g=pa.g=Ha.g=P.g;Ga.b=la.b=pa.b=Ha.b=P.b;Z(Ma,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Z(Ma,ha.v2.positionWorld,ha.vertexNormalsWorld[1],la);Z(Ma,ha.v4.positionWorld,ha.vertexNormalsWorld[3],pa);Z(Ma,ha.v3.positionWorld,ha.vertexNormalsWorld[2],Ha);Xa=jb(Ga,la,pa,Ha);R(da,e,ga,Ba, -wa,ea);Qa(da,e,ga,Ba,wa,ea,Xa,0,0,1,0,0,1);R(va,Ca,Ja,Ka,ka,aa);Qa(va,Ca,Ja,Ka,ka,aa,Xa,1,0,1,1,0,1)}else{x.r=P.r;x.g=P.g;x.b=P.b;Z(Ma,ha.centroidWorld,ha.normalWorld,x);ra.r=U.color.r*x.r;ra.g=U.color.g*x.g;ra.b=U.color.b*x.b;ra.updateStyleString();Sa(da,e,ga,Ba,Ja,Ka,wa,ea);U.wireframe?fb(ra.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(ra.__styleString)}else{Sa(da,e,ga,Ba,Ja,Ka,wa,ea);U.wireframe?fb(U.color.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin): +wa,ea);Qa(da,e,ga,Ba,wa,ea,Xa,0,0,1,0,0,1);R(va,Ca,Ja,Ka,ka,aa);Qa(va,Ca,Ja,Ka,ka,aa,Xa,1,0,1,1,0,1)}else{y.r=P.r;y.g=P.g;y.b=P.b;Z(Ma,ha.centroidWorld,ha.normalWorld,y);ra.r=U.color.r*y.r;ra.g=U.color.g*y.g;ra.b=U.color.b*y.b;ra.updateStyleString();Sa(da,e,ga,Ba,Ja,Ka,wa,ea);U.wireframe?fb(ra.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(ra.__styleString)}else{Sa(da,e,ga,Ba,Ja,Ka,wa,ea);U.wireframe?fb(U.color.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin): Pa(U.color.__styleString)}else if(U instanceof THREE.MeshNormalMaterial){ra.r=bb(ha.normalWorld.x);ra.g=bb(ha.normalWorld.y);ra.b=bb(ha.normalWorld.z);ra.updateStyleString();Sa(da,e,ga,Ba,Ja,Ka,wa,ea);U.wireframe?fb(ra.__styleString,U.wireframeLinewidth,U.wireframeLinecap,U.wireframeLinejoin):Pa(ra.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){Ta=za.near;ab=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ta,ab);la.r=la.g=la.b=1-gb(ja.positionScreen.z,Ta,ab);pa.r=pa.g=pa.b=1-gb(Y.positionScreen.z, Ta,ab);Ha.r=Ha.g=Ha.b=1-gb(na.positionScreen.z,Ta,ab);Xa=jb(Ga,la,pa,Ha);R(da,e,ga,Ba,wa,ea);Qa(da,e,ga,Ba,wa,ea,Xa,0,0,1,0,0,1);R(va,Ca,Ja,Ka,ka,aa);Qa(va,Ca,Ja,Ka,ka,aa,Xa,1,0,1,1,0,1)}}}function R(T,ja,na,Y,ya,xa){o.beginPath();o.moveTo(T,ja);o.lineTo(na,Y);o.lineTo(ya,xa);o.lineTo(T,ja);o.closePath()}function Sa(T,ja,na,Y,ya,xa,ha,U){o.beginPath();o.moveTo(T,ja);o.lineTo(na,Y);o.lineTo(ya,xa);o.lineTo(ha,U);o.lineTo(T,ja);o.closePath()}function fb(T,ja,na,Y){if(L!=ja)o.lineWidth=L=ja;if(V!=na)o.lineCap= -V=na;if(D!=Y)o.lineJoin=D=Y;c(T);o.stroke();z.inflate(ja*2)}function Pa(T){if(H!=T)o.fillStyle=H=T;o.fill()}function Qa(T,ja,na,Y,ya,xa,ha,U,Ma,Ya,Wa,kb,Za){var hb,ib;hb=ha.width-1;ib=ha.height-1;U*=hb;Ma*=ib;Ya*=hb;Wa*=ib;kb*=hb;Za*=ib;na-=T;Y-=ja;ya-=T;xa-=ja;Ya-=U;Wa-=Ma;kb-=U;Za-=Ma;hb=Ya*Za-kb*Wa;if(hb!=0){ib=1/hb;hb=(Za*na-Wa*ya)*ib;Wa=(Za*Y-Wa*xa)*ib;na=(Ya*ya-kb*na)*ib;Y=(Ya*xa-kb*Y)*ib;T=T-hb*U-na*Ma;ja=ja-Wa*U-Y*Ma;o.save();o.transform(hb,Wa,na,Y,T,ja);o.clip();o.drawImage(ha,0,0);o.restore()}} +V=na;if(D!=Y)o.lineJoin=D=Y;c(T);o.stroke();z.inflate(ja*2)}function Pa(T){if(G!=T)o.fillStyle=G=T;o.fill()}function Qa(T,ja,na,Y,ya,xa,ha,U,Ma,Ya,Wa,kb,Za){var hb,ib;hb=ha.width-1;ib=ha.height-1;U*=hb;Ma*=ib;Ya*=hb;Wa*=ib;kb*=hb;Za*=ib;na-=T;Y-=ja;ya-=T;xa-=ja;Ya-=U;Wa-=Ma;kb-=U;Za-=Ma;hb=Ya*Za-kb*Wa;if(hb!=0){ib=1/hb;hb=(Za*na-Wa*ya)*ib;Wa=(Za*Y-Wa*xa)*ib;na=(Ya*ya-kb*na)*ib;Y=(Ya*xa-kb*Y)*ib;T=T-hb*U-na*Ma;ja=ja-Wa*U-Y*Ma;o.save();o.transform(hb,Wa,na,Y,T,ja);o.clip();o.drawImage(ha,0,0);o.restore()}} function jb(T,ja,na,Y){var ya=~~(T.r*255),xa=~~(T.g*255);T=~~(T.b*255);var ha=~~(ja.r*255),U=~~(ja.g*255);ja=~~(ja.b*255);var Ma=~~(na.r*255),Ya=~~(na.g*255);na=~~(na.b*255);var Wa=~~(Y.r*255),kb=~~(Y.g*255);Y=~~(Y.b*255);qa[0]=ya<0?0:ya>255?255:ya;qa[1]=xa<0?0:xa>255?255:xa;qa[2]=T<0?0:T>255?255:T;qa[4]=ha<0?0:ha>255?255:ha;qa[5]=U<0?0:U>255?255:U;qa[6]=ja<0?0:ja>255?255:ja;qa[8]=Ma<0?0:Ma>255?255:Ma;qa[9]=Ya<0?0:Ya>255?255:Ya;qa[10]=na<0?0:na>255?255:na;qa[12]=Wa<0?0:Wa>255?255:Wa;qa[13]=kb<0?0: -kb>255?255:kb;qa[14]=Y<0?0:Y>255?255:Y;K.putImageData(X,0,0);Fa.drawImage(E,0,0);return W}function gb(T,ja,na){T=(T-ja)/(na-ja);return T*T*(3-2*T)}function bb(T){T=(T+1)*0.5;return T<0?0:T>1?1:T}function cb(T,ja){var na=ja.x-T.x,Y=ja.y-T.y,ya=1/Math.sqrt(na*na+Y*Y);na*=ya;Y*=ya;ja.x+=na;ja.y+=Y;T.x-=na;T.y-=Y}var Oa,eb,Da,S,Ra,Va,lb,$a;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,p);f=g.projectScene(ta,za,this.sortElements);(w=ta.lights.length>0)&&db(ta);Oa=0;for(eb=f.length;Oa255?255:kb;qa[14]=Y<0?0:Y>255?255:Y;K.putImageData(X,0,0);Fa.drawImage(F,0,0);return W}function gb(T,ja,na){T=(T-ja)/(na-ja);return T*T*(3-2*T)}function bb(T){T=(T+1)*0.5;return T<0?0:T>1?1:T}function cb(T,ja){var na=ja.x-T.x,Y=ja.y-T.y,ya=1/Math.sqrt(na*na+Y*Y);na*=ya;Y*=ya;ja.x+=na;ja.y+=Y;T.x-=na;T.y-=Y}var Oa,eb,Da,S,Ra,Va,lb,$a;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,p);f=g.projectScene(ta,za,this.sortElements);(w=ta.lights.length>0)&&db(ta);Oa=0;for(eb=f.length;Oa0){va.r+=aa.color.r*ra;va.g+=aa.color.g*ra;va.b+=aa.color.b*ra}}else if(aa instanceof THREE.PointLight){Aa.sub(aa.position,ea.centroidWorld);Aa.normalize();ra=ea.normalWorld.dot(Aa)*aa.intensity;if(ra>0){va.r+=aa.color.r*ra;va.g+=aa.color.g*ra;va.b+=aa.color.b*ra}}}}function d(wa,ea, va,Ca,ka,aa){ga=f(Ba++);ga.setAttribute("d","M "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)D.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(V){M.r=O.r;M.g=O.g;M.b=O.b;b(aa,Ca,M);D.r=ka.color.r*M.r;D.g=ka.color.g*M.g;D.b=ka.color.b*M.b;D.updateStyleString()}else D.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){ua=1-ka.__2near/(ka.__farPlusNear-Ca.z*ka.__farMinusNear);D.setRGB(ua,ua,ua)}else ka instanceof THREE.MeshNormalMaterial&&D.setRGB(g(Ca.normalWorld.x),g(Ca.normalWorld.y),g(Ca.normalWorld.z));ka.wireframe?ga.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+ka.wireframeLinewidth+"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):ga.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+ ka.opacity);k.appendChild(ga)}function c(wa,ea,va,Ca,ka,aa,ra){ga=f(Ba++);ga.setAttribute("d","M "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Ca.positionScreen.x+","+Ca.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)D.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(V){M.r=O.r;M.g=O.g;M.b=O.b;b(ra,ka,M);D.r=aa.color.r*M.r;D.g=aa.color.g* M.g;D.b=aa.color.b*M.b;D.updateStyleString()}else D.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){ua=1-aa.__2near/(aa.__farPlusNear-ka.z*aa.__farMinusNear);D.setRGB(ua,ua,ua)}else aa instanceof THREE.MeshNormalMaterial&&D.setRGB(g(ka.normalWorld.x),g(ka.normalWorld.y),g(ka.normalWorld.z));aa.wireframe?ga.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+ -"; stroke-linejoin: "+aa.wireframeLinejoin):ga.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+aa.opacity);k.appendChild(ga)}function f(wa){if(da[wa]==null){da[wa]=document.createElementNS("http://www.w3.org/2000/svg","path");Ka==0&&da[wa].setAttribute("shape-rendering","crispEdges")}return da[wa]}function g(wa){return wa<0?Math.min((1+wa)*0.5,0.5):0.5+Math.min(wa*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,t,A,y, -B,F,H=new THREE.Rectangle,L=new THREE.Rectangle,V=!1,D=new THREE.Color(16777215),M=new THREE.Color(16777215),O=new THREE.Color(0),Q=new THREE.Color(0),Ia=new THREE.Color(0),ua,Aa=new THREE.Vector3,da=[],e=[],ga,Ba,Ja,Ka=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(wa){switch(wa){case "high":Ka=1;break;case "low":Ka=0}};this.setSize=function(wa,ea){n=wa;p=ea;o=n/2;t=p/2;k.setAttribute("viewBox",-o+" "+-t+" "+n+" "+p);k.setAttribute("width", -n);k.setAttribute("height",p);H.set(-o,-t,o,t)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(wa,ea){var va,Ca,ka,aa,ra,Ga,la,pa;this.autoClear&&this.clear();h=j.projectScene(wa,ea,this.sortElements);Ja=Ba=0;if(V=wa.lights.length>0){la=wa.lights;O.setRGB(0,0,0);Q.setRGB(0,0,0);Ia.setRGB(0,0,0);va=0;for(Ca=la.length;va0;)k.removeChild(k.childNodes[0])};this.render=function(wa,ea){var va,Ca,ka,aa,ra,Ga,la,pa;this.autoClear&&this.clear();h=j.projectScene(wa,ea,this.sortElements);Ja=Ba=0;if(V=wa.lights.length>0){la=wa.lights;O.setRGB(0,0,0);Q.setRGB(0,0,0);Ia.setRGB(0,0,0);va=0;for(Ca=la.length;vaE){K=X;E=J[K]}e.bindBuffer(e.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[K]);e.vertexAttribPointer(C["morphTarget"+z],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[z]=E;I[K]=1;E=-1;z++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,P.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER, -x.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(x.__webglCustomAttributes)for(G in x.__webglCustomAttributes)if(m[G]>=0){C=x.__webglCustomAttributes[G];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(m[G],C.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>= -0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(x.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUVBuffer);e.vertexAttribPointer(m.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv)}else e.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(x.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUV2Buffer);e.vertexAttribPointer(m.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv2)}else e.disableVertexAttribArray(m.uv2); -if(w.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight, -4,e.FLOAT,!1,0,0)}if(P instanceof THREE.Mesh)if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);e.drawElements(e.LINES,x.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);e.drawElements(e.TRIANGLES,x.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(P instanceof THREE.Line){P=P.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(P,0,x.__webglLineCount)}else if(P instanceof -THREE.ParticleSystem)e.drawArrays(e.POINTS,0,x.__webglParticleCount);else P instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,x.__webglVertexCount)}}function h(m,C){if(!m.__webglVertexBuffer)m.__webglVertexBuffer=e.createBuffer();if(!m.__webglNormalBuffer)m.__webglNormalBuffer=e.createBuffer();if(m.hasPos){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,m.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position, -3,e.FLOAT,!1,0,0)}if(m.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,m.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,m.count);m.count=0}function j(m){if(ea!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ea=m.doubleSided}if(va!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);va=m.flipSided}}function k(m){if(ka!= -m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ka=m}}function n(m){pa[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);pa[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);pa[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);pa[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);pa[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);pa[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var C;for(m=0;m<6;m++){C=pa[m];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z* -C.z))}}function p(m){for(var C=m.matrixWorld,z=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),w=0;w<6;w++){m=pa[w].x*C.n14+pa[w].y*C.n24+pa[w].z*C.n34+pa[w].w;if(m<=z)return!1}return!0}function o(m,C){m.list[m.count]=C;m.count+=1}function t(m){var C,z,w=m.object,x=m.opaque,P=m.transparent;P.count=0;m=x.count=0;for(C=w.materials.length;m0.0010&&J.scale>0.0010){qa[0]=J.x;qa[1]=J.y;qa[2]=J.z;K=J.size*J.scale/la;X[0]=K*E;X[1]=K;e.uniform3fv(za.screenPosition, -qa);e.uniform1f(za.rotation,J.rotation);e.uniform2fv(za.scale,X);e.uniform1f(za.opacity,J.opacity);M(J.blending);Q(J.texture,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Ka)}function H(m,C){m._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function L(m){var C,z,w,x,P;if(m instanceof THREE.Mesh){z=m.geometry; -for(C in z.geometryGroups){w=z.geometryGroups[C];P=!1;for(x in w.__webglCustomAttributes)if(w.__webglCustomAttributes[x].needsUpdate){P=!0;break}if(z.__dirtyVertices||z.__dirtyMorphTargets||z.__dirtyElements||z.__dirtyUvs||z.__dirtyNormals||z.__dirtyColors||z.__dirtyTangents||P){P=e.DYNAMIC_DRAW;var G=void 0,I=void 0,J=void 0,E=void 0;J=void 0;var K=void 0,X=void 0,qa=void 0,W=void 0,Fa=void 0,La=void 0,ta=void 0,za=void 0,db=void 0,Z=void 0,fa=void 0,oa=void 0,Na=void 0;X=void 0;qa=void 0;E=void 0; -W=void 0;E=void 0;Z=void 0;fa=void 0;X=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;E=void 0;W=void 0;K=void 0;J=void 0;J=void 0;var $=void 0,R=void 0,Sa=void 0,fb=void 0,Pa=0,Qa=0,jb=0,gb=0,bb=0,cb=0,Oa=0,eb=0,Da=0,S=0,Ra=0;$=0;var Va=w.__vertexArray,lb=w.__uvArray,$a=w.__uv2Array,T=w.__normalArray,ja=w.__tangentArray,na=w.__colorArray,Y=w.__skinVertexAArray,ya=w.__skinVertexBArray,xa=w.__skinIndexArray, +J.image[K])}else{J.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,J.image.__webglTextureCube);for(K=0;K<6;++K)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,J.image[K]);J.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,J,J.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);J.needsUpdate=!1}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_CUBE_MAP,J.image.__webglTextureCube)}}else Q(J,z)}}e.uniformMatrix4fv(H.modelViewMatrix,!1,y._modelViewMatrixArray); +e.uniformMatrix3fv(H.normalMatrix,!1,y._normalMatrixArray);(w instanceof THREE.MeshShaderMaterial||w instanceof THREE.MeshPhongMaterial||w.envMap)&&e.uniform3f(H.cameraPosition,m.position.x,m.position.y,m.position.z);(w instanceof THREE.MeshShaderMaterial||w.envMap||w.skinning)&&e.uniformMatrix4fv(H.objectMatrix,!1,y._objectMatrixArray);(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshShaderMaterial||w.skinning)&&e.uniformMatrix4fv(H.viewMatrix, +!1,ab);if(w instanceof THREE.ShadowVolumeDynamicMaterial){m=I.directionalLightDirection.value;m[0]=-B.position.x;m[1]=-B.position.y;m[2]=-B.position.z;e.uniform3fv(H.directionalLightDirection,m);e.uniformMatrix4fv(H.objectMatrix,!1,y._objectMatrixArray);e.uniformMatrix4fv(H.viewMatrix,!1,ab)}if(w.skinning){e.uniformMatrix4fv(H.cameraInverseMatrix,!1,ab);e.uniformMatrix4fv(H.boneGlobalMatrices,!1,y.boneMatrices)}return P}function g(m,B,z,w,y,P){if(w.opacity!=0){var H;m=f(m,B,z,w,P).attributes;if(w.morphTargets){B= +w.program.attributes;P.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[P.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,y.__webglVertexBuffer);e.vertexAttribPointer(B.position,3,e.FLOAT,!1,0,0);if(P.morphTargetForcedOrder.length){z=0;for(var I=P.morphTargetForcedOrder,J=P.morphTargetInfluences;zF){K=X;F=J[K]}e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[K]);e.vertexAttribPointer(B["morphTarget"+z],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[z]=F;I[K]=1;F=-1;z++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,P.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER, +y.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(y.__webglCustomAttributes)for(H in y.__webglCustomAttributes)if(m[H]>=0){B=y.__webglCustomAttributes[H];e.bindBuffer(e.ARRAY_BUFFER,B.buffer);e.vertexAttribPointer(m[H],B.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>= +0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(y.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,y.__webglUVBuffer);e.vertexAttribPointer(m.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv)}else e.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(y.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,y.__webglUV2Buffer);e.vertexAttribPointer(m.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv2)}else e.disableVertexAttribArray(m.uv2); +if(w.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight, +4,e.FLOAT,!1,0,0)}if(P instanceof THREE.Mesh)if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webglLineBuffer);e.drawElements(e.LINES,y.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webglFaceBuffer);e.drawElements(e.TRIANGLES,y.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(P instanceof THREE.Line){P=P.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(P,0,y.__webglLineCount)}else if(P instanceof +THREE.ParticleSystem)e.drawArrays(e.POINTS,0,y.__webglParticleCount);else P instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,y.__webglVertexCount)}}function h(m,B){if(!m.__webglVertexBuffer)m.__webglVertexBuffer=e.createBuffer();if(!m.__webglNormalBuffer)m.__webglNormalBuffer=e.createBuffer();if(m.hasPos){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,m.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(B.attributes.position);e.vertexAttribPointer(B.attributes.position, +3,e.FLOAT,!1,0,0)}if(m.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,m.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(B.attributes.normal);e.vertexAttribPointer(B.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,m.count);m.count=0}function j(m){if(ea!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ea=m.doubleSided}if(va!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);va=m.flipSided}}function k(m){if(ka!= +m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ka=m}}function n(m){pa[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);pa[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);pa[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);pa[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);pa[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);pa[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var B;for(m=0;m<6;m++){B=pa[m];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z* +B.z))}}function p(m){for(var B=m.matrixWorld,z=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),w=0;w<6;w++){m=pa[w].x*B.n14+pa[w].y*B.n24+pa[w].z*B.n34+pa[w].w;if(m<=z)return!1}return!0}function o(m,B){m.list[m.count]=B;m.count+=1}function x(m){var B,z,w=m.object,y=m.opaque,P=m.transparent;P.count=0;m=y.count=0;for(B=w.materials.length;m0.0010&&J.scale>0.0010){qa[0]=J.x;qa[1]=J.y;qa[2]=J.z;K=J.size*J.scale/la;X[0]=K*F;X[1]=K;e.uniform3fv(za.screenPosition, +qa);e.uniform1f(za.rotation,J.rotation);e.uniform2fv(za.scale,X);e.uniform1f(za.opacity,J.opacity);M(J.blending);Q(J.texture,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Ka)}function G(m,B){m._modelViewMatrix.multiplyToArray(B.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function L(m){var B,z,w,y,P;if(m instanceof THREE.Mesh){z=m.geometry; +for(B in z.geometryGroups){w=z.geometryGroups[B];P=!1;for(y in w.__webglCustomAttributes)if(w.__webglCustomAttributes[y].needsUpdate){P=!0;break}if(z.__dirtyVertices||z.__dirtyMorphTargets||z.__dirtyElements||z.__dirtyUvs||z.__dirtyNormals||z.__dirtyColors||z.__dirtyTangents||P){P=e.DYNAMIC_DRAW;var H=void 0,I=void 0,J=void 0,F=void 0;J=void 0;var K=void 0,X=void 0,qa=void 0,W=void 0,Fa=void 0,La=void 0,ta=void 0,za=void 0,db=void 0,Z=void 0,fa=void 0,oa=void 0,Na=void 0;X=void 0;qa=void 0;F=void 0; +W=void 0;F=void 0;Z=void 0;fa=void 0;X=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;F=void 0;W=void 0;K=void 0;J=void 0;J=void 0;var $=void 0,R=void 0,Sa=void 0,fb=void 0,Pa=0,Qa=0,jb=0,gb=0,bb=0,cb=0,Oa=0,eb=0,Da=0,S=0,Ra=0;$=0;var Va=w.__vertexArray,lb=w.__uvArray,$a=w.__uv2Array,T=w.__normalArray,ja=w.__tangentArray,na=w.__colorArray,Y=w.__skinVertexAArray,ya=w.__skinVertexBArray,xa=w.__skinIndexArray, ha=w.__skinWeightArray,U=w.__morphTargetsArrays,Ma=w.__webglCustomAttributes;R=void 0;var Ya=w.__faceArray,Wa=w.__lineArray,kb=w.__needsSmoothNormals;La=w.__vertexColorType;Fa=w.__uvType;ta=w.__normalType;var Za=m.geometry,hb=Za.__dirtyVertices,ib=Za.__dirtyElements,tb=Za.__dirtyUvs,ub=Za.__dirtyNormals,vb=Za.__dirtyTangents,wb=Za.__dirtyColors,xb=Za.__dirtyMorphTargets,pb=Za.vertices,yb=w.faces,Bb=Za.faces,zb=Za.faceVertexUvs[0],Ab=Za.faceVertexUvs[1],qb=Za.skinVerticesA,rb=Za.skinVerticesB,sb=Za.skinIndices, -nb=Za.skinWeights,ob=Za.edgeFaces,mb=Za.morphTargets;if(Ma)for(fb in Ma)Ma[fb].offset=0;G=0;for(I=yb.length;G0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,P)}if(ub){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,T,P)}if(vb&&Za.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ja,P)}if(tb&& jb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,lb,P)}if(tb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,$a,P)}if(ib){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,P);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Wa,P)}if(S>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,Y,P);e.bindBuffer(e.ARRAY_BUFFER, -w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ya,P);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,xa,P);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ha,P)}}}z.__dirtyVertices=!1;z.__dirtyMorphTargets=!1;z.__dirtyElements=!1;z.__dirtyUvs=!1;z.__dirtyNormals=!1;z.__dirtyTangents=!1;z.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){z=m.geometry;if(z.__dirtyVertices||z.__dirtyColors){m=z;C=e.DYNAMIC_DRAW;La=m.vertices; -w=m.colors;ta=La.length;P=w.length;za=m.__vertexArray;G=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(I=0;I65535){K[J].counter+=1;E=K[J].hash+"_"+K[J].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:I,vertices:0,numMorphTargets:X})}m.geometryGroups[E].faces.push(x);m.geometryGroups[E].vertices+= -G}}function D(m,C,z){m.push({buffer:C,object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(m){if(m!=Ca){switch(m){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)}Ca=m}}function O(m,C,z){if((z.width&z.width-1)==0&&(z.height&z.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,da(C.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,da(C.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,da(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,da(C.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_MAG_FILTER, -Aa(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,Aa(C.minFilter))}}function Q(m,C){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}O(e.TEXTURE_2D,m,m.image);e.bindTexture(e.TEXTURE_2D,null);m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+ -C);e.bindTexture(e.TEXTURE_2D,m.__webglTexture)}function Ia(m){if(m&&!m.__webglFramebuffer){m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();m.__webglTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,m.width,m.height);e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,da(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,da(m.wrapT)); +w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ya,P);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,xa,P);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ha,P)}}}z.__dirtyVertices=!1;z.__dirtyMorphTargets=!1;z.__dirtyElements=!1;z.__dirtyUvs=!1;z.__dirtyNormals=!1;z.__dirtyTangents=!1;z.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){z=m.geometry;if(z.__dirtyVertices||z.__dirtyColors){m=z;B=e.DYNAMIC_DRAW;La=m.vertices; +w=m.colors;ta=La.length;P=w.length;za=m.__vertexArray;H=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(I=0;I65535){K[J].counter+=1;F=K[J].hash+"_"+K[J].counter;m.geometryGroups[F]==undefined&&(m.geometryGroups[F]={faces:[],materials:I,vertices:0,numMorphTargets:X})}m.geometryGroups[F].faces.push(y);m.geometryGroups[F].vertices+= +H}}function D(m,B,z){m.push({buffer:B,object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(m){if(m!=Ca){switch(m){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)}Ca=m}}function O(m,B,z){if((z.width&z.width-1)==0&&(z.height&z.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,da(B.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,da(B.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,da(B.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,da(B.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_MAG_FILTER, +Aa(B.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,Aa(B.minFilter))}}function Q(m,B){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}O(e.TEXTURE_2D,m,m.image);e.bindTexture(e.TEXTURE_2D,null);m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+ +B);e.bindTexture(e.TEXTURE_2D,m.__webglTexture)}function Ia(m){if(m&&!m.__webglFramebuffer){m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();m.__webglTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,m.width,m.height);e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,da(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,da(m.wrapT)); e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,da(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,da(m.minFilter));e.texImage2D(e.TEXTURE_2D,0,da(m.format),m.width,m.height,0,da(m.format),da(m.type),null);e.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m.__webglTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER, -null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,z;if(m){C=m.__webglFramebuffer;z=m.width;m=m.height}else{C=null;z=Ga;m=la}if(C!=Ja){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(aa,ra,z,m);Ja=C}}function ua(m,C){var z;if(m=="fragment")z=e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(z=e.createShader(e.VERTEX_SHADER));e.shaderSource(z,C);e.compileShader(z);if(!e.getShaderParameter(z,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(z));console.error(C);return null}return z}function Aa(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST; +null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var B,z;if(m){B=m.__webglFramebuffer;z=m.width;m=m.height}else{B=null;z=Ga;m=la}if(B!=Ja){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport(aa,ra,z,m);Ja=B}}function ua(m,B){var z;if(m=="fragment")z=e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(z=e.createShader(e.VERTEX_SHADER));e.shaderSource(z,B);e.compileShader(z);if(!e.getShaderParameter(z,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(z));console.error(B);return null}return z}function Aa(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST; default:return e.LINEAR}}function da(m){switch(m){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.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 e,ga=document.createElement("canvas"),Ba=null,Ja=null,Ka=!0,wa=this,ea=null,va=null,Ca=null,ka=null,aa=0,ra=0,Ga=0,la=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ha=new THREE.Matrix4,Ta=new Float32Array(16),ab=new Float32Array(16),Xa=new THREE.Vector4,Ua={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},N=!0,ca=!0,sa=new THREE.Color(0),Ea=0;if(b){if(b.stencil!= -undefined)N=b.stencil;if(b.antialias!==undefined)ca=b.antialias;b.clearColor!==undefined&&sa.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ea=b.clearAlpha}this.maxMorphTargets=8;this.domElement=ga;this.autoClear=!0;this.sortObjects=!0;(function(m,C,z,w){try{if(!(e=ga.getContext("experimental-webgl",{antialias:m,stencil:w})))throw"Error creating WebGL context.";}catch(x){console.error(x)}e.clearColor(0,0,0,1);e.clearDepth(1);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(C.r,C.g,C.b,z)})(ca,sa,Ea,N);this.context=e;if(N){var ia={};ia.vertices=new Float32Array(12);ia.faces=new Uint16Array(6);ia.darkness=0.5;ia.vertices[0]=-2;ia.vertices[1]=-1;ia.vertices[2]=-1;ia.vertices[3]=2;ia.vertices[4]=-1;ia.vertices[5]=-1;ia.vertices[6]=2;ia.vertices[7]=1;ia.vertices[8]=-1;ia.vertices[9]=-2;ia.vertices[10]=1;ia.vertices[11]=-1;ia.faces[0]=0;ia.faces[1]= +undefined)N=b.stencil;if(b.antialias!==undefined)ca=b.antialias;b.clearColor!==undefined&&sa.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ea=b.clearAlpha}this.maxMorphTargets=8;this.domElement=ga;this.autoClear=!0;this.sortObjects=!0;(function(m,B,z,w){try{if(!(e=ga.getContext("experimental-webgl",{antialias:m,stencil:w})))throw"Error creating WebGL context.";}catch(y){console.error(y)}e.clearColor(0,0,0,1);e.clearDepth(1);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(B.r,B.g,B.b,z)})(ca,sa,Ea,N);this.context=e;if(N){var ia={};ia.vertices=new Float32Array(12);ia.faces=new Uint16Array(6);ia.darkness=0.5;ia.vertices[0]=-2;ia.vertices[1]=-1;ia.vertices[2]=-1;ia.vertices[3]=2;ia.vertices[4]=-1;ia.vertices[5]=-1;ia.vertices[6]=2;ia.vertices[7]=1;ia.vertices[8]=-1;ia.vertices[9]=-2;ia.vertices[10]=1;ia.vertices[11]=-1;ia.faces[0]=0;ia.faces[1]= 1;ia.faces[2]=2;ia.faces[3]=0;ia.faces[4]=2;ia.faces[5]=3;ia.vertexBuffer=e.createBuffer();ia.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ia.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ia.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ia.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia.faces,e.STATIC_DRAW);ia.program=e.createProgram();e.attachShader(ia.program,ua("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ia.program,ua("vertex",THREE.ShaderLib.shadowPost.vertexShader)); e.linkProgram(ia.program);ia.vertexLocation=e.getAttribLocation(ia.program,"position");ia.projectionLocation=e.getUniformLocation(ia.program,"projectionMatrix");ia.darknessLocation=e.getUniformLocation(ia.program,"darkness")}var ma={};ma.vertices=new Float32Array(16);ma.faces=new Uint16Array(6);ma.transparency=0.5;b=0;ma.vertices[b++]=-1;ma.vertices[b++]=-1;ma.vertices[b++]=0;ma.vertices[b++]=0;ma.vertices[b++]=1;ma.vertices[b++]=-1;ma.vertices[b++]=1;ma.vertices[b++]=0;ma.vertices[b++]=1;ma.vertices[b++]= 1;ma.vertices[b++]=1;ma.vertices[b++]=1;ma.vertices[b++]=-1;ma.vertices[b++]=1;ma.vertices[b++]=0;ma.vertices[b++]=1;b=0;ma.faces[b++]=0;ma.faces[b++]=1;ma.faces[b++]=2;ma.faces[b++]=0;ma.faces[b++]=2;ma.faces[b++]=3;ma.vertexBuffer=e.createBuffer();ma.elementBuffer=e.createBuffer();ma.tempTexture=e.createTexture();ma.readBackPixels=new Uint8Array(1024);e.bindBuffer(e.ARRAY_BUFFER,ma.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ma.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ma.elementBuffer); e.bufferData(e.ELEMENT_ARRAY_BUFFER,ma.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,ma.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);ma.program=e.createProgram();e.attachShader(ma.program,ua("fragment",THREE.ShaderLib.lensFlare.fragmentShader)); e.attachShader(ma.program,ua("vertex",THREE.ShaderLib.lensFlare.vertexShader));e.linkProgram(ma.program);ma.attributes={};ma.uniforms={};ma.attributes.vertex=e.getAttribLocation(ma.program,"position");ma.attributes.uv=e.getAttribLocation(ma.program,"UV");ma.uniforms.map=e.getUniformLocation(ma.program,"map");ma.uniforms.opacity=e.getUniformLocation(ma.program,"opacity");ma.uniforms.scale=e.getUniformLocation(ma.program,"scale");ma.uniforms.rotation=e.getUniformLocation(ma.program,"rotation");ma.uniforms.screenPosition= -e.getUniformLocation(ma.program,"screenPosition");ma.uniforms.renderPink=e.getUniformLocation(ma.program,"renderPink");this.setSize=function(m,C){ga.width=m;ga.height=C;this.setViewport(0,0,ga.width,ga.height)};this.setViewport=function(m,C,z,w){aa=m;ra=C;Ga=z;la=w;e.viewport(aa,ra,Ga,la)};this.setScissor=function(m,C,z,w){e.scissor(m,C,z,w)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){Ka=m;e.depthMask(m)};this.setClearColorHex= -function(m,C){var z=new THREE.Color(m);e.clearColor(z.r,z.g,z.b,C)};this.setClearColor=function(m,C){e.clearColor(m.r,m.g,m.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ia.darkness=m};this.initMaterial=function(m,C,z,w){var x,P,G,I;if(m instanceof THREE.MeshDepthMaterial)c(m,THREE.ShaderLib.depth);else if(m instanceof THREE.ShadowVolumeDynamicMaterial)c(m,THREE.ShaderLib.shadowVolumeDynamic);else if(m instanceof -THREE.MeshNormalMaterial)c(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)c(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)c(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)c(m,THREE.ShaderLib.phong);else if(m instanceof THREE.LineBasicMaterial)c(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&c(m,THREE.ShaderLib.particle_basic);if(!m.program){var J,E,K;J=K=I=0;for(G=C.length;J0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+G.maxDirLights,"#define MAX_POINT_LIGHTS "+ -G.maxPointLights,"#define MAX_BONES "+G.maxBones,G.map?"#define USE_MAP":"",G.envMap?"#define USE_ENVMAP":"",G.lightMap?"#define USE_LIGHTMAP":"",G.vertexColors?"#define USE_COLOR":"",G.skinning?"#define USE_SKINNING":"",G.morphTargets?"#define USE_MORPHTARGETS":"",G.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"); -e.attachShader(C,ua("fragment",J+z));e.attachShader(C,ua("vertex",G+I));e.linkProgram(C);e.getProgramParameter(C,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(C,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");C.uniforms={};C.attributes={};m.program=C;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in m.uniforms)z.push(x); -x=m.program;I=0;for(C=z.length;I=0&&e.enableVertexAttribArray(x.color);x.normal>=0&&e.enableVertexAttribArray(x.normal); -x.tangent>=0&&e.enableVertexAttribArray(x.tangent);if(m.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0){e.enableVertexAttribArray(x.skinVertexA);e.enableVertexAttribArray(x.skinVertexB);e.enableVertexAttribArray(x.skinIndex);e.enableVertexAttribArray(x.skinWeight)}for(P in m.attributes)x[P]>=0&&e.enableVertexAttribArray(x[P]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(x.morphTarget0>=0){e.enableVertexAttribArray(x.morphTarget0);m.numSupportedMorphTargets++}if(x.morphTarget1>= -0){e.enableVertexAttribArray(x.morphTarget1);m.numSupportedMorphTargets++}if(x.morphTarget2>=0){e.enableVertexAttribArray(x.morphTarget2);m.numSupportedMorphTargets++}if(x.morphTarget3>=0){e.enableVertexAttribArray(x.morphTarget3);m.numSupportedMorphTargets++}if(x.morphTarget4>=0){e.enableVertexAttribArray(x.morphTarget4);m.numSupportedMorphTargets++}if(x.morphTarget5>=0){e.enableVertexAttribArray(x.morphTarget5);m.numSupportedMorphTargets++}if(x.morphTarget6>=0){e.enableVertexAttribArray(x.morphTarget6); -m.numSupportedMorphTargets++}if(x.morphTarget7>=0){e.enableVertexAttribArray(x.morphTarget7);m.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);x=0;for(P=this.maxMorphTargets;x0||qa.faceVertexUvs.length>0)G.__uvArray=new Float32Array(J*2);if(qa.faceUvs.length>1||qa.faceVertexUvs.length>1)G.__uv2Array=new Float32Array(J*2)}if(I.geometry.skinWeights.length&&I.geometry.skinIndices.length){G.__skinVertexAArray=new Float32Array(J*4);G.__skinVertexBArray=new Float32Array(J*4);G.__skinIndexArray=new Float32Array(J* -4);G.__skinWeightArray=new Float32Array(J*4)}G.__faceArray=new Uint16Array(Fa*3+(I.geometry.edgeFaces?I.geometry.edgeFaces.length*6:0));G.__lineArray=new Uint16Array(La*2);if(G.numMorphTargets){G.__morphTargetsArrays=[];qa=0;for(W=G.numMorphTargets;qa=0;x--){w= -z.__webglObjects[x].object;C==w&&z.__webglObjects.splice(x,1)}m.__objectsRemoved.splice(0,1)}C=0;for(z=m.__webglObjects.length;C0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+ +H.maxPointLights,"#define MAX_BONES "+H.maxBones,H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"",H.skinning?"#define USE_SKINNING":"",H.morphTargets?"#define USE_MORPHTARGETS":"",H.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"); +e.attachShader(B,ua("fragment",J+z));e.attachShader(B,ua("vertex",H+I));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};m.program=B;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in m.uniforms)z.push(y); +y=m.program;I=0;for(B=z.length;I=0&&e.enableVertexAttribArray(y.color);y.normal>=0&&e.enableVertexAttribArray(y.normal); +y.tangent>=0&&e.enableVertexAttribArray(y.tangent);if(m.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){e.enableVertexAttribArray(y.skinVertexA);e.enableVertexAttribArray(y.skinVertexB);e.enableVertexAttribArray(y.skinIndex);e.enableVertexAttribArray(y.skinWeight)}for(P in m.attributes)y[P]>=0&&e.enableVertexAttribArray(y[P]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(y.morphTarget0>=0){e.enableVertexAttribArray(y.morphTarget0);m.numSupportedMorphTargets++}if(y.morphTarget1>= +0){e.enableVertexAttribArray(y.morphTarget1);m.numSupportedMorphTargets++}if(y.morphTarget2>=0){e.enableVertexAttribArray(y.morphTarget2);m.numSupportedMorphTargets++}if(y.morphTarget3>=0){e.enableVertexAttribArray(y.morphTarget3);m.numSupportedMorphTargets++}if(y.morphTarget4>=0){e.enableVertexAttribArray(y.morphTarget4);m.numSupportedMorphTargets++}if(y.morphTarget5>=0){e.enableVertexAttribArray(y.morphTarget5);m.numSupportedMorphTargets++}if(y.morphTarget6>=0){e.enableVertexAttribArray(y.morphTarget6); +m.numSupportedMorphTargets++}if(y.morphTarget7>=0){e.enableVertexAttribArray(y.morphTarget7);m.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);y=0;for(P=this.maxMorphTargets;y0||qa.faceVertexUvs.length>0)H.__uvArray=new Float32Array(J*2);if(qa.faceUvs.length>1||qa.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(J*2)}if(I.geometry.skinWeights.length&&I.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(J*4);H.__skinVertexBArray=new Float32Array(J*4);H.__skinIndexArray=new Float32Array(J* +4);H.__skinWeightArray=new Float32Array(J*4)}H.__faceArray=new Uint16Array(Fa*3+(I.geometry.edgeFaces?I.geometry.edgeFaces.length*6:0));H.__lineArray=new Uint16Array(La*2);if(H.numMorphTargets){H.__morphTargetsArrays=[];qa=0;for(W=H.numMorphTargets;qa=0;y--){w= +z.__webglObjects[y].object;B==w&&z.__webglObjects.splice(y,1)}m.__objectsRemoved.splice(0,1)}B=0;for(z=m.__webglObjects.length;B0}}; THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType}; THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f=0?A:A+g;A=this.verticalAngleMap.srcRange;y=this.verticalAngleMap.dstRange; -this.phi=(this.phi-A[0])*(y[1]-y[0])/(A[1]-A[0])+y[0];A=this.horizontalAngleMap.srcRange;y=this.horizontalAngleMap.dstRange;this.theta=(this.theta-A[0])*(y[1]-y[0])/(A[1]-A[0])+y[0];A=this.target.position;A.x=100*Math.sin(this.phi)*Math.cos(this.theta);A.y=100*Math.cos(this.phi);A.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,t)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); +this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(p,o,x){var A,t;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;A=this.phi%g;this.phi=A>=0?A:A+g;A=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange; +this.phi=(this.phi-A[0])*(t[1]-t[0])/(A[1]-A[0])+t[0];A=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-A[0])*(t[1]-t[0])/(A[1]-A[0])+t[0];A=this.target.position;A.x=100*Math.sin(this.phi)*Math.cos(this.theta);A.y=100*Math.cos(this.phi);A.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,x)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),n=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(n,j);b.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation= d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(p,o){return function(){o.apply(p,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; -var Cube=function(b,d,c,f,g,h,j,k,n){function p(H,L,V,D,M,O,Q,Ia){var ua,Aa,da=f||1,e=g||1,ga=M/2,Ba=O/2,Ja=o.vertices.length;if(H=="x"&&L=="y"||H=="y"&&L=="x")ua="z";else if(H=="x"&&L=="z"||H=="z"&&L=="x"){ua="y";e=h||1}else if(H=="z"&&L=="y"||H=="y"&&L=="z"){ua="x";da=h||1}var Ka=da+1,wa=e+1;M/=da;var ea=O/e;for(Aa=0;Aa0){j(0,0,-p-(h||0));for(f=b;f0){j(0,0,p+(g||0)); +var Cube=function(b,d,c,f,g,h,j,k,n){function p(G,L,V,D,M,O,Q,Ia){var ua,Aa,da=f||1,e=g||1,ga=M/2,Ba=O/2,Ja=o.vertices.length;if(G=="x"&&L=="y"||G=="y"&&L=="x")ua="z";else if(G=="x"&&L=="z"||G=="z"&&L=="x"){ua="y";e=h||1}else if(G=="z"&&L=="y"||G=="y"&&L=="z"){ua="x";da=h||1}var Ka=da+1,wa=e+1;M/=da;var ea=O/e;for(Aa=0;Aa0){j(0,0,-p-(h||0));for(f=b;f0){j(0,0,p+(g||0)); for(f=b+b/2;f<2*b;f++)k.faces.push(new THREE.Face4(2*b+1,(2*f-2*b+2)%b+b,(2*f-2*b+1)%b+b,(2*f-2*b)%b+b))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder; -var Icosahedron=function(b){function d(t,A,y){var B=Math.sqrt(t*t+A*A+y*y);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/B,A/B,y/B)))-1}function c(t,A,y,B){B.faces.push(new THREE.Face3(t,A,y))}function f(t,A){var y=g.vertices[t].position,B=g.vertices[A].position;return d((y.x+B.x)/2,(y.y+B.y)/2,(y.z+B.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0, +var Icosahedron=function(b){function d(x,A,t){var C=Math.sqrt(x*x+A*A+t*t);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(x/C,A/C,t/C)))-1}function c(x,A,t,C){C.faces.push(new THREE.Face3(x,A,t))}function f(x,A){var t=g.vertices[x].position,C=g.vertices[A].position;return d((t.x+C.x)/2,(t.y+C.y)/2,(t.z+C.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0, 1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(b=0;b0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,k,A)))-1);p.push(o)}d.push(p)}var y,B,F;g=d.length;for(c=0;c0)for(f=0;f1){y=this.vertices[j].position.clone(); -B=this.vertices[n].position.clone();F=this.vertices[p].position.clone();y.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,t,H])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,A)))-1);p.push(o)}d.push(p)}var t,C,E;g=d.length;for(c=0;c0)for(f=0;f1){t=this.vertices[j].position.clone(); +C=this.vertices[n].position.clone();E=this.vertices[p].position.clone();t.normalize();C.normalize();E.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(C.x,C.y,C.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([o,x,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; var Torus=function(b,d,c,f){this.radius=b||100;this.tube=d||40;this.segmentsR=c||8;this.segmentsT=f||6;b=[];THREE.Geometry.call(this);for(d=0;d<=this.segmentsR;++d)for(c=0;c<=this.segmentsT;++c){f=c/this.segmentsT*2*Math.PI;var g=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([c/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(c= 1;c<=this.segmentsT;++c){f=(this.segmentsT+1)*d+c;g=(this.segmentsT+1)*d+c-1;var h=(this.segmentsT+1)*(d-1)+c-1,j=(this.segmentsT+1)*(d-1)+c;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var TorusKnot=function(b,d,c,f,g,h,j){function k(t,A,y,B,F,H){A=y/B*t;y=Math.cos(A);return new THREE.Vector3(F*(2+y)*0.5*Math.cos(t),F*(2+y)*Math.sin(t)*0.5,H*F*Math.sin(A)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b>7)-127;sa|=(ia&127)<<16|Ea<<8;if(sa==0&&m==-127)return 0;return(1-2*(ma>>7))*(1+sa*Math.pow(2,-23))*Math.pow(2,m)}function k(N,ca){var sa=o(N,ca),Ea=o(N,ca+1),ia=o(N,ca+2);return(o(N,ca+3)<<24)+(ia<<16)+(Ea<<8)+sa}function n(N,ca){var sa=o(N,ca);return(o(N,ca+1)<<8)+sa}function p(N,ca){var sa=o(N,ca); -return sa>127?sa-256:sa}function o(N,ca){return N.charCodeAt(ca)&255}function t(N){var ca,sa,Ea;ca=k(b,N);sa=k(b,N+Q);Ea=k(b,N+Ia);N=n(b,N+ua);THREE.BinaryLoader.prototype.f3(L,ca,sa,Ea,N)}function A(N){var ca,sa,Ea,ia,ma,m;ca=k(b,N);sa=k(b,N+Q);Ea=k(b,N+Ia);ia=n(b,N+ua);ma=k(b,N+Aa);m=k(b,N+da);N=k(b,N+e);THREE.BinaryLoader.prototype.f3n(L,M,ca,sa,Ea,ia,ma,m,N)}function y(N){var ca,sa,Ea,ia;ca=k(b,N);sa=k(b,N+ga);Ea=k(b,N+Ba);ia=k(b,N+Ja);N=n(b,N+Ka);THREE.BinaryLoader.prototype.f4(L,ca,sa,Ea,ia, -N)}function B(N){var ca,sa,Ea,ia,ma,m,C,z;ca=k(b,N);sa=k(b,N+ga);Ea=k(b,N+Ba);ia=k(b,N+Ja);ma=n(b,N+Ka);m=k(b,N+wa);C=k(b,N+ea);z=k(b,N+va);N=k(b,N+Ca);THREE.BinaryLoader.prototype.f4n(L,M,ca,sa,Ea,ia,ma,m,C,z,N)}function F(N){var ca,sa;ca=k(b,N);sa=k(b,N+ka);N=k(b,N+aa);THREE.BinaryLoader.prototype.uv3(L.faceVertexUvs[0],O[ca*2],O[ca*2+1],O[sa*2],O[sa*2+1],O[N*2],O[N*2+1])}function H(N){var ca,sa,Ea;ca=k(b,N);sa=k(b,N+ra);Ea=k(b,N+Ga);N=k(b,N+la);THREE.BinaryLoader.prototype.uv4(L.faceVertexUvs[0], +return sa>127?sa-256:sa}function o(N,ca){return N.charCodeAt(ca)&255}function x(N){var ca,sa,Ea;ca=k(b,N);sa=k(b,N+Q);Ea=k(b,N+Ia);N=n(b,N+ua);THREE.BinaryLoader.prototype.f3(L,ca,sa,Ea,N)}function A(N){var ca,sa,Ea,ia,ma,m;ca=k(b,N);sa=k(b,N+Q);Ea=k(b,N+Ia);ia=n(b,N+ua);ma=k(b,N+Aa);m=k(b,N+da);N=k(b,N+e);THREE.BinaryLoader.prototype.f3n(L,M,ca,sa,Ea,ia,ma,m,N)}function t(N){var ca,sa,Ea,ia;ca=k(b,N);sa=k(b,N+ga);Ea=k(b,N+Ba);ia=k(b,N+Ja);N=n(b,N+Ka);THREE.BinaryLoader.prototype.f4(L,ca,sa,Ea,ia, +N)}function C(N){var ca,sa,Ea,ia,ma,m,B,z;ca=k(b,N);sa=k(b,N+ga);Ea=k(b,N+Ba);ia=k(b,N+Ja);ma=n(b,N+Ka);m=k(b,N+wa);B=k(b,N+ea);z=k(b,N+va);N=k(b,N+Ca);THREE.BinaryLoader.prototype.f4n(L,M,ca,sa,Ea,ia,ma,m,B,z,N)}function E(N){var ca,sa;ca=k(b,N);sa=k(b,N+ka);N=k(b,N+aa);THREE.BinaryLoader.prototype.uv3(L.faceVertexUvs[0],O[ca*2],O[ca*2+1],O[sa*2],O[sa*2+1],O[N*2],O[N*2+1])}function G(N){var ca,sa,Ea;ca=k(b,N);sa=k(b,N+ra);Ea=k(b,N+Ga);N=k(b,N+la);THREE.BinaryLoader.prototype.uv4(L.faceVertexUvs[0], O[ca*2],O[ca*2+1],O[sa*2],O[sa*2+1],O[Ea*2],O[Ea*2+1],O[N*2],O[N*2+1])}var L=this,V=0,D,M=[],O=[],Q,Ia,ua,Aa,da,e,ga,Ba,Ja,Ka,wa,ea,va,Ca,ka,aa,ra,Ga,la,pa,Ha,Ta,ab,Xa,Ua;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(L,f,h);D={signature:b.substr(V,8),header_bytes:o(b,V+8),vertex_coordinate_bytes:o(b,V+9),normal_coordinate_bytes:o(b,V+10),uv_coordinate_bytes:o(b,V+11),vertex_index_bytes:o(b,V+12),normal_index_bytes:o(b,V+13),uv_index_bytes:o(b,V+14),material_index_bytes:o(b,V+15), nvertices:k(b,V+16),nnormals:k(b,V+16+4),nuvs:k(b,V+16+8),ntri_flat:k(b,V+16+12),ntri_smooth:k(b,V+16+16),ntri_flat_uv:k(b,V+16+20),ntri_smooth_uv:k(b,V+16+24),nquad_flat:k(b,V+16+28),nquad_smooth:k(b,V+16+32),nquad_flat_uv:k(b,V+16+36),nquad_smooth_uv:k(b,V+16+40)};V+=D.header_bytes;Q=D.vertex_index_bytes;Ia=D.vertex_index_bytes*2;ua=D.vertex_index_bytes*3;Aa=D.vertex_index_bytes*3+D.material_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;e=D.vertex_index_bytes* 3+D.material_index_bytes+D.normal_index_bytes*2;ga=D.vertex_index_bytes;Ba=D.vertex_index_bytes*2;Ja=D.vertex_index_bytes*3;Ka=D.vertex_index_bytes*4;wa=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;va=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;Ca=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ka=D.uv_index_bytes;aa=D.uv_index_bytes*2;ra=D.uv_index_bytes;Ga=D.uv_index_bytes*2;la=D.uv_index_bytes* 3;h=D.vertex_index_bytes*3+D.material_index_bytes;Ua=D.vertex_index_bytes*4+D.material_index_bytes;pa=D.ntri_flat*h;Ha=D.ntri_smooth*(h+D.normal_index_bytes*3);Ta=D.ntri_flat_uv*(h+D.uv_index_bytes*3);ab=D.ntri_smooth_uv*(h+D.normal_index_bytes*3+D.uv_index_bytes*3);Xa=D.nquad_flat*Ua;h=D.nquad_smooth*(Ua+D.normal_index_bytes*4);Ua=D.nquad_flat_uv*(Ua+D.uv_index_bytes*4);V+=function(N){for(var ca,sa,Ea,ia=D.vertex_coordinate_bytes*3,ma=N+D.nvertices*ia;N=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;fthis.size-1&&(n=this.size-1);var A=Math.floor(p-k);A<1&&(A=1);p=Math.floor(p+k);p>this.size-1&&(p= -this.size-1);var y=Math.floor(o-k);y<1&&(y=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,F,H,L,V,D;t0&&(this.field[H+B]+=L)}}}};this.addPlaneX=function(c,f){var g,h,j,k,n,p=this.size,o=this.yd,t=this.zd,A=this.field,y=p*Math.sqrt(c/f);y>p&&(y=p);for(g=0;g0)for(h=0;ho&&(B=o);for(h=0;h0){n=h*t;for(g=0;gsize&&(dist=size);for(j=0;j0){n=zd*j;for(h=0;h=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;fthis.size-1&&(n=this.size-1);var A=Math.floor(p-k);A<1&&(A=1);p=Math.floor(p+k);p>this.size-1&&(p= +this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var C,E,G,L,V,D;x0&&(this.field[G+C]+=L)}}}};this.addPlaneX=function(c,f){var g,h,j,k,n,p=this.size,o=this.yd,x=this.zd,A=this.field,t=p*Math.sqrt(c/f);t>p&&(t=p);for(g=0;g0)for(h=0;ho&&(C=o);for(h=0;h0){n=h*x;for(g=0;gsize&&(dist=size);for(j=0;j0){n=zd*j;for(h=0;h=0?p:p+d;p=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange; -this.phi=(this.phi-p[0])*(w[1]-w[0])/(p[1]-p[0])+w[0];p=this.horizontalAngleMap.srcRange;w=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(w[1]-w[0])/(p[1]-p[0])+w[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,k,j,m)};this.onMouseMove=function(k){this.mouseX=k.clientX-this.windowHalfX;this.mouseY=k.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); +this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var d=Math.PI*2,f=Math.PI/180;this.update=function(k,j,m){var p,t;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;p=this.phi%d;this.phi=p>=0?p:p+d;p=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange; +this.phi=(this.phi-p[0])*(t[1]-t[0])/(p[1]-p[0])+t[0];p=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(t[1]-t[0])/(p[1]-p[0])+t[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,k,j,m)};this.onMouseMove=function(k){this.mouseX=k.clientX-this.windowHalfX;this.mouseY=k.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var g=new THREE.MeshLambertMaterial({color:65280}),h=new Cube(10,10,20),l=new Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(l,g);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation= e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&c(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(k,j){return function(){j.apply(k,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; -var Cube=function(a,e,b,c,d,f,g,h,l){function k(y,A,C,n,E,D,L,M){var K,J,G=c||1,N=d||1,U=E/2,R=D/2,P=j.vertices.length;if(y=="x"&&A=="y"||y=="y"&&A=="x")K="z";else if(y=="x"&&A=="z"||y=="z"&&A=="x"){K="y";N=f||1}else if(y=="z"&&A=="y"||y=="y"&&A=="z"){K="x";G=f||1}var Q=G+1,T=N+1;E/=G;var H=D/N;for(J=0;J0){g(0,0,-k-(f||0));for(c=a;c0){g(0,0,k+(d||0)); for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*a+1)%a+a,(2*c-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder; -var Icosahedron=function(a){function e(m,p,w){var t=Math.sqrt(m*m+p*p+w*w);return d.vertices.push(new THREE.Vertex(new THREE.Vector3(m/t,p/t,w/t)))-1}function b(m,p,w,t){t.faces.push(new THREE.Face3(m,p,w))}function c(m,p){var w=d.vertices[m].position,t=d.vertices[p].position;return e((w.x+t.x)/2,(w.y+t.y)/2,(w.z+t.z)/2)}var d=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;e(-1,a,0);e(1,a,0);e(-1,-a,0);e(1,-a,0);e(0,-1,a);e(0,1,a);e(0,-1,-a);e(0, +var Icosahedron=function(a){function e(m,p,t){var y=Math.sqrt(m*m+p*p+t*t);return d.vertices.push(new THREE.Vertex(new THREE.Vector3(m/y,p/y,t/y)))-1}function b(m,p,t,y){y.faces.push(new THREE.Face3(m,p,t))}function c(m,p){var t=d.vertices[m].position,y=d.vertices[p].position;return e((t.x+y.x)/2,(t.y+y.y)/2,(t.z+y.z)/2)}var d=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;e(-1,a,0);e(1,a,0);e(-1,-a,0);e(1,-a,0);e(0,-1,a);e(0,1,a);e(0,-1,-a);e(0, 1,-a);e(a,0,-1);e(a,0,1);e(-a,0,-1);e(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a0||(j=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,p)))-1);k.push(j)}e.push(k)}var w,t,z;d=e.length;for(b=0;b0)for(c=0;c1){w=this.vertices[g].position.clone(); -t=this.vertices[l].position.clone();z=this.vertices[k].position.clone();w.normalize();t.normalize();z.normalize();this.faces.push(new THREE.Face3(g,l,k,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z)]));this.faceVertexUvs[0].push([j,m,y])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Sphere=function(a,e,b){THREE.Geometry.call(this);var c,d=Math.PI,f=Math.max(3,e||8),g=Math.max(2,b||6);e=[];for(b=0;b0||(j=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,p)))-1);k.push(j)}e.push(k)}var t,y,z;d=e.length;for(b=0;b0)for(c=0;c1){t=this.vertices[g].position.clone(); +y=this.vertices[l].position.clone();z=this.vertices[k].position.clone();t.normalize();y.normalize();z.normalize();this.faces.push(new THREE.Face3(g,l,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)]));this.faceVertexUvs[0].push([j,m,w])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; var Torus=function(a,e,b,c){this.radius=a||100;this.tube=e||40;this.segmentsR=b||8;this.segmentsT=c||6;a=[];THREE.Geometry.call(this);for(e=0;e<=this.segmentsR;++e)for(b=0;b<=this.segmentsT;++b){c=b/this.segmentsT*2*Math.PI;var d=e/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(d))*Math.cos(c),(this.radius+this.tube*Math.cos(d))*Math.sin(c),this.tube*Math.sin(d))));a.push([b/this.segmentsT,1-e/this.segmentsR])}for(e=1;e<=this.segmentsR;++e)for(b= 1;b<=this.segmentsT;++b){c=(this.segmentsT+1)*e+b;d=(this.segmentsT+1)*e+b-1;var f=(this.segmentsT+1)*(e-1)+b-1,g=(this.segmentsT+1)*(e-1)+b;this.faces.push(new THREE.Face4(c,d,f,g));this.faceVertexUvs[0].push([new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var TorusKnot=function(a,e,b,c,d,f,g){function h(m,p,w,t,z,y){p=w/t*m;w=Math.cos(p);return new THREE.Vector3(z*(2+w)*0.5*Math.cos(m),z*(2+w)*Math.sin(m)*0.5,y*z*Math.sin(p)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=e||40;this.segmentsR=b||64;this.segmentsT=c||8;this.p=d||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;c=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a>7)-127;B|=(I&127)<<16|F<<8;if(B==0&&V==-127)return 0;return(1-2*(S>>7))*(1+B*Math.pow(2,-23))*Math.pow(2,V)}function h(o,x){var B=j(o,x),F=j(o,x+1),I=j(o,x+2);return(j(o,x+3)<<24)+(I<<16)+(F<<8)+B}function l(o,x){var B=j(o,x);return(j(o,x+1)<<8)+B}function k(o,x){var B=j(o,x);return B>127?B-256:B}function j(o, -x){return o.charCodeAt(x)&255}function m(o){var x,B,F;x=h(a,o);B=h(a,o+L);F=h(a,o+M);o=l(a,o+K);THREE.BinaryLoader.prototype.f3(A,x,B,F,o)}function p(o){var x,B,F,I,S,V;x=h(a,o);B=h(a,o+L);F=h(a,o+M);I=l(a,o+K);S=h(a,o+J);V=h(a,o+G);o=h(a,o+N);THREE.BinaryLoader.prototype.f3n(A,E,x,B,F,I,S,V,o)}function w(o){var x,B,F,I;x=h(a,o);B=h(a,o+U);F=h(a,o+R);I=h(a,o+P);o=l(a,o+Q);THREE.BinaryLoader.prototype.f4(A,x,B,F,I,o)}function t(o){var x,B,F,I,S,V,da,ea;x=h(a,o);B=h(a,o+U);F=h(a,o+R);I=h(a,o+P);S=l(a, -o+Q);V=h(a,o+T);da=h(a,o+H);ea=h(a,o+O);o=h(a,o+X);THREE.BinaryLoader.prototype.f4n(A,E,x,B,F,I,S,V,da,ea,o)}function z(o){var x,B;x=h(a,o);B=h(a,o+Y);o=h(a,o+fa);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],D[x*2],D[x*2+1],D[B*2],D[B*2+1],D[o*2],D[o*2+1])}function y(o){var x,B,F;x=h(a,o);B=h(a,o+ga);F=h(a,o+ha);o=h(a,o+ia);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],D[x*2],D[x*2+1],D[B*2],D[B*2+1],D[F*2],D[F*2+1],D[o*2],D[o*2+1])}var A=this,C=0,n,E=[],D=[],L,M,K,J,G,N,U,R,P,Q,T,H, -O,X,Y,fa,ga,ha,ia,Z,$,aa,ba,ca,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,c,f);n={signature:a.substr(C,8),header_bytes:j(a,C+8),vertex_coordinate_bytes:j(a,C+9),normal_coordinate_bytes:j(a,C+10),uv_coordinate_bytes:j(a,C+11),vertex_index_bytes:j(a,C+12),normal_index_bytes:j(a,C+13),uv_index_bytes:j(a,C+14),material_index_bytes:j(a,C+15),nvertices:h(a,C+16),nnormals:h(a,C+16+4),nuvs:h(a,C+16+8),ntri_flat:h(a,C+16+12),ntri_smooth:h(a,C+16+16),ntri_flat_uv:h(a,C+16+20),ntri_smooth_uv:h(a, -C+16+24),nquad_flat:h(a,C+16+28),nquad_smooth:h(a,C+16+32),nquad_flat_uv:h(a,C+16+36),nquad_smooth_uv:h(a,C+16+40)};C+=n.header_bytes;L=n.vertex_index_bytes;M=n.vertex_index_bytes*2;K=n.vertex_index_bytes*3;J=n.vertex_index_bytes*3+n.material_index_bytes;G=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;N=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;U=n.vertex_index_bytes;R=n.vertex_index_bytes*2;P=n.vertex_index_bytes*3;Q=n.vertex_index_bytes*4;T=n.vertex_index_bytes* +x){return o.charCodeAt(x)&255}function m(o){var x,B,F;x=h(a,o);B=h(a,o+L);F=h(a,o+M);o=l(a,o+K);THREE.BinaryLoader.prototype.f3(C,x,B,F,o)}function p(o){var x,B,F,I,S,V;x=h(a,o);B=h(a,o+L);F=h(a,o+M);I=l(a,o+K);S=h(a,o+J);V=h(a,o+G);o=h(a,o+N);THREE.BinaryLoader.prototype.f3n(C,E,x,B,F,I,S,V,o)}function t(o){var x,B,F,I;x=h(a,o);B=h(a,o+U);F=h(a,o+R);I=h(a,o+P);o=l(a,o+Q);THREE.BinaryLoader.prototype.f4(C,x,B,F,I,o)}function y(o){var x,B,F,I,S,V,da,ea;x=h(a,o);B=h(a,o+U);F=h(a,o+R);I=h(a,o+P);S=l(a, +o+Q);V=h(a,o+T);da=h(a,o+H);ea=h(a,o+O);o=h(a,o+X);THREE.BinaryLoader.prototype.f4n(C,E,x,B,F,I,S,V,da,ea,o)}function z(o){var x,B;x=h(a,o);B=h(a,o+Y);o=h(a,o+fa);THREE.BinaryLoader.prototype.uv3(C.faceVertexUvs[0],D[x*2],D[x*2+1],D[B*2],D[B*2+1],D[o*2],D[o*2+1])}function w(o){var x,B,F;x=h(a,o);B=h(a,o+ga);F=h(a,o+ha);o=h(a,o+ia);THREE.BinaryLoader.prototype.uv4(C.faceVertexUvs[0],D[x*2],D[x*2+1],D[B*2],D[B*2+1],D[F*2],D[F*2+1],D[o*2],D[o*2+1])}var C=this,A=0,n,E=[],D=[],L,M,K,J,G,N,U,R,P,Q,T,H, +O,X,Y,fa,ga,ha,ia,Z,$,aa,ba,ca,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,c,f);n={signature:a.substr(A,8),header_bytes:j(a,A+8),vertex_coordinate_bytes:j(a,A+9),normal_coordinate_bytes:j(a,A+10),uv_coordinate_bytes:j(a,A+11),vertex_index_bytes:j(a,A+12),normal_index_bytes:j(a,A+13),uv_index_bytes:j(a,A+14),material_index_bytes:j(a,A+15),nvertices:h(a,A+16),nnormals:h(a,A+16+4),nuvs:h(a,A+16+8),ntri_flat:h(a,A+16+12),ntri_smooth:h(a,A+16+16),ntri_flat_uv:h(a,A+16+20),ntri_smooth_uv:h(a, +A+16+24),nquad_flat:h(a,A+16+28),nquad_smooth:h(a,A+16+32),nquad_flat_uv:h(a,A+16+36),nquad_smooth_uv:h(a,A+16+40)};A+=n.header_bytes;L=n.vertex_index_bytes;M=n.vertex_index_bytes*2;K=n.vertex_index_bytes*3;J=n.vertex_index_bytes*3+n.material_index_bytes;G=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;N=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;U=n.vertex_index_bytes;R=n.vertex_index_bytes*2;P=n.vertex_index_bytes*3;Q=n.vertex_index_bytes*4;T=n.vertex_index_bytes* 4+n.material_index_bytes;H=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;O=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;X=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;Y=n.uv_index_bytes;fa=n.uv_index_bytes*2;ga=n.uv_index_bytes;ha=n.uv_index_bytes*2;ia=n.uv_index_bytes*3;f=n.vertex_index_bytes*3+n.material_index_bytes;W=n.vertex_index_bytes*4+n.material_index_bytes;Z=n.ntri_flat*f;$=n.ntri_smooth*(f+n.normal_index_bytes*3);aa=n.ntri_flat_uv* -(f+n.uv_index_bytes*3);ba=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);ca=n.nquad_flat*W;f=n.nquad_smooth*(W+n.normal_index_bytes*4);W=n.nquad_flat_uv*(W+n.uv_index_bytes*4);C+=function(o){for(var x,B,F,I=n.vertex_coordinate_bytes*3,S=o+n.nvertices*I;o=this.maxCount-3&&h(this)};this.begin= -function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(l=this.size-1);var p=Math.floor(k-h);p<1&&(p=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var w=Math.floor(j-h);w<1&&(w=1);h=Math.floor(j+h); -h>this.size-1&&(h=this.size-1);for(var t,z,y,A,C,n;m0&&(this.field[y+t]+=A)}}}};this.addPlaneX=function(b,c){var d,f,g,h,l,k=this.size,j=this.yd,m=this.zd,p=this.field,w=k*Math.sqrt(b/c);w>k&&(w=k);for(d=0;d0)for(f=0;fj&&(t=j);for(f=0;f0){l=f*m;for(d=0;dsize&&(dist=size);for(g=0;g0){l=zd*g;for(f=0;fthis.size-1&&(l=this.size-1);var p=Math.floor(k-h);p<1&&(p=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var t=Math.floor(j-h);t<1&&(t=1);h=Math.floor(j+h); +h>this.size-1&&(h=this.size-1);for(var y,z,w,C,A,n;m0&&(this.field[w+y]+=C)}}}};this.addPlaneX=function(b,c){var d,f,g,h,l,k=this.size,j=this.yd,m=this.zd,p=this.field,t=k*Math.sqrt(b/c);t>k&&(t=k);for(d=0;d0)for(f=0;fj&&(y=j);for(f=0;f0){l=f*m;for(d=0;dsize&&(dist=size);for(g=0;g0){l=zd*g;for(f=0;f=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var j=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.001){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}g=Math.sin((1-h)*j)/k;h=Math.sin(h*j)/k;e.w=b.w*g+d.w*h;e.x=b.x*g+d.x*h;e.y=b.y*g+d.y*h;e.z=b.z*g+d.z*h;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; +THREE.Quaternion.slerp=function(b,d,e,h){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var j=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.0010){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}g=Math.sin((1-h)*j)/k;h=Math.sin(h*j)/k;e.w=b.w*g+d.w*h;e.x=b.x*g+d.x*h;e.y=b.y*g+d.y*h;e.z=b.z*g+d.z*h;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; THREE.Face3=function(b,d,e,h,g,j){this.a=b;this.b=d;this.c=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,d,e,h,g,j,k){this.a=b;this.b=d;this.c=e;this.d=h;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; @@ -205,7 +205,7 @@ c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,V.elementBuffer) 1);c.uniform1f(T.rotation,0);c.uniform2fv(T.scale,E);c.bindBuffer(c.ARRAY_BUFFER,L.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,2,c.FLOAT,!1,16,8);c.bindTexture(c.TEXTURE_2D,L.tempTexture);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,L.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);for(m=0;m0.001&&w.scale>0.001){M[0]=w.x;M[1]=w.y;M[2]=w.z;u=w.size*w.scale/Aa;E[0]=u*r;E[1]=u;c.uniform3fv(T.screenPosition,M);c.uniform1f(T.rotation,w.rotation);c.uniform2fv(T.scale,E);c.uniform1f(T.opacity,w.opacity); +M[2];n.customUpdateCallback?n.customUpdateCallback(R,n):n.updateLensFlares(R);c.uniform1i(T.renderPink,0);c.disable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}for(m=0;m0.0010&&w.scale>0.0010){M[0]=w.x;M[1]=w.y;M[2]=w.z;u=w.size*w.scale/Aa;E[0]=u*r;E[1]=u;c.uniform3fv(T.screenPosition,M);c.uniform1f(T.rotation,w.rotation);c.uniform2fv(T.scale,E);c.uniform1f(T.opacity,w.opacity); sa(w.blending);K(w.texture,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Ea)}function W(f,o){f._modelViewMatrix.multiplyToArray(o.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function P(f){var o,n,i,m,y;if(f instanceof THREE.Mesh){n=f.geometry;for(o in n.geometryGroups){i=n.geometryGroups[o];y=!1;for(m in i.__webglCustomAttributes)if(i.__webglCustomAttributes[m].needsUpdate){y= !0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||y){y=c.DYNAMIC_DRAW;var s=void 0,t=void 0,w=void 0,r=void 0;w=void 0;var u=void 0,E=void 0,M=void 0,A=void 0,Q=void 0,U=void 0,R=void 0,T=void 0,Fa=void 0,H=void 0,D=void 0,I=void 0,Y=void 0;E=void 0;M=void 0;r=void 0;A=void 0;r=void 0;H=void 0;D=void 0;E=void 0;H=void 0;D=void 0;I=void 0;Y=void 0;H=void 0;D=void 0;I=void 0;Y=void 0;H=void 0;D=void 0;I=void 0; Y=void 0;H=void 0;D=void 0;I=void 0;r=void 0;A=void 0;u=void 0;w=void 0;w=void 0;var B=void 0,x=void 0,qa=void 0,Xa=void 0,ta=0,ya=0,Za=0,$a=0,Ja=0,Ka=0,ca=0,La=0,va=0,z=0,za=0;B=0;var Ba=i.__vertexArray,hb=i.__uvArray,ib=i.__uv2Array,Pa=i.__normalArray,ga=i.__tangentArray,Ca=i.__colorArray,ha=i.__skinVertexAArray,ia=i.__skinVertexBArray,ja=i.__skinIndexArray,ka=i.__skinWeightArray,jb=i.__morphTargetsArrays,Ra=i.__webglCustomAttributes;x=void 0;var Ma=i.__faceArray,Na=i.__lineArray,qb=i.__needsSmoothNormals; diff --git a/src/extras/io/JSONLoader.js b/src/extras/io/JSONLoader.js index 4771c015..4bbb4774 100644 --- a/src/extras/io/JSONLoader.js +++ b/src/extras/io/JSONLoader.js @@ -75,6 +75,8 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path var i, j, fi, offset, zLength, + + colorIndex, normalIndex, uvIndex, materialIndex, type, isQuad,