diff --git a/build/Three.js b/build/Three.js index c85cdcbb..bb8ec697 100644 --- a/build/Three.js +++ b/build/Three.js @@ -10,68 +10,50 @@ distanceToSquared:function(a){var b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return 1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,f,c){this.x=a||0;this.y=b||0;this.z=f||0;this.w=c||1}; THREE.Vector4.prototype={set:function(a,b,f,c){this.x=a;this.y=b;this.z=f;this.w=c;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,f,c=a.objects,d=[];a=0;for(b=c.length;a0&&y>0&&B+y<1}var f,c,d,o,q,j,e,g,l,r, -k,s=a.geometry,p=s.vertices,n=[];f=0;for(c=s.faces.length;f= -0&&Math.min(d,e.getBottom())-Math.max(f,e.getTop())>=0};this.empty=function(){j=true;d=c=f=b=0;a()};this.isEmpty=function(){return j};this.toString=function(){return"THREE.Rectangle ( left: "+b+", right: "+c+", top: "+f+", bottom: "+d+", width: "+o+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}}; +THREE.Ray.prototype={intersectScene:function(a){var b,f,c=a.objects,d=[];a=0;for(b=c.length;a0&&u>0&&F+u<1}var f,c,d,m,n,r,e,g,k,i, +l,o=a.geometry,s=o.vertices,q=[];f=0;for(c=o.faces.length;f= +0&&Math.min(d,e.getBottom())-Math.max(f,e.getTop())>=0};this.empty=function(){r=true;d=c=f=b=0;a()};this.isEmpty=function(){return r};this.toString=function(){return"THREE.Rectangle ( left: "+b+", right: "+c+", top: "+f+", bottom: "+d+", width: "+m+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}}; THREE.Matrix4=function(){this._x=new THREE.Vector3;this._y=new THREE.Vector3;this._z=new THREE.Vector3}; THREE.Matrix4.prototype={n11:1,n12:0,n13:0,n14:0,n21:0,n22:1,n23:0,n24:0,n31:0,n32:0,n33:1,n34:0,n41:0,n42:0,n43:0,n44:1,identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41= -a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44},lookAt:function(a,b,f){var c=this._x,d=this._y,o=this._z;o.sub(a,b);o.normalize();c.cross(f,o);c.normalize();d.cross(o,c);d.normalize();this.n11=c.x;this.n12=c.y;this.n13=c.z;this.n14=-c.dot(a);this.n21=d.x;this.n22=d.y;this.n23=d.z;this.n24=-d.dot(a);this.n31=o.x;this.n32=o.y;this.n33=o.z;this.n34=-o.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transform:function(a){var b=a.x,f=a.y,c=a.z,d=a.w?a.w:1;a.x=this.n11*b+this.n12*f+this.n13*c+this.n14* +a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44},lookAt:function(a,b,f){var c=this._x,d=this._y,m=this._z;m.sub(a,b);m.normalize();c.cross(f,m);c.normalize();d.cross(m,c);d.normalize();this.n11=c.x;this.n12=c.y;this.n13=c.z;this.n14=-c.dot(a);this.n21=d.x;this.n22=d.y;this.n23=d.z;this.n24=-d.dot(a);this.n31=m.x;this.n32=m.y;this.n33=m.z;this.n34=-m.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transform:function(a){var b=a.x,f=a.y,c=a.z,d=a.w?a.w:1;a.x=this.n11*b+this.n12*f+this.n13*c+this.n14* d;a.y=this.n21*b+this.n22*f+this.n23*c+this.n24*d;a.z=this.n31*b+this.n32*f+this.n33*c+this.n34*d;d=this.n41*b+this.n42*f+this.n43*c+this.n44*d;if(a.w)a.w=d;else{a.x/=d;a.y/=d;a.z/=d}return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a, b){this.n11=a.n11*b.n11+a.n12*b.n21+a.n13*b.n31+a.n14*b.n41;this.n12=a.n11*b.n12+a.n12*b.n22+a.n13*b.n32+a.n14*b.n42;this.n13=a.n11*b.n13+a.n12*b.n23+a.n13*b.n33+a.n14*b.n43;this.n14=a.n11*b.n14+a.n12*b.n24+a.n13*b.n34+a.n14*b.n44;this.n21=a.n21*b.n11+a.n22*b.n21+a.n23*b.n31+a.n24*b.n41;this.n22=a.n21*b.n12+a.n22*b.n22+a.n23*b.n32+a.n24*b.n42;this.n23=a.n21*b.n13+a.n22*b.n23+a.n23*b.n33+a.n24*b.n43;this.n24=a.n21*b.n14+a.n22*b.n24+a.n23*b.n34+a.n24*b.n44;this.n31=a.n31*b.n11+a.n32*b.n21+a.n33*b.n31+ -a.n34*b.n41;this.n32=a.n31*b.n12+a.n32*b.n22+a.n33*b.n32+a.n34*b.n42;this.n33=a.n31*b.n13+a.n32*b.n23+a.n33*b.n33+a.n34*b.n43;this.n34=a.n31*b.n14+a.n32*b.n24+a.n33*b.n34+a.n34*b.n44;this.n41=a.n41*b.n11+a.n42*b.n21+a.n43*b.n31+a.n44*b.n41;this.n42=a.n41*b.n12+a.n42*b.n22+a.n43*b.n32+a.n44*b.n42;this.n43=a.n41*b.n13+a.n42*b.n23+a.n43*b.n33+a.n44*b.n43;this.n44=a.n41*b.n14+a.n42*b.n24+a.n43*b.n34+a.n44*b.n44},multiplySelf:function(a){var b=this.n11,f=this.n12,c=this.n13,d=this.n14,o=this.n21,q=this.n22, -j=this.n23,e=this.n24,g=this.n31,l=this.n32,r=this.n33,k=this.n34,s=this.n41,p=this.n42,n=this.n43,y=this.n44;this.n11=b*a.n11+f*a.n21+c*a.n31+d*a.n41;this.n12=b*a.n12+f*a.n22+c*a.n32+d*a.n42;this.n13=b*a.n13+f*a.n23+c*a.n33+d*a.n43;this.n14=b*a.n14+f*a.n24+c*a.n34+d*a.n44;this.n21=o*a.n11+q*a.n21+j*a.n31+e*a.n41;this.n22=o*a.n12+q*a.n22+j*a.n32+e*a.n42;this.n23=o*a.n13+q*a.n23+j*a.n33+e*a.n43;this.n24=o*a.n14+q*a.n24+j*a.n34+e*a.n44;this.n31=g*a.n11+l*a.n21+r*a.n31+k*a.n41;this.n32=g*a.n12+l*a.n22+ -r*a.n32+k*a.n42;this.n33=g*a.n13+l*a.n23+r*a.n33+k*a.n43;this.n34=g*a.n14+l*a.n24+r*a.n34+k*a.n44;this.n41=s*a.n11+p*a.n21+n*a.n31+y*a.n41;this.n42=s*a.n12+p*a.n22+n*a.n32+y*a.n42;this.n43=s*a.n13+p*a.n23+n*a.n33+y*a.n43;this.n44=s*a.n14+p*a.n24+n*a.n34+y*a.n44},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a},determinant:function(){return this.n14* +a.n34*b.n41;this.n32=a.n31*b.n12+a.n32*b.n22+a.n33*b.n32+a.n34*b.n42;this.n33=a.n31*b.n13+a.n32*b.n23+a.n33*b.n33+a.n34*b.n43;this.n34=a.n31*b.n14+a.n32*b.n24+a.n33*b.n34+a.n34*b.n44;this.n41=a.n41*b.n11+a.n42*b.n21+a.n43*b.n31+a.n44*b.n41;this.n42=a.n41*b.n12+a.n42*b.n22+a.n43*b.n32+a.n44*b.n42;this.n43=a.n41*b.n13+a.n42*b.n23+a.n43*b.n33+a.n44*b.n43;this.n44=a.n41*b.n14+a.n42*b.n24+a.n43*b.n34+a.n44*b.n44},multiplySelf:function(a){var b=this.n11,f=this.n12,c=this.n13,d=this.n14,m=this.n21,n=this.n22, +r=this.n23,e=this.n24,g=this.n31,k=this.n32,i=this.n33,l=this.n34,o=this.n41,s=this.n42,q=this.n43,u=this.n44;this.n11=b*a.n11+f*a.n21+c*a.n31+d*a.n41;this.n12=b*a.n12+f*a.n22+c*a.n32+d*a.n42;this.n13=b*a.n13+f*a.n23+c*a.n33+d*a.n43;this.n14=b*a.n14+f*a.n24+c*a.n34+d*a.n44;this.n21=m*a.n11+n*a.n21+r*a.n31+e*a.n41;this.n22=m*a.n12+n*a.n22+r*a.n32+e*a.n42;this.n23=m*a.n13+n*a.n23+r*a.n33+e*a.n43;this.n24=m*a.n14+n*a.n24+r*a.n34+e*a.n44;this.n31=g*a.n11+k*a.n21+i*a.n31+l*a.n41;this.n32=g*a.n12+k*a.n22+ +i*a.n32+l*a.n42;this.n33=g*a.n13+k*a.n23+i*a.n33+l*a.n43;this.n34=g*a.n14+k*a.n24+i*a.n34+l*a.n44;this.n41=o*a.n11+s*a.n21+q*a.n31+u*a.n41;this.n42=o*a.n12+s*a.n22+q*a.n32+u*a.n42;this.n43=o*a.n13+s*a.n23+q*a.n33+u*a.n43;this.n44=o*a.n14+s*a.n24+q*a.n34+u*a.n44},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a},determinant:function(){return this.n14* this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14* this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,f,c){var d=b[f];b[f]=b[c];b[c]=d}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this, "n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){return[this.n11,this.n21,this.n31,this.n41,this.n12,this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]}, toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,f){var c=new THREE.Matrix4;c.n14=a;c.n24=b;c.n34=f;return c};THREE.Matrix4.scaleMatrix=function(a,b,f){var c=new THREE.Matrix4;c.n11=a;c.n22=b;c.n33=f;return c}; THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b}; -THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var f=new THREE.Matrix4,c=Math.cos(b),d=Math.sin(b),o=1-c,q=a.x,j=a.y,e=a.z;f.n11=o*q*q+c;f.n12=o*q*j-d*e;f.n13=o*q*e+d*j;f.n21=o*q*j+d*e;f.n22=o*j*j+c;f.n23=o*j*e-d*q;f.n31=o*q*e-d*j;f.n32=o*j*e+d*q;f.n33=o*e*e+c;return f}; +THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var f=new THREE.Matrix4,c=Math.cos(b),d=Math.sin(b),m=1-c,n=a.x,r=a.y,e=a.z;f.n11=m*n*n+c;f.n12=m*n*r-d*e;f.n13=m*n*e+d*r;f.n21=m*n*r+d*e;f.n22=m*r*r+c;f.n23=m*r*e-d*n;f.n31=m*n*e-d*r;f.n32=m*r*e+d*n;f.n33=m*e*e+c;return f}; THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;b.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;b.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;b.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12* a.n23*a.n34;b.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;b.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;b.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;b.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;b.n31=a.n22*a.n34*a.n41-a.n24*a.n32* a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;b.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;b.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;b.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;b.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22* a.n31*a.n43-a.n21*a.n32*a.n43;b.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;b.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;b.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;b.multiplyScalar(1/a.determinant());return b}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var f=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],o=-b[10]*b[4]+b[6]*b[8],q=b[10]*b[0]-b[2]*b[8],j=-b[6]*b[0]+b[2]*b[4],e=b[9]*b[4]-b[5]*b[8],g=-b[9]*b[0]+b[1]*b[8],l=b[5]*b[0]-b[1]*b[4];b=b[0]*f+b[1]*o+b[2]*e;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*f;a.m[1]=b*c;a.m[2]=b*d;a.m[3]=b*o;a.m[4]=b*q;a.m[5]=b*j;a.m[6]=b*e;a.m[7]=b*g;a.m[8]=b*l;return a}; -THREE.Matrix4.makeFrustum=function(a,b,f,c,d,o){var q,j,e;q=new THREE.Matrix4;j=2*d/(b-a);e=2*d/(c-f);a=(b+a)/(b-a);f=(c+f)/(c-f);c=-(o+d)/(o-d);d=-2*o*d/(o-d);q.n11=j;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=e;q.n23=f;q.n24=0;q.n31=0;q.n32=0;q.n33=c;q.n34=d;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,b,f,c){var d;a=f*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,f,c)}; -THREE.Matrix4.makeOrtho=function(a,b,f,c,d,o){var q,j,e,g;q=new THREE.Matrix4;j=b-a;e=f-c;g=o-d;a=(b+a)/j;f=(f+c)/e;d=(o+d)/g;q.n11=2/j;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/e;q.n23=0;q.n24=-f;q.n31=0;q.n32=0;q.n33=-2/g;q.n34=-d;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var f=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],m=-b[10]*b[4]+b[6]*b[8],n=b[10]*b[0]-b[2]*b[8],r=-b[6]*b[0]+b[2]*b[4],e=b[9]*b[4]-b[5]*b[8],g=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4];b=b[0]*f+b[1]*m+b[2]*e;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*f;a.m[1]=b*c;a.m[2]=b*d;a.m[3]=b*m;a.m[4]=b*n;a.m[5]=b*r;a.m[6]=b*e;a.m[7]=b*g;a.m[8]=b*k;return a}; +THREE.Matrix4.makeFrustum=function(a,b,f,c,d,m){var n,r,e;n=new THREE.Matrix4;r=2*d/(b-a);e=2*d/(c-f);a=(b+a)/(b-a);f=(c+f)/(c-f);c=-(m+d)/(m-d);d=-2*m*d/(m-d);n.n11=r;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=e;n.n23=f;n.n24=0;n.n31=0;n.n32=0;n.n33=c;n.n34=d;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,b,f,c){var d;a=f*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,f,c)}; +THREE.Matrix4.makeOrtho=function(a,b,f,c,d,m){var n,r,e,g;n=new THREE.Matrix4;r=b-a;e=f-c;g=m-d;a=(b+a)/r;f=(f+c)/e;d=(m+d)/g;n.n11=2/r;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/e;n.n23=0;n.n24=-f;n.n31=0;n.n32=0;n.n33=-2/g;n.n34=-d;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector3;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; THREE.Face3=function(a,b,f,c,d){this.a=a;this.b=b;this.c=f;this.centroid=new THREE.Vector3;this.normal=c instanceof THREE.Vector3?c:new THREE.Vector3;this.vertexNormals=c instanceof Array?c:[];this.material=d instanceof Array?d:[d]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,b,f,c,d,o){this.a=a;this.b=b;this.c=f;this.d=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=o instanceof Array?o:[o]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; +THREE.Face4=function(a,b,f,c,d,m){this.a=a;this.b=b;this.c=f;this.d=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=m instanceof Array?m:[m]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[]}; THREE.Geometry.prototype={computeCentroids:function(){var a,b,f;a=0;for(b=this.faces.length;a0){this.bbox={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 a=1,b=this.vertices.length;a +f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeNormals:function(a){var b,f,c,d,m,n,r=new THREE.Vector3,e=new THREE.Vector3;c=0;for(d=this.vertices.length;c0){this.bbox={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 a=1,b=this.vertices.length;a this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.ythis.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.zthis.bbox.z[1])this.bbox.z[1]=vertex.position.z}}},toString:function(){return"THREE.Geometry ( vertices: "+this.vertices+", faces: "+this.faces+" )"}}; -THREE.Camera=function(a,b,f,c){this.position=new THREE.Vector3(0,0,0);this.target={position:new THREE.Vector3(0,0,0)};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,b,f,c);this.autoUpdateMatrix=true;this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.toString=function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Loader=function(){}; -THREE.Loader.prototype={loadAsciiOld:function(a,b){var f=document.createElement("script");f.type="text/javascript";f.onload=b;f.src=a;document.getElementsByTagName("head")[0].appendChild(f)},loadAscii:function(a,b,f){var c=(new Date).getTime();a=new Worker(a);a.onmessage=function(d){THREE.Loader.prototype.createModel(d.data,b,f)};a.postMessage(c)},loadBinary:function(a,b,f){var c=(new Date).getTime();a=new Worker(a);a.onmessage=function(d){THREE.Loader.prototype.loadAjaxBuffers(d.data.buffers,d.data.materials, -b,f)};a.onerror=function(d){alert("worker.onerror: "+d.message+"\n"+d.data);d.preventDefault()};a.postMessage(c)},loadAjaxBuffers:function(a,b,f,c){var d=new XMLHttpRequest,o=c+"/"+a;d.onreadystatechange=function(){if(d.readyState==4)d.status==200||d.status==0?THREE.Loader.prototype.createBinModel(d.responseText,f,c,b):alert("Couldn't load ["+o+"] ["+d.status+"]")};d.open("GET",o,true);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)}, -createBinModel:function(a,b,f,c){var d=function(o){function q(h,t){var x=l(h,t),C=l(h,t+1),K=l(h,t+2),da=l(h,t+3),ia=(da<<1&255|K>>7)-127;x=(K&127)<<16|C<<8|x;if(x==0&&ia==-127)return 0;return(1-2*(da>>7))*(1+x*Math.pow(2,-23))*Math.pow(2,ia)}function j(h,t){var x=l(h,t),C=l(h,t+1),K=l(h,t+2);return(l(h,t+3)<<24)+(K<<16)+(C<<8)+x}function e(h,t){var x=l(h,t);return(l(h,t+1)<<8)+x}function g(h,t){var x=l(h,t);return x>127?x-256:x}function l(h,t){return h.charCodeAt(t)&255}function r(h){var t,x,C;t= -j(a,h);x=j(a,h+V);C=j(a,h+w);h=e(a,h+D);THREE.Loader.prototype.f3(m,t,x,C,h)}function k(h){var t,x,C,K,da,ia;t=j(a,h);x=j(a,h+V);C=j(a,h+w);K=e(a,h+D);da=j(a,h+z);ia=j(a,h+T);h=j(a,h+O);THREE.Loader.prototype.f3n(m,A,t,x,C,K,da,ia,h)}function s(h){var t,x,C,K;t=j(a,h);x=j(a,h+P);C=j(a,h+U);K=j(a,h+W);h=e(a,h+aa);THREE.Loader.prototype.f4(m,t,x,C,K,h)}function p(h){var t,x,C,K,da,ia,ja,qa;t=j(a,h);x=j(a,h+P);C=j(a,h+U);K=j(a,h+W);da=e(a,h+aa);ia=j(a,h+I);ja=j(a,h+Z);qa=j(a,h+Q);h=j(a,h+ca);THREE.Loader.prototype.f4n(m, -A,t,x,C,K,da,ia,ja,qa,h)}function n(h){var t,x;t=j(a,h);x=j(a,h+G);h=j(a,h+E);THREE.Loader.prototype.uv(m,B[t*2],B[t*2+1],B[x*2],B[x*2+1],B[h*2],B[h*2+1])}function y(h){var t,x,C;t=j(a,h);x=j(a,h+ba);C=j(a,h+ma);h=j(a,h+R);THREE.Loader.prototype.uv(m,B[t*2],B[t*2+1],B[x*2],B[x*2+1],B[C*2],B[C*2+1],B[h*2],B[h*2+1])}var m=this,v=0,i,A=[],B=[],V,w,D,z,T,O,P,U,W,aa,I,Z,Q,ca,G,E,ba,ma,R;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(m,c,o);i={signature:a.substr(v,8),header_bytes:l(a,v+ -8),vertex_coordinate_bytes:l(a,v+9),normal_coordinate_bytes:l(a,v+10),uv_coordinate_bytes:l(a,v+11),vertex_index_bytes:l(a,v+12),normal_index_bytes:l(a,v+13),uv_index_bytes:l(a,v+14),material_index_bytes:l(a,v+15),nvertices:j(a,v+16),nnormals:j(a,v+16+4),nuvs:j(a,v+16+8),ntri_flat:j(a,v+16+12),ntri_smooth:j(a,v+16+16),ntri_flat_uv:j(a,v+16+20),ntri_smooth_uv:j(a,v+16+24),nquad_flat:j(a,v+16+28),nquad_smooth:j(a,v+16+32),nquad_flat_uv:j(a,v+16+36),nquad_smooth_uv:j(a,v+16+40)};v+=i.header_bytes;V= -i.vertex_index_bytes;w=i.vertex_index_bytes*2;D=i.vertex_index_bytes*3;z=i.vertex_index_bytes*3+i.material_index_bytes;T=i.vertex_index_bytes*3+i.material_index_bytes+i.normal_index_bytes;O=i.vertex_index_bytes*3+i.material_index_bytes+i.normal_index_bytes*2;P=i.vertex_index_bytes;U=i.vertex_index_bytes*2;W=i.vertex_index_bytes*3;aa=i.vertex_index_bytes*4;I=i.vertex_index_bytes*4+i.material_index_bytes;Z=i.vertex_index_bytes*4+i.material_index_bytes+i.normal_index_bytes;Q=i.vertex_index_bytes*4+i.material_index_bytes+ -i.normal_index_bytes*2;ca=i.vertex_index_bytes*4+i.material_index_bytes+i.normal_index_bytes*3;G=i.uv_index_bytes;E=i.uv_index_bytes*2;ba=i.uv_index_bytes;ma=i.uv_index_bytes*2;R=i.uv_index_bytes*3;v+=function(h){var t,x,C,K=i.vertex_coordinate_bytes*3,da=h+i.nvertices*K;for(h=h;h65535){g[j].counter+=1;e=g[j].hash+"_"+g[j].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:q,vertices:0}}this.materialFaceGroup[e].faces.push(c);this.materialFaceGroup[e].vertices+=o}};THREE.Mesh.prototype.normalizeUVs=function(){var a,b,f,c,d;a=0;for(b=this.geometry.uvs.length;a65535){g[r].counter+=1;e=g[r].hash+"_"+g[r].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:n,vertices:0}}this.materialFaceGroup[e].faces.push(c);this.materialFaceGroup[e].vertices+=m}};THREE.Mesh.prototype.normalizeUVs=function(){var a,b,f,c,d;a=0;for(b=this.geometry.uvs.length;acolor: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
linewidth: "+ this.linewidth+"
)"}}; @@ -88,50 +70,50 @@ THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16711680);thi this.blending+"
)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16711680);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b){this.image=a;this.mapping=b?b:THREE.UVMapping;this.toString=function(){return"THREE.Texture (
image: "+this.image+"
mapping: "+this.mapping+"
)"}};THREE.UVMapping=0;THREE.ReflectionMap=1;THREE.CubeMap=2; THREE.Scene=function(){this.objects=[];this.lights=[];this.addObject=function(a){this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}}; -THREE.Projector=function(){var a=null,b,f,c=[],d,o,q=[],j,e,g=[],l,r,k=[],s=new THREE.Vector4,p=new THREE.Matrix4,n=new THREE.Matrix4;this.projectScene=function(y,m){var v,i,A,B,V,w,D,z,T,O,P,U,W,aa;a=[];r=e=o=f=0;m.autoUpdateMatrix&&m.updateMatrix();p.multiply(m.projectionMatrix,m.matrix);V=y.objects;v=0;for(i=V.length;v0&&O.z<1}T=w.geometry.faces;A=0;for(B=T.length;A0&&O.z<1;if(T.__visible&&A>0){D=w.geometry.vertices[A-1];if(T.__visible&&D.__visible){j=g[e]=g[e]||new THREE.RenderableLine;j.v1.positionScreen.copy(T.positionScreen);j.v2.positionScreen.copy(D.positionScreen);j.z=Math.max(T.positionScreen.z,D.positionScreen.z);j.material=w.material;a.push(j);e++}}}}else if(w instanceof THREE.Particle){s.set(w.position.x,w.position.y,w.position.z,1);p.transform(s); -s.z/=s.w;if(s.z>0&&s.z<1){l=k[r]=k[r]||new THREE.RenderableParticle;l.x=s.x/s.w;l.y=s.y/s.w;l.z=s.z;l.rotation=w.rotation.z;l.scale.x=w.scale.x*Math.abs(l.x-(s.x+m.projectionMatrix.n11)/(s.w+m.projectionMatrix.n14));l.scale.y=w.scale.y*Math.abs(l.y-(s.y+m.projectionMatrix.n22)/(s.w+m.projectionMatrix.n24));l.material=w.material;a.push(l);r++}}}a.sort(function(I,Z){return Z.z-I.z});return a};this.unprojectVector=function(y,m){var v=new THREE.Matrix4;v.multiply(THREE.Matrix4.makeInvert(m.matrix),THREE.Matrix4.makeInvert(m.projectionMatrix)); -v.transform(y);return y}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,f,c,d,o;this.domElement=document.createElement("div");this.setSize=function(q,j){f=q;c=j;d=f/2;o=c/2};this.render=function(q,j){var e,g,l,r,k,s,p,n;a=b.projectScene(q,j);e=0;for(g=a.length;e0){M.r+=L.r*u;M.g+=L.g*u;M.b+=L.b*u}}else if(u instanceof THREE.PointLight){Ha.sub(u.position,S.centroidWorld);Ha.normalize();u=S.normalWorld.dot(Ha)*u.intensity;if(u>0){M.r+=L.r*u;M.g+=L.g*u;M.b+=L.b*u}}}}function b(J,S,M,N,u,L){U=J.positionScreen.x;W=J.positionScreen.y;aa=S.positionScreen.x; -I=S.positionScreen.y;Z=M.positionScreen.x;Q=M.positionScreen.y;if(u.opacity!=v)m.globalAlpha=v=u.opacity;u.blending!=i&&q(u.blending);if(u.map){ja=u.map.image;qa=ja.width-1;ta=ja.height-1;ka.u=N.uvs[0].u*qa;ka.v=N.uvs[0].v*ta;ea.u=N.uvs[1].u*qa;ea.v=N.uvs[1].v*ta;la.u=N.uvs[2].u*qa;la.v=N.uvs[2].v*ta;o(ja,U,W,aa,I,Z,Q,ka.u,ka.v,ea.u,ea.v,la.u,la.v)}else if(u instanceof THREE.MeshBasicMaterial)c(U,W,aa,I,Z,Q,u.color,u.wireframe,u.wireframe_linewidth);else if(u instanceof THREE.MeshLambertMaterial){if(Ea){ga.r= -na.r;ga.g=na.g;ga.b=na.b;a(L,N,ga);X.r=u.color.r*ga.r;X.g=u.color.g*ga.g;X.b=u.color.b*ga.b;X.updateStyleString()}else X.__styleString=u.color.__styleString;c(U,W,aa,I,Z,Q,X,u.wireframe,u.wireframe_linewidth)}else if(u instanceof THREE.MeshDepthMaterial){K=u.__2near;da=u.__farPlusNear;ia=u.__farMinusNear;h=~~((1-K/(da-J.positionScreen.z*ia))*255);t=~~((1-K/(da-S.positionScreen.z*ia))*255);x=~~((1-K/(da-M.positionScreen.z*ia))*255);ja=j([h,h,h],[t,t,t],[x,x,x],[x,x,x]);ka.u=0;ka.v=0;ea.u=ra;ea.v=0; -la.u=0;la.v=ra;o(ja,U,W,aa,I,Z,Q,ka.u,ka.v,ea.u,ea.v,la.u,la.v)}else if(u instanceof THREE.MeshNormalMaterial){X.r=e(N.normalWorld.x);X.g=e(N.normalWorld.y);X.b=e(N.normalWorld.z);X.updateStyleString();c(U,W,aa,I,Z,Q,X,u.wireframe,u.wireframe_linewidth)}}function f(J,S,M,N,u,L,Y,F,$){U=J.positionScreen.x;W=J.positionScreen.y;aa=S.positionScreen.x;I=S.positionScreen.y;Z=M.positionScreen.x;Q=M.positionScreen.y;ca=N.positionScreen.x;G=N.positionScreen.y;E=u.positionScreen.x;ba=u.positionScreen.y;ma= -L.positionScreen.x;R=L.positionScreen.y;if(F.opacity!=v)m.globalAlpha=v=F.opacity;F.blending!=i&&q(F.blending);if(F.map){ja=F.map.image;qa=ja.width-1;ta=ja.height-1;ka.copy(Y.uvs[0]);ea.copy(Y.uvs[1]);la.copy(Y.uvs[2]);oa.copy(Y.uvs[3]);ka.u*=qa;ka.v*=ta;ea.u*=qa;ea.v*=ta;la.u*=qa;la.v*=ta;oa.u*=qa;oa.v*=ta;o(ja,U,W,aa,I,ca,G,ka.u,ka.v,ea.u,ea.v,oa.u,oa.v);o(ja,E,ba,Z,Q,ma,R,ea.u,ea.v,la.u,la.v,oa.u,oa.v)}else if(F instanceof THREE.MeshBasicMaterial)d(U,W,aa,I,Z,Q,ca,G,F.color,F.wireframe,F.wireframe_linewidth); -else if(F instanceof THREE.MeshLambertMaterial){if(Ea){ga.r=na.r;ga.g=na.g;ga.b=na.b;a($,Y,ga);X.r=F.color.r*ga.r;X.g=F.color.g*ga.g;X.b=F.color.b*ga.b;X.updateStyleString()}else X.__styleString=F.color.__styleString;d(U,W,aa,I,Z,Q,ca,G,X,F.wireframe,F.wireframe_linewidth)}else if(F instanceof THREE.MeshDepthMaterial){K=F.__2near;da=F.__farPlusNear;ia=F.__farMinusNear;h=~~((1-K/(da-J.positionScreen.z*ia))*255);t=~~((1-K/(da-S.positionScreen.z*ia))*255);x=~~((1-K/(da-M.positionScreen.z*ia))*255);C= -~~((1-K/(da-N.positionScreen.z*ia))*255);ja=j([h,h,h],[t,t,t],[C,C,C],[x,x,x]);ka.u=0;ka.v=0;ea.u=ra;ea.v=0;la.u=ra;la.v=ra;oa.u=0;oa.v=ra;o(ja,U,W,aa,I,ca,G,ka.u,ka.v,ea.u,ea.v,oa.u,oa.v);o(ja,E,ba,Z,Q,ma,R,ea.u,ea.v,la.u,la.v,oa.u,oa.v)}else if(F instanceof THREE.MeshNormalMaterial){X.r=e(Y.normalWorld.x);X.g=e(Y.normalWorld.y);X.b=e(Y.normalWorld.z);X.updateStyleString();d(U,W,aa,I,Z,Q,ca,G,X,F.wireframe,F.wireframe_linewidth)}}function c(J,S,M,N,u,L,Y,F,$){m.beginPath();m.moveTo(J,S);m.lineTo(M, -N);m.lineTo(u,L);m.lineTo(J,S);m.closePath();if(F){if(V!=$)m.lineWidth=V=$;if(A!=Y.__styleString)m.strokeStyle=A=Y.__styleString;m.stroke();fa.inflate($*2)}else{if(B!=Y.__styleString)m.fillStyle=B=Y.__styleString;m.fill()}}function d(J,S,M,N,u,L,Y,F,$,H,ha){m.beginPath();m.moveTo(J,S);m.lineTo(M,N);m.lineTo(u,L);m.lineTo(Y,F);m.lineTo(J,S);m.closePath();if(H){if(V!=ha)m.lineWidth=V=ha;if(A!=$.__styleString)m.strokeStyle=A=$.__styleString;m.stroke();fa.inflate(ha*2)}else{if(B!=$.__styleString)m.fillStyle= -B=$.__styleString;m.fill()}}function o(J,S,M,N,u,L,Y,F,$,H,ha,sa,ua){m.beginPath();m.moveTo(S,M);m.lineTo(N,u);m.lineTo(L,Y);m.closePath();N-=S;u-=M;L-=S;Y-=M;H-=F;ha-=$;sa-=F;ua-=$;var va=1/(H*ua-sa*ha),Aa=(ua*N-ha*L)*va;ha=(ua*u-ha*Y)*va;N=(H*L-sa*N)*va;u=(H*Y-sa*u)*va;S=S-Aa*F-N*$;M=M-ha*F-u*$;m.save();m.transform(Aa,ha,N,u,S,M);m.clip();m.drawImage(J,0,0);m.restore()}function q(J){switch(J){case 0:m.globalCompositeOperation="source-over";break;case 1:m.globalCompositeOperation="lighter";break; -case 2:m.globalCompositeOperation="darker"}i=J}function j(J,S,M,N){pa[0]=J[0];pa[1]=J[1];pa[2]=J[2];pa[4]=S[0];pa[5]=S[1];pa[6]=S[2];pa[8]=M[0];pa[9]=M[1];pa[10]=M[2];pa[12]=N[0];pa[13]=N[1];pa[14]=N[2];Ba.putImageData(Ia,0,0);Fa.drawImage(Ca,0,0);return Da}function e(J){return J<0?Math.min((1+J)*0.5,0.5):0.5+Math.min(J*0.5,0.5)}function g(J,S){var M=S.x-J.x,N=S.y-J.y,u=1/Math.sqrt(M*M+N*N);M*=u;N*=u;S.x+=M;S.y+=N;J.x-=M;J.y-=N}var l=null,r=new THREE.Projector,k=document.createElement("canvas"),s, -p,n,y,m=k.getContext("2d"),v=1,i=0,A=null,B=null,V=1,w,D,z,T,O=new THREE.Vertex,P=new THREE.Vertex,U,W,aa,I,Z,Q,ca,G,E,ba,ma,R,h,t,x,C,K,da,ia,ja,qa,ta,xa=new THREE.Rectangle,wa=new THREE.Rectangle,fa=new THREE.Rectangle,Ea=false,X=new THREE.Color(4294967295),ga=new THREE.Color(4294967295),na=new THREE.Color(4278190080),ya=new THREE.Color(4278190080),za=new THREE.Color(4278190080),Ma=Math.PI*2,Ha=new THREE.Vector3,ka=new THREE.UV,ea=new THREE.UV,la=new THREE.UV,oa=new THREE.UV,Ca,Ba,Ia,pa,Da,Fa,ra= -16;Ca=document.createElement("canvas");Ca.width=Ca.height=2;Ba=Ca.getContext("2d");Ba.fillStyle="rgba(0,0,0,1)";Ba.fillRect(0,0,2,2);Ia=Ba.getImageData(0,0,2,2);pa=Ia.data;Da=document.createElement("canvas");Da.width=Da.height=ra;Fa=Da.getContext("2d");Fa.translate(-ra/2,-ra/2);Fa.scale(ra,ra);ra--;this.domElement=k;this.autoClear=true;this.setSize=function(J,S){s=J;p=S;n=s/2;y=p/2;k.width=s;k.height=p;m.lineJoin="round";m.lineCap="round";xa.set(-n,-y,n,y)};this.clear=function(){if(!wa.isEmpty()){wa.inflate(1); -wa.minSelf(xa);m.setTransform(1,0,0,-1,n,y);m.clearRect(wa.getX(),wa.getY(),wa.getWidth(),wa.getHeight());wa.empty()}};this.render=function(J,S){var M,N,u,L,Y,F,$,H;this.autoClear&&this.clear();l=r.projectScene(J,S);m.setTransform(1,0,0,-1,n,y);if(Ea=J.lights.length>0){Y=J.lights;na.setRGBA(0,0,0,1);ya.setRGBA(0,0,0,1);za.setRGBA(0,0,0,1);M=0;for(N=Y.length;M0){Q.r+=E.color.r*ba;Q.g+=E.color.g*ba;Q.b+=E.color.b*ba}}else if(E instanceof THREE.PointLight){z.sub(E.position,Z.centroidWorld);z.normalize();ba=Z.normalWorld.dot(z)*E.intensity;if(ba>0){Q.r+=E.color.r*ba;Q.g+=E.color.g*ba;Q.b+=E.color.b*ba}}}}function b(I,Z,Q,ca,G,E){P=c(U++);P.setAttribute("d", -"M "+I.positionScreen.x+" "+I.positionScreen.y+" L "+Z.positionScreen.x+" "+Z.positionScreen.y+" L "+Q.positionScreen.x+","+Q.positionScreen.y+"z");if(G instanceof THREE.MeshBasicMaterial)i.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshLambertMaterial)if(v){A.r=B.r;A.g=B.g;A.b=B.b;a(E,ca,A);i.r=G.color.r*A.r;i.g=G.color.g*A.g;i.b=G.color.b*A.b;i.updateStyleString()}else i.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshDepthMaterial){D=1-G.__2near/(G.__farPlusNear- -ca.z*G.__farMinusNear);i.setRGBA(D,D,D,1)}else G instanceof THREE.MeshNormalMaterial&&i.setRGBA(d(ca.normalWorld.x),d(ca.normalWorld.y),d(ca.normalWorld.z),1);G.wireframe?P.setAttribute("style","fill: none; stroke: "+i.__styleString+"; stroke-width: "+G.wireframe_linewidth+"; stroke-opacity: "+G.opacity+"; stroke-linecap: round; stroke-linejoin: round"):P.setAttribute("style","fill: "+i.__styleString+"; fill-opacity: "+G.opacity);j.appendChild(P)}function f(I,Z,Q,ca,G,E,ba){P=c(U++);P.setAttribute("d", -"M "+I.positionScreen.x+" "+I.positionScreen.y+" L "+Z.positionScreen.x+" "+Z.positionScreen.y+" L "+Q.positionScreen.x+","+Q.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(E instanceof THREE.MeshBasicMaterial)i.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshLambertMaterial)if(v){A.r=B.r;A.g=B.g;A.b=B.b;a(ba,G,A);i.r=E.color.r*A.r;i.g=E.color.g*A.g;i.b=E.color.b*A.b;i.updateStyleString()}else i.__styleString=E.color.__styleString;else if(E instanceof -THREE.MeshDepthMaterial){D=1-E.__2near/(E.__farPlusNear-G.z*E.__farMinusNear);i.setRGBA(D,D,D,1)}else E instanceof THREE.MeshNormalMaterial&&i.setRGBA(d(G.normalWorld.x),d(G.normalWorld.y),d(G.normalWorld.z),1);E.wireframe?P.setAttribute("style","fill: none; stroke: "+i.__styleString+"; stroke-width: "+E.wireframe_linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: round; stroke-linejoin: round"):P.setAttribute("style","fill: "+i.__styleString+"; fill-opacity: "+E.opacity);j.appendChild(P)} -function c(I){if(T[I]==null){T[I]=document.createElementNS("http://www.w3.org/2000/svg","path");aa==0&&T[I].setAttribute("shape-rendering","crispEdges");return T[I]}return T[I]}function d(I){return I<0?Math.min((1+I)*0.5,0.5):0.5+Math.min(I*0.5,0.5)}var o=null,q=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),e,g,l,r,k,s,p,n,y=new THREE.Rectangle,m=new THREE.Rectangle,v=false,i=new THREE.Color(4294967295),A=new THREE.Color(4294967295),B=new THREE.Color(4278190080), -V=new THREE.Color(4278190080),w=new THREE.Color(4278190080),D,z=new THREE.Vector3,T=[],O=[],P,U,W,aa=1;this.domElement=j;this.autoClear=true;this.setQuality=function(I){switch(I){case "high":aa=1;break;case "low":aa=0}};this.setSize=function(I,Z){e=I;g=Z;l=e/2;r=g/2;j.setAttribute("viewBox",-l+" "+-r+" "+e+" "+g);j.setAttribute("width",e);j.setAttribute("height",g);y.set(-l,-r,l,r)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(I,Z){var Q,ca, -G,E,ba,ma,R,h;this.autoClear&&this.clear();o=q.projectScene(I,Z);W=U=0;if(v=I.lights.length>0){R=I.lights;B.setRGBA(0,0,0,1);V.setRGBA(0,0,0,1);w.setRGBA(0,0,0,1);Q=0;for(ca=R.length;Q0&&J.z<1}O=p.geometry.faces;w=0;for(F=O.length;w0&&J.z<1;if(O.__visible&&w>0){y=p.geometry.vertices[w-1];if(O.__visible&&y.__visible){r=g[e]=g[e]||new THREE.RenderableLine;r.v1.positionScreen.copy(O.positionScreen);r.v2.positionScreen.copy(y.positionScreen);r.z=Math.max(O.positionScreen.z,y.positionScreen.z);r.material=p.material;a.push(r);e++}}}}else if(p instanceof THREE.Particle){o.set(p.position.x,p.position.y,p.position.z,1);s.transform(o);o.z/=o.w;if(o.z>0&&o.z<1){k=l[i]= +l[i]||new THREE.RenderableParticle;k.x=o.x/o.w;k.y=o.y/o.w;k.z=o.z;k.rotation=p.rotation.z;k.scale.x=p.scale.x*Math.abs(k.x-(o.x+h.projectionMatrix.n11)/(o.w+h.projectionMatrix.n14));k.scale.y=p.scale.y*Math.abs(k.y-(o.y+h.projectionMatrix.n22)/(o.w+h.projectionMatrix.n24));k.material=p.material;a.push(k);i++}}}a.sort(function(D,W){return W.z-D.z});return a};this.unprojectVector=function(u,h){var I=new THREE.Matrix4;I.multiply(THREE.Matrix4.makeInvert(h.matrix),THREE.Matrix4.makeInvert(h.projectionMatrix)); +I.transform(u);return u}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,f,c,d,m;this.domElement=document.createElement("div");this.setSize=function(n,r){f=n;c=r;d=f/2;m=c/2};this.render=function(n,r){var e,g,k,i,l,o,s,q;a=b.projectScene(n,r);e=0;for(g=a.length;e0){G.r+=E.r*j;G.g+=E.g*j;G.b+=E.b*j}}else if(j instanceof THREE.PointLight){Ha.sub(j.position,K.centroidWorld);Ha.normalize();j=K.normalWorld.dot(Ha)*j.intensity;if(j>0){G.r+=E.r*j;G.g+=E.g*j;G.b+=E.b*j}}}}function b(C,K,G,H,j,E){S=C.positionScreen.x;V=C.positionScreen.y;Y=K.positionScreen.x; +D=K.positionScreen.y;W=G.positionScreen.x;M=G.positionScreen.y;if(j.opacity!=I)h.globalAlpha=I=j.opacity;j.blending!=v&&n(j.blending);if(j.map){fa=j.map.image;oa=fa.width-1;pa=fa.height-1;da.u=H.uvs[0].u*oa;da.v=H.uvs[0].v*pa;$.u=H.uvs[1].u*oa;$.v=H.uvs[1].v*pa;ea.u=H.uvs[2].u*oa;ea.v=H.uvs[2].v*pa;m(fa,S,V,Y,D,W,M,da.u,da.v,$.u,$.v,ea.u,ea.v)}else if(j instanceof THREE.MeshBasicMaterial)c(S,V,Y,D,W,M,j.color,j.wireframe,j.wireframe_linewidth);else if(j instanceof THREE.MeshLambertMaterial){if(Da){ba.r= +ga.r;ba.g=ga.g;ba.b=ga.b;a(E,H,ba);P.r=j.color.r*ba.r;P.g=j.color.g*ba.g;P.b=j.color.b*ba.b;P.updateStyleString()}else P.__styleString=j.color.__styleString;c(S,V,Y,D,W,M,P,j.wireframe,j.wireframe_linewidth)}else if(j instanceof THREE.MeshDepthMaterial){qa=j.__2near;ra=j.__farPlusNear;sa=j.__farMinusNear;T=~~((1-qa/(ra-C.positionScreen.z*sa))*255);ha=~~((1-qa/(ra-K.positionScreen.z*sa))*255);ma=~~((1-qa/(ra-G.positionScreen.z*sa))*255);fa=r([T,T,T],[ha,ha,ha],[ma,ma,ma],[ma,ma,ma]);da.u=0;da.v=0; +$.u=ka;$.v=0;ea.u=0;ea.v=ka;m(fa,S,V,Y,D,W,M,da.u,da.v,$.u,$.v,ea.u,ea.v)}else if(j instanceof THREE.MeshNormalMaterial){P.r=e(H.normalWorld.x);P.g=e(H.normalWorld.y);P.b=e(H.normalWorld.z);P.updateStyleString();c(S,V,Y,D,W,M,P,j.wireframe,j.wireframe_linewidth)}}function f(C,K,G,H,j,E,Q,x,R){S=C.positionScreen.x;V=C.positionScreen.y;Y=K.positionScreen.x;D=K.positionScreen.y;W=G.positionScreen.x;M=G.positionScreen.y;Z=H.positionScreen.x;B=H.positionScreen.y;z=j.positionScreen.x;X=j.positionScreen.y; +na=E.positionScreen.x;N=E.positionScreen.y;if(x.opacity!=I)h.globalAlpha=I=x.opacity;x.blending!=v&&n(x.blending);if(x.map){fa=x.map.image;oa=fa.width-1;pa=fa.height-1;da.copy(Q.uvs[0]);$.copy(Q.uvs[1]);ea.copy(Q.uvs[2]);ia.copy(Q.uvs[3]);da.u*=oa;da.v*=pa;$.u*=oa;$.v*=pa;ea.u*=oa;ea.v*=pa;ia.u*=oa;ia.v*=pa;m(fa,S,V,Y,D,Z,B,da.u,da.v,$.u,$.v,ia.u,ia.v);m(fa,z,X,W,M,na,N,$.u,$.v,ea.u,ea.v,ia.u,ia.v)}else if(x instanceof THREE.MeshBasicMaterial)d(S,V,Y,D,W,M,Z,B,x.color,x.wireframe,x.wireframe_linewidth); +else if(x instanceof THREE.MeshLambertMaterial){if(Da){ba.r=ga.r;ba.g=ga.g;ba.b=ga.b;a(R,Q,ba);P.r=x.color.r*ba.r;P.g=x.color.g*ba.g;P.b=x.color.b*ba.b;P.updateStyleString()}else P.__styleString=x.color.__styleString;d(S,V,Y,D,W,M,Z,B,P,x.wireframe,x.wireframe_linewidth)}else if(x instanceof THREE.MeshDepthMaterial){qa=x.__2near;ra=x.__farPlusNear;sa=x.__farMinusNear;T=~~((1-qa/(ra-C.positionScreen.z*sa))*255);ha=~~((1-qa/(ra-K.positionScreen.z*sa))*255);ma=~~((1-qa/(ra-G.positionScreen.z*sa))*255); +Ea=~~((1-qa/(ra-H.positionScreen.z*sa))*255);fa=r([T,T,T],[ha,ha,ha],[Ea,Ea,Ea],[ma,ma,ma]);da.u=0;da.v=0;$.u=ka;$.v=0;ea.u=ka;ea.v=ka;ia.u=0;ia.v=ka;m(fa,S,V,Y,D,Z,B,da.u,da.v,$.u,$.v,ia.u,ia.v);m(fa,z,X,W,M,na,N,$.u,$.v,ea.u,ea.v,ia.u,ia.v)}else if(x instanceof THREE.MeshNormalMaterial){P.r=e(Q.normalWorld.x);P.g=e(Q.normalWorld.y);P.b=e(Q.normalWorld.z);P.updateStyleString();d(S,V,Y,D,W,M,Z,B,P,x.wireframe,x.wireframe_linewidth)}}function c(C,K,G,H,j,E,Q,x,R){h.beginPath();h.moveTo(C,K);h.lineTo(G, +H);h.lineTo(j,E);h.lineTo(C,K);h.closePath();if(x){if(U!=R)h.lineWidth=U=R;if(w!=Q.__styleString)h.strokeStyle=w=Q.__styleString;h.stroke();aa.inflate(R*2)}else{if(F!=Q.__styleString)h.fillStyle=F=Q.__styleString;h.fill()}}function d(C,K,G,H,j,E,Q,x,R,A,ca){h.beginPath();h.moveTo(C,K);h.lineTo(G,H);h.lineTo(j,E);h.lineTo(Q,x);h.lineTo(C,K);h.closePath();if(A){if(U!=ca)h.lineWidth=U=ca;if(w!=R.__styleString)h.strokeStyle=w=R.__styleString;h.stroke();aa.inflate(ca*2)}else{if(F!=R.__styleString)h.fillStyle= +F=R.__styleString;h.fill()}}function m(C,K,G,H,j,E,Q,x,R,A,ca,la,ta){h.beginPath();h.moveTo(K,G);h.lineTo(H,j);h.lineTo(E,Q);h.closePath();H-=K;j-=G;E-=K;Q-=G;A-=x;ca-=R;la-=x;ta-=R;var ua=1/(A*ta-la*ca),za=(ta*H-ca*E)*ua;ca=(ta*j-ca*Q)*ua;H=(A*E-la*H)*ua;j=(A*Q-la*j)*ua;K=K-za*x-H*R;G=G-ca*x-j*R;h.save();h.transform(za,ca,H,j,K,G);h.clip();h.drawImage(C,0,0);h.restore()}function n(C){switch(C){case 0:h.globalCompositeOperation="source-over";break;case 1:h.globalCompositeOperation="lighter";break; +case 2:h.globalCompositeOperation="darker"}v=C}function r(C,K,G,H){ja[0]=C[0];ja[1]=C[1];ja[2]=C[2];ja[4]=K[0];ja[5]=K[1];ja[6]=K[2];ja[8]=G[0];ja[9]=G[1];ja[10]=G[2];ja[12]=H[0];ja[13]=H[1];ja[14]=H[2];Aa.putImageData(Ia,0,0);Fa.drawImage(Ba,0,0);return Ca}function e(C){return C<0?Math.min((1+C)*0.5,0.5):0.5+Math.min(C*0.5,0.5)}function g(C,K){var G=K.x-C.x,H=K.y-C.y,j=1/Math.sqrt(G*G+H*H);G*=j;H*=j;K.x+=G;K.y+=H;C.x-=G;C.y-=H}var k=null,i=new THREE.Projector,l=document.createElement("canvas"),o, +s,q,u,h=l.getContext("2d"),I=1,v=0,w=null,F=null,U=1,p,y,t,O,J=new THREE.Vertex,L=new THREE.Vertex,S,V,Y,D,W,M,Z,B,z,X,na,N,T,ha,ma,Ea,qa,ra,sa,fa,oa,pa,wa=new THREE.Rectangle,va=new THREE.Rectangle,aa=new THREE.Rectangle,Da=false,P=new THREE.Color(4294967295),ba=new THREE.Color(4294967295),ga=new THREE.Color(4278190080),xa=new THREE.Color(4278190080),ya=new THREE.Color(4278190080),Ma=Math.PI*2,Ha=new THREE.Vector3,da=new THREE.UV,$=new THREE.UV,ea=new THREE.UV,ia=new THREE.UV,Ba,Aa,Ia,ja,Ca,Fa,ka= +16;Ba=document.createElement("canvas");Ba.width=Ba.height=2;Aa=Ba.getContext("2d");Aa.fillStyle="rgba(0,0,0,1)";Aa.fillRect(0,0,2,2);Ia=Aa.getImageData(0,0,2,2);ja=Ia.data;Ca=document.createElement("canvas");Ca.width=Ca.height=ka;Fa=Ca.getContext("2d");Fa.translate(-ka/2,-ka/2);Fa.scale(ka,ka);ka--;this.domElement=l;this.autoClear=true;this.setSize=function(C,K){o=C;s=K;q=o/2;u=s/2;l.width=o;l.height=s;h.lineJoin="round";h.lineCap="round";wa.set(-q,-u,q,u)};this.clear=function(){if(!va.isEmpty()){va.inflate(1); +va.minSelf(wa);h.setTransform(1,0,0,-1,q,u);h.clearRect(va.getX(),va.getY(),va.getWidth(),va.getHeight());va.empty()}};this.render=function(C,K){var G,H,j,E,Q,x,R,A;this.autoClear&&this.clear();k=i.projectScene(C,K);h.setTransform(1,0,0,-1,q,u);if(Da=C.lights.length>0){Q=C.lights;ga.setRGBA(0,0,0,1);xa.setRGBA(0,0,0,1);ya.setRGBA(0,0,0,1);G=0;for(H=Q.length;G0){M.r+=z.color.r*X;M.g+=z.color.g*X;M.b+=z.color.b*X}}else if(z instanceof THREE.PointLight){t.sub(z.position,W.centroidWorld);t.normalize();X=W.normalWorld.dot(t)*z.intensity;if(X>0){M.r+=z.color.r*X;M.g+=z.color.g*X;M.b+=z.color.b*X}}}}function b(D,W,M,Z,B,z){L=c(S++);L.setAttribute("d","M "+D.positionScreen.x+ +" "+D.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)v.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(I){w.r=F.r;w.g=F.g;w.b=F.b;a(z,Z,w);v.r=B.color.r*w.r;v.g=B.color.g*w.g;v.b=B.color.b*w.b;v.updateStyleString()}else v.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){y=1-B.__2near/(B.__farPlusNear-Z.z*B.__farMinusNear); +v.setRGBA(y,y,y,1)}else B instanceof THREE.MeshNormalMaterial&&v.setRGBA(d(Z.normalWorld.x),d(Z.normalWorld.y),d(Z.normalWorld.z),1);B.wireframe?L.setAttribute("style","fill: none; stroke: "+v.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: round; stroke-linejoin: round"):L.setAttribute("style","fill: "+v.__styleString+"; fill-opacity: "+B.opacity);r.appendChild(L)}function f(D,W,M,Z,B,z,X){L=c(S++);L.setAttribute("d","M "+D.positionScreen.x+ +" "+D.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");if(z instanceof THREE.MeshBasicMaterial)v.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshLambertMaterial)if(I){w.r=F.r;w.g=F.g;w.b=F.b;a(X,B,w);v.r=z.color.r*w.r;v.g=z.color.g*w.g;v.b=z.color.b*w.b;v.updateStyleString()}else v.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshDepthMaterial){y= +1-z.__2near/(z.__farPlusNear-B.z*z.__farMinusNear);v.setRGBA(y,y,y,1)}else z instanceof THREE.MeshNormalMaterial&&v.setRGBA(d(B.normalWorld.x),d(B.normalWorld.y),d(B.normalWorld.z),1);z.wireframe?L.setAttribute("style","fill: none; stroke: "+v.__styleString+"; stroke-width: "+z.wireframe_linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: round; stroke-linejoin: round"):L.setAttribute("style","fill: "+v.__styleString+"; fill-opacity: "+z.opacity);r.appendChild(L)}function c(D){if(O[D]==null){O[D]= +document.createElementNS("http://www.w3.org/2000/svg","path");Y==0&&O[D].setAttribute("shape-rendering","crispEdges");return O[D]}return O[D]}function d(D){return D<0?Math.min((1+D)*0.5,0.5):0.5+Math.min(D*0.5,0.5)}var m=null,n=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),e,g,k,i,l,o,s,q,u=new THREE.Rectangle,h=new THREE.Rectangle,I=false,v=new THREE.Color(4294967295),w=new THREE.Color(4294967295),F=new THREE.Color(4278190080),U=new THREE.Color(4278190080),p= +new THREE.Color(4278190080),y,t=new THREE.Vector3,O=[],J=[],L,S,V,Y=1;this.domElement=r;this.autoClear=true;this.setQuality=function(D){switch(D){case "high":Y=1;break;case "low":Y=0}};this.setSize=function(D,W){e=D;g=W;k=e/2;i=g/2;r.setAttribute("viewBox",-k+" "+-i+" "+e+" "+g);r.setAttribute("width",e);r.setAttribute("height",g);u.set(-k,-i,k,i)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(D,W){var M,Z,B,z,X,na,N,T;this.autoClear&&this.clear(); +m=n.projectScene(D,W);V=S=0;if(I=D.lights.length>0){N=D.lights;F.setRGBA(0,0,0,1);U.setRGBA(0,0,0,1);p.setRGBA(0,0,0,1);M=0;for(Z=N.length;M= 0.0 )": @@ -145,21 +127,21 @@ g?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",g?"}":""," "normalMatrix");d.objMatrix=c.getUniformLocation(d,"objMatrix");d.cameraPosition=c.getUniformLocation(d,"cameraPosition");d.enableLighting=c.getUniformLocation(d,"enableLighting");d.ambientLightColor=c.getUniformLocation(d,"ambientLightColor");if(e){d.directionalLightNumber=c.getUniformLocation(d,"directionalLightNumber");d.directionalLightColor=c.getUniformLocation(d,"directionalLightColor");d.directionalLightDirection=c.getUniformLocation(d,"directionalLightDirection")}if(g){d.pointLightNumber= c.getUniformLocation(d,"pointLightNumber");d.pointLightColor=c.getUniformLocation(d,"pointLightColor");d.pointLightPosition=c.getUniformLocation(d,"pointLightPosition")}d.material=c.getUniformLocation(d,"material");d.mColor=c.getUniformLocation(d,"mColor");d.mOpacity=c.getUniformLocation(d,"mOpacity");d.mAmbient=c.getUniformLocation(d,"mAmbient");d.mSpecular=c.getUniformLocation(d,"mSpecular");d.mShininess=c.getUniformLocation(d,"mShininess");d.enableMap=c.getUniformLocation(d,"enableMap");c.uniform1i(d.enableMap, 0);d.tMap=c.getUniformLocation(d,"tMap");c.uniform1i(d.tMap,0);d.m2Near=c.getUniformLocation(d,"m2Near");d.mFarPlusNear=c.getUniformLocation(d,"mFarPlusNear");d.mFarMinusNear=c.getUniformLocation(d,"mFarMinusNear");d.position=c.getAttribLocation(d,"position");c.enableVertexAttribArray(d.position);d.normal=c.getAttribLocation(d,"normal");c.enableVertexAttribArray(d.normal);d.uv=c.getAttribLocation(d,"uv");c.enableVertexAttribArray(d.uv);d.viewMatrixArray=new Float32Array(16);d.modelViewMatrixArray= -new Float32Array(16);d.projectionMatrixArray=new Float32Array(16)})(a.directional,a.point);this.setSize=function(e,g){f.width=e;f.height=g;c.viewport(0,0,f.width,f.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(e){var g,l,r,k,s=[],p=[],n=[];k=[];var y=[];c.uniform1i(d.enableLighting,e.lights.length);g=0;for(l=e.lights.length;g0&&y>0&&C+y<1}var f,c,d,o,q,k,e,g,m,r, -l,s=a.geometry,p=s.vertices,n=[];f=0;for(c=s.faces.length;f= -0&&Math.min(d,e.getBottom())-Math.max(f,e.getTop())>=0};this.empty=function(){k=true;d=c=f=b=0;a()};this.isEmpty=function(){return k};this.toString=function(){return"THREE.Rectangle ( left: "+b+", right: "+c+", top: "+f+", bottom: "+d+", width: "+o+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}}; +THREE.Ray.prototype={intersectScene:function(a){var b,f,c=a.objects,d=[];a=0;for(b=c.length;a0&&v>0&&F+v<1}var f,c,d,m,n,r,e,g,k,i, +l,o=a.geometry,s=o.vertices,q=[];f=0;for(c=o.faces.length;f= +0&&Math.min(d,e.getBottom())-Math.max(f,e.getTop())>=0};this.empty=function(){r=true;d=c=f=b=0;a()};this.isEmpty=function(){return r};this.toString=function(){return"THREE.Rectangle ( left: "+b+", right: "+c+", top: "+f+", bottom: "+d+", width: "+m+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}}; THREE.Matrix4=function(){this._x=new THREE.Vector3;this._y=new THREE.Vector3;this._z=new THREE.Vector3}; THREE.Matrix4.prototype={n11:1,n12:0,n13:0,n14:0,n21:0,n22:1,n23:0,n24:0,n31:0,n32:0,n33:1,n34:0,n41:0,n42:0,n43:0,n44:1,identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41= -a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44},lookAt:function(a,b,f){var c=this._x,d=this._y,o=this._z;o.sub(a,b);o.normalize();c.cross(f,o);c.normalize();d.cross(o,c);d.normalize();this.n11=c.x;this.n12=c.y;this.n13=c.z;this.n14=-c.dot(a);this.n21=d.x;this.n22=d.y;this.n23=d.z;this.n24=-d.dot(a);this.n31=o.x;this.n32=o.y;this.n33=o.z;this.n34=-o.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transform:function(a){var b=a.x,f=a.y,c=a.z,d=a.w?a.w:1;a.x=this.n11*b+this.n12*f+this.n13*c+this.n14* +a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44},lookAt:function(a,b,f){var c=this._x,d=this._y,m=this._z;m.sub(a,b);m.normalize();c.cross(f,m);c.normalize();d.cross(m,c);d.normalize();this.n11=c.x;this.n12=c.y;this.n13=c.z;this.n14=-c.dot(a);this.n21=d.x;this.n22=d.y;this.n23=d.z;this.n24=-d.dot(a);this.n31=m.x;this.n32=m.y;this.n33=m.z;this.n34=-m.dot(a);this.n43=this.n42=this.n41=0;this.n44=1},transform:function(a){var b=a.x,f=a.y,c=a.z,d=a.w?a.w:1;a.x=this.n11*b+this.n12*f+this.n13*c+this.n14* d;a.y=this.n21*b+this.n22*f+this.n23*c+this.n24*d;a.z=this.n31*b+this.n32*f+this.n33*c+this.n34*d;d=this.n41*b+this.n42*f+this.n43*c+this.n44*d;if(a.w)a.w=d;else{a.x/=d;a.y/=d;a.z/=d}return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a, b){this.n11=a.n11*b.n11+a.n12*b.n21+a.n13*b.n31+a.n14*b.n41;this.n12=a.n11*b.n12+a.n12*b.n22+a.n13*b.n32+a.n14*b.n42;this.n13=a.n11*b.n13+a.n12*b.n23+a.n13*b.n33+a.n14*b.n43;this.n14=a.n11*b.n14+a.n12*b.n24+a.n13*b.n34+a.n14*b.n44;this.n21=a.n21*b.n11+a.n22*b.n21+a.n23*b.n31+a.n24*b.n41;this.n22=a.n21*b.n12+a.n22*b.n22+a.n23*b.n32+a.n24*b.n42;this.n23=a.n21*b.n13+a.n22*b.n23+a.n23*b.n33+a.n24*b.n43;this.n24=a.n21*b.n14+a.n22*b.n24+a.n23*b.n34+a.n24*b.n44;this.n31=a.n31*b.n11+a.n32*b.n21+a.n33*b.n31+ -a.n34*b.n41;this.n32=a.n31*b.n12+a.n32*b.n22+a.n33*b.n32+a.n34*b.n42;this.n33=a.n31*b.n13+a.n32*b.n23+a.n33*b.n33+a.n34*b.n43;this.n34=a.n31*b.n14+a.n32*b.n24+a.n33*b.n34+a.n34*b.n44;this.n41=a.n41*b.n11+a.n42*b.n21+a.n43*b.n31+a.n44*b.n41;this.n42=a.n41*b.n12+a.n42*b.n22+a.n43*b.n32+a.n44*b.n42;this.n43=a.n41*b.n13+a.n42*b.n23+a.n43*b.n33+a.n44*b.n43;this.n44=a.n41*b.n14+a.n42*b.n24+a.n43*b.n34+a.n44*b.n44},multiplySelf:function(a){var b=this.n11,f=this.n12,c=this.n13,d=this.n14,o=this.n21,q=this.n22, -k=this.n23,e=this.n24,g=this.n31,m=this.n32,r=this.n33,l=this.n34,s=this.n41,p=this.n42,n=this.n43,y=this.n44;this.n11=b*a.n11+f*a.n21+c*a.n31+d*a.n41;this.n12=b*a.n12+f*a.n22+c*a.n32+d*a.n42;this.n13=b*a.n13+f*a.n23+c*a.n33+d*a.n43;this.n14=b*a.n14+f*a.n24+c*a.n34+d*a.n44;this.n21=o*a.n11+q*a.n21+k*a.n31+e*a.n41;this.n22=o*a.n12+q*a.n22+k*a.n32+e*a.n42;this.n23=o*a.n13+q*a.n23+k*a.n33+e*a.n43;this.n24=o*a.n14+q*a.n24+k*a.n34+e*a.n44;this.n31=g*a.n11+m*a.n21+r*a.n31+l*a.n41;this.n32=g*a.n12+m*a.n22+ -r*a.n32+l*a.n42;this.n33=g*a.n13+m*a.n23+r*a.n33+l*a.n43;this.n34=g*a.n14+m*a.n24+r*a.n34+l*a.n44;this.n41=s*a.n11+p*a.n21+n*a.n31+y*a.n41;this.n42=s*a.n12+p*a.n22+n*a.n32+y*a.n42;this.n43=s*a.n13+p*a.n23+n*a.n33+y*a.n43;this.n44=s*a.n14+p*a.n24+n*a.n34+y*a.n44},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a},determinant:function(){return this.n14* +a.n34*b.n41;this.n32=a.n31*b.n12+a.n32*b.n22+a.n33*b.n32+a.n34*b.n42;this.n33=a.n31*b.n13+a.n32*b.n23+a.n33*b.n33+a.n34*b.n43;this.n34=a.n31*b.n14+a.n32*b.n24+a.n33*b.n34+a.n34*b.n44;this.n41=a.n41*b.n11+a.n42*b.n21+a.n43*b.n31+a.n44*b.n41;this.n42=a.n41*b.n12+a.n42*b.n22+a.n43*b.n32+a.n44*b.n42;this.n43=a.n41*b.n13+a.n42*b.n23+a.n43*b.n33+a.n44*b.n43;this.n44=a.n41*b.n14+a.n42*b.n24+a.n43*b.n34+a.n44*b.n44},multiplySelf:function(a){var b=this.n11,f=this.n12,c=this.n13,d=this.n14,m=this.n21,n=this.n22, +r=this.n23,e=this.n24,g=this.n31,k=this.n32,i=this.n33,l=this.n34,o=this.n41,s=this.n42,q=this.n43,v=this.n44;this.n11=b*a.n11+f*a.n21+c*a.n31+d*a.n41;this.n12=b*a.n12+f*a.n22+c*a.n32+d*a.n42;this.n13=b*a.n13+f*a.n23+c*a.n33+d*a.n43;this.n14=b*a.n14+f*a.n24+c*a.n34+d*a.n44;this.n21=m*a.n11+n*a.n21+r*a.n31+e*a.n41;this.n22=m*a.n12+n*a.n22+r*a.n32+e*a.n42;this.n23=m*a.n13+n*a.n23+r*a.n33+e*a.n43;this.n24=m*a.n14+n*a.n24+r*a.n34+e*a.n44;this.n31=g*a.n11+k*a.n21+i*a.n31+l*a.n41;this.n32=g*a.n12+k*a.n22+ +i*a.n32+l*a.n42;this.n33=g*a.n13+k*a.n23+i*a.n33+l*a.n43;this.n34=g*a.n14+k*a.n24+i*a.n34+l*a.n44;this.n41=o*a.n11+s*a.n21+q*a.n31+v*a.n41;this.n42=o*a.n12+s*a.n22+q*a.n32+v*a.n42;this.n43=o*a.n13+s*a.n23+q*a.n33+v*a.n43;this.n44=o*a.n14+s*a.n24+q*a.n34+v*a.n44},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a},determinant:function(){return this.n14* this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14* this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,f,c){var d=b[f];b[f]=b[c];b[c]=d}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this, "n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){return[this.n11,this.n21,this.n31,this.n41,this.n12,this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]}, toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,f){var c=new THREE.Matrix4;c.n14=a;c.n24=b;c.n34=f;return c};THREE.Matrix4.scaleMatrix=function(a,b,f){var c=new THREE.Matrix4;c.n11=a;c.n22=b;c.n33=f;return c}; THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b}; -THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var f=new THREE.Matrix4,c=Math.cos(b),d=Math.sin(b),o=1-c,q=a.x,k=a.y,e=a.z;f.n11=o*q*q+c;f.n12=o*q*k-d*e;f.n13=o*q*e+d*k;f.n21=o*q*k+d*e;f.n22=o*k*k+c;f.n23=o*k*e-d*q;f.n31=o*q*e-d*k;f.n32=o*k*e+d*q;f.n33=o*e*e+c;return f}; +THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var f=new THREE.Matrix4,c=Math.cos(b),d=Math.sin(b),m=1-c,n=a.x,r=a.y,e=a.z;f.n11=m*n*n+c;f.n12=m*n*r-d*e;f.n13=m*n*e+d*r;f.n21=m*n*r+d*e;f.n22=m*r*r+c;f.n23=m*r*e-d*n;f.n31=m*n*e-d*r;f.n32=m*r*e+d*n;f.n33=m*e*e+c;return f}; THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;b.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;b.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;b.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12* a.n23*a.n34;b.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;b.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;b.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;b.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;b.n31=a.n22*a.n34*a.n41-a.n24*a.n32* a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;b.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;b.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;b.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;b.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22* a.n31*a.n43-a.n21*a.n32*a.n43;b.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;b.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;b.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;b.multiplyScalar(1/a.determinant());return b}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var f=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],o=-b[10]*b[4]+b[6]*b[8],q=b[10]*b[0]-b[2]*b[8],k=-b[6]*b[0]+b[2]*b[4],e=b[9]*b[4]-b[5]*b[8],g=-b[9]*b[0]+b[1]*b[8],m=b[5]*b[0]-b[1]*b[4];b=b[0]*f+b[1]*o+b[2]*e;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*f;a.m[1]=b*c;a.m[2]=b*d;a.m[3]=b*o;a.m[4]=b*q;a.m[5]=b*k;a.m[6]=b*e;a.m[7]=b*g;a.m[8]=b*m;return a}; -THREE.Matrix4.makeFrustum=function(a,b,f,c,d,o){var q,k,e;q=new THREE.Matrix4;k=2*d/(b-a);e=2*d/(c-f);a=(b+a)/(b-a);f=(c+f)/(c-f);c=-(o+d)/(o-d);d=-2*o*d/(o-d);q.n11=k;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=e;q.n23=f;q.n24=0;q.n31=0;q.n32=0;q.n33=c;q.n34=d;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,b,f,c){var d;a=f*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,f,c)}; -THREE.Matrix4.makeOrtho=function(a,b,f,c,d,o){var q,k,e,g;q=new THREE.Matrix4;k=b-a;e=f-c;g=o-d;a=(b+a)/k;f=(f+c)/e;d=(o+d)/g;q.n11=2/k;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/e;q.n23=0;q.n24=-f;q.n31=0;q.n32=0;q.n33=-2/g;q.n34=-d;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var f=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],m=-b[10]*b[4]+b[6]*b[8],n=b[10]*b[0]-b[2]*b[8],r=-b[6]*b[0]+b[2]*b[4],e=b[9]*b[4]-b[5]*b[8],g=-b[9]*b[0]+b[1]*b[8],k=b[5]*b[0]-b[1]*b[4];b=b[0]*f+b[1]*m+b[2]*e;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*f;a.m[1]=b*c;a.m[2]=b*d;a.m[3]=b*m;a.m[4]=b*n;a.m[5]=b*r;a.m[6]=b*e;a.m[7]=b*g;a.m[8]=b*k;return a}; +THREE.Matrix4.makeFrustum=function(a,b,f,c,d,m){var n,r,e;n=new THREE.Matrix4;r=2*d/(b-a);e=2*d/(c-f);a=(b+a)/(b-a);f=(c+f)/(c-f);c=-(m+d)/(m-d);d=-2*m*d/(m-d);n.n11=r;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=e;n.n23=f;n.n24=0;n.n31=0;n.n32=0;n.n33=c;n.n34=d;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,b,f,c){var d;a=f*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,f,c)}; +THREE.Matrix4.makeOrtho=function(a,b,f,c,d,m){var n,r,e,g;n=new THREE.Matrix4;r=b-a;e=f-c;g=m-d;a=(b+a)/r;f=(f+c)/e;d=(m+d)/g;n.n11=2/r;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/e;n.n23=0;n.n24=-f;n.n31=0;n.n32=0;n.n33=-2/g;n.n34=-d;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector3;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; THREE.Face3=function(a,b,f,c,d){this.a=a;this.b=b;this.c=f;this.centroid=new THREE.Vector3;this.normal=c instanceof THREE.Vector3?c:new THREE.Vector3;this.vertexNormals=c instanceof Array?c:[];this.material=d instanceof Array?d:[d]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,b,f,c,d,o){this.a=a;this.b=b;this.c=f;this.d=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=o instanceof Array?o:[o]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; +THREE.Face4=function(a,b,f,c,d,m){this.a=a;this.b=b;this.c=f;this.d=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=m instanceof Array?m:[m]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[]}; THREE.Geometry.prototype={computeCentroids:function(){var a,b,f;a=0;for(b=this.faces.length;a0){this.bbox={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 a=1,b=this.vertices.length;a +f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeNormals:function(a){var b,f,c,d,m,n,r=new THREE.Vector3,e=new THREE.Vector3;c=0;for(d=this.vertices.length;c0){this.bbox={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 a=1,b=this.vertices.length;a this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.ythis.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.zthis.bbox.z[1])this.bbox.z[1]=vertex.position.z}}},toString:function(){return"THREE.Geometry ( vertices: "+this.vertices+", faces: "+this.faces+" )"}}; -THREE.Camera=function(a,b,f,c){this.position=new THREE.Vector3(0,0,0);this.target={position:new THREE.Vector3(0,0,0)};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,b,f,c);this.autoUpdateMatrix=true;this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.toString=function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Loader=function(){}; -THREE.Loader.prototype={loadAsciiOld:function(a,b){var f=document.createElement("script");f.type="text/javascript";f.onload=b;f.src=a;document.getElementsByTagName("head")[0].appendChild(f)},loadAscii:function(a,b,f){var c=(new Date).getTime();a=new Worker(a);a.onmessage=function(d){THREE.Loader.prototype.createModel(d.data,b,f)};a.postMessage(c)},loadBinary:function(a,b,f){var c=(new Date).getTime();a=new Worker(a);a.onmessage=function(d){THREE.Loader.prototype.loadAjaxBuffers(d.data.buffers,d.data.materials, -b,f)};a.onerror=function(d){alert("worker.onerror: "+d.message+"\n"+d.data);d.preventDefault()};a.postMessage(c)},loadAjaxBuffers:function(a,b,f,c){var d=new XMLHttpRequest,o=c+"/"+a;d.onreadystatechange=function(){if(d.readyState==4)d.status==200||d.status==0?THREE.Loader.prototype.createBinModel(d.responseText,f,c,b):alert("Couldn't load ["+o+"] ["+d.status+"]")};d.open("GET",o,true);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)}, -createBinModel:function(a,b,f,c){var d=function(o){function q(h,t){var x=m(h,t),D=m(h,t+1),K=m(h,t+2),da=m(h,t+3),ia=(da<<1&255|K>>7)-127;x=(K&127)<<16|D<<8|x;if(x==0&&ia==-127)return 0;return(1-2*(da>>7))*(1+x*Math.pow(2,-23))*Math.pow(2,ia)}function k(h,t){var x=m(h,t),D=m(h,t+1),K=m(h,t+2);return(m(h,t+3)<<24)+(K<<16)+(D<<8)+x}function e(h,t){var x=m(h,t);return(m(h,t+1)<<8)+x}function g(h,t){var x=m(h,t);return x>127?x-256:x}function m(h,t){return h.charCodeAt(t)&255}function r(h){var t,x,D;t= -k(a,h);x=k(a,h+V);D=k(a,h+w);h=e(a,h+E);THREE.Loader.prototype.f3(j,t,x,D,h)}function l(h){var t,x,D,K,da,ia;t=k(a,h);x=k(a,h+V);D=k(a,h+w);K=e(a,h+E);da=k(a,h+z);ia=k(a,h+T);h=k(a,h+O);THREE.Loader.prototype.f3n(j,B,t,x,D,K,da,ia,h)}function s(h){var t,x,D,K;t=k(a,h);x=k(a,h+P);D=k(a,h+U);K=k(a,h+W);h=e(a,h+aa);THREE.Loader.prototype.f4(j,t,x,D,K,h)}function p(h){var t,x,D,K,da,ia,ja,ra;t=k(a,h);x=k(a,h+P);D=k(a,h+U);K=k(a,h+W);da=e(a,h+aa);ia=k(a,h+I);ja=k(a,h+Z);ra=k(a,h+Q);h=k(a,h+ca);THREE.Loader.prototype.f4n(j, -B,t,x,D,K,da,ia,ja,ra,h)}function n(h){var t,x;t=k(a,h);x=k(a,h+G);h=k(a,h+F);THREE.Loader.prototype.uv(j,C[t*2],C[t*2+1],C[x*2],C[x*2+1],C[h*2],C[h*2+1])}function y(h){var t,x,D;t=k(a,h);x=k(a,h+ba);D=k(a,h+ma);h=k(a,h+R);THREE.Loader.prototype.uv(j,C[t*2],C[t*2+1],C[x*2],C[x*2+1],C[D*2],C[D*2+1],C[h*2],C[h*2+1])}var j=this,v=0,i,B=[],C=[],V,w,E,z,T,O,P,U,W,aa,I,Z,Q,ca,G,F,ba,ma,R;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(j,c,o);i={signature:a.substr(v,8),header_bytes:m(a,v+ -8),vertex_coordinate_bytes:m(a,v+9),normal_coordinate_bytes:m(a,v+10),uv_coordinate_bytes:m(a,v+11),vertex_index_bytes:m(a,v+12),normal_index_bytes:m(a,v+13),uv_index_bytes:m(a,v+14),material_index_bytes:m(a,v+15),nvertices:k(a,v+16),nnormals:k(a,v+16+4),nuvs:k(a,v+16+8),ntri_flat:k(a,v+16+12),ntri_smooth:k(a,v+16+16),ntri_flat_uv:k(a,v+16+20),ntri_smooth_uv:k(a,v+16+24),nquad_flat:k(a,v+16+28),nquad_smooth:k(a,v+16+32),nquad_flat_uv:k(a,v+16+36),nquad_smooth_uv:k(a,v+16+40)};v+=i.header_bytes;V= -i.vertex_index_bytes;w=i.vertex_index_bytes*2;E=i.vertex_index_bytes*3;z=i.vertex_index_bytes*3+i.material_index_bytes;T=i.vertex_index_bytes*3+i.material_index_bytes+i.normal_index_bytes;O=i.vertex_index_bytes*3+i.material_index_bytes+i.normal_index_bytes*2;P=i.vertex_index_bytes;U=i.vertex_index_bytes*2;W=i.vertex_index_bytes*3;aa=i.vertex_index_bytes*4;I=i.vertex_index_bytes*4+i.material_index_bytes;Z=i.vertex_index_bytes*4+i.material_index_bytes+i.normal_index_bytes;Q=i.vertex_index_bytes*4+i.material_index_bytes+ -i.normal_index_bytes*2;ca=i.vertex_index_bytes*4+i.material_index_bytes+i.normal_index_bytes*3;G=i.uv_index_bytes;F=i.uv_index_bytes*2;ba=i.uv_index_bytes;ma=i.uv_index_bytes*2;R=i.uv_index_bytes*3;v+=function(h){var t,x,D,K=i.vertex_coordinate_bytes*3,da=h+i.nvertices*K;for(h=h;h65535){g[k].counter+=1;e=g[k].hash+"_"+g[k].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:q,vertices:0}}this.materialFaceGroup[e].faces.push(c);this.materialFaceGroup[e].vertices+=o}};THREE.Mesh.prototype.normalizeUVs=function(){var a,b,f,c,d;a=0;for(b=this.geometry.uvs.length;a65535){g[r].counter+=1;e=g[r].hash+"_"+g[r].counter;if(this.materialFaceGroup[e]==undefined)this.materialFaceGroup[e]={faces:[],material:n,vertices:0}}this.materialFaceGroup[e].faces.push(c);this.materialFaceGroup[e].vertices+=m}};THREE.Mesh.prototype.normalizeUVs=function(){var a,b,f,c,d;a=0;for(b=this.geometry.uvs.length;acolor: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
linewidth: "+ this.linewidth+"
)"}}; @@ -88,51 +70,51 @@ THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16711680);thi this.blending+"
)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16711680);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b){this.image=a;this.mapping=b?b:THREE.UVMapping;this.toString=function(){return"THREE.Texture (
image: "+this.image+"
mapping: "+this.mapping+"
)"}};THREE.UVMapping=0;THREE.ReflectionMap=1;THREE.CubeMap=2; THREE.Scene=function(){this.objects=[];this.lights=[];this.addObject=function(a){this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}}; -THREE.Projector=function(){var a=null,b,f,c=[],d,o,q=[],k,e,g=[],m,r,l=[],s=new THREE.Vector4,p=new THREE.Matrix4,n=new THREE.Matrix4;this.projectScene=function(y,j){var v,i,B,C,V,w,E,z,T,O,P,U,W,aa;a=[];r=e=o=f=0;j.autoUpdateMatrix&&j.updateMatrix();p.multiply(j.projectionMatrix,j.matrix);V=y.objects;v=0;for(i=V.length;v0&&O.z<1}T=w.geometry.faces;B=0;for(C=T.length;B0&&O.z<1;if(T.__visible&&B>0){E=w.geometry.vertices[B-1];if(T.__visible&&E.__visible){k=g[e]=g[e]||new THREE.RenderableLine;k.v1.positionScreen.copy(T.positionScreen);k.v2.positionScreen.copy(E.positionScreen);k.z=Math.max(T.positionScreen.z,E.positionScreen.z);k.material=w.material;a.push(k);e++}}}}else if(w instanceof THREE.Particle){s.set(w.position.x,w.position.y,w.position.z,1);p.transform(s); -s.z/=s.w;if(s.z>0&&s.z<1){m=l[r]=l[r]||new THREE.RenderableParticle;m.x=s.x/s.w;m.y=s.y/s.w;m.z=s.z;m.rotation=w.rotation.z;m.scale.x=w.scale.x*Math.abs(m.x-(s.x+j.projectionMatrix.n11)/(s.w+j.projectionMatrix.n14));m.scale.y=w.scale.y*Math.abs(m.y-(s.y+j.projectionMatrix.n22)/(s.w+j.projectionMatrix.n24));m.material=w.material;a.push(m);r++}}}a.sort(function(I,Z){return Z.z-I.z});return a};this.unprojectVector=function(y,j){var v=new THREE.Matrix4;v.multiply(THREE.Matrix4.makeInvert(j.matrix),THREE.Matrix4.makeInvert(j.projectionMatrix)); -v.transform(y);return y}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,f,c,d,o;this.domElement=document.createElement("div");this.setSize=function(q,k){f=q;c=k;d=f/2;o=c/2};this.render=function(q,k){var e,g,m,r,l,s,p,n;a=b.projectScene(q,k);e=0;for(g=a.length;e0){M.r+=L.r*u;M.g+=L.g*u;M.b+=L.b*u}}else if(u instanceof THREE.PointLight){Ha.sub(u.position,S.centroidWorld);Ha.normalize();u=S.normalWorld.dot(Ha)*u.intensity;if(u>0){M.r+=L.r*u;M.g+=L.g*u;M.b+=L.b*u}}}}function b(J,S,M,N,u,L){U=J.positionScreen.x;W=J.positionScreen.y;aa=S.positionScreen.x; -I=S.positionScreen.y;Z=M.positionScreen.x;Q=M.positionScreen.y;if(u.opacity!=v)j.globalAlpha=v=u.opacity;u.blending!=i&&q(u.blending);if(u.map){ja=u.map.image;ra=ja.width-1;va=ja.height-1;ka.u=N.uvs[0].u*ra;ka.v=N.uvs[0].v*va;ea.u=N.uvs[1].u*ra;ea.v=N.uvs[1].v*va;la.u=N.uvs[2].u*ra;la.v=N.uvs[2].v*va;o(ja,U,W,aa,I,Z,Q,ka.u,ka.v,ea.u,ea.v,la.u,la.v)}else if(u instanceof THREE.MeshBasicMaterial)c(U,W,aa,I,Z,Q,u.color,u.wireframe,u.wireframe_linewidth);else if(u instanceof THREE.MeshLambertMaterial){if(Ea){ga.r= -na.r;ga.g=na.g;ga.b=na.b;a(L,N,ga);X.r=u.color.r*ga.r;X.g=u.color.g*ga.g;X.b=u.color.b*ga.b;X.updateStyleString()}else X.__styleString=u.color.__styleString;c(U,W,aa,I,Z,Q,X,u.wireframe,u.wireframe_linewidth)}else if(u instanceof THREE.MeshDepthMaterial){K=u.__2near;da=u.__farPlusNear;ia=u.__farMinusNear;h=~~((1-K/(da-J.positionScreen.z*ia))*255);t=~~((1-K/(da-S.positionScreen.z*ia))*255);x=~~((1-K/(da-M.positionScreen.z*ia))*255);ja=k([h,h,h],[t,t,t],[x,x,x],[x,x,x]);ka.u=0;ka.v=0;ea.u=sa;ea.v=0; -la.u=0;la.v=sa;o(ja,U,W,aa,I,Z,Q,ka.u,ka.v,ea.u,ea.v,la.u,la.v)}else if(u instanceof THREE.MeshNormalMaterial){X.r=e(N.normalWorld.x);X.g=e(N.normalWorld.y);X.b=e(N.normalWorld.z);X.updateStyleString();c(U,W,aa,I,Z,Q,X,u.wireframe,u.wireframe_linewidth)}}function f(J,S,M,N,u,L,Y,A,$){U=J.positionScreen.x;W=J.positionScreen.y;aa=S.positionScreen.x;I=S.positionScreen.y;Z=M.positionScreen.x;Q=M.positionScreen.y;ca=N.positionScreen.x;G=N.positionScreen.y;F=u.positionScreen.x;ba=u.positionScreen.y;ma= -L.positionScreen.x;R=L.positionScreen.y;if(A.opacity!=v)j.globalAlpha=v=A.opacity;A.blending!=i&&q(A.blending);if(A.map){ja=A.map.image;ra=ja.width-1;va=ja.height-1;ka.copy(Y.uvs[0]);ea.copy(Y.uvs[1]);la.copy(Y.uvs[2]);oa.copy(Y.uvs[3]);ka.u*=ra;ka.v*=va;ea.u*=ra;ea.v*=va;la.u*=ra;la.v*=va;oa.u*=ra;oa.v*=va;o(ja,U,W,aa,I,ca,G,ka.u,ka.v,ea.u,ea.v,oa.u,oa.v);o(ja,F,ba,Z,Q,ma,R,ea.u,ea.v,la.u,la.v,oa.u,oa.v)}else if(A instanceof THREE.MeshBasicMaterial)d(U,W,aa,I,Z,Q,ca,G,A.color,A.wireframe,A.wireframe_linewidth); -else if(A instanceof THREE.MeshLambertMaterial){if(Ea){ga.r=na.r;ga.g=na.g;ga.b=na.b;a($,Y,ga);X.r=A.color.r*ga.r;X.g=A.color.g*ga.g;X.b=A.color.b*ga.b;X.updateStyleString()}else X.__styleString=A.color.__styleString;d(U,W,aa,I,Z,Q,ca,G,X,A.wireframe,A.wireframe_linewidth)}else if(A instanceof THREE.MeshDepthMaterial){K=A.__2near;da=A.__farPlusNear;ia=A.__farMinusNear;h=~~((1-K/(da-J.positionScreen.z*ia))*255);t=~~((1-K/(da-S.positionScreen.z*ia))*255);x=~~((1-K/(da-M.positionScreen.z*ia))*255);D= -~~((1-K/(da-N.positionScreen.z*ia))*255);ja=k([h,h,h],[t,t,t],[D,D,D],[x,x,x]);ka.u=0;ka.v=0;ea.u=sa;ea.v=0;la.u=sa;la.v=sa;oa.u=0;oa.v=sa;o(ja,U,W,aa,I,ca,G,ka.u,ka.v,ea.u,ea.v,oa.u,oa.v);o(ja,F,ba,Z,Q,ma,R,ea.u,ea.v,la.u,la.v,oa.u,oa.v)}else if(A instanceof THREE.MeshNormalMaterial){X.r=e(Y.normalWorld.x);X.g=e(Y.normalWorld.y);X.b=e(Y.normalWorld.z);X.updateStyleString();d(U,W,aa,I,Z,Q,ca,G,X,A.wireframe,A.wireframe_linewidth)}}function c(J,S,M,N,u,L,Y,A,$){j.beginPath();j.moveTo(J,S);j.lineTo(M, -N);j.lineTo(u,L);j.lineTo(J,S);j.closePath();if(A){if(V!=$)j.lineWidth=V=$;if(B!=Y.__styleString)j.strokeStyle=B=Y.__styleString;j.stroke();fa.inflate($*2)}else{if(C!=Y.__styleString)j.fillStyle=C=Y.__styleString;j.fill()}}function d(J,S,M,N,u,L,Y,A,$,H,ha){j.beginPath();j.moveTo(J,S);j.lineTo(M,N);j.lineTo(u,L);j.lineTo(Y,A);j.lineTo(J,S);j.closePath();if(H){if(V!=ha)j.lineWidth=V=ha;if(B!=$.__styleString)j.strokeStyle=B=$.__styleString;j.stroke();fa.inflate(ha*2)}else{if(C!=$.__styleString)j.fillStyle= -C=$.__styleString;j.fill()}}function o(J,S,M,N,u,L,Y,A,$,H,ha,ta,wa){j.beginPath();j.moveTo(S,M);j.lineTo(N,u);j.lineTo(L,Y);j.closePath();N-=S;u-=M;L-=S;Y-=M;H-=A;ha-=$;ta-=A;wa-=$;var xa=1/(H*wa-ta*ha),Aa=(wa*N-ha*L)*xa;ha=(wa*u-ha*Y)*xa;N=(H*L-ta*N)*xa;u=(H*Y-ta*u)*xa;S=S-Aa*A-N*$;M=M-ha*A-u*$;j.save();j.transform(Aa,ha,N,u,S,M);j.clip();j.drawImage(J,0,0);j.restore()}function q(J){switch(J){case 0:j.globalCompositeOperation="source-over";break;case 1:j.globalCompositeOperation="lighter";break; -case 2:j.globalCompositeOperation="darker"}i=J}function k(J,S,M,N){pa[0]=J[0];pa[1]=J[1];pa[2]=J[2];pa[4]=S[0];pa[5]=S[1];pa[6]=S[2];pa[8]=M[0];pa[9]=M[1];pa[10]=M[2];pa[12]=N[0];pa[13]=N[1];pa[14]=N[2];Ba.putImageData(Ia,0,0);Fa.drawImage(Ca,0,0);return Da}function e(J){return J<0?Math.min((1+J)*0.5,0.5):0.5+Math.min(J*0.5,0.5)}function g(J,S){var M=S.x-J.x,N=S.y-J.y,u=1/Math.sqrt(M*M+N*N);M*=u;N*=u;S.x+=M;S.y+=N;J.x-=M;J.y-=N}var m=null,r=new THREE.Projector,l=document.createElement("canvas"),s, -p,n,y,j=l.getContext("2d"),v=1,i=0,B=null,C=null,V=1,w,E,z,T,O=new THREE.Vertex,P=new THREE.Vertex,U,W,aa,I,Z,Q,ca,G,F,ba,ma,R,h,t,x,D,K,da,ia,ja,ra,va,ua=new THREE.Rectangle,qa=new THREE.Rectangle,fa=new THREE.Rectangle,Ea=false,X=new THREE.Color(4294967295),ga=new THREE.Color(4294967295),na=new THREE.Color(4278190080),ya=new THREE.Color(4278190080),za=new THREE.Color(4278190080),Ma=Math.PI*2,Ha=new THREE.Vector3,ka=new THREE.UV,ea=new THREE.UV,la=new THREE.UV,oa=new THREE.UV,Ca,Ba,Ia,pa,Da,Fa,sa= -16;Ca=document.createElement("canvas");Ca.width=Ca.height=2;Ba=Ca.getContext("2d");Ba.fillStyle="rgba(0,0,0,1)";Ba.fillRect(0,0,2,2);Ia=Ba.getImageData(0,0,2,2);pa=Ia.data;Da=document.createElement("canvas");Da.width=Da.height=sa;Fa=Da.getContext("2d");Fa.translate(-sa/2,-sa/2);Fa.scale(sa,sa);sa--;this.domElement=l;this.autoClear=true;this.setSize=function(J,S){s=J;p=S;n=s/2;y=p/2;l.width=s;l.height=p;j.lineJoin="round";j.lineCap="round";ua.set(-n,-y,n,y)};this.clear=function(){if(!qa.isEmpty()){qa.inflate(1); -qa.minSelf(ua);j.setTransform(1,0,0,-1,n,y);j.clearRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight());qa.empty()}};this.render=function(J,S){var M,N,u,L,Y,A,$,H;this.autoClear&&this.clear();m=r.projectScene(J,S);j.setTransform(1,0,0,-1,n,y);j.fillStyle="rgba(0, 255, 255, 0.5)";j.fillRect(ua.getX(),ua.getY(),ua.getWidth(),ua.getHeight());if(Ea=J.lights.length>0){Y=J.lights;na.setRGBA(0,0,0,1);ya.setRGBA(0,0,0,1);za.setRGBA(0,0,0,1);M=0;for(N=Y.length;M0){Q.r+=F.color.r*ba;Q.g+=F.color.g*ba;Q.b+=F.color.b*ba}}else if(F instanceof THREE.PointLight){z.sub(F.position,Z.centroidWorld);z.normalize();ba=Z.normalWorld.dot(z)*F.intensity;if(ba>0){Q.r+=F.color.r*ba;Q.g+=F.color.g*ba;Q.b+=F.color.b*ba}}}}function b(I,Z,Q,ca,G,F){P=c(U++);P.setAttribute("d", -"M "+I.positionScreen.x+" "+I.positionScreen.y+" L "+Z.positionScreen.x+" "+Z.positionScreen.y+" L "+Q.positionScreen.x+","+Q.positionScreen.y+"z");if(G instanceof THREE.MeshBasicMaterial)i.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshLambertMaterial)if(v){B.r=C.r;B.g=C.g;B.b=C.b;a(F,ca,B);i.r=G.color.r*B.r;i.g=G.color.g*B.g;i.b=G.color.b*B.b;i.updateStyleString()}else i.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshDepthMaterial){E=1-G.__2near/(G.__farPlusNear- -ca.z*G.__farMinusNear);i.setRGBA(E,E,E,1)}else G instanceof THREE.MeshNormalMaterial&&i.setRGBA(d(ca.normalWorld.x),d(ca.normalWorld.y),d(ca.normalWorld.z),1);G.wireframe?P.setAttribute("style","fill: none; stroke: "+i.__styleString+"; stroke-width: "+G.wireframe_linewidth+"; stroke-opacity: "+G.opacity+"; stroke-linecap: round; stroke-linejoin: round"):P.setAttribute("style","fill: "+i.__styleString+"; fill-opacity: "+G.opacity);k.appendChild(P)}function f(I,Z,Q,ca,G,F,ba){P=c(U++);P.setAttribute("d", -"M "+I.positionScreen.x+" "+I.positionScreen.y+" L "+Z.positionScreen.x+" "+Z.positionScreen.y+" L "+Q.positionScreen.x+","+Q.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(F instanceof THREE.MeshBasicMaterial)i.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshLambertMaterial)if(v){B.r=C.r;B.g=C.g;B.b=C.b;a(ba,G,B);i.r=F.color.r*B.r;i.g=F.color.g*B.g;i.b=F.color.b*B.b;i.updateStyleString()}else i.__styleString=F.color.__styleString;else if(F instanceof -THREE.MeshDepthMaterial){E=1-F.__2near/(F.__farPlusNear-G.z*F.__farMinusNear);i.setRGBA(E,E,E,1)}else F instanceof THREE.MeshNormalMaterial&&i.setRGBA(d(G.normalWorld.x),d(G.normalWorld.y),d(G.normalWorld.z),1);F.wireframe?P.setAttribute("style","fill: none; stroke: "+i.__styleString+"; stroke-width: "+F.wireframe_linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: round; stroke-linejoin: round"):P.setAttribute("style","fill: "+i.__styleString+"; fill-opacity: "+F.opacity);k.appendChild(P)} -function c(I){if(T[I]==null){T[I]=document.createElementNS("http://www.w3.org/2000/svg","path");aa==0&&T[I].setAttribute("shape-rendering","crispEdges");return T[I]}return T[I]}function d(I){return I<0?Math.min((1+I)*0.5,0.5):0.5+Math.min(I*0.5,0.5)}var o=null,q=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),e,g,m,r,l,s,p,n,y=new THREE.Rectangle,j=new THREE.Rectangle,v=false,i=new THREE.Color(4294967295),B=new THREE.Color(4294967295),C=new THREE.Color(4278190080), -V=new THREE.Color(4278190080),w=new THREE.Color(4278190080),E,z=new THREE.Vector3,T=[],O=[],P,U,W,aa=1;this.domElement=k;this.autoClear=true;this.setQuality=function(I){switch(I){case "high":aa=1;break;case "low":aa=0}};this.setSize=function(I,Z){e=I;g=Z;m=e/2;r=g/2;k.setAttribute("viewBox",-m+" "+-r+" "+e+" "+g);k.setAttribute("width",e);k.setAttribute("height",g);y.set(-m,-r,m,r)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(I,Z){var Q,ca, -G,F,ba,ma,R,h;this.autoClear&&this.clear();o=q.projectScene(I,Z);W=U=0;if(v=I.lights.length>0){R=I.lights;C.setRGBA(0,0,0,1);V.setRGBA(0,0,0,1);w.setRGBA(0,0,0,1);Q=0;for(ca=R.length;Q0&&J.z<1}O=p.geometry.faces;x=0;for(F=O.length;x0&&J.z<1;if(O.__visible&&x>0){y=p.geometry.vertices[x-1];if(O.__visible&&y.__visible){r=g[e]=g[e]||new THREE.RenderableLine;r.v1.positionScreen.copy(O.positionScreen);r.v2.positionScreen.copy(y.positionScreen);r.z=Math.max(O.positionScreen.z,y.positionScreen.z);r.material=p.material;a.push(r);e++}}}}else if(p instanceof THREE.Particle){o.set(p.position.x,p.position.y,p.position.z,1);s.transform(o);o.z/=o.w;if(o.z>0&&o.z<1){k=l[i]= +l[i]||new THREE.RenderableParticle;k.x=o.x/o.w;k.y=o.y/o.w;k.z=o.z;k.rotation=p.rotation.z;k.scale.x=p.scale.x*Math.abs(k.x-(o.x+h.projectionMatrix.n11)/(o.w+h.projectionMatrix.n14));k.scale.y=p.scale.y*Math.abs(k.y-(o.y+h.projectionMatrix.n22)/(o.w+h.projectionMatrix.n24));k.material=p.material;a.push(k);i++}}}a.sort(function(D,W){return W.z-D.z});return a};this.unprojectVector=function(v,h){var I=new THREE.Matrix4;I.multiply(THREE.Matrix4.makeInvert(h.matrix),THREE.Matrix4.makeInvert(h.projectionMatrix)); +I.transform(v);return v}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,f,c,d,m;this.domElement=document.createElement("div");this.setSize=function(n,r){f=n;c=r;d=f/2;m=c/2};this.render=function(n,r){var e,g,k,i,l,o,s,q;a=b.projectScene(n,r);e=0;for(g=a.length;e0){G.r+=E.r*j;G.g+=E.g*j;G.b+=E.b*j}}else if(j instanceof THREE.PointLight){Ha.sub(j.position,K.centroidWorld);Ha.normalize();j=K.normalWorld.dot(Ha)*j.intensity;if(j>0){G.r+=E.r*j;G.g+=E.g*j;G.b+=E.b*j}}}}function b(C,K,G,H,j,E){S=C.positionScreen.x;V=C.positionScreen.y;Y=K.positionScreen.x; +D=K.positionScreen.y;W=G.positionScreen.x;M=G.positionScreen.y;if(j.opacity!=I)h.globalAlpha=I=j.opacity;j.blending!=w&&n(j.blending);if(j.map){fa=j.map.image;qa=fa.width-1;ra=fa.height-1;da.u=H.uvs[0].u*qa;da.v=H.uvs[0].v*ra;$.u=H.uvs[1].u*qa;$.v=H.uvs[1].v*ra;ea.u=H.uvs[2].u*qa;ea.v=H.uvs[2].v*ra;m(fa,S,V,Y,D,W,M,da.u,da.v,$.u,$.v,ea.u,ea.v)}else if(j instanceof THREE.MeshBasicMaterial)c(S,V,Y,D,W,M,j.color,j.wireframe,j.wireframe_linewidth);else if(j instanceof THREE.MeshLambertMaterial){if(Da){ba.r= +ga.r;ba.g=ga.g;ba.b=ga.b;a(E,H,ba);P.r=j.color.r*ba.r;P.g=j.color.g*ba.g;P.b=j.color.b*ba.b;P.updateStyleString()}else P.__styleString=j.color.__styleString;c(S,V,Y,D,W,M,P,j.wireframe,j.wireframe_linewidth)}else if(j instanceof THREE.MeshDepthMaterial){sa=j.__2near;ta=j.__farPlusNear;ua=j.__farMinusNear;T=~~((1-sa/(ta-C.positionScreen.z*ua))*255);ha=~~((1-sa/(ta-K.positionScreen.z*ua))*255);na=~~((1-sa/(ta-G.positionScreen.z*ua))*255);fa=r([T,T,T],[ha,ha,ha],[na,na,na],[na,na,na]);da.u=0;da.v=0; +$.u=la;$.v=0;ea.u=0;ea.v=la;m(fa,S,V,Y,D,W,M,da.u,da.v,$.u,$.v,ea.u,ea.v)}else if(j instanceof THREE.MeshNormalMaterial){P.r=e(H.normalWorld.x);P.g=e(H.normalWorld.y);P.b=e(H.normalWorld.z);P.updateStyleString();c(S,V,Y,D,W,M,P,j.wireframe,j.wireframe_linewidth)}}function f(C,K,G,H,j,E,Q,u,R){S=C.positionScreen.x;V=C.positionScreen.y;Y=K.positionScreen.x;D=K.positionScreen.y;W=G.positionScreen.x;M=G.positionScreen.y;Z=H.positionScreen.x;B=H.positionScreen.y;z=j.positionScreen.x;X=j.positionScreen.y; +pa=E.positionScreen.x;N=E.positionScreen.y;if(u.opacity!=I)h.globalAlpha=I=u.opacity;u.blending!=w&&n(u.blending);if(u.map){fa=u.map.image;qa=fa.width-1;ra=fa.height-1;da.copy(Q.uvs[0]);$.copy(Q.uvs[1]);ea.copy(Q.uvs[2]);ia.copy(Q.uvs[3]);da.u*=qa;da.v*=ra;$.u*=qa;$.v*=ra;ea.u*=qa;ea.v*=ra;ia.u*=qa;ia.v*=ra;m(fa,S,V,Y,D,Z,B,da.u,da.v,$.u,$.v,ia.u,ia.v);m(fa,z,X,W,M,pa,N,$.u,$.v,ea.u,ea.v,ia.u,ia.v)}else if(u instanceof THREE.MeshBasicMaterial)d(S,V,Y,D,W,M,Z,B,u.color,u.wireframe,u.wireframe_linewidth); +else if(u instanceof THREE.MeshLambertMaterial){if(Da){ba.r=ga.r;ba.g=ga.g;ba.b=ga.b;a(R,Q,ba);P.r=u.color.r*ba.r;P.g=u.color.g*ba.g;P.b=u.color.b*ba.b;P.updateStyleString()}else P.__styleString=u.color.__styleString;d(S,V,Y,D,W,M,Z,B,P,u.wireframe,u.wireframe_linewidth)}else if(u instanceof THREE.MeshDepthMaterial){sa=u.__2near;ta=u.__farPlusNear;ua=u.__farMinusNear;T=~~((1-sa/(ta-C.positionScreen.z*ua))*255);ha=~~((1-sa/(ta-K.positionScreen.z*ua))*255);na=~~((1-sa/(ta-G.positionScreen.z*ua))*255); +Ea=~~((1-sa/(ta-H.positionScreen.z*ua))*255);fa=r([T,T,T],[ha,ha,ha],[Ea,Ea,Ea],[na,na,na]);da.u=0;da.v=0;$.u=la;$.v=0;ea.u=la;ea.v=la;ia.u=0;ia.v=la;m(fa,S,V,Y,D,Z,B,da.u,da.v,$.u,$.v,ia.u,ia.v);m(fa,z,X,W,M,pa,N,$.u,$.v,ea.u,ea.v,ia.u,ia.v)}else if(u instanceof THREE.MeshNormalMaterial){P.r=e(Q.normalWorld.x);P.g=e(Q.normalWorld.y);P.b=e(Q.normalWorld.z);P.updateStyleString();d(S,V,Y,D,W,M,Z,B,P,u.wireframe,u.wireframe_linewidth)}}function c(C,K,G,H,j,E,Q,u,R){h.beginPath();h.moveTo(C,K);h.lineTo(G, +H);h.lineTo(j,E);h.lineTo(C,K);h.closePath();if(u){if(U!=R)h.lineWidth=U=R;if(x!=Q.__styleString)h.strokeStyle=x=Q.__styleString;h.stroke();aa.inflate(R*2)}else{if(F!=Q.__styleString)h.fillStyle=F=Q.__styleString;h.fill()}}function d(C,K,G,H,j,E,Q,u,R,A,ca){h.beginPath();h.moveTo(C,K);h.lineTo(G,H);h.lineTo(j,E);h.lineTo(Q,u);h.lineTo(C,K);h.closePath();if(A){if(U!=ca)h.lineWidth=U=ca;if(x!=R.__styleString)h.strokeStyle=x=R.__styleString;h.stroke();aa.inflate(ca*2)}else{if(F!=R.__styleString)h.fillStyle= +F=R.__styleString;h.fill()}}function m(C,K,G,H,j,E,Q,u,R,A,ca,ma,va){h.beginPath();h.moveTo(K,G);h.lineTo(H,j);h.lineTo(E,Q);h.closePath();H-=K;j-=G;E-=K;Q-=G;A-=u;ca-=R;ma-=u;va-=R;var wa=1/(A*va-ma*ca),za=(va*H-ca*E)*wa;ca=(va*j-ca*Q)*wa;H=(A*E-ma*H)*wa;j=(A*Q-ma*j)*wa;K=K-za*u-H*R;G=G-ca*u-j*R;h.save();h.transform(za,ca,H,j,K,G);h.clip();h.drawImage(C,0,0);h.restore()}function n(C){switch(C){case 0:h.globalCompositeOperation="source-over";break;case 1:h.globalCompositeOperation="lighter";break; +case 2:h.globalCompositeOperation="darker"}w=C}function r(C,K,G,H){ja[0]=C[0];ja[1]=C[1];ja[2]=C[2];ja[4]=K[0];ja[5]=K[1];ja[6]=K[2];ja[8]=G[0];ja[9]=G[1];ja[10]=G[2];ja[12]=H[0];ja[13]=H[1];ja[14]=H[2];Aa.putImageData(Ia,0,0);Fa.drawImage(Ba,0,0);return Ca}function e(C){return C<0?Math.min((1+C)*0.5,0.5):0.5+Math.min(C*0.5,0.5)}function g(C,K){var G=K.x-C.x,H=K.y-C.y,j=1/Math.sqrt(G*G+H*H);G*=j;H*=j;K.x+=G;K.y+=H;C.x-=G;C.y-=H}var k=null,i=new THREE.Projector,l=document.createElement("canvas"),o, +s,q,v,h=l.getContext("2d"),I=1,w=0,x=null,F=null,U=1,p,y,t,O,J=new THREE.Vertex,L=new THREE.Vertex,S,V,Y,D,W,M,Z,B,z,X,pa,N,T,ha,na,Ea,sa,ta,ua,fa,qa,ra,oa=new THREE.Rectangle,ka=new THREE.Rectangle,aa=new THREE.Rectangle,Da=false,P=new THREE.Color(4294967295),ba=new THREE.Color(4294967295),ga=new THREE.Color(4278190080),xa=new THREE.Color(4278190080),ya=new THREE.Color(4278190080),Ma=Math.PI*2,Ha=new THREE.Vector3,da=new THREE.UV,$=new THREE.UV,ea=new THREE.UV,ia=new THREE.UV,Ba,Aa,Ia,ja,Ca,Fa,la= +16;Ba=document.createElement("canvas");Ba.width=Ba.height=2;Aa=Ba.getContext("2d");Aa.fillStyle="rgba(0,0,0,1)";Aa.fillRect(0,0,2,2);Ia=Aa.getImageData(0,0,2,2);ja=Ia.data;Ca=document.createElement("canvas");Ca.width=Ca.height=la;Fa=Ca.getContext("2d");Fa.translate(-la/2,-la/2);Fa.scale(la,la);la--;this.domElement=l;this.autoClear=true;this.setSize=function(C,K){o=C;s=K;q=o/2;v=s/2;l.width=o;l.height=s;h.lineJoin="round";h.lineCap="round";oa.set(-q,-v,q,v)};this.clear=function(){if(!ka.isEmpty()){ka.inflate(1); +ka.minSelf(oa);h.setTransform(1,0,0,-1,q,v);h.clearRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight());ka.empty()}};this.render=function(C,K){var G,H,j,E,Q,u,R,A;this.autoClear&&this.clear();k=i.projectScene(C,K);h.setTransform(1,0,0,-1,q,v);h.fillStyle="rgba(0, 255, 255, 0.5)";h.fillRect(oa.getX(),oa.getY(),oa.getWidth(),oa.getHeight());if(Da=C.lights.length>0){Q=C.lights;ga.setRGBA(0,0,0,1);xa.setRGBA(0,0,0,1);ya.setRGBA(0,0,0,1);G=0;for(H=Q.length;G0){M.r+=z.color.r*X;M.g+=z.color.g*X;M.b+=z.color.b*X}}else if(z instanceof THREE.PointLight){t.sub(z.position,W.centroidWorld);t.normalize();X=W.normalWorld.dot(t)*z.intensity;if(X>0){M.r+=z.color.r*X;M.g+=z.color.g*X;M.b+=z.color.b*X}}}}function b(D,W,M,Z,B,z){L=c(S++);L.setAttribute("d","M "+D.positionScreen.x+ +" "+D.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)w.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(I){x.r=F.r;x.g=F.g;x.b=F.b;a(z,Z,x);w.r=B.color.r*x.r;w.g=B.color.g*x.g;w.b=B.color.b*x.b;w.updateStyleString()}else w.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){y=1-B.__2near/(B.__farPlusNear-Z.z*B.__farMinusNear); +w.setRGBA(y,y,y,1)}else B instanceof THREE.MeshNormalMaterial&&w.setRGBA(d(Z.normalWorld.x),d(Z.normalWorld.y),d(Z.normalWorld.z),1);B.wireframe?L.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: round; stroke-linejoin: round"):L.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+B.opacity);r.appendChild(L)}function f(D,W,M,Z,B,z,X){L=c(S++);L.setAttribute("d","M "+D.positionScreen.x+ +" "+D.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");if(z instanceof THREE.MeshBasicMaterial)w.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshLambertMaterial)if(I){x.r=F.r;x.g=F.g;x.b=F.b;a(X,B,x);w.r=z.color.r*x.r;w.g=z.color.g*x.g;w.b=z.color.b*x.b;w.updateStyleString()}else w.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshDepthMaterial){y= +1-z.__2near/(z.__farPlusNear-B.z*z.__farMinusNear);w.setRGBA(y,y,y,1)}else z instanceof THREE.MeshNormalMaterial&&w.setRGBA(d(B.normalWorld.x),d(B.normalWorld.y),d(B.normalWorld.z),1);z.wireframe?L.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+z.wireframe_linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: round; stroke-linejoin: round"):L.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+z.opacity);r.appendChild(L)}function c(D){if(O[D]==null){O[D]= +document.createElementNS("http://www.w3.org/2000/svg","path");Y==0&&O[D].setAttribute("shape-rendering","crispEdges");return O[D]}return O[D]}function d(D){return D<0?Math.min((1+D)*0.5,0.5):0.5+Math.min(D*0.5,0.5)}var m=null,n=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),e,g,k,i,l,o,s,q,v=new THREE.Rectangle,h=new THREE.Rectangle,I=false,w=new THREE.Color(4294967295),x=new THREE.Color(4294967295),F=new THREE.Color(4278190080),U=new THREE.Color(4278190080),p= +new THREE.Color(4278190080),y,t=new THREE.Vector3,O=[],J=[],L,S,V,Y=1;this.domElement=r;this.autoClear=true;this.setQuality=function(D){switch(D){case "high":Y=1;break;case "low":Y=0}};this.setSize=function(D,W){e=D;g=W;k=e/2;i=g/2;r.setAttribute("viewBox",-k+" "+-i+" "+e+" "+g);r.setAttribute("width",e);r.setAttribute("height",g);v.set(-k,-i,k,i)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(D,W){var M,Z,B,z,X,pa,N,T;this.autoClear&&this.clear(); +m=n.projectScene(D,W);V=S=0;if(I=D.lights.length>0){N=D.lights;F.setRGBA(0,0,0,1);U.setRGBA(0,0,0,1);p.setRGBA(0,0,0,1);M=0;for(Z=N.length;M= 0.0 )": @@ -146,20 +128,20 @@ g?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",g?"}":""," "normalMatrix");d.objMatrix=c.getUniformLocation(d,"objMatrix");d.cameraPosition=c.getUniformLocation(d,"cameraPosition");d.enableLighting=c.getUniformLocation(d,"enableLighting");d.ambientLightColor=c.getUniformLocation(d,"ambientLightColor");if(e){d.directionalLightNumber=c.getUniformLocation(d,"directionalLightNumber");d.directionalLightColor=c.getUniformLocation(d,"directionalLightColor");d.directionalLightDirection=c.getUniformLocation(d,"directionalLightDirection")}if(g){d.pointLightNumber= c.getUniformLocation(d,"pointLightNumber");d.pointLightColor=c.getUniformLocation(d,"pointLightColor");d.pointLightPosition=c.getUniformLocation(d,"pointLightPosition")}d.material=c.getUniformLocation(d,"material");d.mColor=c.getUniformLocation(d,"mColor");d.mOpacity=c.getUniformLocation(d,"mOpacity");d.mAmbient=c.getUniformLocation(d,"mAmbient");d.mSpecular=c.getUniformLocation(d,"mSpecular");d.mShininess=c.getUniformLocation(d,"mShininess");d.enableMap=c.getUniformLocation(d,"enableMap");c.uniform1i(d.enableMap, 0);d.tMap=c.getUniformLocation(d,"tMap");c.uniform1i(d.tMap,0);d.m2Near=c.getUniformLocation(d,"m2Near");d.mFarPlusNear=c.getUniformLocation(d,"mFarPlusNear");d.mFarMinusNear=c.getUniformLocation(d,"mFarMinusNear");d.position=c.getAttribLocation(d,"position");c.enableVertexAttribArray(d.position);d.normal=c.getAttribLocation(d,"normal");c.enableVertexAttribArray(d.normal);d.uv=c.getAttribLocation(d,"uv");c.enableVertexAttribArray(d.uv);d.viewMatrixArray=new Float32Array(16);d.modelViewMatrixArray= -new Float32Array(16);d.projectionMatrixArray=new Float32Array(16)})(a.directional,a.point);this.setSize=function(e,g){f.width=e;f.height=g;c.viewport(0,0,f.width,f.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(e){var g,m,r,l,s=[],p=[],n=[];l=[];var y=[];c.uniform1i(d.enableLighting,e.lights.length);g=0;for(m=e.lights.length;g + + diff --git a/examples/lights_pointlights_gl.html b/examples/lights_pointlights_gl.html index d85e4d08..ec39dbe5 100644 --- a/examples/lights_pointlights_gl.html +++ b/examples/lights_pointlights_gl.html @@ -40,6 +40,7 @@ + diff --git a/examples/lights_test.html b/examples/lights_test.html index 8f61a68d..6ebe6c32 100644 --- a/examples/lights_test.html +++ b/examples/lights_test.html @@ -41,6 +41,7 @@ + diff --git a/examples/materials_multimaterials.html b/examples/materials_multimaterials.html index fa9978fc..5071c660 100644 --- a/examples/materials_multimaterials.html +++ b/examples/materials_multimaterials.html @@ -44,6 +44,7 @@ + diff --git a/examples/materials_shaders.html b/examples/materials_shaders.html index e7b6f25b..7c13fe76 100644 --- a/examples/materials_shaders.html +++ b/examples/materials_shaders.html @@ -42,7 +42,8 @@

 
 		 
