From 1fd801719f3e105e4510089a542a5a45be471181 Mon Sep 17 00:00:00 2001 From: alteredq Date: Tue, 5 Apr 2011 20:30:58 +0200 Subject: [PATCH] Added option to have flat shading for renderBufferImmediate. --- build/Three.js | 462 ++++++++++++++--------------- build/custom/ThreeWebGL.js | 316 ++++++++++---------- examples/webgl_collisions_box.html | 16 +- src/physics/Collisions.js | 14 +- src/renderers/WebGLRenderer.js | 50 +++- 5 files changed, 453 insertions(+), 405 deletions(-) diff --git a/build/Three.js b/build/Three.js index 66a402e654..80540914ae 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,c,d,f){this.set(b||0,c||0,d||0,f||1)}; THREE.Vector4.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y,b.z+c.z,b.w+c.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,c){this.set(b.x-c.x,b.y-c.y,b.z-c.z,b.w-c.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,c){this.set(this.x+(b.x-this.x)*c,this.y+(b.y-this.y)*c,this.z+(b.z-this.z)*c,this.w+(b.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(b){var c,d,f=b.objects,g=[];b=0;for(c=f.length;b0&&G>0&&P+G<1}var d,f,g,h,j,k,n,p,o,v, -y,u=b.geometry,A=u.vertices,E=[];d=0;for(f=u.faces.length;d0:o<0)){p=p.dot((new THREE.Vector3).sub(h,v))/ -o;v=v.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(c(v,h,j,k)){g={distance:this.origin.distanceTo(v),point:v,face:g,object:b};E.push(g)}}else if(g instanceof THREE.Face4&&(c(v,h,j,n)||c(v,j,k,n))){g={distance:this.origin.distanceTo(v),point:v,face:g,object:b};E.push(g)}}}return E}}; -THREE.Rectangle=function(){function b(){h=f-c;j=g-d}var c,d,f,g,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(n,p,o,v){k=!1;c=n;d=p;f=o;g=v;b()};this.addPoint=function(n,p){if(k){k=!1;c=n;d=p;f=n;g=p}else{c=cn?f:n;g=g>p?g:p}b()}; -this.add3Points=function(n,p,o,v,y,u){if(k){k=!1;c=no?n>y?n:y:o>y?o:y;g=p>v?p>u?p:u:v>u?v:u}else{c=no?n>y?n>f?n:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>v?p>u?p>g?p:g:u>g?u:g:v>u?v>g?v:g:u>g?u:g}b()};this.addRectangle=function(n){if(k){k=!1;c=n.getLeft();d=n.getTop();f=n.getRight();g=n.getBottom()}else{c=cn.getRight()? +THREE.Ray.prototype={intersectScene:function(b){var c,d,f=b.objects,g=[];b=0;for(c=f.length;b0&&G>0&&P+G<1}var d,f,g,h,j,k,n,p,o,x, +y,v=b.geometry,B=v.vertices,F=[];d=0;for(f=v.faces.length;d0:o<0)){p=p.dot((new THREE.Vector3).sub(h,x))/ +o;x=x.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(c(x,h,j,k)){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};F.push(g)}}else if(g instanceof THREE.Face4&&(c(x,h,j,n)||c(x,j,k,n))){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};F.push(g)}}}return F}}; +THREE.Rectangle=function(){function b(){h=f-c;j=g-d}var c,d,f,g,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(n,p,o,x){k=!1;c=n;d=p;f=o;g=x;b()};this.addPoint=function(n,p){if(k){k=!1;c=n;d=p;f=n;g=p}else{c=cn?f:n;g=g>p?g:p}b()}; +this.add3Points=function(n,p,o,x,y,v){if(k){k=!1;c=no?n>y?n:y:o>y?o:y;g=p>x?p>v?p:v:x>v?x:v}else{c=no?n>y?n>f?n:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>x?p>v?p>g?p:g:v>g?v:g:x>v?x>g?x:g:v>g?v:g}b()};this.addRectangle=function(n){if(k){k=!1;c=n.getLeft();d=n.getTop();f=n.getRight();g=n.getBottom()}else{c=cn.getRight()? f:n.getRight();g=g>n.getBottom()?g:n.getBottom()}b()};this.inflate=function(n){c-=n;d-=n;f+=n;g+=n;b()};this.minSelf=function(n){c=c>n.getLeft()?c:n.getLeft();d=d>n.getTop()?d:n.getTop();f=f=0&&Math.min(g,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){k=!0;g=f=d=c=0;b()};this.isEmpty=function(){return k}}; THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}}; -THREE.Matrix4=function(b,c,d,f,g,h,j,k,n,p,o,v,y,u,A,E){this.set(b||1,c||0,d||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,v||0,y||0,u||0,A||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,c,d,f,g,h,j,k,n,p,o,v,y,u,A,E){this.n11=b;this.n12=c;this.n13=d;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=v;this.n41=y;this.n42=u;this.n43=A;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,c,d){var f=THREE.Matrix4.__v1, +THREE.Matrix4=function(b,c,d,f,g,h,j,k,n,p,o,x,y,v,B,F){this.set(b||1,c||0,d||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,x||0,y||0,v||0,B||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,c,d,f,g,h,j,k,n,p,o,x,y,v,B,F){this.n11=b;this.n12=c;this.n13=d;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=y;this.n42=v;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,c,d){var f=THREE.Matrix4.__v1, g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(d,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 c=b.x,d=b.y,f=b.z,g=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*d+this.n23* f+this.n24)*g;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+d*this.n32+f*this.n33;b.normalize(); -return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,v=b.n32,y=b.n33,u=b.n34,A=b.n41,E=b.n42,G=b.n43,L=b.n44,V=c.n11,z=c.n12,N=c.n13,P=c.n14,S=c.n21,xa=c.n22, -sa=c.n23,qa=c.n24,e=c.n31,fa=c.n32,da=c.n33,ya=c.n34;this.n11=d*V+f*S+g*e;this.n12=d*z+f*xa+g*fa;this.n13=d*N+f*sa+g*da;this.n14=d*P+f*qa+g*ya+h;this.n21=j*V+k*S+n*e;this.n22=j*z+k*xa+n*fa;this.n23=j*N+k*sa+n*da;this.n24=j*P+k*qa+n*ya+p;this.n31=o*V+v*S+y*e;this.n32=o*z+v*xa+y*fa;this.n33=o*N+v*sa+y*da;this.n34=o*P+v*qa+y*ya+u;this.n41=A*V+E*S+G*e;this.n42=A*z+E*xa+G*fa;this.n43=A*N+E*sa+G*da;this.n44=A*P+E*qa+G*ya+L;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]= +return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,y=b.n33,v=b.n34,B=b.n41,F=b.n42,G=b.n43,N=b.n44,W=c.n11,z=c.n12,O=c.n13,P=c.n14,S=c.n21,xa=c.n22, +sa=c.n23,qa=c.n24,e=c.n31,fa=c.n32,da=c.n33,ya=c.n34;this.n11=d*W+f*S+g*e;this.n12=d*z+f*xa+g*fa;this.n13=d*O+f*sa+g*da;this.n14=d*P+f*qa+g*ya+h;this.n21=j*W+k*S+n*e;this.n22=j*z+k*xa+n*fa;this.n23=j*O+k*sa+n*da;this.n24=j*P+k*qa+n*ya+p;this.n31=o*W+x*S+y*e;this.n32=o*z+x*xa+y*fa;this.n33=o*O+x*sa+y*da;this.n34=o*P+x*qa+y*ya+v;this.n41=B*W+F*S+G*e;this.n42=B*z+F*xa+G*fa;this.n43=B*O+F*sa+G*da;this.n44=B*P+F*qa+G*ya+N;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]= this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*= -b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,v=this.n34,y=this.n41,u=this.n42,A=this.n43,E=this.n44;return f*j*p*y-d*k*p*y-f*h*o*y+c*k*o*y+d*h*v*y-c*j*v*y-f*j*n*u+d*k*n*u+f*g*o*u-b*k*o*u-d*g*v*u+b*j*v*u+f*h*n*A-c*k*n*A-f*g*p*A+b*k*p*A+c*g*v*A-b*h*v*A-d*h*n*E+c*j*n*E+d*g*p*E-b*j*p*E-c*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= +b;return this},determinant:function(){var b=this.n11,c=this.n12,d=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,y=this.n41,v=this.n42,B=this.n43,F=this.n44;return f*j*p*y-d*k*p*y-f*h*o*y+c*k*o*y+d*h*x*y-c*j*x*y-f*j*n*v+d*k*n*v+f*g*o*v-b*k*o*v-d*g*x*v+b*j*x*v+f*h*n*B-c*k*n*B-f*g*p*B+b*k*p*B+c*g*x*B-b*h*x*B-d*h*n*F+c*j*n*F+d*g*p*F-b*j*p*F-c*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= this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]= this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42; b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0, @@ -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-d,h=b.x,j=b.y,k=b.z,n=g*h,p=g*j;this.set(n*h+d,n*j-f*k,n*k+f*j,0,n*j+f*k,p*j+d,p*k-f*h,0,n*k-f*j,p*k+f*h,g*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var c=b.x,d=b.y,f=b.z;b=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(f);f=Math.sin(f);var j=b*d,k=c*d;this.n11=g*h;this.n12=-g*f;this.n13=d;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-c*g;this.n31=-j*h+c*f;this.n32=j*f+c*h;this.n33= b*g;return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,g=b.w,h=c+c,j=d+d,k=f+f;b=c*h;var n=c*j;c*=k;var p=d*j;d*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=n-g;this.n13=c+j;this.n21=n+g;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y;b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14= b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; -THREE.Matrix4.makeInvert=function(b,c){var d=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,v=b.n32,y=b.n33,u=b.n34,A=b.n41,E=b.n42,G=b.n43,L=b.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*u*E-p*y*E+p*v*G-k*u*G-n*v*L+k*y*L;c.n12=h*y*E-g*u*E-h*v*G+f*u*G+g*v*L-f*y*L;c.n13=g*p*E-h*n*E+h*k*G-f*p*G-g*k*L+f*n*L;c.n14=h*n*v-g*p*v-h*k*y+f*p*y+g*k*u-f*n*u;c.n21=p*y*A-n*u*A-p*o*G+j*u*G+n*o*L-j*y*L;c.n22=g*u*A-h*y*A+h*o*G-d*u*G-g*o*L+d*y*L;c.n23=h*n*A-g*p*A-h*j*G+d*p*G+g*j*L-d*n*L; -c.n24=g*p*o-h*n*o+h*j*y-d*p*y-g*j*u+d*n*u;c.n31=k*u*A-p*v*A+p*o*E-j*u*E-k*o*L+j*v*L;c.n32=h*v*A-f*u*A-h*o*E+d*u*E+f*o*L-d*v*L;c.n33=g*p*A-h*k*A+h*j*E-d*p*E-f*j*L+d*k*L;c.n34=h*k*o-f*p*o-h*j*v+d*p*v+f*j*u-d*k*u;c.n41=n*v*A-k*y*A-n*o*E+j*y*E+k*o*G-j*v*G;c.n42=f*y*A-g*v*A+g*o*E-d*y*E-f*o*G+d*v*G;c.n43=g*k*A-f*n*A-g*j*E+d*n*E+f*j*G-d*k*G;c.n44=f*n*o-g*k*o+g*j*v-d*n*v-f*j*y+d*k*y;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,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,v=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;d[0]=b*f;d[1]=b*g;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*n;d[6]=b*p;d[7]=b*o;d[8]=b*v;return c}; +THREE.Matrix4.makeInvert=function(b,c){var d=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,y=b.n33,v=b.n34,B=b.n41,F=b.n42,G=b.n43,N=b.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*v*F-p*y*F+p*x*G-k*v*G-n*x*N+k*y*N;c.n12=h*y*F-g*v*F-h*x*G+f*v*G+g*x*N-f*y*N;c.n13=g*p*F-h*n*F+h*k*G-f*p*G-g*k*N+f*n*N;c.n14=h*n*x-g*p*x-h*k*y+f*p*y+g*k*v-f*n*v;c.n21=p*y*B-n*v*B-p*o*G+j*v*G+n*o*N-j*y*N;c.n22=g*v*B-h*y*B+h*o*G-d*v*G-g*o*N+d*y*N;c.n23=h*n*B-g*p*B-h*j*G+d*p*G+g*j*N-d*n*N; +c.n24=g*p*o-h*n*o+h*j*y-d*p*y-g*j*v+d*n*v;c.n31=k*v*B-p*x*B+p*o*F-j*v*F-k*o*N+j*x*N;c.n32=h*x*B-f*v*B-h*o*F+d*v*F+f*o*N-d*x*N;c.n33=g*p*B-h*k*B+h*j*F-d*p*F-f*j*N+d*k*N;c.n34=h*k*o-f*p*o-h*j*x+d*p*x+f*j*v-d*k*v;c.n41=n*x*B-k*y*B-n*o*F+j*y*F+k*o*G-j*x*G;c.n42=f*y*B-g*x*B+g*o*F-d*y*F-f*o*G+d*x*G;c.n43=g*k*B-f*n*B-g*j*F+d*n*F+f*j*G-d*k*G;c.n44=f*n*o-g*k*o+g*j*x-d*n*x-f*j*y+d*k*y;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,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;d[0]=b*f;d[1]=b*g;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*n;d[6]=b*p;d[7]=b*o;d[8]=b*x;return c}; THREE.Matrix4.makeFrustum=function(b,c,d,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*g/(f-d);j.n23=(f+d)/(f-d);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,c,d,f){var g;b=d*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,d,f)}; THREE.Matrix4.makeOrtho=function(b,c,d,f,g,h){var j,k,n,p;j=new THREE.Matrix4;k=c-b;n=d-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((d+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 c c,d)}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==undefined?f:1)}; THREE.Quaternion.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,f=b.y*c,g=b.z*c;b=Math.cos(f);f=Math.sin(f);c=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(d);d=Math.sin(d);var j=b*c,k=f*g;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*g*d;this.z=b*g*h-f*c*d;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 c=this.x,d=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=c*b+g*h+d*k-f*j;this.y=d*b+g*j+f*h-c*k;this.z=f*b+g*k+c*j-d*h;this.w=g*b-c*h-d*j-f*k;return this}, -multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*d+j*g-k*f,o=n*f+k*d-h*g,v=n*g+h*f-j*d;d=-h*d-j*f-k*g;c.x=p*n+d*-h+o*-k-v*-j;c.y=o*n+d*-j+v*-h-p*-k;c.z=v*n+d*-k+p*-j-o*-h;return c}}; +multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*d+j*g-k*f,o=n*f+k*d-h*g,x=n*g+h*f-j*d;d=-h*d-j*f-k*g;c.x=p*n+d*-h+o*-k-x*-j;c.y=o*n+d*-j+x*-h-p*-k;c.z=x*n+d*-k+p*-j-o*-h;return c}}; THREE.Quaternion.slerp=function(b,c,d,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1){d.w=b.w;d.x=b.x;d.y=b.y;d.z=b.z;return d}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){d.w=0.5*(b.w+c.w);d.x=0.5*(b.x+c.x);d.y=0.5*(b.y+c.y);d.z=0.5*(b.z+c.z);return d}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*g+c.w*f;d.x=b.x*g+c.x*f;d.y=b.y*g+c.y*f;d.z=b.z*g+c.z*f;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; THREE.Face3=function(b,c,d,f,g,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=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,c,d,f,g,h,j){this.a=b;this.b=c;this.c=d;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,c){this.set(b||0,c||0)}; @@ -56,17 +56,17 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,d;b=0;for(c=this.f d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var c,d,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 c=1,d=this.vertices.length;cthis.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,c=0,d=this.vertices.length;cthis.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];o=this.points[d[1]]; -v=this.points[d[2]];y=this.points[d[3]];k=j*j;n=j*k;f.x=c(p.x,o.x,v.x,y.x,j,k,n);f.y=c(p.y,o.y,v.y,y.y,j,k,n);f.z=c(p.z,o.z,v.z,y.z,j,k,n);return f};this.getControlPointsArray=function(){var u,A,E=this.points.length,G=[];for(u=0;uthis.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];o=this.points[d[1]]; +x=this.points[d[2]];y=this.points[d[3]];k=j*j;n=j*k;f.x=c(p.x,o.x,x.x,y.x,j,k,n);f.y=c(p.y,o.y,x.y,y.y,j,k,n);f.z=c(p.z,o.z,x.z,y.z,j,k,n);return f};this.getControlPointsArray=function(){var v,B,F=this.points.length,G=[];for(v=0;v1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u);f=f<0?0:1}if(d==="pos"){d=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.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",u,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);d.x=g[0];d.y=g[1];d.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(d);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(d=== -"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(d==="scl"){d=b.scale;d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;u1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v);f=f<0?0:1}if(d==="pos"){d=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.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",v,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",v,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);d.x=g[0];d.y=g[1];d.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(d);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(d=== +"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(d==="scl"){d=b.scale;d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(v=0;vb.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];n=b[d[2]];p=b[d[3]];d=g*g;j=g*d;f[0]=this.interpolate(h[0],k[0],n[0],p[0],g,d,j);f[1]=this.interpolate(h[1],k[1],n[1],p[1],g,d,j);f[2]=this.interpolate(h[2],k[2],n[2],p[2],g,d,j);return f}; THREE.Animation.prototype.interpolate=function(b,c,d,f,g,h,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var f=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d0?d:0:d>=0?d:d+f.length;d>=0;d--)if(f[d][b]!==undefined)return f[d];return this.data.hierarchy[c].keys[f.length-1]}; @@ -139,65 +139,65 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){b=d.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&&ra>=0&&aa>=0&&pa>=0)return!0;else if(Ga<0&&ra<0||aa<0&&pa<0)return!1;else{if(Ga<0)ya=Math.max(ya,Ga/(Ga-ra));else ra<0&&(Fa=Math.min(Fa,Ga/(Ga-ra)));if(aa<0)ya=Math.max(ya,aa/(aa-pa));else pa<0&&(Fa=Math.min(Fa,aa/(aa-pa)));if(FaGa&&j.positionScreen.z0&&P.z<1){Sa=z[V]=z[V]||new THREE.RenderableParticle;V++;L=Sa;L.x=P.x/P.w;L.y=P.y/P.w;L.z=P.z;L.rotation=Ea.rotation.z;L.scale.x=Ea.scale.x*Math.abs(L.x-(P.x+da.projectionMatrix.n11)/(P.w+da.projectionMatrix.n14));L.scale.y=Ea.scale.y*Math.abs(L.y-(P.y+da.projectionMatrix.n22)/(P.w+da.projectionMatrix.n24));L.materials=Ea.materials;Fa.push(L)}}}}ya&&Fa.sort(c);return Fa}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){d=j;f=k;g=d/2;h=f/2};this.render=function(j,k){var n,p,o,v,y,u,A,E;b=c.projectScene(j,k);n=0;for(p=b.length;n>1;Na=ga.height>>1;ea=ta.scale.x*n;ua=ta.scale.y*p;ca=ea*Q;va=ua*Na;x.set(W.x-ca,W.y-va,W.x+ca,W.y+va);if(m.instersects(x)){o.save();o.translate(W.x,W.y); -o.rotate(-ta.rotation);o.scale(ea,-ua);o.translate(-Q,-Na);o.drawImage(ga,0,0);o.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){ca=ta.scale.x*n;va=ta.scale.y*p;x.set(W.x-ca,W.y-va,W.x+ca,W.y+va);if(m.instersects(x)){d(ea.color.__styleString);ua=ea.color.__styleString;if(G!=ua)o.fillStyle=G=ua;o.save();o.translate(W.x,W.y);o.rotate(-ta.rotation);o.scale(ca,va);ea.program(o);o.restore()}}}function Ja(W,ta,ea,ca){b(ca.opacity);c(ca.blending);o.beginPath();o.moveTo(W.positionScreen.x, -W.positionScreen.y);o.lineTo(ta.positionScreen.x,ta.positionScreen.y);o.closePath();if(ca instanceof THREE.LineBasicMaterial){ma.__styleString=ca.color.__styleString;W=ca.linewidth;if(L!=W)o.lineWidth=L=W;W=ca.linecap;if(V!=W)o.lineCap=V=W;W=ca.linejoin;if(z!=W)o.lineJoin=z=W;d(ma.__styleString);o.stroke();x.inflate(ca.linewidth*2)}}function Qa(W,ta,ea,ca,va,ua,ga,Q,Na){b(Q.opacity);c(Q.blending);e=W.positionScreen.x;fa=W.positionScreen.y;da=ta.positionScreen.x;ya=ta.positionScreen.y;Fa=ea.positionScreen.x; -Ga=ea.positionScreen.y;Z(e,fa,da,ya,Fa,Ga);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Ta=ga.uvs[0];Ma(e,fa,da,ya,Fa,Ga,Q.map.image,Ta[ca].u,Ta[ca].v,Ta[va].u,Ta[va].v,Ta[ua].u,Ta[ua].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=wa.matrixWorldInverse;H.copy(ga.vertexNormalsWorld[0]);R=(H.x*W.n11+H.y*W.n12+H.z*W.n13)*0.5+0.5;$=-(H.x*W.n21+H.y*W.n22+H.z*W.n23)*0.5+0.5;H.copy(ga.vertexNormalsWorld[1]);na=(H.x* -W.n11+H.y*W.n12+H.z*W.n13)*0.5+0.5;Ba=-(H.x*W.n21+H.y*W.n22+H.z*W.n23)*0.5+0.5;H.copy(ga.vertexNormalsWorld[2]);ha=(H.x*W.n11+H.y*W.n12+H.z*W.n13)*0.5+0.5;ka=-(H.x*W.n21+H.y*W.n22+H.z*W.n23)*0.5+0.5;Ma(e,fa,da,ya,Fa,Ga,Q.envMap.image,R,$,na,Ba,ha,ka)}}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Ta= -ga.uvs[0];Ma(e,fa,da,ya,Fa,Ga,Q.map.image,Ta[ca].u,Ta[ca].v,Ta[va].u,Ta[va].v,Ta[ua].u,Ta[ua].v)}c(THREE.SubtractiveBlending)}if(w)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==3){Da.r=ja.r=la.r=O.r;Da.g=ja.g=la.g=O.g;Da.b=ja.b=la.b=O.b;Aa(Na,ga.v1.positionWorld,ga.vertexNormalsWorld[0],Da);Aa(Na,ga.v2.positionWorld,ga.vertexNormalsWorld[1],ja);Aa(Na,ga.v3.positionWorld,ga.vertexNormalsWorld[2],la);Ea.r=(ja.r+la.r)*0.5;Ea.g=(ja.g+la.g)*0.5;Ea.b=(ja.b+la.b)*0.5;Ya= -Va(Da,ja,la,Ea);Ma(e,fa,da,ya,Fa,Ga,Ya,0,0,1,0,0,1)}else{B.r=O.r;B.g=O.g;B.b=O.b;Aa(Na,ga.centroidWorld,ga.normalWorld,B);ma.r=Q.color.r*B.r;ma.g=Q.color.g*B.g;ma.b=Q.color.b*B.b;ma.updateStyleString();Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=wa.near; -$a=wa.far;Da.r=Da.g=Da.b=1-gb(W.positionScreen.z,Sa,$a);ja.r=ja.g=ja.b=1-gb(ta.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(ea.positionScreen.z,Sa,$a);Ea.r=(ja.r+la.r)*0.5;Ea.g=(ja.g+la.g)*0.5;Ea.b=(ja.b+la.b)*0.5;Ya=Va(Da,ja,la,Ea);Ma(e,fa,da,ya,Fa,Ga,Ya,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=hb(ga.normalWorld.x);ma.g=hb(ga.normalWorld.y);ma.b=hb(ga.normalWorld.z);ma.updateStyleString();Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin): -fb(ma.__styleString)}}function D(W,ta,ea,ca,va,ua,ga,Q,Na){b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){Qa(W,ta,ca,0,1,3,ga,Q,Na);Qa(va,ea,ua,1,2,3,ga,Q,Na)}else{e=W.positionScreen.x;fa=W.positionScreen.y;da=ta.positionScreen.x;ya=ta.positionScreen.y;Fa=ea.positionScreen.x;Ga=ea.positionScreen.y;ra=ca.positionScreen.x;aa=ca.positionScreen.y;pa=va.positionScreen.x;za=va.positionScreen.y;ia=ua.positionScreen.x;Y=ua.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){t(e,fa,da,ya,Fa,Ga,ra,aa); -Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(w)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==4){Da.r=ja.r=la.r=Ea.r=O.r;Da.g=ja.g=la.g=Ea.g=O.g;Da.b=ja.b=la.b=Ea.b=O.b;Aa(Na,ga.v1.positionWorld,ga.vertexNormalsWorld[0],Da);Aa(Na,ga.v2.positionWorld,ga.vertexNormalsWorld[1],ja);Aa(Na,ga.v4.positionWorld,ga.vertexNormalsWorld[3],la);Aa(Na, -ga.v3.positionWorld,ga.vertexNormalsWorld[2],Ea);Ya=Va(Da,ja,la,Ea);Z(e,fa,da,ya,ra,aa);Ma(e,fa,da,ya,ra,aa,Ya,0,0,1,0,0,1);Z(pa,za,Fa,Ga,ia,Y);Ma(pa,za,Fa,Ga,ia,Y,Ya,1,0,1,1,0,1)}else{B.r=O.r;B.g=O.g;B.b=O.b;Aa(Na,ga.centroidWorld,ga.normalWorld,B);ma.r=Q.color.r*B.r;ma.g=Q.color.g*B.g;ma.b=Q.color.b*B.b;ma.updateStyleString();t(e,fa,da,ya,Fa,Ga,ra,aa);Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else{t(e,fa,da,ya,Fa,Ga,ra,aa); -Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=hb(ga.normalWorld.x);ma.g=hb(ga.normalWorld.y);ma.b=hb(ga.normalWorld.z);ma.updateStyleString();t(e,fa,da,ya,Fa,Ga,ra,aa);Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=wa.near;$a=wa.far;Da.r=Da.g=Da.b=1-gb(W.positionScreen.z, -Sa,$a);ja.r=ja.g=ja.b=1-gb(ta.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(ca.positionScreen.z,Sa,$a);Ea.r=Ea.g=Ea.b=1-gb(ea.positionScreen.z,Sa,$a);Ya=Va(Da,ja,la,Ea);Z(e,fa,da,ya,ra,aa);Ma(e,fa,da,ya,ra,aa,Ya,0,0,1,0,0,1);Z(pa,za,Fa,Ga,ia,Y);Ma(pa,za,Fa,Ga,ia,Y,Ya,1,0,1,1,0,1)}}}function Z(W,ta,ea,ca,va,ua){o.beginPath();o.moveTo(W,ta);o.lineTo(ea,ca);o.lineTo(va,ua);o.lineTo(W,ta);o.closePath()}function t(W,ta,ea,ca,va,ua,ga,Q){o.beginPath();o.moveTo(W,ta);o.lineTo(ea,ca);o.lineTo(va,ua);o.lineTo(ga, -Q);o.lineTo(W,ta);o.closePath()}function ab(W,ta,ea,ca){if(L!=ta)o.lineWidth=L=ta;if(V!=ea)o.lineCap=V=ea;if(z!=ca)o.lineJoin=z=ca;d(W);o.stroke();x.inflate(ta*2)}function fb(W){if(G!=W)o.fillStyle=G=W;o.fill()}function Ma(W,ta,ea,ca,va,ua,ga,Q,Na,db,Ua,bb,lb){var Pa,ib;Pa=ga.width-1;ib=ga.height-1;Q*=Pa;Na*=ib;db*=Pa;Ua*=ib;bb*=Pa;lb*=ib;ea-=W;ca-=ta;va-=W;ua-=ta;db-=Q;Ua-=Na;bb-=Q;lb-=Na;Pa=db*lb-bb*Ua;if(Pa!=0){ib=1/Pa;Pa=(lb*ea-Ua*va)*ib;Ua=(lb*ca-Ua*ua)*ib;ea=(db*va-bb*ea)*ib;ca=(db*ua-bb*ca)* -ib;W=W-Pa*Q-ea*Na;ta=ta-Ua*Q-ca*Na;o.save();o.transform(Pa,Ua,ea,ca,W,ta);o.clip();o.drawImage(ga,0,0);o.restore()}}function Va(W,ta,ea,ca){var va=~~(W.r*255),ua=~~(W.g*255);W=~~(W.b*255);var ga=~~(ta.r*255),Q=~~(ta.g*255);ta=~~(ta.b*255);var Na=~~(ea.r*255),db=~~(ea.g*255);ea=~~(ea.b*255);var Ua=~~(ca.r*255),bb=~~(ca.g*255);ca=~~(ca.b*255);X[0]=va<0?0:va>255?255:va;X[1]=ua<0?0:ua>255?255:ua;X[2]=W<0?0:W>255?255:W;X[4]=ga<0?0:ga>255?255:ga;X[5]=Q<0?0:Q>255?255:Q;X[6]=ta<0?0:ta>255?255:ta;X[8]=Na< -0?0:Na>255?255:Na;X[9]=db<0?0:db>255?255:db;X[10]=ea<0?0:ea>255?255:ea;X[12]=Ua<0?0:Ua>255?255:Ua;X[13]=bb<0?0:bb>255?255:bb;X[14]=ca<0?0:ca>255?255:ca;J.putImageData(M,0,0);Ca.drawImage(F,0,0);return U}function gb(W,ta,ea){W=(W-ta)/(ea-ta);return W*W*(3-2*W)}function hb(W){W=(W+1)*0.5;return W<0?0:W>1?1:W}function Wa(W,ta){var ea=ta.x-W.x,ca=ta.y-W.y,va=1/Math.sqrt(ea*ea+ca*ca);ea*=va;ca*=va;ta.x+=ea;ta.y+=ca;W.x-=ea;W.y-=ca}var eb,Oa,Ka,La,T,Ra,Xa,Za;this.autoClear?this.clear():o.setTransform(1, -0,0,-1,n,p);f=g.projectScene(oa,wa,this.sortElements);(w=oa.lights.length>0)&&cb(oa);eb=0;for(Oa=f.length;eb0&&P.z<1){Sa=z[W]=z[W]||new THREE.RenderableParticle;W++;N=Sa;N.x=P.x/P.w;N.y=P.y/P.w;N.z=P.z;N.rotation=Ea.rotation.z;N.scale.x=Ea.scale.x*Math.abs(N.x-(P.x+da.projectionMatrix.n11)/(P.w+da.projectionMatrix.n14));N.scale.y=Ea.scale.y*Math.abs(N.y-(P.y+da.projectionMatrix.n22)/(P.w+da.projectionMatrix.n24));N.materials=Ea.materials;Fa.push(N)}}}}ya&&Fa.sort(c);return Fa}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){d=j;f=k;g=d/2;h=f/2};this.render=function(j,k){var n,p,o,x,y,v,B,F;b=c.projectScene(j,k);n=0;for(p=b.length;n>1;Na=ga.height>>1;ea=ta.scale.x*n;ua=ta.scale.y*p;ca=ea*Q;va=ua*Na;u.set(X.x-ca,X.y-va,X.x+ca,X.y+va);if(m.instersects(u)){o.save();o.translate(X.x,X.y); +o.rotate(-ta.rotation);o.scale(ea,-ua);o.translate(-Q,-Na);o.drawImage(ga,0,0);o.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){ca=ta.scale.x*n;va=ta.scale.y*p;u.set(X.x-ca,X.y-va,X.x+ca,X.y+va);if(m.instersects(u)){d(ea.color.__styleString);ua=ea.color.__styleString;if(G!=ua)o.fillStyle=G=ua;o.save();o.translate(X.x,X.y);o.rotate(-ta.rotation);o.scale(ca,va);ea.program(o);o.restore()}}}function Ja(X,ta,ea,ca){b(ca.opacity);c(ca.blending);o.beginPath();o.moveTo(X.positionScreen.x, +X.positionScreen.y);o.lineTo(ta.positionScreen.x,ta.positionScreen.y);o.closePath();if(ca instanceof THREE.LineBasicMaterial){ma.__styleString=ca.color.__styleString;X=ca.linewidth;if(N!=X)o.lineWidth=N=X;X=ca.linecap;if(W!=X)o.lineCap=W=X;X=ca.linejoin;if(z!=X)o.lineJoin=z=X;d(ma.__styleString);o.stroke();u.inflate(ca.linewidth*2)}}function Qa(X,ta,ea,ca,va,ua,ga,Q,Na){b(Q.opacity);c(Q.blending);e=X.positionScreen.x;fa=X.positionScreen.y;da=ta.positionScreen.x;ya=ta.positionScreen.y;Fa=ea.positionScreen.x; +Ga=ea.positionScreen.y;Z(e,fa,da,ya,Fa,Ga);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Ta=ga.uvs[0];Ma(e,fa,da,ya,Fa,Ga,Q.map.image,Ta[ca].u,Ta[ca].v,Ta[va].u,Ta[va].v,Ta[ua].u,Ta[ua].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){X=wa.matrixWorldInverse;H.copy(ga.vertexNormalsWorld[0]);R=(H.x*X.n11+H.y*X.n12+H.z*X.n13)*0.5+0.5;$=-(H.x*X.n21+H.y*X.n22+H.z*X.n23)*0.5+0.5;H.copy(ga.vertexNormalsWorld[1]);na=(H.x* +X.n11+H.y*X.n12+H.z*X.n13)*0.5+0.5;Ba=-(H.x*X.n21+H.y*X.n22+H.z*X.n23)*0.5+0.5;H.copy(ga.vertexNormalsWorld[2]);ha=(H.x*X.n11+H.y*X.n12+H.z*X.n13)*0.5+0.5;ka=-(H.x*X.n21+H.y*X.n22+H.z*X.n23)*0.5+0.5;Ma(e,fa,da,ya,Fa,Ga,Q.envMap.image,R,$,na,Ba,ha,ka)}}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Ta= +ga.uvs[0];Ma(e,fa,da,ya,Fa,Ga,Q.map.image,Ta[ca].u,Ta[ca].v,Ta[va].u,Ta[va].v,Ta[ua].u,Ta[ua].v)}c(THREE.SubtractiveBlending)}if(w)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==3){Da.r=ja.r=la.r=M.r;Da.g=ja.g=la.g=M.g;Da.b=ja.b=la.b=M.b;Aa(Na,ga.v1.positionWorld,ga.vertexNormalsWorld[0],Da);Aa(Na,ga.v2.positionWorld,ga.vertexNormalsWorld[1],ja);Aa(Na,ga.v3.positionWorld,ga.vertexNormalsWorld[2],la);Ea.r=(ja.r+la.r)*0.5;Ea.g=(ja.g+la.g)*0.5;Ea.b=(ja.b+la.b)*0.5;Ya= +Va(Da,ja,la,Ea);Ma(e,fa,da,ya,Fa,Ga,Ya,0,0,1,0,0,1)}else{A.r=M.r;A.g=M.g;A.b=M.b;Aa(Na,ga.centroidWorld,ga.normalWorld,A);ma.r=Q.color.r*A.r;ma.g=Q.color.g*A.g;ma.b=Q.color.b*A.b;ma.updateStyleString();Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=wa.near; +$a=wa.far;Da.r=Da.g=Da.b=1-gb(X.positionScreen.z,Sa,$a);ja.r=ja.g=ja.b=1-gb(ta.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(ea.positionScreen.z,Sa,$a);Ea.r=(ja.r+la.r)*0.5;Ea.g=(ja.g+la.g)*0.5;Ea.b=(ja.b+la.b)*0.5;Ya=Va(Da,ja,la,Ea);Ma(e,fa,da,ya,Fa,Ga,Ya,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=hb(ga.normalWorld.x);ma.g=hb(ga.normalWorld.y);ma.b=hb(ga.normalWorld.z);ma.updateStyleString();Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin): +fb(ma.__styleString)}}function D(X,ta,ea,ca,va,ua,ga,Q,Na){b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){Qa(X,ta,ca,0,1,3,ga,Q,Na);Qa(va,ea,ua,1,2,3,ga,Q,Na)}else{e=X.positionScreen.x;fa=X.positionScreen.y;da=ta.positionScreen.x;ya=ta.positionScreen.y;Fa=ea.positionScreen.x;Ga=ea.positionScreen.y;ra=ca.positionScreen.x;aa=ca.positionScreen.y;pa=va.positionScreen.x;za=va.positionScreen.y;ia=ua.positionScreen.x;Y=ua.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){t(e,fa,da,ya,Fa,Ga,ra,aa); +Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(w)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==4){Da.r=ja.r=la.r=Ea.r=M.r;Da.g=ja.g=la.g=Ea.g=M.g;Da.b=ja.b=la.b=Ea.b=M.b;Aa(Na,ga.v1.positionWorld,ga.vertexNormalsWorld[0],Da);Aa(Na,ga.v2.positionWorld,ga.vertexNormalsWorld[1],ja);Aa(Na,ga.v4.positionWorld,ga.vertexNormalsWorld[3],la);Aa(Na, +ga.v3.positionWorld,ga.vertexNormalsWorld[2],Ea);Ya=Va(Da,ja,la,Ea);Z(e,fa,da,ya,ra,aa);Ma(e,fa,da,ya,ra,aa,Ya,0,0,1,0,0,1);Z(pa,za,Fa,Ga,ia,Y);Ma(pa,za,Fa,Ga,ia,Y,Ya,1,0,1,1,0,1)}else{A.r=M.r;A.g=M.g;A.b=M.b;Aa(Na,ga.centroidWorld,ga.normalWorld,A);ma.r=Q.color.r*A.r;ma.g=Q.color.g*A.g;ma.b=Q.color.b*A.b;ma.updateStyleString();t(e,fa,da,ya,Fa,Ga,ra,aa);Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else{t(e,fa,da,ya,Fa,Ga,ra,aa); +Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=hb(ga.normalWorld.x);ma.g=hb(ga.normalWorld.y);ma.b=hb(ga.normalWorld.z);ma.updateStyleString();t(e,fa,da,ya,Fa,Ga,ra,aa);Q.wireframe?ab(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(ma.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=wa.near;$a=wa.far;Da.r=Da.g=Da.b=1-gb(X.positionScreen.z, +Sa,$a);ja.r=ja.g=ja.b=1-gb(ta.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(ca.positionScreen.z,Sa,$a);Ea.r=Ea.g=Ea.b=1-gb(ea.positionScreen.z,Sa,$a);Ya=Va(Da,ja,la,Ea);Z(e,fa,da,ya,ra,aa);Ma(e,fa,da,ya,ra,aa,Ya,0,0,1,0,0,1);Z(pa,za,Fa,Ga,ia,Y);Ma(pa,za,Fa,Ga,ia,Y,Ya,1,0,1,1,0,1)}}}function Z(X,ta,ea,ca,va,ua){o.beginPath();o.moveTo(X,ta);o.lineTo(ea,ca);o.lineTo(va,ua);o.lineTo(X,ta);o.closePath()}function t(X,ta,ea,ca,va,ua,ga,Q){o.beginPath();o.moveTo(X,ta);o.lineTo(ea,ca);o.lineTo(va,ua);o.lineTo(ga, +Q);o.lineTo(X,ta);o.closePath()}function ab(X,ta,ea,ca){if(N!=ta)o.lineWidth=N=ta;if(W!=ea)o.lineCap=W=ea;if(z!=ca)o.lineJoin=z=ca;d(X);o.stroke();u.inflate(ta*2)}function fb(X){if(G!=X)o.fillStyle=G=X;o.fill()}function Ma(X,ta,ea,ca,va,ua,ga,Q,Na,db,Ua,bb,lb){var Pa,ib;Pa=ga.width-1;ib=ga.height-1;Q*=Pa;Na*=ib;db*=Pa;Ua*=ib;bb*=Pa;lb*=ib;ea-=X;ca-=ta;va-=X;ua-=ta;db-=Q;Ua-=Na;bb-=Q;lb-=Na;Pa=db*lb-bb*Ua;if(Pa!=0){ib=1/Pa;Pa=(lb*ea-Ua*va)*ib;Ua=(lb*ca-Ua*ua)*ib;ea=(db*va-bb*ea)*ib;ca=(db*ua-bb*ca)* +ib;X=X-Pa*Q-ea*Na;ta=ta-Ua*Q-ca*Na;o.save();o.transform(Pa,Ua,ea,ca,X,ta);o.clip();o.drawImage(ga,0,0);o.restore()}}function Va(X,ta,ea,ca){var va=~~(X.r*255),ua=~~(X.g*255);X=~~(X.b*255);var ga=~~(ta.r*255),Q=~~(ta.g*255);ta=~~(ta.b*255);var Na=~~(ea.r*255),db=~~(ea.g*255);ea=~~(ea.b*255);var Ua=~~(ca.r*255),bb=~~(ca.g*255);ca=~~(ca.b*255);U[0]=va<0?0:va>255?255:va;U[1]=ua<0?0:ua>255?255:ua;U[2]=X<0?0:X>255?255:X;U[4]=ga<0?0:ga>255?255:ga;U[5]=Q<0?0:Q>255?255:Q;U[6]=ta<0?0:ta>255?255:ta;U[8]=Na< +0?0:Na>255?255:Na;U[9]=db<0?0:db>255?255:db;U[10]=ea<0?0:ea>255?255:ea;U[12]=Ua<0?0:Ua>255?255:Ua;U[13]=bb<0?0:bb>255?255:bb;U[14]=ca<0?0:ca>255?255:ca;J.putImageData(L,0,0);Ca.drawImage(E,0,0);return V}function gb(X,ta,ea){X=(X-ta)/(ea-ta);return X*X*(3-2*X)}function hb(X){X=(X+1)*0.5;return X<0?0:X>1?1:X}function Wa(X,ta){var ea=ta.x-X.x,ca=ta.y-X.y,va=1/Math.sqrt(ea*ea+ca*ca);ea*=va;ca*=va;ta.x+=ea;ta.y+=ca;X.x-=ea;X.y-=ca}var eb,Oa,Ka,La,T,Ra,Xa,Za;this.autoClear?this.clear():o.setTransform(1, +0,0,-1,n,p);f=g.projectScene(oa,wa,this.sortElements);(w=oa.lights.length>0)&&cb(oa);eb=0;for(Oa=f.length;eb0){pa.r+=Y.color.r*ma;pa.g+=Y.color.g*ma;pa.b+=Y.color.b*ma}}else if(Y instanceof THREE.PointLight){qa.sub(Y.position,aa.centroidWorld);qa.normalize();ma=aa.normalWorld.dot(qa)*Y.intensity;if(ma>0){pa.r+=Y.color.r*ma;pa.g+=Y.color.g*ma;pa.b+=Y.color.b*ma}}}}function c(ra,aa,pa,za,ia,Y){da= -f(ya++);da.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)z.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(V){N.r=P.r;N.g=P.g;N.b=P.b;b(Y,za,N);z.r=ia.color.r*N.r;z.g=ia.color.g*N.g;z.b=ia.color.b*N.b;z.updateStyleString()}else z.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshDepthMaterial){sa= +f(ya++);da.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)z.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(W){O.r=P.r;O.g=P.g;O.b=P.b;b(Y,za,O);z.r=ia.color.r*O.r;z.g=ia.color.g*O.g;z.b=ia.color.b*O.b;z.updateStyleString()}else z.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshDepthMaterial){sa= 1-ia.__2near/(ia.__farPlusNear-za.z*ia.__farMinusNear);z.setRGB(sa,sa,sa)}else ia instanceof THREE.MeshNormalMaterial&&z.setRGB(g(za.normalWorld.x),g(za.normalWorld.y),g(za.normalWorld.z));ia.wireframe?da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ia.wireframeLinewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.wireframeLinecap+"; stroke-linejoin: "+ia.wireframeLinejoin):da.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+ia.opacity); -k.appendChild(da)}function d(ra,aa,pa,za,ia,Y,ma){da=f(ya++);da.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+za.positionScreen.x+","+za.positionScreen.y+"z");if(Y instanceof THREE.MeshBasicMaterial)z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshLambertMaterial)if(V){N.r=P.r;N.g=P.g;N.b=P.b;b(ma,ia,N);z.r=Y.color.r*N.r;z.g=Y.color.g*N.g;z.b=Y.color.b* -N.b;z.updateStyleString()}else z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshDepthMaterial){sa=1-Y.__2near/(Y.__farPlusNear-ia.z*Y.__farMinusNear);z.setRGB(sa,sa,sa)}else Y instanceof THREE.MeshNormalMaterial&&z.setRGB(g(ia.normalWorld.x),g(ia.normalWorld.y),g(ia.normalWorld.z));Y.wireframe?da.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+Y.wireframeLinewidth+"; stroke-opacity: "+Y.opacity+"; stroke-linecap: "+Y.wireframeLinecap+"; stroke-linejoin: "+ -Y.wireframeLinejoin):da.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+Y.opacity);k.appendChild(da)}function f(ra){if(e[ra]==null){e[ra]=document.createElementNS("http://www.w3.org/2000/svg","path");Ga==0&&e[ra].setAttribute("shape-rendering","crispEdges")}return e[ra]}function g(ra){return ra<0?Math.min((1+ra)*0.5,0.5):0.5+Math.min(ra*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,v,y,u,A,E,G=new THREE.Rectangle,L= -new THREE.Rectangle,V=!1,z=new THREE.Color(16777215),N=new THREE.Color(16777215),P=new THREE.Color(0),S=new THREE.Color(0),xa=new THREE.Color(0),sa,qa=new THREE.Vector3,e=[],fa=[],da,ya,Fa,Ga=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ra){switch(ra){case "high":Ga=1;break;case "low":Ga=0}};this.setSize=function(ra,aa){n=ra;p=aa;o=n/2;v=p/2;k.setAttribute("viewBox",-o+" "+-v+" "+n+" "+p);k.setAttribute("width",n);k.setAttribute("height", -p);G.set(-o,-v,o,v)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(ra,aa){var pa,za,ia,Y,ma,Da,ja,la;this.autoClear&&this.clear();h=j.projectScene(ra,aa,this.sortElements);Fa=ya=0;if(V=ra.lights.length>0){ja=ra.lights;P.setRGB(0,0,0);S.setRGB(0,0,0);xa.setRGB(0,0,0);pa=0;for(za=ja.length;pa0;)k.removeChild(k.childNodes[0])};this.render=function(ra,aa){var pa,za,ia,Y,ma,Da,ja,la;this.autoClear&&this.clear();h=j.projectScene(ra,aa,this.sortElements);Fa=ya=0;if(W=ra.lights.length>0){ja=ra.lights;P.setRGB(0,0,0);S.setRGB(0,0,0);xa.setRGB(0,0,0);pa=0;for(za=ja.length;paF){J=M;F=H[J]}e.bindBuffer(e.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[J]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);O.__webglMorphTargetInfluences[x]=F;K[J]=1;F=-1;x++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,O.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,B.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(B.__webglCustomAttributes)for(I in B.__webglCustomAttributes)if(m[I]>= -0){C=B.__webglCustomAttributes[I];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(m[I],C.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(B.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER, -B.__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(B.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,B.__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,B.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA, -4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight,4,e.FLOAT,!1,0,0)}if(O instanceof THREE.Mesh)if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webglLineBuffer);e.drawElements(e.LINES, -B.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webglFaceBuffer);e.drawElements(e.TRIANGLES,B.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(O instanceof THREE.Line){O=O.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(O,0,B.__webglLineCount)}else if(O instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,B.__webglParticleCount);else O instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,B.__webglVertexCount)}}function g(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 h(m){if(aa!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);aa=m.doubleSided}if(pa!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);pa=m.flipSided}}function j(m){if(ia!=m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ia=m}}function k(m){la[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);la[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);la[2].set(m.n41+m.n21,m.n42+m.n22, -m.n43+m.n23,m.n44+m.n24);la[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);la[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);la[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=la[m];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function n(m){for(var C=m.matrixWorld,x=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),w=0;w<6;w++){m=la[w].x*C.n14+la[w].y*C.n24+la[w].z*C.n34+la[w].w;if(m<=x)return!1}return!0}function p(m, -C){m.list[m.count]=C;m.count+=1}function o(m){var C,x,w=m.object,B=m.opaque,O=m.transparent;O.count=0;m=B.count=0;for(C=w.materials.length;m0.0010&&H.scale>0.0010){X[0]=H.x;X[1]=H.y;X[2]=H.z;J=H.size*H.scale/ja;M[0]=J*F;M[1]=J;e.uniform3fv(wa.screenPosition,X);e.uniform1f(wa.rotation,H.rotation);e.uniform2fv(wa.scale,M);e.uniform1f(wa.opacity,H.opacity);z(H.blending);P(H.texture,0);e.drawElements(e.TRIANGLES, -6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Ga)}function E(m,C){m._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function G(m){var C,x,w,B,O;if(m instanceof THREE.Mesh){x=m.geometry;for(C in x.geometryGroups){w=x.geometryGroups[C];O=!1;for(B in w.__webglCustomAttributes)if(w.__webglCustomAttributes[B].needsUpdate){O=!0;break}if(x.__dirtyVertices|| -x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||O){O=e.DYNAMIC_DRAW;var I=void 0,K=void 0,H=void 0,F=void 0;H=void 0;var J=void 0,M=void 0,X=void 0,U=void 0,Ca=void 0,Ha=void 0,oa=void 0,wa=void 0,cb=void 0,Aa=void 0,Ia=void 0,Ja=void 0,Qa=void 0;M=void 0;X=void 0;F=void 0;U=void 0;F=void 0;var D=void 0,Z=void 0;M=void 0;D=void 0;Z=void 0;var t=void 0,ab=void 0;D=void 0;Z=void 0;t=void 0;ab=void 0;D=void 0;Z=void 0;t=void 0;ab=void 0;D= -void 0;Z=void 0;t=void 0;F=void 0;U=void 0;J=void 0;H=void 0;H=void 0;D=void 0;Z=void 0;t=void 0;var fb=void 0,Ma=0,Va=0,gb=0,hb=0,Wa=0,eb=0,Oa=0,Ka=0,La=0,T=0,Ra=0;Z=D=0;var Xa=w.__vertexArray,Za=w.__uvArray,W=w.__uv2Array,ta=w.__normalArray,ea=w.__tangentArray,ca=w.__colorArray,va=w.__skinVertexAArray,ua=w.__skinVertexBArray,ga=w.__skinIndexArray,Q=w.__skinWeightArray,Na=w.__morphTargetsArrays,db=w.__webglCustomAttributes;t=void 0;var Ua=w.__faceArray,bb=w.__lineArray,lb=w.__needsSmoothNormals; -Ha=w.__vertexColorType;Ca=w.__uvType;oa=w.__normalType;var Pa=m.geometry,ib=Pa.__dirtyVertices,sb=Pa.__dirtyElements,rb=Pa.__dirtyUvs,tb=Pa.__dirtyNormals,ub=Pa.__dirtyTangents,vb=Pa.__dirtyColors,wb=Pa.__dirtyMorphTargets,nb=Pa.vertices,xb=w.faces,Ab=Pa.faces,yb=Pa.faceVertexUvs[0],zb=Pa.faceVertexUvs[1],ob=Pa.skinVerticesA,pb=Pa.skinVerticesB,qb=Pa.skinIndices,kb=Pa.skinWeights,mb=Pa.edgeFaces,jb=Pa.morphTargets;if(db)for(fb in db){db[fb].offset=0;db[fb].offsetSrc=0}I=0;for(K=xb.length;I0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ca,O)}if(tb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ta,O)}if(ub&&Pa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ea,O)}if(rb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,Za,O)}if(rb&& -hb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,W,O)}if(sb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ua,O);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,bb,O)}if(T>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,va,O);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,O);e.bindBuffer(e.ARRAY_BUFFER, -w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ga,O);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,Q,O)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){x=m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;C=e.DYNAMIC_DRAW;Ha=m.vertices;w=m.colors;oa=Ha.length;O=w.length;wa=m.__vertexArray;I=m.__colorArray;cb=m.__dirtyColors; -if(m.__dirtyVertices){for(K=0;K65535){J[H].counter+=1;F=J[H].hash+"_"+J[H].counter;m.geometryGroups[F]==undefined&&(m.geometryGroups[F]={faces:[],materials:K,vertices:0,numMorphTargets:M})}m.geometryGroups[F].faces.push(B);m.geometryGroups[F].vertices+=I}}function V(m,C,x){m.push({buffer:C,object:x,opaque:{list:[],count:0},transparent:{list:[], -count:0}})}function z(m){if(m!=za){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)}za=m}}function N(m,C,x){if((x.width& -x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,qa(C.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,qa(C.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,qa(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,qa(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,sa(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,sa(C.minFilter))}}function P(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}N(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 S(m){if(m&&!m.__webglFramebuffer){if(m.depthBuffer=== -undefined)m.depthBuffer=!0;if(m.stencilBuffer===undefined)m.stencilBuffer=!0;m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,qa(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,qa(m.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,qa(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,qa(m.minFilter));e.texImage2D(e.TEXTURE_2D, -0,qa(m.format),m.width,m.height,0,qa(m.format),qa(m.type),null);e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m.__webglTexture,0);if(m.depthBuffer&&!m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer)}else if(m.depthBuffer&&m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER, -e.DEPTH_STENCIL,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,m.width,m.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,x;if(m){C=m.__webglFramebuffer;x=m.width;m=m.height}else{C=null;x=Da;m=ja}if(C!=Fa){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(Y,ma,x,m);Fa=C}}function xa(m,C){var x;if(m=="fragment")x= -e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,C);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(C);return null}return x}function sa(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function qa(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,fa=document.createElement("canvas"),da=[],ya=null,Fa=null,Ga=!0,ra=this,aa=null,pa=null,za=null,ia=null, -Y=0,ma=0,Da=0,ja=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Matrix4,Sa=new Float32Array(16),$a=new Float32Array(16),Ya=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},R=!0,$=!0,na=new THREE.Color(0),Ba=0;if(b){if(b.stencil!=undefined)R=b.stencil;if(b.antialias!==undefined)$=b.antialias;b.clearColor!==undefined&&na.setHex(b.clearColor); -if(b.clearAlpha!==undefined)Ba=b.clearAlpha}this.maxMorphTargets=8;this.domElement=fa;this.autoClear=!0;this.sortObjects=!0;(function(m,C,x,w){try{if(!(e=fa.getContext("experimental-webgl",{antialias:m,stencil:w})))throw"Error creating WebGL context.";}catch(B){console.error(B)}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,x)})($,na,Ba,R);this.context=e;if(R){var ha={};ha.vertices=new Float32Array(12);ha.faces=new Uint16Array(6);ha.darkness=0.5;ha.vertices[0]=-20;ha.vertices[1]=-20;ha.vertices[2]=-1;ha.vertices[3]=20;ha.vertices[4]=-20;ha.vertices[5]=-1;ha.vertices[6]=20;ha.vertices[7]=20;ha.vertices[8]=-1;ha.vertices[9]=-20;ha.vertices[10]=20;ha.vertices[11]=-1;ha.faces[0]=0;ha.faces[1]=1;ha.faces[2]=2;ha.faces[3]=0;ha.faces[4]=2;ha.faces[5]=3;ha.vertexBuffer=e.createBuffer();ha.elementBuffer= -e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ha.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ha.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ha.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha.faces,e.STATIC_DRAW);ha.program=e.createProgram();e.attachShader(ha.program,xa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ha.program,xa("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(ha.program);ha.vertexLocation=e.getAttribLocation(ha.program,"position"); -ha.projectionLocation=e.getUniformLocation(ha.program,"projectionMatrix");ha.darknessLocation=e.getUniformLocation(ha.program,"darkness")}var ka={};ka.vertices=new Float32Array(16);ka.faces=new Uint16Array(6);ka.transparency=0.5;b=0;ka.vertices[b++]=-1;ka.vertices[b++]=-1;ka.vertices[b++]=0;ka.vertices[b++]=0;ka.vertices[b++]=1;ka.vertices[b++]=-1;ka.vertices[b++]=1;ka.vertices[b++]=0;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=-1;ka.vertices[b++]= -1;ka.vertices[b++]=0;ka.vertices[b++]=1;b=0;ka.faces[b++]=0;ka.faces[b++]=1;ka.faces[b++]=2;ka.faces[b++]=0;ka.faces[b++]=2;ka.faces[b++]=3;ka.vertexBuffer=e.createBuffer();ka.elementBuffer=e.createBuffer();ka.tempTexture=e.createTexture();ka.readBackPixels=new Uint8Array(1024);e.bindBuffer(e.ARRAY_BUFFER,ka.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ka.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ka.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ka.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D, -ka.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);ka.program=e.createProgram();e.attachShader(ka.program,xa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(ka.program,xa("vertex",THREE.ShaderLib.lensFlare.vertexShader)); -e.linkProgram(ka.program);ka.attributes={};ka.uniforms={};ka.attributes.vertex=e.getAttribLocation(ka.program,"position");ka.attributes.uv=e.getAttribLocation(ka.program,"UV");ka.uniforms.map=e.getUniformLocation(ka.program,"map");ka.uniforms.opacity=e.getUniformLocation(ka.program,"opacity");ka.uniforms.scale=e.getUniformLocation(ka.program,"scale");ka.uniforms.rotation=e.getUniformLocation(ka.program,"rotation");ka.uniforms.screenPosition=e.getUniformLocation(ka.program,"screenPosition");ka.uniforms.renderPink= -e.getUniformLocation(ka.program,"renderPink");this.setSize=function(m,C){fa.width=m;fa.height=C;this.setViewport(0,0,fa.width,fa.height)};this.setViewport=function(m,C,x,w){Y=m;ma=C;Da=x;ja=w;e.viewport(Y,ma,Da,ja)};this.setScissor=function(m,C,x,w){e.scissor(m,C,x,w)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){Ga=m;e.depthMask(m)};this.setClearColorHex=function(m,C){var x=new THREE.Color(m);e.clearColor(x.r,x.g, -x.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){ha.darkness=m};this.initMaterial=function(m,C,x,w){var B,O,I;if(m instanceof THREE.MeshDepthMaterial)I="depth";else if(m instanceof THREE.ShadowVolumeDynamicMaterial)I="shadowVolumeDynamic";else if(m instanceof THREE.MeshNormalMaterial)I="normal";else if(m instanceof THREE.MeshBasicMaterial)I="basic"; -else if(m instanceof THREE.MeshLambertMaterial)I="lambert";else if(m instanceof THREE.MeshPhongMaterial)I="phong";else if(m instanceof THREE.LineBasicMaterial)I="basic";else m instanceof THREE.ParticleBasicMaterial&&(I="particle_basic");if(I){var K=THREE.ShaderLib[I];m.uniforms=Uniforms.clone(K.uniforms);m.vertexShader=K.vertexShader;m.fragmentShader=K.fragmentShader}var H,F,J;H=J=K=0;for(F=C.length;H0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS": -"",x.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(X,xa("fragment",prefix_fragment+H));e.attachShader(X,xa("vertex",prefix_vertex+F));e.linkProgram(X);e.getProgramParameter(X,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(X,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");X.uniforms={};X.attributes={};var U;H=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(U in K)H.push(U); -U=H;K=0;for(H=U.length;K=0&&e.enableVertexAttribArray(M.color);M.normal>= -0&&e.enableVertexAttribArray(M.normal);M.tangent>=0&&e.enableVertexAttribArray(M.tangent);if(m.skinning&&M.skinVertexA>=0&&M.skinVertexB>=0&&M.skinIndex>=0&&M.skinWeight>=0){e.enableVertexAttribArray(M.skinVertexA);e.enableVertexAttribArray(M.skinVertexB);e.enableVertexAttribArray(M.skinIndex);e.enableVertexAttribArray(M.skinWeight)}for(B in m.attributes)M[B]>=0&&e.enableVertexAttribArray(M[B]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(M.morphTarget0>=0){e.enableVertexAttribArray(M.morphTarget0); -m.numSupportedMorphTargets++}if(M.morphTarget1>=0){e.enableVertexAttribArray(M.morphTarget1);m.numSupportedMorphTargets++}if(M.morphTarget2>=0){e.enableVertexAttribArray(M.morphTarget2);m.numSupportedMorphTargets++}if(M.morphTarget3>=0){e.enableVertexAttribArray(M.morphTarget3);m.numSupportedMorphTargets++}if(M.morphTarget4>=0){e.enableVertexAttribArray(M.morphTarget4);m.numSupportedMorphTargets++}if(M.morphTarget5>=0){e.enableVertexAttribArray(M.morphTarget5);m.numSupportedMorphTargets++}if(M.morphTarget6>= -0){e.enableVertexAttribArray(M.morphTarget6);m.numSupportedMorphTargets++}if(M.morphTarget7>=0){e.enableVertexAttribArray(M.morphTarget7);m.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);m=0;for(B=this.maxMorphTargets;m0||X.faceVertexUvs.length>0)I.__uvArray=new Float32Array(H*2);if(X.faceUvs.length>1||X.faceVertexUvs.length>1)I.__uv2Array=new Float32Array(H*2)}if(K.geometry.skinWeights.length&&K.geometry.skinIndices.length){I.__skinVertexAArray=new Float32Array(H*4);I.__skinVertexBArray=new Float32Array(H* -4);I.__skinIndexArray=new Float32Array(H*4);I.__skinWeightArray=new Float32Array(H*4)}I.__faceArray=new Uint16Array(Ca*3+(K.geometry.edgeFaces?K.geometry.edgeFaces.length*6:0));I.__lineArray=new Uint16Array(Ha*2);if(I.numMorphTargets){I.__morphTargetsArrays=[];X=0;for(U=I.numMorphTargets;X=0;B--){w=x.__webglObjects[B].object;C==w&&x.__webglObjects.splice(B,1)}m.__objectsRemoved.splice(0,1)}C=0;for(x=m.__webglObjects.length;C0}}; +w.specular.g,w.specular.b);K.shininess.value=w.shininess}else if(w instanceof THREE.MeshDepthMaterial){K.mNear.value=m.near;K.mFar.value=m.far;K.opacity.value=w.opacity}else if(w instanceof THREE.MeshNormalMaterial)K.opacity.value=w.opacity;for(var t in K)if(L=M.uniforms[t]){H=K[t];J=H.type;u=H.value;if(J=="i")e.uniform1i(L,u);else if(J=="f")e.uniform1f(L,u);else if(J=="fv1")e.uniform1fv(L,u);else if(J=="fv")e.uniform3fv(L,u);else if(J=="v2")e.uniform2f(L,u.x,u.y);else if(J=="v3")e.uniform3f(L,u.x, +u.y,u.z);else if(J=="v4")e.uniform4f(L,u.x,u.y,u.z,u.w);else if(J=="c")e.uniform3f(L,u.r,u.g,u.b);else if(J=="t"){e.uniform1i(L,u);if(H=H.texture)if(H.image instanceof Array&&H.image.length==6){if(H.image.length==6){if(H.needsUpdate){if(H.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,H.image.__webglTextureCube);for(J=0;J<6;++J)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,e.RGBA,e.UNSIGNED_BYTE,H.image[J])}else{H.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP, +H.image.__webglTextureCube);for(J=0;J<6;++J)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,H.image[J]);H.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,H,H.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);H.needsUpdate=!1}e.activeTexture(e.TEXTURE0+u);e.bindTexture(e.TEXTURE_CUBE_MAP,H.image.__webglTextureCube)}}else P(H,u)}}e.uniformMatrix4fv(I.modelViewMatrix,!1,A._modelViewMatrixArray);e.uniformMatrix3fv(I.normalMatrix,!1,A._normalMatrixArray);(w instanceof THREE.MeshShaderMaterial|| +w instanceof THREE.MeshPhongMaterial||w.envMap)&&e.uniform3f(I.cameraPosition,m.position.x,m.position.y,m.position.z);(w instanceof THREE.MeshShaderMaterial||w.envMap||w.skinning)&&e.uniformMatrix4fv(I.objectMatrix,!1,A._objectMatrixArray);(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshShaderMaterial||w.skinning)&&e.uniformMatrix4fv(I.viewMatrix,!1,$a);if(w instanceof THREE.ShadowVolumeDynamicMaterial){m=K.directionalLightDirection.value;m[0]= +-C.position.x;m[1]=-C.position.y;m[2]=-C.position.z;e.uniform3fv(I.directionalLightDirection,m);e.uniformMatrix4fv(I.objectMatrix,!1,A._objectMatrixArray);e.uniformMatrix4fv(I.viewMatrix,!1,$a)}if(w.skinning){e.uniformMatrix4fv(I.cameraInverseMatrix,!1,$a);e.uniformMatrix4fv(I.boneGlobalMatrices,!1,A.boneMatrices)}return M}function f(m,C,u,w,A,M){if(w.opacity!=0){var I;m=d(m,C,u,w,M).attributes;if(w.morphTargets){C=w.program.attributes;M.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[M.morphTargetBase]): +e.bindBuffer(e.ARRAY_BUFFER,A.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(M.morphTargetForcedOrder.length){u=0;for(var K=M.morphTargetForcedOrder,H=M.morphTargetInfluences;uE){J=L;E=H[J]}e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[J]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);M.__webglMorphTargetInfluences[u]=E;K[J]=1;E=-1;u++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,M.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,A.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(A.__webglCustomAttributes)for(I in A.__webglCustomAttributes)if(m[I]>= +0){C=A.__webglCustomAttributes[I];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(m[I],C.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(A.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER, +A.__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(A.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,A.__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,A.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA, +4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight,4,e.FLOAT,!1,0,0)}if(M instanceof THREE.Mesh)if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webglLineBuffer);e.drawElements(e.LINES, +A.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webglFaceBuffer);e.drawElements(e.TRIANGLES,A.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(M instanceof THREE.Line){M=M.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(M,0,A.__webglLineCount)}else if(M instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,A.__webglParticleCount);else M instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,A.__webglVertexCount)}}function g(m,C, +u){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);if(u==THREE.FlatShading){var w,A,M,I,K,H,E,J,L,U,V=m.count*3;for(U= +0;U0.0010&&H.scale>0.0010){U[0]=H.x;U[1]=H.y;U[2]=H.z;J=H.size*H.scale/ja;L[0]=J*E;L[1]=J;e.uniform3fv(wa.screenPosition,U);e.uniform1f(wa.rotation,H.rotation);e.uniform2fv(wa.scale,L);e.uniform1f(wa.opacity,H.opacity);z(H.blending);P(H.texture,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Ga)}function F(m,C){m._modelViewMatrix.multiplyToArray(C.matrixWorldInverse, +m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function G(m){var C,u,w,A,M;if(m instanceof THREE.Mesh){u=m.geometry;for(C in u.geometryGroups){w=u.geometryGroups[C];M=!1;for(A in w.__webglCustomAttributes)if(w.__webglCustomAttributes[A].needsUpdate){M=!0;break}if(u.__dirtyVertices||u.__dirtyMorphTargets||u.__dirtyElements||u.__dirtyUvs||u.__dirtyNormals||u.__dirtyColors||u.__dirtyTangents||M){M=e.DYNAMIC_DRAW;var I=void 0, +K=void 0,H=void 0,E=void 0;H=void 0;var J=void 0,L=void 0,U=void 0,V=void 0,Ca=void 0,Ha=void 0,oa=void 0,wa=void 0,cb=void 0,Aa=void 0,Ia=void 0,Ja=void 0,Qa=void 0;L=void 0;U=void 0;E=void 0;V=void 0;E=void 0;var D=void 0,Z=void 0;L=void 0;D=void 0;Z=void 0;var t=void 0,ab=void 0;D=void 0;Z=void 0;t=void 0;ab=void 0;D=void 0;Z=void 0;t=void 0;ab=void 0;D=void 0;Z=void 0;t=void 0;E=void 0;V=void 0;J=void 0;H=void 0;H=void 0;D=void 0;Z=void 0;t=void 0;var fb=void 0,Ma=0,Va=0,gb=0,hb=0,Wa=0,eb=0,Oa= +0,Ka=0,La=0,T=0,Ra=0;Z=D=0;var Xa=w.__vertexArray,Za=w.__uvArray,X=w.__uv2Array,ta=w.__normalArray,ea=w.__tangentArray,ca=w.__colorArray,va=w.__skinVertexAArray,ua=w.__skinVertexBArray,ga=w.__skinIndexArray,Q=w.__skinWeightArray,Na=w.__morphTargetsArrays,db=w.__webglCustomAttributes;t=void 0;var Ua=w.__faceArray,bb=w.__lineArray,lb=w.__needsSmoothNormals;Ha=w.__vertexColorType;Ca=w.__uvType;oa=w.__normalType;var Pa=m.geometry,ib=Pa.__dirtyVertices,sb=Pa.__dirtyElements,rb=Pa.__dirtyUvs,tb=Pa.__dirtyNormals, +ub=Pa.__dirtyTangents,vb=Pa.__dirtyColors,wb=Pa.__dirtyMorphTargets,nb=Pa.vertices,xb=w.faces,Ab=Pa.faces,yb=Pa.faceVertexUvs[0],zb=Pa.faceVertexUvs[1],ob=Pa.skinVerticesA,pb=Pa.skinVerticesB,qb=Pa.skinIndices,kb=Pa.skinWeights,mb=Pa.edgeFaces,jb=Pa.morphTargets;if(db)for(fb in db){db[fb].offset=0;db[fb].offsetSrc=0}I=0;for(K=xb.length;I0){e.bindBuffer(e.ARRAY_BUFFER, +w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ca,M)}if(tb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ta,M)}if(ub&&Pa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ea,M)}if(rb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,Za,M)}if(rb&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,X,M)}if(sb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer); +e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ua,M);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,bb,M)}if(T>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,va,M);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,M);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ga,M);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER, +Q,M)}}}u.__dirtyVertices=!1;u.__dirtyMorphTargets=!1;u.__dirtyElements=!1;u.__dirtyUvs=!1;u.__dirtyNormals=!1;u.__dirtyTangents=!1;u.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){u=m.geometry;if(u.__dirtyVertices||u.__dirtyColors){m=u;C=e.DYNAMIC_DRAW;Ha=m.vertices;w=m.colors;oa=Ha.length;M=w.length;wa=m.__vertexArray;I=m.__colorArray;cb=m.__dirtyColors;if(m.__dirtyVertices){for(K=0;K65535){J[H].counter+=1;E=J[H].hash+"_"+J[H].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:K,vertices:0,numMorphTargets:L})}m.geometryGroups[E].faces.push(A);m.geometryGroups[E].vertices+=I}}function W(m,C,u){m.push({buffer:C,object:u,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function z(m){if(m!=za){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)}za=m}}function O(m,C,u){if((u.width&u.width-1)==0&&(u.height&u.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,qa(C.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,qa(C.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,qa(C.magFilter)); +e.texParameteri(m,e.TEXTURE_MIN_FILTER,qa(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,sa(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,sa(C.minFilter))}}function P(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 S(m){if(m&&!m.__webglFramebuffer){if(m.depthBuffer===undefined)m.depthBuffer=!0;if(m.stencilBuffer===undefined)m.stencilBuffer=!0;m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer(); +m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,qa(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,qa(m.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,qa(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,qa(m.minFilter));e.texImage2D(e.TEXTURE_2D,0,qa(m.format),m.width,m.height,0,qa(m.format),qa(m.type),null);e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER, +m.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m.__webglTexture,0);if(m.depthBuffer&&!m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer)}else if(m.depthBuffer&&m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER, +m.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,m.width,m.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,u;if(m){C=m.__webglFramebuffer;u=m.width;m=m.height}else{C=null;u=Da;m=ja}if(C!=Fa){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(Y,ma,u,m);Fa=C}}function xa(m,C){var u;if(m=="fragment")u=e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(u=e.createShader(e.VERTEX_SHADER));e.shaderSource(u, +C);e.compileShader(u);if(!e.getShaderParameter(u,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(u));console.error(C);return null}return u}function sa(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function qa(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,fa=document.createElement("canvas"),da=[],ya=null,Fa=null,Ga=!0,ra=this,aa=null,pa=null,za=null,ia=null,Y=0,ma=0,Da=0,ja=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, +new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Matrix4,Sa=new Float32Array(16),$a=new Float32Array(16),Ya=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},R=!0,$=!0,na=new THREE.Color(0),Ba=0;if(b){if(b.stencil!=undefined)R=b.stencil;if(b.antialias!==undefined)$=b.antialias;b.clearColor!==undefined&&na.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ba=b.clearAlpha}this.maxMorphTargets=8;this.domElement=fa; +this.autoClear=!0;this.sortObjects=!0;(function(m,C,u,w){try{if(!(e=fa.getContext("experimental-webgl",{antialias:m,stencil:w})))throw"Error creating WebGL context.";}catch(A){console.error(A)}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,u)})($,na,Ba,R);this.context=e;if(R){var ha={}; +ha.vertices=new Float32Array(12);ha.faces=new Uint16Array(6);ha.darkness=0.5;ha.vertices[0]=-20;ha.vertices[1]=-20;ha.vertices[2]=-1;ha.vertices[3]=20;ha.vertices[4]=-20;ha.vertices[5]=-1;ha.vertices[6]=20;ha.vertices[7]=20;ha.vertices[8]=-1;ha.vertices[9]=-20;ha.vertices[10]=20;ha.vertices[11]=-1;ha.faces[0]=0;ha.faces[1]=1;ha.faces[2]=2;ha.faces[3]=0;ha.faces[4]=2;ha.faces[5]=3;ha.vertexBuffer=e.createBuffer();ha.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ha.vertexBuffer);e.bufferData(e.ARRAY_BUFFER, +ha.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ha.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha.faces,e.STATIC_DRAW);ha.program=e.createProgram();e.attachShader(ha.program,xa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ha.program,xa("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(ha.program);ha.vertexLocation=e.getAttribLocation(ha.program,"position");ha.projectionLocation=e.getUniformLocation(ha.program,"projectionMatrix");ha.darknessLocation= +e.getUniformLocation(ha.program,"darkness")}var ka={};ka.vertices=new Float32Array(16);ka.faces=new Uint16Array(6);ka.transparency=0.5;b=0;ka.vertices[b++]=-1;ka.vertices[b++]=-1;ka.vertices[b++]=0;ka.vertices[b++]=0;ka.vertices[b++]=1;ka.vertices[b++]=-1;ka.vertices[b++]=1;ka.vertices[b++]=0;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=-1;ka.vertices[b++]=1;ka.vertices[b++]=0;ka.vertices[b++]=1;b=0;ka.faces[b++]=0;ka.faces[b++]=1;ka.faces[b++]=2;ka.faces[b++]= +0;ka.faces[b++]=2;ka.faces[b++]=3;ka.vertexBuffer=e.createBuffer();ka.elementBuffer=e.createBuffer();ka.tempTexture=e.createTexture();ka.readBackPixels=new Uint8Array(1024);e.bindBuffer(e.ARRAY_BUFFER,ka.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ka.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ka.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ka.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,ka.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);ka.program=e.createProgram();e.attachShader(ka.program,xa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(ka.program,xa("vertex",THREE.ShaderLib.lensFlare.vertexShader));e.linkProgram(ka.program);ka.attributes={};ka.uniforms={};ka.attributes.vertex=e.getAttribLocation(ka.program, +"position");ka.attributes.uv=e.getAttribLocation(ka.program,"UV");ka.uniforms.map=e.getUniformLocation(ka.program,"map");ka.uniforms.opacity=e.getUniformLocation(ka.program,"opacity");ka.uniforms.scale=e.getUniformLocation(ka.program,"scale");ka.uniforms.rotation=e.getUniformLocation(ka.program,"rotation");ka.uniforms.screenPosition=e.getUniformLocation(ka.program,"screenPosition");ka.uniforms.renderPink=e.getUniformLocation(ka.program,"renderPink");this.setSize=function(m,C){fa.width=m;fa.height= +C;this.setViewport(0,0,fa.width,fa.height)};this.setViewport=function(m,C,u,w){Y=m;ma=C;Da=u;ja=w;e.viewport(Y,ma,Da,ja)};this.setScissor=function(m,C,u,w){e.scissor(m,C,u,w)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){Ga=m;e.depthMask(m)};this.setClearColorHex=function(m,C){var u=new THREE.Color(m);e.clearColor(u.r,u.g,u.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){ha.darkness=m};this.initMaterial=function(m,C,u,w){var A,M,I;if(m instanceof THREE.MeshDepthMaterial)I="depth";else if(m instanceof THREE.ShadowVolumeDynamicMaterial)I="shadowVolumeDynamic";else if(m instanceof THREE.MeshNormalMaterial)I="normal";else if(m instanceof THREE.MeshBasicMaterial)I="basic";else if(m instanceof THREE.MeshLambertMaterial)I="lambert";else if(m instanceof THREE.MeshPhongMaterial)I="phong";else if(m instanceof +THREE.LineBasicMaterial)I="basic";else m instanceof THREE.ParticleBasicMaterial&&(I="particle_basic");if(I){var K=THREE.ShaderLib[I];m.uniforms=Uniforms.clone(K.uniforms);m.vertexShader=K.vertexShader;m.fragmentShader=K.fragmentShader}var H,E,J;H=J=K=0;for(E=C.length;H +0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_BONES "+u.maxBones,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"",u.morphTargets?"#define USE_MORPHTARGETS":"",u.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(U,xa("fragment",prefix_fragment+H));e.attachShader(U,xa("vertex",prefix_vertex+E));e.linkProgram(U);e.getProgramParameter(U,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(U,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");U.uniforms={};U.attributes={};var V;H=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(V in K)H.push(V); +V=H;K=0;for(H=V.length;K=0&&e.enableVertexAttribArray(L.color);L.normal>= +0&&e.enableVertexAttribArray(L.normal);L.tangent>=0&&e.enableVertexAttribArray(L.tangent);if(m.skinning&&L.skinVertexA>=0&&L.skinVertexB>=0&&L.skinIndex>=0&&L.skinWeight>=0){e.enableVertexAttribArray(L.skinVertexA);e.enableVertexAttribArray(L.skinVertexB);e.enableVertexAttribArray(L.skinIndex);e.enableVertexAttribArray(L.skinWeight)}for(A in m.attributes)L[A]>=0&&e.enableVertexAttribArray(L[A]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(L.morphTarget0>=0){e.enableVertexAttribArray(L.morphTarget0); +m.numSupportedMorphTargets++}if(L.morphTarget1>=0){e.enableVertexAttribArray(L.morphTarget1);m.numSupportedMorphTargets++}if(L.morphTarget2>=0){e.enableVertexAttribArray(L.morphTarget2);m.numSupportedMorphTargets++}if(L.morphTarget3>=0){e.enableVertexAttribArray(L.morphTarget3);m.numSupportedMorphTargets++}if(L.morphTarget4>=0){e.enableVertexAttribArray(L.morphTarget4);m.numSupportedMorphTargets++}if(L.morphTarget5>=0){e.enableVertexAttribArray(L.morphTarget5);m.numSupportedMorphTargets++}if(L.morphTarget6>= +0){e.enableVertexAttribArray(L.morphTarget6);m.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.morphTarget7);m.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);m=0;for(A=this.maxMorphTargets;m0||U.faceVertexUvs.length>0)I.__uvArray=new Float32Array(H*2);if(U.faceUvs.length>1||U.faceVertexUvs.length>1)I.__uv2Array=new Float32Array(H*2)}if(K.geometry.skinWeights.length&&K.geometry.skinIndices.length){I.__skinVertexAArray=new Float32Array(H*4);I.__skinVertexBArray= +new Float32Array(H*4);I.__skinIndexArray=new Float32Array(H*4);I.__skinWeightArray=new Float32Array(H*4)}I.__faceArray=new Uint16Array(Ca*3+(K.geometry.edgeFaces?K.geometry.edgeFaces.length*6:0));I.__lineArray=new Uint16Array(Ha*2);if(I.numMorphTargets){I.__morphTargetsArrays=[];U=0;for(V=I.numMorphTargets;U=0;A--){w=u.__webglObjects[A].object;C==w&&u.__webglObjects.splice(A,1)}m.__objectsRemoved.splice(0,1)}C=0;for(u=m.__webglObjects.length;C0}}; THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!== undefined?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==undefined?d.stencilBuffer:!0}; 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,c,d){d&&b.update(undefined,!1,c);d=b.sounds;var f,g=d.length;for(f=0;fc.max.z)return Number.MAX_VALUE;c.normal=new THR THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq=0)return Math.abs(f)-Math.sqrt(d);return Number.MAX_VALUE};THREE.CollisionUtils={}; THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,d=new THREE.Vector3(c.x[0],c.y[0],c.z[0]);c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]);d=new THREE.BoxCollider(d,c);d.mesh=b;return d};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c}; THREE.CollisionUtils.MeshColliderWBox=function(b){for(var c=b.geometry.vertices,d=c.length,f=b.geometry.faces,g=f.length,h=[],j=[],k=[],n=0;n=0?y:y+g;y=this.verticalAngleMap.srcRange;u=this.verticalAngleMap.dstRange; -this.phi=(this.phi-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,v)};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 y,v;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;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange; +this.phi=(this.phi-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.horizontalAngleMap.srcRange;v=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.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=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation= c(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,c,d,f,g,h,j,k,n){function p(G,L,V,z,N,P,S,xa){var sa,qa,e=f||1,fa=g||1,da=N/2,ya=P/2,Fa=o.vertices.length;if(G=="x"&&L=="y"||G=="y"&&L=="x")sa="z";else if(G=="x"&&L=="z"||G=="z"&&L=="x"){sa="y";fa=h||1}else if(G=="z"&&L=="y"||G=="y"&&L=="z"){sa="x";e=h||1}var Ga=e+1,ra=fa+1;N/=e;var aa=P/fa;for(qa=0;qa0){j(0,0,-p-(h||0));for(f=b;f0){j(0,0,p+(g||0)); +var Cube=function(b,c,d,f,g,h,j,k,n){function p(G,N,W,z,O,P,S,xa){var sa,qa,e=f||1,fa=g||1,da=O/2,ya=P/2,Fa=o.vertices.length;if(G=="x"&&N=="y"||G=="y"&&N=="x")sa="z";else if(G=="x"&&N=="z"||G=="z"&&N=="x"){sa="y";fa=h||1}else if(G=="z"&&N=="y"||G=="y"&&N=="z"){sa="x";e=h||1}var Ga=e+1,ra=fa+1;O/=e;var aa=P/fa;for(qa=0;qa0){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 c(v,y,u){var A=Math.sqrt(v*v+y*y+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(v/A,y/A,u/A)))-1}function d(v,y,u,A){A.faces.push(new THREE.Face3(v,y,u))}function f(v,y){var u=g.vertices[v].position,A=g.vertices[y].position;return c((u.x+A.x)/2,(u.y+A.y)/2,(u.z+A.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0, +var Icosahedron=function(b){function c(x,y,v){var B=Math.sqrt(x*x+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(x/B,y/B,v/B)))-1}function d(x,y,v,B){B.faces.push(new THREE.Face3(x,y,v))}function f(x,y){var v=g.vertices[x].position,B=g.vertices[y].position;return c((v.x+B.x)/2,(v.y+B.y)/2,(v.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;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0, 1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,h);d(0,5,1,h);d(0,1,7,h);d(0,7,10,h);d(0,10,11,h);d(1,5,9,h);d(5,11,4,h);d(11,10,2,h);d(10,7,6,h);d(7,1,8,h);d(3,9,4,h);d(3,4,2,h);d(3,2,6,h);d(3,6,8,h);d(3,8,9,h);d(4,9,5,h);d(2,4,11,h);d(6,2,10,h);d(8,6,7,h);d(9,8,1,h);for(b=0;b0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,k,y)))-1);p.push(o)}c.push(p)}var u,A,E;g=c.length;for(d=0;d0)for(f=0;f1){u=this.vertices[j].position.clone(); -A=this.vertices[n].position.clone();E=this.vertices[p].position.clone();u.normalize();A.normalize();E.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([o,v,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Sphere=function(b,c,d){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,c||8),j=Math.max(2,d||6);c=[];for(d=0;d0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,y)))-1);p.push(o)}c.push(p)}var v,B,F;g=c.length;for(d=0;d0)for(f=0;f1){v=this.vertices[j].position.clone(); +B=this.vertices[n].position.clone();F=this.vertices[p].position.clone();v.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.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,c,d,f){this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=f||6;b=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){f=d/this.segmentsT*2*Math.PI;var g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d= 1;d<=this.segmentsT;++d){f=(this.segmentsT+1)*c+d;g=(this.segmentsT+1)*c+d-1;var h=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;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,c,d,f,g,h,j){function k(v,y,u,A,E,G){y=u/A*v;u=Math.cos(y);return new THREE.Vector3(E*(2+u)*0.5*Math.cos(v),E*(2+u)*Math.sin(v)*0.5,G*E*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b>7)-127;na|=(ha&127)<<16|Ba<<8;if(na==0&&m==-127)return 0;return(1-2*(ka>>7))*(1+na*Math.pow(2,-23))*Math.pow(2,m)}function k(R,$){var na=o(R,$),Ba=o(R,$+1),ha=o(R,$+2);return(o(R,$+3)<<24)+(ha<<16)+(Ba<<8)+na}function n(R,$){var na=o(R,$);return(o(R,$+1)<<8)+na}function p(R,$){var na=o(R,$);return na>127? -na-256:na}function o(R,$){return R.charCodeAt($)&255}function v(R){var $,na,Ba;$=k(b,R);na=k(b,R+S);Ba=k(b,R+xa);R=n(b,R+sa);THREE.BinaryLoader.prototype.f3(L,$,na,Ba,R)}function y(R){var $,na,Ba,ha,ka,m;$=k(b,R);na=k(b,R+S);Ba=k(b,R+xa);ha=n(b,R+sa);ka=k(b,R+qa);m=k(b,R+e);R=k(b,R+fa);THREE.BinaryLoader.prototype.f3n(L,N,$,na,Ba,ha,ka,m,R)}function u(R){var $,na,Ba,ha;$=k(b,R);na=k(b,R+da);Ba=k(b,R+ya);ha=k(b,R+Fa);R=n(b,R+Ga);THREE.BinaryLoader.prototype.f4(L,$,na,Ba,ha,R)}function A(R){var $,na, -Ba,ha,ka,m,C,x;$=k(b,R);na=k(b,R+da);Ba=k(b,R+ya);ha=k(b,R+Fa);ka=n(b,R+Ga);m=k(b,R+ra);C=k(b,R+aa);x=k(b,R+pa);R=k(b,R+za);THREE.BinaryLoader.prototype.f4n(L,N,$,na,Ba,ha,ka,m,C,x,R)}function E(R){var $,na;$=k(b,R);na=k(b,R+ia);R=k(b,R+Y);THREE.BinaryLoader.prototype.uv3(L.faceVertexUvs[0],P[$*2],P[$*2+1],P[na*2],P[na*2+1],P[R*2],P[R*2+1])}function G(R){var $,na,Ba;$=k(b,R);na=k(b,R+ma);Ba=k(b,R+Da);R=k(b,R+ja);THREE.BinaryLoader.prototype.uv4(L.faceVertexUvs[0],P[$*2],P[$*2+1],P[na*2],P[na*2+1], -P[Ba*2],P[Ba*2+1],P[R*2],P[R*2+1])}var L=this,V=0,z,N=[],P=[],S,xa,sa,qa,e,fa,da,ya,Fa,Ga,ra,aa,pa,za,ia,Y,ma,Da,ja,la,Ea,Sa,$a,Ya,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(L,f,h);z={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+=z.header_bytes;S=z.vertex_index_bytes;xa=z.vertex_index_bytes*2;sa=z.vertex_index_bytes*3;qa=z.vertex_index_bytes*3+z.material_index_bytes;e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;fa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes* +na-256:na}function o(R,$){return R.charCodeAt($)&255}function x(R){var $,na,Ba;$=k(b,R);na=k(b,R+S);Ba=k(b,R+xa);R=n(b,R+sa);THREE.BinaryLoader.prototype.f3(N,$,na,Ba,R)}function y(R){var $,na,Ba,ha,ka,m;$=k(b,R);na=k(b,R+S);Ba=k(b,R+xa);ha=n(b,R+sa);ka=k(b,R+qa);m=k(b,R+e);R=k(b,R+fa);THREE.BinaryLoader.prototype.f3n(N,O,$,na,Ba,ha,ka,m,R)}function v(R){var $,na,Ba,ha;$=k(b,R);na=k(b,R+da);Ba=k(b,R+ya);ha=k(b,R+Fa);R=n(b,R+Ga);THREE.BinaryLoader.prototype.f4(N,$,na,Ba,ha,R)}function B(R){var $,na, +Ba,ha,ka,m,C,u;$=k(b,R);na=k(b,R+da);Ba=k(b,R+ya);ha=k(b,R+Fa);ka=n(b,R+Ga);m=k(b,R+ra);C=k(b,R+aa);u=k(b,R+pa);R=k(b,R+za);THREE.BinaryLoader.prototype.f4n(N,O,$,na,Ba,ha,ka,m,C,u,R)}function F(R){var $,na;$=k(b,R);na=k(b,R+ia);R=k(b,R+Y);THREE.BinaryLoader.prototype.uv3(N.faceVertexUvs[0],P[$*2],P[$*2+1],P[na*2],P[na*2+1],P[R*2],P[R*2+1])}function G(R){var $,na,Ba;$=k(b,R);na=k(b,R+ma);Ba=k(b,R+Da);R=k(b,R+ja);THREE.BinaryLoader.prototype.uv4(N.faceVertexUvs[0],P[$*2],P[$*2+1],P[na*2],P[na*2+1], +P[Ba*2],P[Ba*2+1],P[R*2],P[R*2+1])}var N=this,W=0,z,O=[],P=[],S,xa,sa,qa,e,fa,da,ya,Fa,Ga,ra,aa,pa,za,ia,Y,ma,Da,ja,la,Ea,Sa,$a,Ya,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(N,f,h);z={signature:b.substr(W,8),header_bytes:o(b,W+8),vertex_coordinate_bytes:o(b,W+9),normal_coordinate_bytes:o(b,W+10),uv_coordinate_bytes:o(b,W+11),vertex_index_bytes:o(b,W+12),normal_index_bytes:o(b,W+13),uv_index_bytes:o(b,W+14),material_index_bytes:o(b,W+15),nvertices:k(b,W+16),nnormals:k(b,W+16+ +4),nuvs:k(b,W+16+8),ntri_flat:k(b,W+16+12),ntri_smooth:k(b,W+16+16),ntri_flat_uv:k(b,W+16+20),ntri_smooth_uv:k(b,W+16+24),nquad_flat:k(b,W+16+28),nquad_smooth:k(b,W+16+32),nquad_flat_uv:k(b,W+16+36),nquad_smooth_uv:k(b,W+16+40)};W+=z.header_bytes;S=z.vertex_index_bytes;xa=z.vertex_index_bytes*2;sa=z.vertex_index_bytes*3;qa=z.vertex_index_bytes*3+z.material_index_bytes;e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;fa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes* 2;da=z.vertex_index_bytes;ya=z.vertex_index_bytes*2;Fa=z.vertex_index_bytes*3;Ga=z.vertex_index_bytes*4;ra=z.vertex_index_bytes*4+z.material_index_bytes;aa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;pa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;za=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;ia=z.uv_index_bytes;Y=z.uv_index_bytes*2;ma=z.uv_index_bytes;Da=z.uv_index_bytes*2;ja=z.uv_index_bytes*3;h=z.vertex_index_bytes*3+z.material_index_bytes; -Ta=z.vertex_index_bytes*4+z.material_index_bytes;la=z.ntri_flat*h;Ea=z.ntri_smooth*(h+z.normal_index_bytes*3);Sa=z.ntri_flat_uv*(h+z.uv_index_bytes*3);$a=z.ntri_smooth_uv*(h+z.normal_index_bytes*3+z.uv_index_bytes*3);Ya=z.nquad_flat*Ta;h=z.nquad_smooth*(Ta+z.normal_index_bytes*4);Ta=z.nquad_flat_uv*(Ta+z.uv_index_bytes*4);V+=function(R){for(var $,na,Ba,ha=z.vertex_coordinate_bytes*3,ka=R+z.nvertices*ha;R=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(d){if(this.count!=0){for(var f=this.count*3;fthis.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p= -this.size-1);var u=Math.floor(o-k);u<1&&(u=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var A,E,G,L,V,z;v0&&(this.field[G+A]+=L)}}}};this.addPlaneX=function(d,f){var g,h,j,k,n,p=this.size,o=this.yd,v=this.zd,y=this.field,u=p*Math.sqrt(d/f);u>p&&(u=p);for(g=0;g0)for(h=0;ho&&(A=o);for(h=0;h0){n=h*v;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(d){if(this.count!=0){for(var f=this.count*3;fthis.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p= +this.size-1);var v=Math.floor(o-k);v<1&&(v=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,F,G,N,W,z;x0&&(this.field[G+B]+=N)}}}};this.addPlaneX=function(d,f){var g,h,j,k,n,p=this.size,o=this.yd,x=this.zd,y=this.field,v=p*Math.sqrt(d/f);v>p&&(v=p);for(g=0;g0)for(h=0;ho&&(B=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>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g* +THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,d,e){var h,g,m,j,o,p;if(e==0)h=g=m=0;else{j=Math.floor(b*6);o=b*6-j;b=e*(1-d);p=e*(1-d*o);d=e*(1-d*(1-o));switch(j){case 1:h=p;g=e;m=b;break;case 2:h=b;g=e;m=d;break;case 3:h=b;g=p;m=e;break;case 4:h=d;g=b;m=e;break;case 5:h=e;g=b; +m=p;break;case 6:case 0:h=e;g=d;m=b}}this.r=h;this.g=g;this.b=m;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g* 255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)}; THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,d,e){this.set(b||0,d||0,e||0)}; @@ -12,73 +12,73 @@ 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,e,h){this.set(b||0,d||0,e||0,h||1)}; THREE.Vector4.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;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,e,h=b.objects,g=[];b=0;for(d=h.length;b0&&Y>0&&$+Y< -1}var e,h,g,k,j,o,p,u,D,F,I,G=b.geometry,L=G.vertices,M=[];e=0;for(h=G.faces.length;e0:D<0)){u=u.dot((new THREE.Vector3).sub(k, -F))/D;F=F.addSelf(I.multiplyScalar(u));if(g instanceof THREE.Face3){if(d(F,k,j,o)){g={distance:this.origin.distanceTo(F),point:F,face:g,object:b};M.push(g)}}else if(g instanceof THREE.Face4&&(d(F,k,j,p)||d(F,j,o,p))){g={distance:this.origin.distanceTo(F),point:F,face:g,object:b};M.push(g)}}}return M}}; -THREE.Rectangle=function(){function b(){k=h-d;j=g-e}var d,e,h,g,k,j,o=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(p,u,D,F){o=!1;d=p;e=u;h=D;g=F;b()};this.addPoint=function(p,u){if(o){o=!1;d=p;e=u;h=p;g=u}else{d=dp?h:p;g=g>u?g:u}b()}; -this.add3Points=function(p,u,D,F,I,G){if(o){o=!1;d=pD?p>I?p:I:D>I?D:I;g=u>F?u>G?u:G:F>G?F:G}else{d=pD?p>I?p>h?p:h:I>h?I:h:D>I?D>h?D:h:I>h?I:h;g=u>F?u>G?u>g?u:g:G>g?G:g:F>G?F>g?F:g:G>g?G:g}b()};this.addRectangle=function(p){if(o){o=!1;d=p.getLeft();e=p.getTop();h=p.getRight();g=p.getBottom()}else{d=dp.getRight()? +THREE.Ray.prototype={intersectScene:function(b){var d,e,h=b.objects,g=[];b=0;for(d=h.length;b0&&Y>0&&$+Y< +1}var e,h,g,m,j,o,p,u,E,G,I,H=b.geometry,L=H.vertices,M=[];e=0;for(h=H.faces.length;e0:E<0)){u=u.dot((new THREE.Vector3).sub(m, +G))/E;G=G.addSelf(I.multiplyScalar(u));if(g instanceof THREE.Face3){if(d(G,m,j,o)){g={distance:this.origin.distanceTo(G),point:G,face:g,object:b};M.push(g)}}else if(g instanceof THREE.Face4&&(d(G,m,j,p)||d(G,j,o,p))){g={distance:this.origin.distanceTo(G),point:G,face:g,object:b};M.push(g)}}}return M}}; +THREE.Rectangle=function(){function b(){m=h-d;j=g-e}var d,e,h,g,m,j,o=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(p,u,E,G){o=!1;d=p;e=u;h=E;g=G;b()};this.addPoint=function(p,u){if(o){o=!1;d=p;e=u;h=p;g=u}else{d=dp?h:p;g=g>u?g:u}b()}; +this.add3Points=function(p,u,E,G,I,H){if(o){o=!1;d=pE?p>I?p:I:E>I?E:I;g=u>G?u>H?u:H:G>H?G:H}else{d=pE?p>I?p>h?p:h:I>h?I:h:E>I?E>h?E:h:I>h?I:h;g=u>G?u>H?u>g?u:g:H>g?H:g:G>H?G>g?G:g:H>g?H:g}b()};this.addRectangle=function(p){if(o){o=!1;d=p.getLeft();e=p.getTop();h=p.getRight();g=p.getBottom()}else{d=dp.getRight()? h:p.getRight();g=g>p.getBottom()?g:p.getBottom()}b()};this.inflate=function(p){d-=p;e-=p;h+=p;g+=p;b()};this.minSelf=function(p){d=d>p.getLeft()?d:p.getLeft();e=e>p.getTop()?e:p.getTop();h=h=0&&Math.min(g,p.getBottom())-Math.max(e,p.getTop())>=0};this.empty=function(){o=!0;g=h=e=d=0;b()};this.isEmpty=function(){return o}}; 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,e,h,g,k,j,o,p,u,D,F,I,G,L,M){this.set(b||1,d||0,e||0,h||0,g||0,k||1,j||0,o||0,p||0,u||0,D||1,F||0,I||0,G||0,L||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,d,e,h,g,k,j,o,p,u,D,F,I,G,L,M){this.n11=b;this.n12=d;this.n13=e;this.n14=h;this.n21=g;this.n22=k;this.n23=j;this.n24=o;this.n31=p;this.n32=u;this.n33=D;this.n34=F;this.n41=I;this.n42=G;this.n43=L;this.n44=M;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(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,e){var h=THREE.Matrix4.__v1, -g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,d).normalize();if(k.length()===0)k.z=1;h.cross(e,k).normalize();if(h.length()===0){k.x+=1.0E-4;h.cross(e,k).normalize()}g.cross(k,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=k.x;this.n21=h.y;this.n22=g.y;this.n23=k.y;this.n31=h.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,h=b.z,g=1/(this.n41*d+this.n42*e+this.n43*h+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*h+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23* +THREE.Matrix4=function(b,d,e,h,g,m,j,o,p,u,E,G,I,H,L,M){this.set(b||1,d||0,e||0,h||0,g||0,m||1,j||0,o||0,p||0,u||0,E||1,G||0,I||0,H||0,L||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,d,e,h,g,m,j,o,p,u,E,G,I,H,L,M){this.n11=b;this.n12=d;this.n13=e;this.n14=h;this.n21=g;this.n22=m;this.n23=j;this.n24=o;this.n31=p;this.n32=u;this.n33=E;this.n34=G;this.n41=I;this.n42=H;this.n43=L;this.n44=M;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(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,e){var h=THREE.Matrix4.__v1, +g=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,d).normalize();if(m.length()===0)m.z=1;h.cross(e,m).normalize();if(h.length()===0){m.x+=1.0E-4;h.cross(e,m).normalize()}g.cross(m,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=m.x;this.n21=h.y;this.n22=g.y;this.n23=m.y;this.n31=h.z;this.n32=g.z;this.n33=m.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,h=b.z,g=1/(this.n41*d+this.n42*e+this.n43*h+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*h+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23* h+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*h+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,h=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*h+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*h+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*h+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*h+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,h=b.z;b.x=d*this.n11+e*this.n12+h*this.n13;b.y=d*this.n21+e*this.n22+h*this.n23;b.z=d*this.n31+e*this.n32+h*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 e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,o=b.n22,p=b.n23,u=b.n24,D=b.n31,F=b.n32,I=b.n33,G=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44,ca=d.n11,ma=d.n12,wa=d.n13,$=d.n14,J=d.n21,xa=d.n22, -ta=d.n23,ea=d.n24,c=d.n31,U=d.n32,V=d.n33,na=d.n34;this.n11=e*ca+h*J+g*c;this.n12=e*ma+h*xa+g*U;this.n13=e*wa+h*ta+g*V;this.n14=e*$+h*ea+g*na+k;this.n21=j*ca+o*J+p*c;this.n22=j*ma+o*xa+p*U;this.n23=j*wa+o*ta+p*V;this.n24=j*$+o*ea+p*na+u;this.n31=D*ca+F*J+I*c;this.n32=D*ma+F*xa+I*U;this.n33=D*wa+F*ta+I*V;this.n34=D*$+F*ea+I*na+G;this.n41=L*ca+M*J+Y*c;this.n42=L*ma+M*xa+Y*U;this.n43=L*wa+M*ta+Y*V;this.n44=L*$+M*ea+Y*na+O;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11; +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 e=b.n11,h=b.n12,g=b.n13,m=b.n14,j=b.n21,o=b.n22,p=b.n23,u=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44,ca=d.n11,ma=d.n12,wa=d.n13,$=d.n14,J=d.n21,xa=d.n22, +ta=d.n23,ea=d.n24,c=d.n31,U=d.n32,V=d.n33,na=d.n34;this.n11=e*ca+h*J+g*c;this.n12=e*ma+h*xa+g*U;this.n13=e*wa+h*ta+g*V;this.n14=e*$+h*ea+g*na+m;this.n21=j*ca+o*J+p*c;this.n22=j*ma+o*xa+p*U;this.n23=j*wa+o*ta+p*V;this.n24=j*$+o*ea+p*na+u;this.n31=E*ca+G*J+I*c;this.n32=E*ma+G*xa+I*U;this.n33=E*wa+G*ta+I*V;this.n34=E*$+G*ea+I*na+H;this.n41=L*ca+M*J+Y*c;this.n42=L*ma+M*xa+Y*U;this.n43=L*wa+M*ta+Y*V;this.n44=L*$+M*ea+Y*na+O;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11; e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[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,e=this.n13,h=this.n14,g=this.n21,k=this.n22,j=this.n23,o=this.n24,p=this.n31,u=this.n32,D=this.n33,F=this.n34,I=this.n41,G=this.n42,L=this.n43,M=this.n44;return h*j*u*I-e*o*u*I-h*k*D*I+d*o*D*I+e*k*F*I-d*j*F*I-h*j*p*G+e*o*p*G+h*g*D*G-b*o*D*G-e*g*F*G+b*j*F*G+h*k*p*L-d*o*p*L-h*g*u*L+b*o*u*L+d*g*F*L-b*k*F*L-e*k*p*M+d*j*p*M+e*g*u*M-b*j*u*M-d*g*D*M+b*k*D*M},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,e=this.n13,h=this.n14,g=this.n21,m=this.n22,j=this.n23,o=this.n24,p=this.n31,u=this.n32,E=this.n33,G=this.n34,I=this.n41,H=this.n42,L=this.n43,M=this.n44;return h*j*u*I-e*o*u*I-h*m*E*I+d*o*E*I+e*m*G*I-d*j*G*I-h*j*p*H+e*o*p*H+h*g*E*H-b*o*E*H-e*g*G*H+b*j*G*H+h*m*p*L-d*o*p*L-h*g*u*L+b*o*u*L+d*g*G*L-b*m*G*L-e*m*p*M+d*j*p*M+e*g*u*M-b*j*u*M-d*g*E*M+b*m*E*M},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,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0, 0,1);return this},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),h=Math.sin(d),g= -1-e,k=b.x,j=b.y,o=b.z,p=g*k,u=g*j;this.set(p*k+e,p*j-h*o,p*o+h*j,0,p*j+h*o,u*j+e,u*o-h*k,0,p*o-h*j,u*o+h*k,g*o*o+e,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,e=b.y,h=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(e);e=Math.sin(e);var k=Math.cos(h);h=Math.sin(h);var j=b*e,o=d*e;this.n11=g*k;this.n12=-g*h;this.n13=e;this.n21=o*k+b*h;this.n22=-o*h+b*k;this.n23=-d*g;this.n31=-j*k+d*h;this.n32=j*h+d*k;this.n33= -b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,h=b.z,g=b.w,k=d+d,j=e+e,o=h+h;b=d*k;var p=d*j;d*=o;var u=e*j;e*=o;h*=o;k*=g;j*=g;g*=o;this.n11=1-(u+h);this.n12=p-g;this.n13=d+j;this.n21=p+g;this.n22=1-(b+h);this.n23=e-k;this.n31=d-j;this.n32=e+k;this.n33=1-(b+u);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14= +1-e,m=b.x,j=b.y,o=b.z,p=g*m,u=g*j;this.set(p*m+e,p*j-h*o,p*o+h*j,0,p*j+h*o,u*j+e,u*o-h*m,0,p*o-h*j,u*o+h*m,g*o*o+e,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,e=b.y,h=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(e);e=Math.sin(e);var m=Math.cos(h);h=Math.sin(h);var j=b*e,o=d*e;this.n11=g*m;this.n12=-g*h;this.n13=e;this.n21=o*m+b*h;this.n22=-o*h+b*m;this.n23=-d*g;this.n31=-j*m+d*h;this.n32=j*h+d*m;this.n33= +b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,h=b.z,g=b.w,m=d+d,j=e+e,o=h+h;b=d*m;var p=d*j;d*=o;var u=e*j;e*=o;h*=o;m*=g;j*=g;g*=o;this.n11=1-(u+h);this.n12=p-g;this.n13=d+j;this.n21=p+g;this.n22=1-(b+h);this.n23=e-m;this.n31=d-j;this.n32=e+m;this.n33=1-(b+u);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14= b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,h=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*h;this.n22=b.n22*h;this.n32=b.n32*h;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; -THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,o=b.n22,p=b.n23,u=b.n24,D=b.n31,F=b.n32,I=b.n33,G=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=p*G*M-u*I*M+u*F*Y-o*G*Y-p*F*O+o*I*O;d.n12=k*I*M-g*G*M-k*F*Y+h*G*Y+g*F*O-h*I*O;d.n13=g*u*M-k*p*M+k*o*Y-h*u*Y-g*o*O+h*p*O;d.n14=k*p*F-g*u*F-k*o*I+h*u*I+g*o*G-h*p*G;d.n21=u*I*L-p*G*L-u*D*Y+j*G*Y+p*D*O-j*I*O;d.n22=g*G*L-k*I*L+k*D*Y-e*G*Y-g*D*O+e*I*O;d.n23=k*p*L-g*u*L-k*j*Y+e*u*Y+g*j*O-e*p*O; -d.n24=g*u*D-k*p*D+k*j*I-e*u*I-g*j*G+e*p*G;d.n31=o*G*L-u*F*L+u*D*M-j*G*M-o*D*O+j*F*O;d.n32=k*F*L-h*G*L-k*D*M+e*G*M+h*D*O-e*F*O;d.n33=g*u*L-k*o*L+k*j*M-e*u*M-h*j*O+e*o*O;d.n34=k*o*D-h*u*D-k*j*F+e*u*F+h*j*G-e*o*G;d.n41=p*F*L-o*I*L-p*D*M+j*I*M+o*D*Y-j*F*Y;d.n42=h*I*L-g*F*L+g*D*M-e*I*M-h*D*Y+e*F*Y;d.n43=g*o*L-h*p*L-g*j*M+e*p*M+h*j*Y-e*o*Y;d.n44=h*p*D-g*o*D+g*j*F-e*p*F-h*j*I+e*o*I;d.multiplyScalar(1/b.determinant());return d}; -THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,o=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,u=b.n23*b.n12-b.n22*b.n13,D=-b.n23*b.n11+b.n21*b.n13,F=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*j+b.n31*u;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*h;e[1]=b*g;e[2]=b*k;e[3]=b*j;e[4]=b*o;e[5]=b*p;e[6]=b*u;e[7]=b*D;e[8]=b*F;return d}; -THREE.Matrix4.makeFrustum=function(b,d,e,h,g,k){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/(h-e);j.n23=(h+e)/(h-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(k+g)/(k-g);j.n34=-2*k*g/(k-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,e,h){var g;b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,h)}; -THREE.Matrix4.makeOrtho=function(b,d,e,h,g,k){var j,o,p,u;j=new THREE.Matrix4;o=d-b;p=e-h;u=k-g;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((d+b)/o);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((e+h)/p);j.n31=0;j.n32=0;j.n33=-2/u;j.n34=-((k+g)/u);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.Matrix4.makeInvert=function(b,d){var e=b.n11,h=b.n12,g=b.n13,m=b.n14,j=b.n21,o=b.n22,p=b.n23,u=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,Y=b.n43,O=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=p*H*M-u*I*M+u*G*Y-o*H*Y-p*G*O+o*I*O;d.n12=m*I*M-g*H*M-m*G*Y+h*H*Y+g*G*O-h*I*O;d.n13=g*u*M-m*p*M+m*o*Y-h*u*Y-g*o*O+h*p*O;d.n14=m*p*G-g*u*G-m*o*I+h*u*I+g*o*H-h*p*H;d.n21=u*I*L-p*H*L-u*E*Y+j*H*Y+p*E*O-j*I*O;d.n22=g*H*L-m*I*L+m*E*Y-e*H*Y-g*E*O+e*I*O;d.n23=m*p*L-g*u*L-m*j*Y+e*u*Y+g*j*O-e*p*O; +d.n24=g*u*E-m*p*E+m*j*I-e*u*I-g*j*H+e*p*H;d.n31=o*H*L-u*G*L+u*E*M-j*H*M-o*E*O+j*G*O;d.n32=m*G*L-h*H*L-m*E*M+e*H*M+h*E*O-e*G*O;d.n33=g*u*L-m*o*L+m*j*M-e*u*M-h*j*O+e*o*O;d.n34=m*o*E-h*u*E-m*j*G+e*u*G+h*j*H-e*o*H;d.n41=p*G*L-o*I*L-p*E*M+j*I*M+o*E*Y-j*G*Y;d.n42=h*I*L-g*G*L+g*E*M-e*I*M-h*E*Y+e*G*Y;d.n43=g*o*L-h*p*L-g*j*M+e*p*M+h*j*Y-e*o*Y;d.n44=h*p*E-g*o*E+g*j*G-e*p*G-h*j*I+e*o*I;d.multiplyScalar(1/b.determinant());return d}; +THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,o=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,u=b.n23*b.n12-b.n22*b.n13,E=-b.n23*b.n11+b.n21*b.n13,G=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*j+b.n31*u;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*h;e[1]=b*g;e[2]=b*m;e[3]=b*j;e[4]=b*o;e[5]=b*p;e[6]=b*u;e[7]=b*E;e[8]=b*G;return d}; +THREE.Matrix4.makeFrustum=function(b,d,e,h,g,m){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/(h-e);j.n23=(h+e)/(h-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(m+g)/(m-g);j.n34=-2*m*g/(m-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,e,h){var g;b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,h)}; +THREE.Matrix4.makeOrtho=function(b,d,e,h,g,m){var j,o,p,u;j=new THREE.Matrix4;o=d-b;p=e-h;u=m-g;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((d+b)/o);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((e+h)/p);j.n31=0;j.n32=0;j.n33=-2/u;j.n34=-((m+g)/u);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= !0;this._vector=new THREE.Vector3}; THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!== undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d instanceof THREE.Scene===!1&&d!==undefined;)d=d.parent;d!==undefined&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!== 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(b,d,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var h=this.children.length;b=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var k=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<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)*k)/j;h=Math.sin(h*k)/j;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,k){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=k instanceof Array?k:[k];this.centroid=new THREE.Vector3}; -THREE.Face4=function(b,d,e,h,g,k,j){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=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];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)}; +THREE.Quaternion.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,h=b.y*d,g=b.z*d;b=Math.cos(h);h=Math.sin(h);d=Math.cos(-g);g=Math.sin(-g);var m=Math.cos(e);e=Math.sin(e);var j=b*d,o=h*g;this.w=j*m-o*e;this.x=j*e+o*m;this.y=h*d*m+b*g*e;this.z=b*g*m-h*d*e;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*= +-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);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,e=this.y,h=this.z,g=this.w,m=b.x,j=b.y,o=b.z;b=b.w;this.x=d*b+g*m+e*o-h*j;this.y=e*b+g*j+h*m-d*o;this.z=h*b+g*o+d*j-e*m;this.w=g*b-d*m-e*j-h*o;return this}, +multiplyVector3:function(b,d){d||(d=b);var e=b.x,h=b.y,g=b.z,m=this.x,j=this.y,o=this.z,p=this.w,u=p*e+j*g-o*h,E=p*h+o*e-m*g,G=p*g+m*h-j*e;e=-m*e-j*h-o*g;d.x=u*p+e*-m+E*-o-G*-j;d.y=E*p+e*-j+G*-m-u*-o;d.z=G*p+e*-o+u*-j-E*-m;return d}}; +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 m=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<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)*m)/j;h=Math.sin(h*m)/j;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,m){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=m instanceof Array?m:[m];this.centroid=new THREE.Vector3}; +THREE.Face4=function(b,d,e,h,g,m,j){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=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];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)}; 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.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b0){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,e=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,e=this.vertices.length;d1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+G);h=h<0?0:1}if(e==="pos"){e=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= -this.getPrevKeyWith("pos",G,j.index-1).pos;this.points[1]=g;this.points[2]=k;this.points[3]=this.getNextKeyWith("pos",G,o.index+1).pos;h=h*0.33+0.33;g=this.interpolateCatmullRom(this.points,h);e.x=g[0];e.y=g[1];e.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){h=this.interpolateCatmullRom(this.points,h*1.01);this.target.set(h[0],h[1],h[2]);this.target.subSelf(e);this.target.y=0;this.target.normalize();h=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,h,0)}}}else if(e=== -"rot")THREE.Quaternion.slerp(g,k,b.quaternion,h);else if(e==="scl"){e=b.scale;e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}}}}if(this.JITCompile&&D[0][u]===undefined){this.hierarchy[0].update(undefined,!0);for(G=0;Gb.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];o=b[e[1]];p=b[e[2]];u=b[e[3]];e=g*g;j=g*e;h[0]=this.interpolate(k[0],o[0],p[0],u[0],g,e,j);h[1]=this.interpolate(k[1],o[1],p[1],u[1],g,e,j);h[2]=this.interpolate(k[2],o[2],p[2],u[2],g,e,j);return h}; -THREE.Animation.prototype.interpolate=function(b,d,e,h,g,k,j){b=(e-b)*0.5;h=(h-d)*0.5;return(2*(d-e)+b+h)*j+(-3*(d-e)-2*b-h)*k+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=e1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+H);h=h<0?0:1}if(e==="pos"){e=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){e.x=g[0]+(m[0]-g[0])*h;e.y=g[1]+(m[1]-g[1])*h;e.z=g[2]+(m[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= +this.getPrevKeyWith("pos",H,j.index-1).pos;this.points[1]=g;this.points[2]=m;this.points[3]=this.getNextKeyWith("pos",H,o.index+1).pos;h=h*0.33+0.33;g=this.interpolateCatmullRom(this.points,h);e.x=g[0];e.y=g[1];e.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){h=this.interpolateCatmullRom(this.points,h*1.01);this.target.set(h[0],h[1],h[2]);this.target.subSelf(e);this.target.y=0;this.target.normalize();h=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,h,0)}}}else if(e=== +"rot")THREE.Quaternion.slerp(g,m,b.quaternion,h);else if(e==="scl"){e=b.scale;e.x=g[0]+(m[0]-g[0])*h;e.y=g[1]+(m[1]-g[1])*h;e.z=g[2]+(m[2]-g[2])*h}}}}if(this.JITCompile&&E[0][u]===undefined){this.hierarchy[0].update(undefined,!0);for(H=0;Hb.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];o=b[e[1]];p=b[e[2]];u=b[e[3]];e=g*g;j=g*e;h[0]=this.interpolate(m[0],o[0],p[0],u[0],g,e,j);h[1]=this.interpolate(m[1],o[1],p[1],u[1],g,e,j);h[2]=this.interpolate(m[2],o[2],p[2],u[2],g,e,j);return h}; +THREE.Animation.prototype.interpolate=function(b,d,e,h,g,m,j){b=(e-b)*0.5;h=(h-d)*0.5;return(2*(d-e)+b+h)*j+(-3*(d-e)-2*b-h)*m+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=e0?e:0:e>=0?e:e+h.length;e>=0;e--)if(h[e][b]!==undefined)return h[e];return this.data.hierarchy[d].keys[h.length-1]}; THREE.Camera=function(b,d,e,h,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=h||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype; THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)}; @@ -105,7 +105,7 @@ THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this THREE.ShadowVolumeDynamicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.lightMap=b.lightMap!==undefined?b.lightMap:null;this.envMap=b.envMap!==undefined?b.envMap:null;this.combine=b.combine!==undefined?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==undefined?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==undefined?b.refractionRatio: 0.98;this.shading=b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==undefined?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==undefined?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!== undefined?b.morphTargets:!1};THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial; -THREE.Texture=function(b,d,e,h,g,k){this.image=b;this.mapping=d!==undefined?d:new THREE.UVMapping;this.wrapS=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrapT=h!==undefined?h:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=k!==undefined?k:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}}; +THREE.Texture=function(b,d,e,h,g,m){this.image=b;this.mapping=d!==undefined?d:new THREE.UVMapping;this.wrapS=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrapT=h!==undefined?h:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=m!==undefined?m:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}}; THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17; THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;var Uniforms={clone:function(b){var d,e,h,g={};for(d in b){g[d]={};for(e in b[d]){h=b[d][e];g[d][e]=h instanceof THREE.Color||h instanceof THREE.Vector3||h instanceof THREE.Texture?h.clone():h}}return g},merge:function(b){var d,e,h,g={};for(d=0;d1){b=e.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 h=1;h=this.LODs[h].visibleAtDistance){this.LODs[h-1].object3D.visible= !1;this.LODs[h].object3D.visible=!0}else break;for(;h=0&&ya>=0&&aa>=0&&pa>=0)return!0;else if(Ga<0&&ya<0||aa<0&&pa<0)return!1;else{if(Ga<0)na=Math.max(na,Ga/(Ga-ya));else ya<0&&(Fa=Math.min(Fa,Ga/(Ga-ya)));if(aa<0)na=Math.max(na,aa/(aa-pa));else pa<0&&(Fa=Math.min(Fa,aa/(aa-pa)));if(FaGa&&j.positionScreen.z0&&$.z<1){Pa=ma[ca]=ma[ca]||new THREE.RenderableParticle;ca++;O=Pa;O.x=$.x/$.w;O.y=$.y/$.w;O.z=$.z;O.rotation=ga.rotation.z;O.scale.x=ga.scale.x*Math.abs(O.x-($.x+V.projectionMatrix.n11)/($.w+V.projectionMatrix.n14));O.scale.y=ga.scale.y*Math.abs(O.y-($.y+V.projectionMatrix.n22)/($.w+V.projectionMatrix.n24));O.materials=ga.materials;Fa.push(O)}}}}na&&Fa.sort(d);return Fa}}; @@ -176,108 +176,108 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE. vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex, THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;", THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}}; -THREE.WebGLRenderer=function(b){function d(f,s,n){var m,r,A,v=f.vertices,x=v.length,z=f.colors,t=z.length,w=f.__vertexArray,y=f.__colorArray,H=f.__sortArray,C=f.__dirtyVertices,N=f.__dirtyColors;if(n.sortParticles){ga.multiplySelf(n.matrixWorld);for(m=0;mt){w=y;t=z[w]}c.bindBuffer(c.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[w]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);A.__webglMorphTargetInfluences[n]=t;x[w]=1;t=-1;n++}}c.uniform1fv(m.program.uniforms.morphTargetInfluences,A.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,r.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(r.__webglCustomAttributes)for(v in r.__webglCustomAttributes)if(f[v]>=0){s=r.__webglCustomAttributes[v];c.bindBuffer(c.ARRAY_BUFFER, -s.buffer);c.vertexAttribPointer(f[v],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(r.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,r.__webglUVBuffer);c.vertexAttribPointer(f.uv, -2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(r.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,r.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(m.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER, -r.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(A instanceof THREE.Mesh)if(m.wireframe){c.lineWidth(m.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer);c.drawElements(c.LINES,r.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, -r.__webglFaceBuffer);c.drawElements(c.TRIANGLES,r.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(A instanceof THREE.Line){A=A.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(m.linewidth);c.drawArrays(A,0,r.__webglLineCount)}else if(A instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,r.__webglParticleCount);else A instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,r.__webglVertexCount)}}function g(f,s){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer= -c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.position);c.vertexAttribPointer(s.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.normal);c.vertexAttribPointer(s.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES, -0,f.count);f.count=0}function k(f){if(aa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);aa=f.doubleSided}if(pa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);pa=f.flipSided}}function j(f){if(qa!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);qa=f}}function o(f){za[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);za[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);za[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);za[3].set(f.n41- -f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);za[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);za[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var s;for(f=0;f<6;f++){s=za[f];s.divideScalar(Math.sqrt(s.x*s.x+s.y*s.y+s.z*s.z))}}function p(f){for(var s=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),m=0;m<6;m++){f=za[m].x*s.n14+za[m].y*s.n24+za[m].z*s.n34+za[m].w;if(f<=n)return!1}return!0}function u(f,s){f.list[f.count]=s;f.count+= -1}function D(f){var s,n,m=f.object,r=f.opaque,A=f.transparent;A.count=0;f=r.count=0;for(s=m.materials.length;f0.0010&&z.scale>0.0010){H[0]=z.x;H[1]=z.y;H[2]=z.z;w=z.size*z.scale/Ca;y[0]=w*t;y[1]=w;c.uniform3fv(T.screenPosition,H);c.uniform1f(T.rotation,z.rotation);c.uniform2fv(T.scale,y);c.uniform1f(T.opacity,z.opacity);ma(z.blending);$(z.texture,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function M(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse, -f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function Y(f){var s,n,m,r,A;if(f instanceof THREE.Mesh){n=f.geometry;for(s in n.geometryGroups){m=n.geometryGroups[s];A=!1;for(r in m.__webglCustomAttributes)if(m.__webglCustomAttributes[r].needsUpdate){A=!0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||A){A=c.DYNAMIC_DRAW;var v=void 0, -x=void 0,z=void 0,t=void 0;z=void 0;var w=void 0,y=void 0,H=void 0,C=void 0,N=void 0,W=void 0,P=void 0,T=void 0,Ha=void 0,R=void 0,Q=void 0,S=void 0,ra=void 0;y=void 0;H=void 0;t=void 0;C=void 0;t=void 0;var q=void 0,E=void 0;y=void 0;q=void 0;E=void 0;var i=void 0,Ka=void 0;q=void 0;E=void 0;i=void 0;Ka=void 0;q=void 0;E=void 0;i=void 0;Ka=void 0;q=void 0;E=void 0;i=void 0;t=void 0;C=void 0;w=void 0;z=void 0;z=void 0;q=void 0;E=void 0;i=void 0;var Wa=void 0,sa=0,Aa=0,$a=0,ab=0,Ja=0,La=0,da=0,Ma= -0,va=0,B=0,Ba=0;E=q=0;var Da=m.__vertexArray,ib=m.__uvArray,jb=m.__uv2Array,Qa=m.__normalArray,ha=m.__tangentArray,Ea=m.__colorArray,ia=m.__skinVertexAArray,ja=m.__skinVertexBArray,ka=m.__skinIndexArray,la=m.__skinWeightArray,kb=m.__morphTargetsArrays,Ra=m.__webglCustomAttributes;i=void 0;var Na=m.__faceArray,Oa=m.__lineArray,rb=m.__needsSmoothNormals;W=m.__vertexColorType;N=m.__uvType;P=m.__normalType;var Ia=f.geometry,lb=Ia.__dirtyVertices,mb=Ia.__dirtyElements,gb=Ia.__dirtyUvs,nb=Ia.__dirtyNormals, -ob=Ia.__dirtyTangents,pb=Ia.__dirtyColors,qb=Ia.__dirtyMorphTargets,bb=Ia.vertices,sb=m.faces,wb=Ia.faces,tb=Ia.faceVertexUvs[0],ub=Ia.faceVertexUvs[1],cb=Ia.skinVerticesA,db=Ia.skinVerticesB,eb=Ia.skinIndices,Xa=Ia.skinWeights,Za=Ia.edgeFaces,Ta=Ia.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}v=0;for(x=sb.length;v0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Ea,A)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,A)}if(ob&& -Ia.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,m.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,A)}if(gb&&$a>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,ib,A)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,A)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,A);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,A)}if(B> -0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,A);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,A);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,A);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,A)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors= -!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;m=f.colors;P=W.length;A=m.length;T=f.__vertexArray;v=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(x=0;x65535){w[z].counter+=1;t=w[z].hash+"_"+w[z].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:x,vertices:0, -numMorphTargets:y})}f.geometryGroups[t].faces.push(r);f.geometryGroups[t].vertices+=v}}function ca(f,s,n){f.push({buffer:s,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ma(f){if(f!=fa){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR); -break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}fa=f}}function wa(f,s,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,ea(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,ea(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ea(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE); -c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,ta(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ta(s.minFilter))}}function $(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}wa(c.TEXTURE_2D, -f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function J(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,ea(f.wrapS)); -c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,ea(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,ea(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,ea(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,ea(f.format),f.width,f.height,0,ea(f.format),ea(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&& -!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D, -null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,n;if(f){s=f.__webglFramebuffer;n=f.width;f=f.height}else{s=null;n=oa;f=Ca}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(Z,ua,n,f);Fa=s}}function xa(f,s){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,s);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));console.error(s); -return null}return n}function ta(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function ea(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR; -case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA; -case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var c,U=document.createElement("canvas"),V=[],na=null,Fa=null,Ga=!0,ya=this,aa=null,pa=null,fa=null,qa=null,Z=0,ua=0,oa=0,Ca=0,za=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ga=new THREE.Matrix4,Pa=new Float32Array(16),Ua=new Float32Array(16),Va=new THREE.Vector4, -hb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Sa=!0,fb=!0,Ya=new THREE.Color(0),vb=0;if(b){if(b.stencil!=undefined)Sa=b.stencil;if(b.antialias!==undefined)fb=b.antialias;b.clearColor!==undefined&&Ya.setHex(b.clearColor);if(b.clearAlpha!==undefined)vb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=U;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,m){try{if(!(c=U.getContext("experimental-webgl",{antialias:f,stencil:m})))throw"Error creating WebGL context."; -}catch(r){console.error(r)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,n)})(fb,Ya,vb,Sa);this.context=c;if(Sa){var X={};X.vertices=new Float32Array(12);X.faces=new Uint16Array(6);X.darkness=0.5;X.vertices[0]=-20;X.vertices[1]=-20;X.vertices[2]=-1;X.vertices[3]=20;X.vertices[4]=-20;X.vertices[5]= --1;X.vertices[6]=20;X.vertices[7]=20;X.vertices[8]=-1;X.vertices[9]=-20;X.vertices[10]=20;X.vertices[11]=-1;X.faces[0]=0;X.faces[1]=1;X.faces[2]=2;X.faces[3]=0;X.faces[4]=2;X.faces[5]=3;X.vertexBuffer=c.createBuffer();X.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,X.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,X.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,X.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X.faces,c.STATIC_DRAW);X.program=c.createProgram();c.attachShader(X.program, -xa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(X.program,xa("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(X.program);X.vertexLocation=c.getAttribLocation(X.program,"position");X.projectionLocation=c.getUniformLocation(X.program,"projectionMatrix");X.darknessLocation=c.getUniformLocation(X.program,"darkness")}var K={};K.vertices=new Float32Array(16);K.faces=new Uint16Array(6);K.transparency=0.5;b=0;K.vertices[b++]=-1;K.vertices[b++]=-1;K.vertices[b++]=0; -K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;b=0;K.faces[b++]=0;K.faces[b++]=1;K.faces[b++]=2;K.faces[b++]=0;K.faces[b++]=2;K.faces[b++]=3;K.vertexBuffer=c.createBuffer();K.elementBuffer=c.createBuffer();K.tempTexture=c.createTexture();K.readBackPixels=new Uint8Array(1024);c.bindBuffer(c.ARRAY_BUFFER,K.vertexBuffer); -c.bufferData(c.ARRAY_BUFFER,K.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,K.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,K.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER, -c.NEAREST);K.program=c.createProgram();c.attachShader(K.program,xa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(K.program,xa("vertex",THREE.ShaderLib.lensFlare.vertexShader));c.linkProgram(K.program);K.attributes={};K.uniforms={};K.attributes.vertex=c.getAttribLocation(K.program,"position");K.attributes.uv=c.getAttribLocation(K.program,"UV");K.uniforms.map=c.getUniformLocation(K.program,"map");K.uniforms.opacity=c.getUniformLocation(K.program,"opacity");K.uniforms.scale=c.getUniformLocation(K.program, -"scale");K.uniforms.rotation=c.getUniformLocation(K.program,"rotation");K.uniforms.screenPosition=c.getUniformLocation(K.program,"screenPosition");K.uniforms.renderPink=c.getUniformLocation(K.program,"renderPink");this.setSize=function(f,s){U.width=f;U.height=s;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(f,s,n,m){Z=f;ua=s;oa=n;Ca=m;c.viewport(Z,ua,oa,Ca)};this.setScissor=function(f,s,n,m){c.scissor(f,s,n,m)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)}; -this.enableDepthBufferWrite=function(f){Ga=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){X.darkness=f};this.initMaterial=function(f,s,n,m){var r,A,v;if(f instanceof THREE.MeshDepthMaterial)v="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)v= -"shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)v="normal";else if(f instanceof THREE.MeshBasicMaterial)v="basic";else if(f instanceof THREE.MeshLambertMaterial)v="lambert";else if(f instanceof THREE.MeshPhongMaterial)v="phong";else if(f instanceof THREE.LineBasicMaterial)v="basic";else f instanceof THREE.ParticleBasicMaterial&&(v="particle_basic");if(v){var x=THREE.ShaderLib[v];f.uniforms=Uniforms.clone(x.uniforms);f.vertexShader=x.vertexShader;f.fragmentShader=x.fragmentShader}var z, -t,w;z=w=x=0;for(t=s.length;z0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP": -"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.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"); -c.attachShader(H,xa("fragment",prefix_fragment+z));c.attachShader(H,xa("vertex",prefix_vertex+t));c.linkProgram(H);c.getProgramParameter(H,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(H,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");H.uniforms={};H.attributes={};var C;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in x)z.push(C); -C=z;x=0;for(z=C.length;x=0&&c.enableVertexAttribArray(y.color);y.normal>= -0&&c.enableVertexAttribArray(y.normal);y.tangent>=0&&c.enableVertexAttribArray(y.tangent);if(f.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){c.enableVertexAttribArray(y.skinVertexA);c.enableVertexAttribArray(y.skinVertexB);c.enableVertexAttribArray(y.skinIndex);c.enableVertexAttribArray(y.skinWeight)}for(r in f.attributes)y[r]>=0&&c.enableVertexAttribArray(y[r]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(y.morphTarget0>=0){c.enableVertexAttribArray(y.morphTarget0); +w,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,z.image[w]);z.__webglInit=!0}wa(c.TEXTURE_CUBE_MAP,z,z.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);z.needsUpdate=!1}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_CUBE_MAP,z.image.__webglTextureCube)}}else $(z,n)}}c.uniformMatrix4fv(v.modelViewMatrix,!1,q._modelViewMatrixArray);c.uniformMatrix3fv(v.normalMatrix,!1,q._normalMatrixArray);(k instanceof THREE.MeshShaderMaterial||k instanceof THREE.MeshPhongMaterial||k.envMap)&&c.uniform3f(v.cameraPosition, +f.position.x,f.position.y,f.position.z);(k instanceof THREE.MeshShaderMaterial||k.envMap||k.skinning)&&c.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);(k instanceof THREE.MeshPhongMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshShaderMaterial||k.skinning)&&c.uniformMatrix4fv(v.viewMatrix,!1,Ua);if(k instanceof THREE.ShadowVolumeDynamicMaterial){f=x.directionalLightDirection.value;f[0]=-s.position.x;f[1]=-s.position.y;f[2]=-s.position.z;c.uniform3fv(v.directionalLightDirection, +f);c.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);c.uniformMatrix4fv(v.viewMatrix,!1,Ua)}if(k.skinning){c.uniformMatrix4fv(v.cameraInverseMatrix,!1,Ua);c.uniformMatrix4fv(v.boneGlobalMatrices,!1,q.boneMatrices)}return A}function h(f,s,n,k,q,A){if(k.opacity!=0){var v;f=e(f,s,n,k,A).attributes;if(k.morphTargets){s=k.program.attributes;A.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[A.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,q.__webglVertexBuffer);c.vertexAttribPointer(s.position, +3,c.FLOAT,!1,0,0);if(A.morphTargetForcedOrder.length){n=0;for(var x=A.morphTargetForcedOrder,z=A.morphTargetInfluences;nt){w=y;t=z[w]}c.bindBuffer(c.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[w]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);A.__webglMorphTargetInfluences[n]=t;x[w]=1;t=-1;n++}}c.uniform1fv(k.program.uniforms.morphTargetInfluences,A.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,q.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(q.__webglCustomAttributes)for(v in q.__webglCustomAttributes)if(f[v]>=0){s=q.__webglCustomAttributes[v];c.bindBuffer(c.ARRAY_BUFFER, +s.buffer);c.vertexAttribPointer(f[v],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(q.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,q.__webglUVBuffer);c.vertexAttribPointer(f.uv, +2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(q.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,q.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(k.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER, +q.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,q.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,q.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(A instanceof THREE.Mesh)if(k.wireframe){c.lineWidth(k.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer);c.drawElements(c.LINES,q.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, +q.__webglFaceBuffer);c.drawElements(c.TRIANGLES,q.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(A instanceof THREE.Line){A=A.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(k.linewidth);c.drawArrays(A,0,q.__webglLineCount)}else if(A instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,q.__webglParticleCount);else A instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,q.__webglVertexCount)}}function g(f,s,n){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer= +c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.position);c.vertexAttribPointer(s.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(n==THREE.FlatShading){var k,q,A,v,x,z,t,w,y,D,B=f.count*3;for(D=0;D0.0010&&z.scale>0.0010){D[0]=z.x;D[1]=z.y;D[2]=z.z;w=z.size*z.scale/Ca;y[0]=w*t;y[1]=w;c.uniform3fv(T.screenPosition, +D);c.uniform1f(T.rotation,z.rotation);c.uniform2fv(T.scale,y);c.uniform1f(T.opacity,z.opacity);ma(z.blending);$(z.texture,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function M(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function Y(f){var s,n,k,q,A;if(f instanceof THREE.Mesh){n=f.geometry; +for(s in n.geometryGroups){k=n.geometryGroups[s];A=!1;for(q in k.__webglCustomAttributes)if(k.__webglCustomAttributes[q].needsUpdate){A=!0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||A){A=c.DYNAMIC_DRAW;var v=void 0,x=void 0,z=void 0,t=void 0;z=void 0;var w=void 0,y=void 0,D=void 0,B=void 0,N=void 0,W=void 0,P=void 0,T=void 0,Ha=void 0,R=void 0,Q=void 0,S=void 0,ra=void 0;y=void 0;D=void 0;t=void 0;B=void 0; +t=void 0;var r=void 0,F=void 0;y=void 0;r=void 0;F=void 0;var i=void 0,Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;F=void 0;i=void 0;t=void 0;B=void 0;w=void 0;z=void 0;z=void 0;r=void 0;F=void 0;i=void 0;var Wa=void 0,sa=0,Aa=0,$a=0,ab=0,Ja=0,La=0,da=0,Ma=0,va=0,C=0,Ba=0;F=r=0;var Da=k.__vertexArray,ib=k.__uvArray,jb=k.__uv2Array,Qa=k.__normalArray,ha=k.__tangentArray,Ea=k.__colorArray,ia=k.__skinVertexAArray,ja=k.__skinVertexBArray,ka=k.__skinIndexArray, +la=k.__skinWeightArray,kb=k.__morphTargetsArrays,Ra=k.__webglCustomAttributes;i=void 0;var Na=k.__faceArray,Oa=k.__lineArray,rb=k.__needsSmoothNormals;W=k.__vertexColorType;N=k.__uvType;P=k.__normalType;var Ia=f.geometry,lb=Ia.__dirtyVertices,mb=Ia.__dirtyElements,gb=Ia.__dirtyUvs,nb=Ia.__dirtyNormals,ob=Ia.__dirtyTangents,pb=Ia.__dirtyColors,qb=Ia.__dirtyMorphTargets,bb=Ia.vertices,sb=k.faces,wb=Ia.faces,tb=Ia.faceVertexUvs[0],ub=Ia.faceVertexUvs[1],cb=Ia.skinVerticesA,db=Ia.skinVerticesB,eb=Ia.skinIndices, +Xa=Ia.skinWeights,Za=Ia.edgeFaces,Ta=Ia.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}v=0;for(x=sb.length;v0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Ea,A)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,k.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,A)}if(ob&&Ia.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,k.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,A)}if(gb&&$a>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER, +ib,A)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,A)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,A);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,A)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,A);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,A);c.bindBuffer(c.ARRAY_BUFFER, +k.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,A);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,A)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;k=f.colors;P=W.length;A=k.length;T=f.__vertexArray;v=f.__colorArray;Ha=f.__dirtyColors; +if(f.__dirtyVertices){for(x=0;x65535){w[z].counter+=1;t=w[z].hash+"_"+w[z].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:x,vertices:0,numMorphTargets:y})}f.geometryGroups[t].faces.push(q);f.geometryGroups[t].vertices+=v}}function ca(f,s,n){f.push({buffer:s,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ma(f){if(f!= +fa){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}fa=f}}function wa(f,s,n){if((n.width&n.width-1)==0&&(n.height& +n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,ea(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,ea(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ea(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,ta(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ta(s.minFilter))}}function $(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D, +f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}wa(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function J(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer=== +undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,ea(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,ea(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,ea(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,ea(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,ea(f.format),f.width,f.height, +0,ea(f.format),ea(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER, +c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,n;if(f){s=f.__webglFramebuffer;n=f.width;f=f.height}else{s=null;n=oa;f=Ca}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(Z,ua,n,f);Fa=s}}function xa(f,s){var n;if(f=="fragment")n= +c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,s);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));console.error(s);return null}return n}function ta(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function ea(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE; +case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT; +case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var c,U=document.createElement("canvas"),V=[],na=null,Fa=null,Ga=!0,ya=this,aa=null,pa=null,fa=null,qa=null,Z= +0,ua=0,oa=0,Ca=0,za=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ga=new THREE.Matrix4,Pa=new Float32Array(16),Ua=new Float32Array(16),Va=new THREE.Vector4,hb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Sa=!0,fb=!0,Ya=new THREE.Color(0),vb=0;if(b){if(b.stencil!=undefined)Sa=b.stencil;if(b.antialias!==undefined)fb=b.antialias;b.clearColor!==undefined&&Ya.setHex(b.clearColor); +if(b.clearAlpha!==undefined)vb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=U;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,k){try{if(!(c=U.getContext("experimental-webgl",{antialias:f,stencil:k})))throw"Error creating WebGL context.";}catch(q){console.error(q)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA); +c.clearColor(s.r,s.g,s.b,n)})(fb,Ya,vb,Sa);this.context=c;if(Sa){var X={};X.vertices=new Float32Array(12);X.faces=new Uint16Array(6);X.darkness=0.5;X.vertices[0]=-20;X.vertices[1]=-20;X.vertices[2]=-1;X.vertices[3]=20;X.vertices[4]=-20;X.vertices[5]=-1;X.vertices[6]=20;X.vertices[7]=20;X.vertices[8]=-1;X.vertices[9]=-20;X.vertices[10]=20;X.vertices[11]=-1;X.faces[0]=0;X.faces[1]=1;X.faces[2]=2;X.faces[3]=0;X.faces[4]=2;X.faces[5]=3;X.vertexBuffer=c.createBuffer();X.elementBuffer=c.createBuffer(); +c.bindBuffer(c.ARRAY_BUFFER,X.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,X.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,X.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X.faces,c.STATIC_DRAW);X.program=c.createProgram();c.attachShader(X.program,xa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(X.program,xa("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(X.program);X.vertexLocation=c.getAttribLocation(X.program,"position");X.projectionLocation= +c.getUniformLocation(X.program,"projectionMatrix");X.darknessLocation=c.getUniformLocation(X.program,"darkness")}var K={};K.vertices=new Float32Array(16);K.faces=new Uint16Array(6);K.transparency=0.5;b=0;K.vertices[b++]=-1;K.vertices[b++]=-1;K.vertices[b++]=0;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;b=0;K.faces[b++]= +0;K.faces[b++]=1;K.faces[b++]=2;K.faces[b++]=0;K.faces[b++]=2;K.faces[b++]=3;K.vertexBuffer=c.createBuffer();K.elementBuffer=c.createBuffer();K.tempTexture=c.createTexture();K.readBackPixels=new Uint8Array(1024);c.bindBuffer(c.ARRAY_BUFFER,K.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,K.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,K.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,K.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16, +16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);K.program=c.createProgram();c.attachShader(K.program,xa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(K.program,xa("vertex",THREE.ShaderLib.lensFlare.vertexShader));c.linkProgram(K.program);K.attributes= +{};K.uniforms={};K.attributes.vertex=c.getAttribLocation(K.program,"position");K.attributes.uv=c.getAttribLocation(K.program,"UV");K.uniforms.map=c.getUniformLocation(K.program,"map");K.uniforms.opacity=c.getUniformLocation(K.program,"opacity");K.uniforms.scale=c.getUniformLocation(K.program,"scale");K.uniforms.rotation=c.getUniformLocation(K.program,"rotation");K.uniforms.screenPosition=c.getUniformLocation(K.program,"screenPosition");K.uniforms.renderPink=c.getUniformLocation(K.program,"renderPink"); +this.setSize=function(f,s){U.width=f;U.height=s;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(f,s,n,k){Z=f;ua=s;oa=n;Ca=k;c.viewport(Z,ua,oa,Ca)};this.setScissor=function(f,s,n,k){c.scissor(f,s,n,k)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){Ga=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r, +f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){X.darkness=f};this.initMaterial=function(f,s,n,k){var q,A,v;if(f instanceof THREE.MeshDepthMaterial)v="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)v="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)v="normal";else if(f instanceof THREE.MeshBasicMaterial)v="basic";else if(f instanceof THREE.MeshLambertMaterial)v="lambert"; +else if(f instanceof THREE.MeshPhongMaterial)v="phong";else if(f instanceof THREE.LineBasicMaterial)v="basic";else f instanceof THREE.ParticleBasicMaterial&&(v="particle_basic");if(v){var x=THREE.ShaderLib[v];f.uniforms=Uniforms.clone(x.uniforms);f.vertexShader=x.vertexShader;f.fragmentShader=x.fragmentShader}var z,t,w;z=w=x=0;for(t=s.length;z0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.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"); +c.attachShader(D,xa("fragment",prefix_fragment+z));c.attachShader(D,xa("vertex",prefix_vertex+t));c.linkProgram(D);c.getProgramParameter(D,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(D,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");D.uniforms={};D.attributes={};var B;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in x)z.push(B); +B=z;x=0;for(z=B.length;x=0&&c.enableVertexAttribArray(y.color);y.normal>= +0&&c.enableVertexAttribArray(y.normal);y.tangent>=0&&c.enableVertexAttribArray(y.tangent);if(f.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){c.enableVertexAttribArray(y.skinVertexA);c.enableVertexAttribArray(y.skinVertexB);c.enableVertexAttribArray(y.skinIndex);c.enableVertexAttribArray(y.skinWeight)}for(q in f.attributes)y[q]>=0&&c.enableVertexAttribArray(y[q]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(y.morphTarget0>=0){c.enableVertexAttribArray(y.morphTarget0); f.numSupportedMorphTargets++}if(y.morphTarget1>=0){c.enableVertexAttribArray(y.morphTarget1);f.numSupportedMorphTargets++}if(y.morphTarget2>=0){c.enableVertexAttribArray(y.morphTarget2);f.numSupportedMorphTargets++}if(y.morphTarget3>=0){c.enableVertexAttribArray(y.morphTarget3);f.numSupportedMorphTargets++}if(y.morphTarget4>=0){c.enableVertexAttribArray(y.morphTarget4);f.numSupportedMorphTargets++}if(y.morphTarget5>=0){c.enableVertexAttribArray(y.morphTarget5);f.numSupportedMorphTargets++}if(y.morphTarget6>= -0){c.enableVertexAttribArray(y.morphTarget6);f.numSupportedMorphTargets++}if(y.morphTarget7>=0){c.enableVertexAttribArray(y.morphTarget7);f.numSupportedMorphTargets++}m.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(r=this.maxMorphTargets;f0||H.faceVertexUvs.length>0)v.__uvArray=new Float32Array(z*2);if(H.faceUvs.length>1||H.faceVertexUvs.length>1)v.__uv2Array=new Float32Array(z*2)}if(x.geometry.skinWeights.length&&x.geometry.skinIndices.length){v.__skinVertexAArray=new Float32Array(z*4);v.__skinVertexBArray=new Float32Array(z*4);v.__skinIndexArray= -new Float32Array(z*4);v.__skinWeightArray=new Float32Array(z*4)}v.__faceArray=new Uint16Array(N*3+(x.geometry.edgeFaces?x.geometry.edgeFaces.length*6:0));v.__lineArray=new Uint16Array(W*2);if(v.numMorphTargets){v.__morphTargetsArrays=[];H=0;for(C=v.numMorphTargets;H=0;r--){m=n.__webglObjects[r].object; -s==m&&n.__webglObjects.splice(r,1)}f.__objectsRemoved.splice(0,1)}s=0;for(n=f.__webglObjects.length;s=0){c.enableVertexAttribArray(y.morphTarget7);f.numSupportedMorphTargets++}k.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(q=this.maxMorphTargets;f0||D.faceVertexUvs.length>0)v.__uvArray=new Float32Array(z*2);if(D.faceUvs.length>1||D.faceVertexUvs.length>1)v.__uv2Array=new Float32Array(z*2)}if(x.geometry.skinWeights.length&&x.geometry.skinIndices.length){v.__skinVertexAArray=new Float32Array(z*4);v.__skinVertexBArray=new Float32Array(z*4);v.__skinIndexArray= +new Float32Array(z*4);v.__skinWeightArray=new Float32Array(z*4)}v.__faceArray=new Uint16Array(N*3+(x.geometry.edgeFaces?x.geometry.edgeFaces.length*6:0));v.__lineArray=new Uint16Array(W*2);if(v.numMorphTargets){v.__morphTargetsArrays=[];D=0;for(B=v.numMorphTargets;D=0;q--){k=n.__webglObjects[q].object; +s==k&&n.__webglObjects.splice(q,1)}f.__objectsRemoved.splice(0,1)}s=0;for(n=f.__webglObjects.length;s0}}; THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==undefined?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==undefined?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==undefined?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==undefined?e.minFilter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!== undefined?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==undefined?e.stencilBuffer:!0}; diff --git a/examples/webgl_collisions_box.html b/examples/webgl_collisions_box.html index 8abf8f1270..0a11dfa650 100644 --- a/examples/webgl_collisions_box.html +++ b/examples/webgl_collisions_box.html @@ -1,8 +1,7 @@ - -threej.s webgl - intersection: ray with box +three.js webgl - intersection: ray with box