-		
+
+		
 		
 
 		
diff --git a/examples/obj_convert_test.html b/examples/obj_convert_test.html
index 0a750ded..3cab8965 100644
--- a/examples/obj_convert_test.html
+++ b/examples/obj_convert_test.html
@@ -44,6 +44,7 @@
 
 		 
 
+		
 		
 		
 
diff --git a/src/io/Loader.js b/src/extras/io/Loader.js
similarity index 100%
rename from src/io/Loader.js
rename to src/extras/io/Loader.js
diff --git a/utils/build.py b/utils/build.py
index 3899d4eb..4c1424b5 100644
--- a/utils/build.py
+++ b/utils/build.py
@@ -100,7 +100,6 @@ def buildFull(debug):
 		'core/UV.js',
 		'core/Geometry.js',
 		'cameras/Camera.js',
-		'io/Loader.js',
 		'lights/Light.js',
 		'lights/AmbientLight.js',
 		'lights/DirectionalLight.js',
@@ -154,7 +153,6 @@ def buildCanvas(debug):
 		'core/UV.js',
 		'core/Geometry.js',
 		'cameras/Camera.js',
-		'io/Loader.js',
 		'lights/Light.js',
 		'lights/AmbientLight.js',
 		'lights/DirectionalLight.js',
@@ -204,7 +202,6 @@ def buildWebGL(debug):
 		'core/UV.js',
 		'core/Geometry.js',
 		'cameras/Camera.js',
-		'io/Loader.js',
 		'lights/Light.js',
 		'lights/AmbientLight.js',
 		'lights/DirectionalLight.js',
@@ -249,7 +246,6 @@ def buildSVG(debug):
 		'core/UV.js',
 		'core/Geometry.js',
 		'cameras/Camera.js',
-		'io/Loader.js',
 		'lights/Light.js',
 		'lights/AmbientLight.js',
 		'lights/DirectionalLight.js',
@@ -297,7 +293,6 @@ def buildDOM(debug):
 		'core/Face4.js',
 		'core/UV.js',
 		'cameras/Camera.js',
-		'io/Loader.js',
 		'objects/Object3D.js',
 		'objects/Particle.js',
 		'materials/ParticleDOMMaterial.js',