diff --git a/build/Three.js b/build/Three.js index 382c7a9b..7731af8c 100644 --- a/build/Three.js +++ b/build/Three.js @@ -1,2 +1,2 @@ -// Three.js r24 - http://github.com/mrdoob/three.js -var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};THREE.Color.prototype={setRGBA:function(f,e,c,d){this.r=f;this.g=e;this.b=c;this.a=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=a;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},copyRGB:function(a){this.r=a.r;this.g=a.g;this.b=a.b},copyRGBA:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a},multiplySelfRGB:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b},updateHex:function(){this.hex=Math.floor(this.a*255)<<24|Math.floor(this.r*255)<<16|Math.floor(this.g*255)<<8|Math.floor(this.b*255)},updateRGBA:function(){this.a=(this.hex>>24&255)/255;this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgba("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+","+this.a+")"},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", a: "+this.a+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(b,a){this.x=b.x+a.x;this.y=b.y+a.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(b,a){this.x=b.x-a.x;this.y=b.y-a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,b){this.x=a||0;this.y=c||0;this.z=b||0};THREE.Vector3.prototype={set:function(a,c,b){this.x=a;this.y=c;this.z=b;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(b,a){this.x=b.x+a.x;this.y=b.y+a.y;this.z=b.z+a.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(b,a){this.x=b.x-a.x;this.y=b.y-a.y;this.z=b.z-a.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},cross:function(b,a){this.x=b.y*a.z-b.z*a.y;this.y=b.z*a.x-b.x*a.z;this.z=b.x*a.y-b.y*a.x;return this},crossSelf:function(c){var b=this.x,a=this.y,d=this.z;this.x=a*c.z-d*c.y;this.y=d*c.x-b*c.z;this.z=b*c.y-a*c.x;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(d){var c=this.x-d.x,b=this.y-d.y,a=this.z-d.z;return c*c+b*b+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){if(this.length()>0){this.multiplyScalar(1/this.length())}else{this.multiplyScalar(0)}return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){var a=0.0001;return(Math.abs(this.x)=0&&Math.min(g,i.getY2())-Math.max(h,i.getY1())>=0};this.empty=function(){e=true;f=0;h=0;d=0;g=0;b()};this.isEmpty=function(){return e};this.toString=function(){return"THREE.Rectangle (x1: "+f+", y1: "+g+", x2: "+d+", y1: "+h+", width: "+a+", height: "+c+")"}};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.n12=0;this.n13=0;this.n14=0;this.n21=0;this.n22=1;this.n23=0;this.n24=0;this.n31=0;this.n32=0;this.n33=1;this.n34=0;this.n41=0;this.n42=0;this.n43=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(d,c,b){var a=this._x,f=this._y,e=this._z;e.sub(d,c);e.normalize();a.cross(b,e);a.normalize();f.cross(e,a);f.normalize();this.n11=a.x;this.n12=a.y;this.n13=a.z;this.n14=-a.dot(d);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(d);this.n31=e.x;this.n32=e.y;this.n33=e.z;this.n34=-e.dot(d);this.n41=0;this.n42=0;this.n43=0;this.n44=1},transform:function(a){var d=a.x,c=a.y,b=a.z,e=a.w?a.w:1;a.x=this.n11*d+this.n12*c+this.n13*b+this.n14*e;a.y=this.n21*d+this.n22*c+this.n23*b+this.n24*e;a.z=this.n31*d+this.n32*c+this.n33*b+this.n34*e;e=this.n41*d+this.n42*c+this.n43*b+this.n44*e;if(a.w){a.w=e}else{a.x=a.x/e;a.y=a.y/e;a.z=a.z/e}return a},crossVector:function(b){var c=new THREE.Vector4();c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=(b.w)?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(d,c){this.n11=d.n11*c.n11+d.n12*c.n21+d.n13*c.n31+d.n14*c.n41;this.n12=d.n11*c.n12+d.n12*c.n22+d.n13*c.n32+d.n14*c.n42;this.n13=d.n11*c.n13+d.n12*c.n23+d.n13*c.n33+d.n14*c.n43;this.n14=d.n11*c.n14+d.n12*c.n24+d.n13*c.n34+d.n14*c.n44;this.n21=d.n21*c.n11+d.n22*c.n21+d.n23*c.n31+d.n24*c.n41;this.n22=d.n21*c.n12+d.n22*c.n22+d.n23*c.n32+d.n24*c.n42;this.n23=d.n21*c.n13+d.n22*c.n23+d.n23*c.n33+d.n24*c.n43;this.n24=d.n21*c.n14+d.n22*c.n24+d.n23*c.n34+d.n24*c.n44;this.n31=d.n31*c.n11+d.n32*c.n21+d.n33*c.n31+d.n34*c.n41;this.n32=d.n31*c.n12+d.n32*c.n22+d.n33*c.n32+d.n34*c.n42;this.n33=d.n31*c.n13+d.n32*c.n23+d.n33*c.n33+d.n34*c.n43;this.n34=d.n31*c.n14+d.n32*c.n24+d.n33*c.n34+d.n34*c.n44;this.n41=d.n41*c.n11+d.n42*c.n21+d.n43*c.n31+d.n44*c.n41;this.n42=d.n41*c.n12+d.n42*c.n22+d.n43*c.n32+d.n44*c.n42;this.n43=d.n41*c.n13+d.n42*c.n23+d.n43*c.n33+d.n44*c.n43;this.n44=d.n41*c.n14+d.n42*c.n24+d.n43*c.n34+d.n44*c.n44},multiplySelf:function(c){var p=this.n11,o=this.n12,k=this.n13,i=this.n14,f=this.n21,e=this.n22,d=this.n23,b=this.n24,a=this.n31,s=this.n32,r=this.n33,q=this.n34,n=this.n41,j=this.n42,h=this.n43,g=this.n44;this.n11=p*c.n11+o*c.n21+k*c.n31+i*c.n41;this.n12=p*c.n12+o*c.n22+k*c.n32+i*c.n42;this.n13=p*c.n13+o*c.n23+k*c.n33+i*c.n43;this.n14=p*c.n14+o*c.n24+k*c.n34+i*c.n44;this.n21=f*c.n11+e*c.n21+d*c.n31+b*c.n41;this.n22=f*c.n12+e*c.n22+d*c.n32+b*c.n42;this.n23=f*c.n13+e*c.n23+d*c.n33+b*c.n43;this.n24=f*c.n14+e*c.n24+d*c.n34+b*c.n44;this.n31=a*c.n11+s*c.n21+r*c.n31+q*c.n41;this.n32=a*c.n12+s*c.n22+r*c.n32+q*c.n42;this.n33=a*c.n13+s*c.n23+r*c.n33+q*c.n43;this.n34=a*c.n14+s*c.n24+r*c.n34+q*c.n44;this.n41=n*c.n11+j*c.n21+h*c.n31+g*c.n41;this.n42=n*c.n12+j*c.n22+h*c.n32+g*c.n42;this.n43=n*c.n13+j*c.n23+h*c.n33+g*c.n43;this.n44=n*c.n14+j*c.n24+h*c.n34+g*c.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(d,e,c){var b=d[e];d[e]=d[c];d[c]=b}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(b,d,c){var a=new THREE.Matrix4();a.n14=b;a.n24=d;a.n34=c;return a};THREE.Matrix4.scaleMatrix=function(b,d,c){var a=new THREE.Matrix4();a.n11=b;a.n22=d;a.n33=c;return a};THREE.Matrix4.rotationXMatrix=function(b){var a=new THREE.Matrix4();a.n22=a.n33=Math.cos(b);a.n32=Math.sin(b);a.n23=-a.n32;return a};THREE.Matrix4.rotationYMatrix=function(b){var a=new THREE.Matrix4();a.n11=a.n33=Math.cos(b);a.n13=Math.sin(b);a.n31=-a.n13;return a};THREE.Matrix4.rotationZMatrix=function(b){var a=new THREE.Matrix4();a.n11=a.n22=Math.cos(b);a.n21=Math.sin(b);a.n12=-a.n21;return a};THREE.Matrix4.rotationAxisAngleMatrix=function(b,d){var a=new THREE.Matrix4(),f=Math.cos(d),j=Math.sin(d),i=1-f,h=b.x,g=b.y,e=b.z;a.n11=i*h*h+f;a.n12=i*h*g-j*e;a.n13=i*h*e+j*g;a.n21=i*h*g+j*e;a.n22=i*g*g+f;a.n23=i*g*e-j*h;a.n31=i*h*e-j*g;a.n32=i*g*e+j*h;a.n33=i*e*e+f;return a};THREE.Matrix4.makeInvert=function(b){var a=new THREE.Matrix4();a.n11=b.n23*b.n34*b.n42-b.n24*b.n33*b.n42+b.n24*b.n32*b.n43-b.n22*b.n34*b.n43-b.n23*b.n32*b.n44+b.n22*b.n33*b.n44;a.n12=b.n14*b.n33*b.n42-b.n13*b.n34*b.n42-b.n14*b.n32*b.n43+b.n12*b.n34*b.n43+b.n13*b.n32*b.n44-b.n12*b.n33*b.n44;a.n13=b.n13*b.n24*b.n42-b.n14*b.n23*b.n42+b.n14*b.n22*b.n43-b.n12*b.n24*b.n43-b.n13*b.n22*b.n44+b.n12*b.n23*b.n44;a.n14=b.n14*b.n23*b.n32-b.n13*b.n24*b.n32-b.n14*b.n22*b.n33+b.n12*b.n24*b.n33+b.n13*b.n22*b.n34-b.n12*b.n23*b.n34;a.n21=b.n24*b.n33*b.n41-b.n23*b.n34*b.n41-b.n24*b.n31*b.n43+b.n21*b.n34*b.n43+b.n23*b.n31*b.n44-b.n21*b.n33*b.n44;a.n22=b.n13*b.n34*b.n41-b.n14*b.n33*b.n41+b.n14*b.n31*b.n43-b.n11*b.n34*b.n43-b.n13*b.n31*b.n44+b.n11*b.n33*b.n44;a.n23=b.n14*b.n23*b.n41-b.n13*b.n24*b.n41-b.n14*b.n21*b.n43+b.n11*b.n24*b.n43+b.n13*b.n21*b.n44-b.n11*b.n23*b.n44;a.n24=b.n13*b.n24*b.n31-b.n14*b.n23*b.n31+b.n14*b.n21*b.n33-b.n11*b.n24*b.n33-b.n13*b.n21*b.n34+b.n11*b.n23*b.n34;a.n31=b.n22*b.n34*b.n41-b.n24*b.n32*b.n41+b.n24*b.n31*b.n42-b.n21*b.n34*b.n42-b.n22*b.n31*b.n44+b.n21*b.n32*b.n44;a.n32=b.n14*b.n32*b.n41-b.n12*b.n34*b.n41-b.n14*b.n31*b.n42+b.n11*b.n34*b.n42+b.n12*b.n31*b.n44-b.n11*b.n32*b.n44;a.n33=b.n13*b.n24*b.n41-b.n14*b.n22*b.n41+b.n14*b.n21*b.n42-b.n11*b.n24*b.n42-b.n12*b.n21*b.n44+b.n11*b.n22*b.n44;a.n34=b.n14*b.n22*b.n31-b.n12*b.n24*b.n31-b.n14*b.n21*b.n32+b.n11*b.n24*b.n32+b.n12*b.n21*b.n34-b.n11*b.n22*b.n34;a.n41=b.n23*b.n32*b.n41-b.n22*b.n33*b.n41-b.n23*b.n31*b.n42+b.n21*b.n33*b.n42+b.n22*b.n31*b.n43-b.n21*b.n32*b.n43;a.n42=b.n12*b.n33*b.n41-b.n13*b.n32*b.n41+b.n13*b.n31*b.n42-b.n11*b.n33*b.n42-b.n12*b.n31*b.n43+b.n11*b.n32*b.n43;a.n43=b.n13*b.n22*b.n41-b.n12*b.n23*b.n41-b.n13*b.n21*b.n42+b.n11*b.n23*b.n42+b.n12*b.n21*b.n43-b.n11*b.n22*b.n43;a.n44=b.n12*b.n23*b.n31-b.n13*b.n22*b.n31+b.n13*b.n21*b.n32-b.n11*b.n23*b.n32-b.n12*b.n21*b.n33+b.n11*b.n22*b.n33;a.multiplyScalar(1/b.determinant());return a};THREE.Matrix4.makeInvert3x3=function(p){var n=new THREE.Matrix3();var e=p.flatten();var o=e[10]*e[5]-e[6]*e[9],i=-e[10]*e[1]+e[2]*e[9],d=e[6]*e[1]-e[2]*e[5],k=-e[10]*e[4]+e[6]*e[8],g=e[10]*e[0]-e[2]*e[8],c=-e[6]*e[0]+e[2]*e[4],j=e[9]*e[4]-e[5]*e[8],f=-e[9]*e[0]+e[1]*e[8],a=e[5]*e[0]-e[1]*e[4];var h=e[0]*(o)+e[1]*(k)+e[2]*(j);if(h==0){throw"matrix not invertible"}var b=1/h;n.m[0]=b*o;n.m[1]=b*i;n.m[2]=b*d;n.m[3]=b*k;n.m[4]=b*g;n.m[5]=b*c;n.m[6]=b*j;n.m[7]=b*f;n.m[8]=b*a;return n};THREE.Matrix4.makeFrustum=function(f,s,e,p,i,h){var g,r,o,q,n,k,j;g=new THREE.Matrix4();r=2*i/(s-f);o=2*i/(p-e);q=(s+f)/(s-f);n=(p+e)/(p-e);k=-(h+i)/(h-i);j=-2*h*i/(h-i);g.n11=r;g.n12=0;g.n13=q;g.n14=0;g.n21=0;g.n22=o;g.n23=n;g.n24=0;g.n31=0;g.n32=0;g.n33=k;g.n34=j;g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(e,c,g,b){var a,f,h,d;a=g*Math.tan(e*Math.PI/360);f=-a;h=f*c;d=a*c;return THREE.Matrix4.makeFrustum(h,d,f,a,g,b)};THREE.Matrix4.makeOrtho=function(c,q,k,a,g,f){var d,n,j,i,o,e,b;d=new THREE.Matrix4();o=q-c;e=a-k;b=f-g;n=(q+c)/o;j=(a+k)/e;i=(f+g)/b;d.n11=2/o;d.n12=0;d.n13=0;d.n14=-n;d.n21=0;d.n22=2/e;d.n23=0;d.n24=-j;d.n31=0;d.n32=0;d.n33=-2/b;d.n34=-i;d.n41=0;d.n42=0;d.n43=0;d.n44=1;return d};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.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(e,d,i,h,f,g){this.a=e;this.b=d;this.c=i;this.centroid=new THREE.Vector3();this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3();this.color=f||new THREE.Color(4278190080);this.vertexNormals=h instanceof Array?h:[];this.material=g||0};THREE.Face3.prototype={getCenter:function(){return this.a.clone().addSelf(this.b).addSelf(this.c).divideScalar(3)},toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};THREE.Face4=function(f,e,k,j,i,g,h){this.a=f;this.b=e;this.c=k;this.d=j;this.centroid=new THREE.Vector3();this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3();this.color=g||new THREE.Color(4278190080);this.vertexNormals=i instanceof Array?i:[];this.material=h||0};THREE.Face4.prototype={getCenter:function(){return this.a.clone().addSelf(this.b).addSelf(this.c).addSelf(this.d).divideScalar(4)},toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(b,a){this.u=b||0;this.v=a||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 c,b,a;for(c=0,b=this.faces.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]};var a,b;for(a=1,b=this.vertices.length;athis.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(c,b,d,a){this.fov=c;this.aspect=b;this.position=new THREE.Vector3(0,0,0);this.target={position:new THREE.Vector3(0,0,0)};this.projectionMatrix=THREE.Matrix4.makePerspective(c,b,d,a);this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4();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.Light=function(a){this.color=new THREE.Color(255<<24|a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light();THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,a){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=a||1};THREE.DirectionalLight.prototype=new THREE.Light();THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,a){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=a||1};THREE.DirectionalLight.prototype=new THREE.Light();THREE.DirectionalLight.prototype.constructor=THREE.PointLight;THREE.Object3D=function(a){this.position=new THREE.Vector3();this.rotation=new THREE.Vector3();this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4();this.matrixTranslation=new THREE.Matrix4();this.matrixRotation=new THREE.Matrix4();this.matrixScale=new THREE.Matrix4();this.screen=new THREE.Vector3();this.autoUpdateMatrix=true;this.updateMatrix=function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);this.matrixRotation=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.matrixRotation.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.matrixRotation.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.matrixScale=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.matrixRotation);this.matrix.multiplySelf(this.matrixScale)}};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D();THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(b,a){THREE.Object3D.call(this);this.geometry=b;this.material=a instanceof Array?a:[a]};THREE.Line.prototype=new THREE.Object3D();THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(b,a,c){THREE.Object3D.call(this);this.geometry=b;this.material=a instanceof Array?a:[a];this.flipSided=false;this.doubleSided=false;this.overdraw=false;this.materialFaces={};this.sortFacesByMaterial();if(c){this.normalizeUVs()}this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D();THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.sortFacesByMaterial=function(){var d,c,b,a;for(d=0,c=this.geometry.faces.length;d=0?(b*255)<<24:4278190080)|c)};THREE.LineColorMaterial.prototype={toString:function(){return"THREE.LineColorMaterial ( color: "+this.color+", lineWidth: "+this.lineWidth+" )"}};THREE.MeshPhongMaterial=function(d,a,e,c,b){this.ambient=new THREE.Color((b>=0?(b*255)<<24:4278190080)|d);this.diffuse=new THREE.Color((b>=0?(b*255)<<24:4278190080)|a);this.specular=new THREE.Color((b>=0?(b*255)<<24:4278190080)|e);this.shininess=c;this.opacity=b;this.toString=function(){return"THREE.MeshPhongMaterial (
ambient: "+this.ambient+",
diffuse: "+this.diffuse+",
specular: "+this.specular+",
shininess: "+this.shininess+",
opacity: "+this.opacity+")"}};THREE.MeshBitmapUVMappingMaterial=function(a){this.bitmap=a;this.loaded=0;this.decalIndex=-1;this.toString=function(){return"THREE.MeshBitmapUVMappingMaterial ( bitmap: "+this.bitmap+" )"}};THREE.MeshColorFillMaterial=function(b,a){this.color=new THREE.Color((a>=0?(a*255)<<24:4278190080)|b);this.toString=function(){return"THREE.MeshColorFillMaterial ( color: "+this.color+" )"}};THREE.MeshColorStrokeMaterial=function(c,b,a){this.lineWidth=a||1;this.color=new THREE.Color((b>=0?(b*255)<<24:4278190080)|c);this.toString=function(){return"THREE.MeshColorStrokeMaterial ( lineWidth: "+this.lineWidth+", color: "+this.color+" )"}};THREE.MeshFaceColorFillMaterial=function(){this.toString=function(){return"THREE.MeshFaceColorFillMaterial ( )"}};THREE.MeshFaceColorStrokeMaterial=function(a){this.lineWidth=a||1;this.toString=function(){return"THREE.MeshFaceColorStrokeMaterial ( lineWidth: "+this.lineWidth+" )"}};THREE.ParticleBitmapMaterial=function(a){this.bitmap=a;this.offset=new THREE.Vector2();this.toString=function(){return"THREE.ParticleBitmapMaterial ( bitmap: "+this.bitmap+" )"}};THREE.ParticleCircleMaterial=function(b,a){this.color=new THREE.Color((a>=0?(a*255)<<24:4278190080)|b);this.toString=function(){return"THREE.ParticleCircleMaterial ( color: "+this.color+" )"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Scene=function(){this.objects=[];this.lights=[];this.addObject=function(a){this.objects.push(a)};this.removeObject=function(b){for(var c=0,a=this.objects.length;c0&&w.z<1}x=M.geometry.faces;for(J=0,C=x.length;J0&&w.z<1;if(E>0){D=M.geometry.vertices[E-1];if(I.__visible&&D.__visible){k=i[n]=i[n]||new THREE.RenderableLine();k.v1.copy(I.positionScreen);k.v2.copy(D.positionScreen);k.z=Math.max(I.positionScreen.z,D.positionScreen.z);k.material=M.material;e.push(k);n++}}}}else{if(M instanceof THREE.Particle){g.set(M.position.x,M.position.y,M.position.z,1);H.matrix.transform(g);H.projectionMatrix.transform(g);M.screen.set(g.x/g.w,g.y/g.w,g.z/g.w);if(M.screen.z>0&&M.screen.z<1){j=a[h]=a[h]||new THREE.RenderableParticle();j.x=M.screen.x;j.y=M.screen.y;j.z=M.screen.z;j.rotation=M.rotation.z;j.scale.x=M.scale.x*Math.abs(g.x/g.w-(g.x+H.projectionMatrix.n11)/(g.w+H.projectionMatrix.n14));j.scale.y=M.scale.y*Math.abs(g.y/g.w-(g.y+H.projectionMatrix.n22)/(g.w+H.projectionMatrix.n24));j.material=M.material;j.color=M.color;e.push(j);h++}}}}}e.sort(function(N,v){return v.z-N.z});return e}};THREE.DOMRenderer=function(){THREE.Renderer.call(this);var e=null,g=new THREE.Projector(),b=document.createElement("div"),a,c,f,d;this.domElement=b;this.setSize=function(i,h){a=i;c=h;f=a/2;d=c/2};this.render=function(q,s){var r,h,i,o,p,t,n,k,j;e=g.projectScene(q,s);for(r=0,h=e.length;r0;if(i){y(ad,f)}for(ac=0,G=x.length;ac0){F.r+=D.color.r*G;F.g+=D.color.g*G;F.b+=D.color.b*G}}else{if(D instanceof THREE.PointLight){g.sub(D.position,H.centroidWorld);g.normalize();G=H.normalWorld.dot(g)*D.intensity;if(G>0){F.r+=D.color.r*G;F.g+=D.color.g*G;F.b+=D.color.b*G}}}}}function s(W,L,K,R,Q,F,D,T,S,H,G,P,O){var E,V,U,J,I,N,M;p.beginPath();p.moveTo(L,K);p.lineTo(R,Q);p.lineTo(F,D);p.lineTo(L,K);p.closePath();p.save();p.clip();E=T*(O-G)-H*O+P*G+(H-P)*S;V=-(S*(F-R)-G*F+O*R+(G-O)*L)/E;U=(G*D+S*(Q-D)-O*Q+(O-G)*K)/E;J=(T*(F-R)-H*F+P*R+(H-P)*L)/E;I=-(H*D+T*(Q-D)-P*Q+(P-H)*K)/E;N=(T*(O*R-G*F)+S*(H*F-P*R)+(P*G-H*O)*L)/E;M=(T*(O*Q-G*D)+S*(H*D-P*Q)+(P*G-H*O)*K)/E;p.transform(V,U,J,I,N,M);p.drawImage(W,0,0);p.restore()}function c(E,D){h.sub(D,E);h.unit();h.multiplyScalar(0.75);D.addSelf(h);E.subSelf(h)}};THREE.SVGRenderer=function(){var r=null,m=new THREE.Projector(),n=document.createElementNS("http://www.w3.org/2000/svg","svg"),g,v,k,b,t=new THREE.Rectangle(),q=new THREE.Rectangle(),f=false,h=new THREE.Color(4294967295),p=new THREE.Color(4294967295),c=new THREE.Color(4294967295),e=new THREE.Vector3(),d=[],i=[],u=1;this.domElement=n;this.autoClear=true;this.setQuality=function(w){switch(w){case"high":u=1;break;case"low":u=0;break}};this.setSize=function(x,w){g=x;v=w;k=g/2;b=v/2;n.setAttribute("viewBox",(-k)+" "+(-b)+" "+g+" "+v);n.setAttribute("width",g);n.setAttribute("height",v);t.set(-k,-b,k,b)};this.clear=function(){while(n.childNodes.length>0){n.removeChild(n.childNodes[0])}};this.render=function(P,M){var O,y,J,N,z,F,I=0,A=0,G,D,B,L,K,x,w,E,C,H;if(this.autoClear){this.clear()}r=m.projectScene(P,M);f=P.lights.length>0;if(f){s(P,c)}for(O=0,y=r.length;O0){y.r+=w.color.r*z;y.g+=w.color.g*z;y.b+=w.color.b*z}}else{if(w instanceof THREE.PointLight){e.sub(w.position,A.centroidWorld);e.normalize();z=A.normalWorld.dot(e)*w.intensity;if(z>0){y.r+=w.color.r*z;y.g+=w.color.g*z;y.b+=w.color.b*z}}}}}function j(w){if(d[w]==null){d[w]=document.createElementNS("http://www.w3.org/2000/svg","path");if(u==0){d[w].setAttribute("shape-rendering","crispEdges")}return d[w]}return d[w]}function o(w){if(i[w]==null){i[w]=document.createElementNS("http://www.w3.org/2000/svg","circle");if(u==0){i[w].setAttribute("shape-rendering","crispEdges")}return i[w]}return i[w]}};THREE.WebGLRenderer=function(){var m=document.createElement("canvas"),c,e,o=new THREE.Matrix4(),k;this.domElement=m;this.autoClear=true;h();g();var a=0,n=1,f=2,j=3,i=4,d=5;this.setSize=function(q,p){m.width=q;m.height=p;c.viewport(0,0,m.width,m.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(v){var t,u,p,s,r,q;c.uniform1i(e.enableLighting,v.lights.length);for(t=0,u=v.lights.length;t>24&255)/255;this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgba("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+","+this.a+")"},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", a: "+this.a+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(b,a){this.x=b.x+a.x;this.y=b.y+a.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(b,a){this.x=b.x-a.x;this.y=b.y-a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,b){this.x=a||0;this.y=c||0;this.z=b||0};THREE.Vector3.prototype={set:function(a,c,b){this.x=a;this.y=c;this.z=b;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(b,a){this.x=b.x+a.x;this.y=b.y+a.y;this.z=b.z+a.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(b,a){this.x=b.x-a.x;this.y=b.y-a.y;this.z=b.z-a.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},cross:function(b,a){this.x=b.y*a.z-b.z*a.y;this.y=b.z*a.x-b.x*a.z;this.z=b.x*a.y-b.y*a.x;return this},crossSelf:function(c){var b=this.x,a=this.y,d=this.z;this.x=a*c.z-d*c.y;this.y=d*c.x-b*c.z;this.z=b*c.y-a*c.x;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(d){var c=this.x-d.x,b=this.y-d.y,a=this.z-d.z;return c*c+b*b+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){if(this.length()>0){this.multiplyScalar(1/this.length())}else{this.multiplyScalar(0)}return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){var a=0.0001;return(Math.abs(this.x)=0&&Math.min(g,i.getY2())-Math.max(h,i.getY1())>=0};this.empty=function(){e=true;f=0;h=0;d=0;g=0;b()};this.isEmpty=function(){return e};this.toString=function(){return"THREE.Rectangle (x1: "+f+", y1: "+g+", x2: "+d+", y1: "+h+", width: "+a+", height: "+c+")"}};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.n12=0;this.n13=0;this.n14=0;this.n21=0;this.n22=1;this.n23=0;this.n24=0;this.n31=0;this.n32=0;this.n33=1;this.n34=0;this.n41=0;this.n42=0;this.n43=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(d,c,b){var a=this._x,f=this._y,e=this._z;e.sub(d,c);e.normalize();a.cross(b,e);a.normalize();f.cross(e,a);f.normalize();this.n11=a.x;this.n12=a.y;this.n13=a.z;this.n14=-a.dot(d);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(d);this.n31=e.x;this.n32=e.y;this.n33=e.z;this.n34=-e.dot(d);this.n41=0;this.n42=0;this.n43=0;this.n44=1},transform:function(a){var d=a.x,c=a.y,b=a.z,e=a.w?a.w:1;a.x=this.n11*d+this.n12*c+this.n13*b+this.n14*e;a.y=this.n21*d+this.n22*c+this.n23*b+this.n24*e;a.z=this.n31*d+this.n32*c+this.n33*b+this.n34*e;e=this.n41*d+this.n42*c+this.n43*b+this.n44*e;if(a.w){a.w=e}else{a.x=a.x/e;a.y=a.y/e;a.z=a.z/e}return a},crossVector:function(b){var c=new THREE.Vector4();c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=(b.w)?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(d,c){this.n11=d.n11*c.n11+d.n12*c.n21+d.n13*c.n31+d.n14*c.n41;this.n12=d.n11*c.n12+d.n12*c.n22+d.n13*c.n32+d.n14*c.n42;this.n13=d.n11*c.n13+d.n12*c.n23+d.n13*c.n33+d.n14*c.n43;this.n14=d.n11*c.n14+d.n12*c.n24+d.n13*c.n34+d.n14*c.n44;this.n21=d.n21*c.n11+d.n22*c.n21+d.n23*c.n31+d.n24*c.n41;this.n22=d.n21*c.n12+d.n22*c.n22+d.n23*c.n32+d.n24*c.n42;this.n23=d.n21*c.n13+d.n22*c.n23+d.n23*c.n33+d.n24*c.n43;this.n24=d.n21*c.n14+d.n22*c.n24+d.n23*c.n34+d.n24*c.n44;this.n31=d.n31*c.n11+d.n32*c.n21+d.n33*c.n31+d.n34*c.n41;this.n32=d.n31*c.n12+d.n32*c.n22+d.n33*c.n32+d.n34*c.n42;this.n33=d.n31*c.n13+d.n32*c.n23+d.n33*c.n33+d.n34*c.n43;this.n34=d.n31*c.n14+d.n32*c.n24+d.n33*c.n34+d.n34*c.n44;this.n41=d.n41*c.n11+d.n42*c.n21+d.n43*c.n31+d.n44*c.n41;this.n42=d.n41*c.n12+d.n42*c.n22+d.n43*c.n32+d.n44*c.n42;this.n43=d.n41*c.n13+d.n42*c.n23+d.n43*c.n33+d.n44*c.n43;this.n44=d.n41*c.n14+d.n42*c.n24+d.n43*c.n34+d.n44*c.n44},multiplySelf:function(c){var p=this.n11,o=this.n12,k=this.n13,i=this.n14,f=this.n21,e=this.n22,d=this.n23,b=this.n24,a=this.n31,s=this.n32,r=this.n33,q=this.n34,n=this.n41,j=this.n42,h=this.n43,g=this.n44;this.n11=p*c.n11+o*c.n21+k*c.n31+i*c.n41;this.n12=p*c.n12+o*c.n22+k*c.n32+i*c.n42;this.n13=p*c.n13+o*c.n23+k*c.n33+i*c.n43;this.n14=p*c.n14+o*c.n24+k*c.n34+i*c.n44;this.n21=f*c.n11+e*c.n21+d*c.n31+b*c.n41;this.n22=f*c.n12+e*c.n22+d*c.n32+b*c.n42;this.n23=f*c.n13+e*c.n23+d*c.n33+b*c.n43;this.n24=f*c.n14+e*c.n24+d*c.n34+b*c.n44;this.n31=a*c.n11+s*c.n21+r*c.n31+q*c.n41;this.n32=a*c.n12+s*c.n22+r*c.n32+q*c.n42;this.n33=a*c.n13+s*c.n23+r*c.n33+q*c.n43;this.n34=a*c.n14+s*c.n24+r*c.n34+q*c.n44;this.n41=n*c.n11+j*c.n21+h*c.n31+g*c.n41;this.n42=n*c.n12+j*c.n22+h*c.n32+g*c.n42;this.n43=n*c.n13+j*c.n23+h*c.n33+g*c.n43;this.n44=n*c.n14+j*c.n24+h*c.n34+g*c.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(d,e,c){var b=d[e];d[e]=d[c];d[c]=b}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(b,d,c){var a=new THREE.Matrix4();a.n14=b;a.n24=d;a.n34=c;return a};THREE.Matrix4.scaleMatrix=function(b,d,c){var a=new THREE.Matrix4();a.n11=b;a.n22=d;a.n33=c;return a};THREE.Matrix4.rotationXMatrix=function(b){var a=new THREE.Matrix4();a.n22=a.n33=Math.cos(b);a.n32=Math.sin(b);a.n23=-a.n32;return a};THREE.Matrix4.rotationYMatrix=function(b){var a=new THREE.Matrix4();a.n11=a.n33=Math.cos(b);a.n13=Math.sin(b);a.n31=-a.n13;return a};THREE.Matrix4.rotationZMatrix=function(b){var a=new THREE.Matrix4();a.n11=a.n22=Math.cos(b);a.n21=Math.sin(b);a.n12=-a.n21;return a};THREE.Matrix4.rotationAxisAngleMatrix=function(b,d){var a=new THREE.Matrix4(),f=Math.cos(d),j=Math.sin(d),i=1-f,h=b.x,g=b.y,e=b.z;a.n11=i*h*h+f;a.n12=i*h*g-j*e;a.n13=i*h*e+j*g;a.n21=i*h*g+j*e;a.n22=i*g*g+f;a.n23=i*g*e-j*h;a.n31=i*h*e-j*g;a.n32=i*g*e+j*h;a.n33=i*e*e+f;return a};THREE.Matrix4.makeInvert=function(b){var a=new THREE.Matrix4();a.n11=b.n23*b.n34*b.n42-b.n24*b.n33*b.n42+b.n24*b.n32*b.n43-b.n22*b.n34*b.n43-b.n23*b.n32*b.n44+b.n22*b.n33*b.n44;a.n12=b.n14*b.n33*b.n42-b.n13*b.n34*b.n42-b.n14*b.n32*b.n43+b.n12*b.n34*b.n43+b.n13*b.n32*b.n44-b.n12*b.n33*b.n44;a.n13=b.n13*b.n24*b.n42-b.n14*b.n23*b.n42+b.n14*b.n22*b.n43-b.n12*b.n24*b.n43-b.n13*b.n22*b.n44+b.n12*b.n23*b.n44;a.n14=b.n14*b.n23*b.n32-b.n13*b.n24*b.n32-b.n14*b.n22*b.n33+b.n12*b.n24*b.n33+b.n13*b.n22*b.n34-b.n12*b.n23*b.n34;a.n21=b.n24*b.n33*b.n41-b.n23*b.n34*b.n41-b.n24*b.n31*b.n43+b.n21*b.n34*b.n43+b.n23*b.n31*b.n44-b.n21*b.n33*b.n44;a.n22=b.n13*b.n34*b.n41-b.n14*b.n33*b.n41+b.n14*b.n31*b.n43-b.n11*b.n34*b.n43-b.n13*b.n31*b.n44+b.n11*b.n33*b.n44;a.n23=b.n14*b.n23*b.n41-b.n13*b.n24*b.n41-b.n14*b.n21*b.n43+b.n11*b.n24*b.n43+b.n13*b.n21*b.n44-b.n11*b.n23*b.n44;a.n24=b.n13*b.n24*b.n31-b.n14*b.n23*b.n31+b.n14*b.n21*b.n33-b.n11*b.n24*b.n33-b.n13*b.n21*b.n34+b.n11*b.n23*b.n34;a.n31=b.n22*b.n34*b.n41-b.n24*b.n32*b.n41+b.n24*b.n31*b.n42-b.n21*b.n34*b.n42-b.n22*b.n31*b.n44+b.n21*b.n32*b.n44;a.n32=b.n14*b.n32*b.n41-b.n12*b.n34*b.n41-b.n14*b.n31*b.n42+b.n11*b.n34*b.n42+b.n12*b.n31*b.n44-b.n11*b.n32*b.n44;a.n33=b.n13*b.n24*b.n41-b.n14*b.n22*b.n41+b.n14*b.n21*b.n42-b.n11*b.n24*b.n42-b.n12*b.n21*b.n44+b.n11*b.n22*b.n44;a.n34=b.n14*b.n22*b.n31-b.n12*b.n24*b.n31-b.n14*b.n21*b.n32+b.n11*b.n24*b.n32+b.n12*b.n21*b.n34-b.n11*b.n22*b.n34;a.n41=b.n23*b.n32*b.n41-b.n22*b.n33*b.n41-b.n23*b.n31*b.n42+b.n21*b.n33*b.n42+b.n22*b.n31*b.n43-b.n21*b.n32*b.n43;a.n42=b.n12*b.n33*b.n41-b.n13*b.n32*b.n41+b.n13*b.n31*b.n42-b.n11*b.n33*b.n42-b.n12*b.n31*b.n43+b.n11*b.n32*b.n43;a.n43=b.n13*b.n22*b.n41-b.n12*b.n23*b.n41-b.n13*b.n21*b.n42+b.n11*b.n23*b.n42+b.n12*b.n21*b.n43-b.n11*b.n22*b.n43;a.n44=b.n12*b.n23*b.n31-b.n13*b.n22*b.n31+b.n13*b.n21*b.n32-b.n11*b.n23*b.n32-b.n12*b.n21*b.n33+b.n11*b.n22*b.n33;a.multiplyScalar(1/b.determinant());return a};THREE.Matrix4.makeInvert3x3=function(p){var n=new THREE.Matrix3();var e=p.flatten();var o=e[10]*e[5]-e[6]*e[9],i=-e[10]*e[1]+e[2]*e[9],d=e[6]*e[1]-e[2]*e[5],k=-e[10]*e[4]+e[6]*e[8],g=e[10]*e[0]-e[2]*e[8],c=-e[6]*e[0]+e[2]*e[4],j=e[9]*e[4]-e[5]*e[8],f=-e[9]*e[0]+e[1]*e[8],a=e[5]*e[0]-e[1]*e[4];var h=e[0]*(o)+e[1]*(k)+e[2]*(j);if(h==0){throw"matrix not invertible"}var b=1/h;n.m[0]=b*o;n.m[1]=b*i;n.m[2]=b*d;n.m[3]=b*k;n.m[4]=b*g;n.m[5]=b*c;n.m[6]=b*j;n.m[7]=b*f;n.m[8]=b*a;return n};THREE.Matrix4.makeFrustum=function(f,s,e,p,i,h){var g,r,o,q,n,k,j;g=new THREE.Matrix4();r=2*i/(s-f);o=2*i/(p-e);q=(s+f)/(s-f);n=(p+e)/(p-e);k=-(h+i)/(h-i);j=-2*h*i/(h-i);g.n11=r;g.n12=0;g.n13=q;g.n14=0;g.n21=0;g.n22=o;g.n23=n;g.n24=0;g.n31=0;g.n32=0;g.n33=k;g.n34=j;g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(e,c,g,b){var a,f,h,d;a=g*Math.tan(e*Math.PI/360);f=-a;h=f*c;d=a*c;return THREE.Matrix4.makeFrustum(h,d,f,a,g,b)};THREE.Matrix4.makeOrtho=function(c,q,k,a,g,f){var d,n,j,i,o,e,b;d=new THREE.Matrix4();o=q-c;e=a-k;b=f-g;n=(q+c)/o;j=(a+k)/e;i=(f+g)/b;d.n11=2/o;d.n12=0;d.n13=0;d.n14=-n;d.n21=0;d.n22=2/e;d.n23=0;d.n24=-j;d.n31=0;d.n32=0;d.n33=-2/b;d.n34=-i;d.n41=0;d.n42=0;d.n43=0;d.n44=1;return d};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.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(e,d,h,g,f){this.a=e;this.b=d;this.c=h;this.centroid=new THREE.Vector3();this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3();this.vertexNormals=g instanceof Array?g:[];this.material=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};THREE.Face4=function(f,e,j,i,h,g){this.a=f;this.b=e;this.c=j;this.d=i;this.centroid=new THREE.Vector3();this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3();this.vertexNormals=h instanceof Array?h:[];this.material=g instanceof Array?g:[g]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(b,a){this.u=b||0;this.v=a||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 c,b,a;for(c=0,b=this.faces.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;athis.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(c,b,d,a){this.fov=c;this.aspect=b;this.position=new THREE.Vector3(0,0,0);this.target={position:new THREE.Vector3(0,0,0)};this.projectionMatrix=THREE.Matrix4.makePerspective(c,b,d,a);this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4();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.Light=function(a){this.color=new THREE.Color(255<<24|a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light();THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,a){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=a||1};THREE.DirectionalLight.prototype=new THREE.Light();THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,a){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=a||1};THREE.DirectionalLight.prototype=new THREE.Light();THREE.DirectionalLight.prototype.constructor=THREE.PointLight;THREE.Object3D=function(a){this.position=new THREE.Vector3();this.rotation=new THREE.Vector3();this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4();this.matrixTranslation=new THREE.Matrix4();this.matrixRotation=new THREE.Matrix4();this.matrixScale=new THREE.Matrix4();this.screen=new THREE.Vector3();this.autoUpdateMatrix=true;this.updateMatrix=function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);this.matrixRotation=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.matrixRotation.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.matrixRotation.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.matrixScale=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.matrixRotation);this.matrix.multiplySelf(this.matrixScale)}};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D();THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(b,a){THREE.Object3D.call(this);this.geometry=b;this.material=a instanceof Array?a:[a]};THREE.Line.prototype=new THREE.Object3D();THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(b,a,c){THREE.Object3D.call(this);this.geometry=b;this.material=a instanceof Array?a:[a];this.flipSided=false;this.doubleSided=false;this.overdraw=false;this.materialFaceGroup={};this.sortFacesByMaterial();if(c){this.normalizeUVs()}this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D();THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.sortFacesByMaterial=function(){function b(j){var h,f,k=[];for(h=0,f=j.length;h=0?(b*255)<<24:4278190080)|c)};THREE.LineColorMaterial.prototype={toString:function(){return"THREE.LineColorMaterial ( color: "+this.color+", lineWidth: "+this.lineWidth+" )"}};THREE.MeshPhongMaterial=function(d,a,e,c,b){this.ambient=new THREE.Color((b>=0?(b*255)<<24:4278190080)|d);this.diffuse=new THREE.Color((b>=0?(b*255)<<24:4278190080)|a);this.specular=new THREE.Color((b>=0?(b*255)<<24:4278190080)|e);this.shininess=c;this.opacity=b;this.toString=function(){return"THREE.MeshPhongMaterial (
ambient: "+this.ambient+",
diffuse: "+this.diffuse+",
specular: "+this.specular+",
shininess: "+this.shininess+",
opacity: "+this.opacity+")"}};THREE.MeshBitmapMaterial=function(a,b){this.bitmap=a;this.mode=b||THREE.MeshBitmapMaterialMode.UVMAPPING;this.id=THREE.MeshBitmapMaterialCounter.value++;this.toString=function(){return"THREE.MeshBitmapMaterial ( bitmap: "+this.bitmap+", mode: "+this.mode+", id: "+this.id+" )"}};THREE.MeshBitmapMaterialCounter={value:0};THREE.MeshBitmapMaterialMode={UVMAPPING:0};THREE.MeshColorFillMaterial=function(b,a){this.color=new THREE.Color((a>=0?(a*255)<<24:4278190080)|b);this.toString=function(){return"THREE.MeshColorFillMaterial ( color: "+this.color+" )"}};THREE.MeshColorStrokeMaterial=function(c,b,a){this.lineWidth=a||1;this.color=new THREE.Color((b>=0?(b*255)<<24:4278190080)|c);this.toString=function(){return"THREE.MeshColorStrokeMaterial ( lineWidth: "+this.lineWidth+", color: "+this.color+" )"}};THREE.MeshFaceMaterial=function(){this.toString=function(){return"THREE.MeshFaceMaterial"}};THREE.ParticleBitmapMaterial=function(a){this.bitmap=a;this.offset=new THREE.Vector2();this.toString=function(){return"THREE.ParticleBitmapMaterial ( bitmap: "+this.bitmap+" )"}};THREE.ParticleCircleMaterial=function(b,a){this.color=new THREE.Color((a>=0?(a*255)<<24:4278190080)|b);this.toString=function(){return"THREE.ParticleCircleMaterial ( color: "+this.color+" )"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Scene=function(){this.objects=[];this.lights=[];this.addObject=function(a){this.objects.push(a)};this.removeObject=function(b){for(var c=0,a=this.objects.length;c0&&w.z<1}x=M.geometry.faces;for(J=0,C=x.length;J0&&w.z<1;if(E>0){D=M.geometry.vertices[E-1];if(I.__visible&&D.__visible){k=i[n]=i[n]||new THREE.RenderableLine();k.v1.copy(I.positionScreen);k.v2.copy(D.positionScreen);k.z=Math.max(I.positionScreen.z,D.positionScreen.z);k.material=M.material;e.push(k);n++}}}}else{if(M instanceof THREE.Particle){g.set(M.position.x,M.position.y,M.position.z,1);H.matrix.transform(g);H.projectionMatrix.transform(g);M.screen.set(g.x/g.w,g.y/g.w,g.z/g.w);if(M.screen.z>0&&M.screen.z<1){j=a[h]=a[h]||new THREE.RenderableParticle();j.x=M.screen.x;j.y=M.screen.y;j.z=M.screen.z;j.rotation=M.rotation.z;j.scale.x=M.scale.x*Math.abs(g.x/g.w-(g.x+H.projectionMatrix.n11)/(g.w+H.projectionMatrix.n14));j.scale.y=M.scale.y*Math.abs(g.y/g.w-(g.y+H.projectionMatrix.n22)/(g.w+H.projectionMatrix.n24));j.material=M.material;j.color=M.color;e.push(j);h++}}}}}e.sort(function(N,v){return v.z-N.z});return e}};THREE.DOMRenderer=function(){THREE.Renderer.call(this);var e=null,g=new THREE.Projector(),b=document.createElement("div"),a,c,f,d;this.domElement=b;this.setSize=function(i,h){a=i;c=h;f=a/2;d=c/2};this.render=function(q,s){var r,h,i,o,p,t,n,k,j;e=g.projectScene(q,s);for(r=0,h=e.length;r0;if(m){B(aj,g)}for(ai=0,L=A.length;ai0){K.r+=I.color.r*L;K.g+=I.color.g*L;K.b+=I.color.b*L}}else{if(I instanceof THREE.PointLight){i.sub(I.position,M.centroidWorld);i.normalize();L=M.normalWorld.dot(i)*I.intensity;if(L>0){K.r+=I.color.r*L;K.g+=I.color.g*L;K.b+=I.color.b*L}}}}}function n(I,M,J,K,L){if(K instanceof THREE.ParticleCircleMaterial){if(m){x.copyRGB(g);u(L,J,x);p.copyRGBA(K.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=K.color}width=J.scale.x*r;height=J.scale.y*e;z.set(I-width,M-height,I+width,M+height);if(!D.instersects(z)){return}t.save();t.translate(I,M);t.rotate(-J.rotation);t.scale(width,height);t.beginPath();t.arc(0,0,1,0,y,true);t.closePath();t.fillStyle=p.__styleString;t.fill();t.restore()}else{if(K instanceof THREE.ParticleBitmapMaterial){bitmap=K.bitmap;bitmapWidth=bitmap.width/2;bitmapHeight=bitmap.height/2;scaleX=J.scale.x*r;scaleY=J.scale.y*e;width=scaleX*bitmapWidth;height=scaleY*bitmapHeight;offsetX=K.offset.x*scaleX;offsetY=K.offset.y*scaleY;z.set(I+offsetX-width,M+offsetY-height,I+offsetX+width,M+offsetY+height);if(!D.instersects(z)){return}t.save();t.translate(I,M);t.rotate(-J.rotation);t.scale(scaleX,-scaleY);t.translate(-bitmapWidth+K.offset.x,-bitmapHeight-K.offset.y);t.drawImage(bitmap,0,0);t.restore()}}}function f(I,O,K,J,L,M,N){if(M instanceof THREE.LineColorMaterial){if(m){x.copyRGB(g);u(N,L,x);p.copyRGBA(M.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=M.color}t.lineWidth=M.lineWidth;t.lineJoin="round";t.lineCap="round";t.strokeStyle=p.__styleString;t.stroke();z.inflate(t.lineWidth)}}function j(K,J,I,Q,P,O,L,N,M){if(N instanceof THREE.MeshColorFillMaterial){if(m){x.copyRGB(g);a(M,L,x);p.copyRGBA(N.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=N.color}t.beginPath();t.moveTo(K,J);t.lineTo(I,Q);t.lineTo(P,O);t.lineTo(K,J);t.closePath();t.fillStyle=p.__styleString;t.fill()}else{if(N instanceof THREE.MeshColorStrokeMaterial){if(m){x.copyRGB(g);a(M,L,x);p.copyRGBA(N.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=N.color}t.beginPath();t.moveTo(K,J);t.lineTo(I,Q);t.lineTo(P,O);t.lineTo(K,J);t.closePath();t.lineWidth=N.lineWidth;t.lineJoin="round";t.lineCap="round";t.strokeStyle=p.__styleString;t.stroke();z.inflate(t.lineWidth)}else{if(N instanceof THREE.MeshBitmapMaterial){bitmap=N.bitmap;bitmapWidth=bitmap.width-1;bitmapHeight=bitmap.height-1;H.copy(L.uvs[0]);F.copy(L.uvs[1]);E.copy(L.uvs[2]);H.u*=bitmapWidth;H.v*=bitmapHeight;F.u*=bitmapWidth;F.v*=bitmapHeight;E.u*=bitmapWidth;E.v*=bitmapHeight;w(bitmap,K,J,I,Q,P,O,H.u,H.v,F.u,F.v,E.u,E.v)}}}}function h(M,K,I,W,T,S,L,J,V,U,R,Q,N,P,O){if(P instanceof THREE.MeshColorFillMaterial){if(m){x.copyRGB(g);a(O,N,x);p.copyRGBA(P.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=P.color}t.beginPath();t.moveTo(M,K);t.lineTo(I,W);t.lineTo(T,S);t.lineTo(L,J);t.lineTo(M,K);t.closePath();t.fillStyle=p.__styleString;t.fill()}else{if(P instanceof THREE.MeshColorStrokeMaterial){if(m){x.copyRGB(g);a(O,N,x);p.copyRGBA(P.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=P.color}t.beginPath();t.moveTo(M,K);t.lineTo(I,W);t.lineTo(T,S);t.lineTo(L,J);t.lineTo(M,K);t.closePath();t.lineWidth=P.lineWidth;t.lineJoin="round";t.lineCap="round";t.strokeStyle=p.__styleString;t.stroke();z.inflate(t.lineWidth)}else{if(P instanceof THREE.MeshBitmapMaterial){bitmap=P.bitmap;bitmapWidth=bitmap.width-1;bitmapHeight=bitmap.height-1;H.copy(N.uvs[0]);F.copy(N.uvs[1]);E.copy(N.uvs[2]);C.copy(N.uvs[3]);H.u*=bitmapWidth;H.v*=bitmapHeight;F.u*=bitmapWidth;F.v*=bitmapHeight;E.u*=bitmapWidth;E.v*=bitmapHeight;C.u*=bitmapWidth;C.v*=bitmapHeight;w(bitmap,M,K,I,W,L,J,H.u,H.v,F.u,F.v,C.u,C.v);w(bitmap,V,U,T,S,R,Q,F.u,F.v,E.u,E.v,C.u,C.v)}}}}function w(ab,Q,P,W,V,K,I,U,T,Y,X,M,L){var J,aa,Z,O,N,S,R;t.beginPath();t.moveTo(Q,P);t.lineTo(W,V);t.lineTo(K,I);t.lineTo(Q,P);t.closePath();t.save();t.clip();J=U*(L-X)-Y*L+M*X+(Y-M)*T;aa=-(T*(K-W)-X*K+L*W+(X-L)*Q)/J;Z=(X*I+T*(V-I)-L*V+(L-X)*P)/J;O=(U*(K-W)-Y*K+M*W+(Y-M)*Q)/J;N=-(Y*I+U*(V-I)-M*V+(M-Y)*P)/J;S=(U*(L*W-X*K)+T*(Y*K-M*W)+(M*X-Y*L)*Q)/J;R=(U*(L*V-X*I)+T*(Y*I-M*V)+(M*X-Y*L)*P)/J;t.transform(aa,Z,O,N,S,R);t.drawImage(ab,0,0);t.restore()}function c(J,I){k.sub(I,J);k.unit();k.multiplyScalar(0.75);I.addSelf(k);J.subSelf(k)}};THREE.SVGRenderer=function(){var y=null,t=new THREE.Projector(),u=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,C,r,b,A=new THREE.Rectangle(),x=new THREE.Rectangle(),j=false,n=new THREE.Color(4294967295),w=new THREE.Color(4294967295),d=new THREE.Color(4294967295),h=new THREE.Vector3(),e=[],o=[],D,q,g,B=1;this.domElement=u;this.autoClear=true;this.setQuality=function(E){switch(E){case"high":B=1;break;case"low":B=0;break}};this.setSize=function(F,E){m=F;C=E;r=m/2;b=C/2;u.setAttribute("viewBox",(-r)+" "+(-b)+" "+m+" "+C);u.setAttribute("width",m);u.setAttribute("height",C);A.set(-r,-b,r,b)};this.clear=function(){while(u.childNodes.length>0){u.removeChild(u.childNodes[0])}};this.render=function(W,T){var V,G,Q,U,L,I,H,O,M,J,S,R,F,E,N,K,P;if(this.autoClear){this.clear()}y=t.projectScene(W,T);q=0;g=0;j=W.lights.length>0;if(j){z(W,d)}for(V=0,G=y.length;V0){G.r+=E.color.r*H;G.g+=E.color.g*H;G.b+=E.color.b*H}}else{if(E instanceof THREE.PointLight){h.sub(E.position,I.centroidWorld);h.normalize();H=I.normalWorld.dot(h)*E.intensity;if(H>0){G.r+=E.color.r*H;G.g+=E.color.g*H;G.b+=E.color.b*H}}}}}function k(E,I,F,G,H){D=v(g++);D.setAttribute("cx",E);D.setAttribute("cy",I);D.setAttribute("r",F.scale.x*r);if(G instanceof THREE.ParticleCircleMaterial){if(j){w.copyRGB(d);s(H,F,w);n.copyRGBA(G.color);n.multiplySelfRGB(w);n.updateStyleString()}else{n=G.color}D.setAttribute("style","fill: "+n.__styleString)}u.appendChild(D)}function c(){}function i(G,F,E,M,L,K,H,J,I){D=p(q++);D.setAttribute("d","M "+G+" "+F+" L "+E+" "+M+" L "+L+","+K+"z");if(J instanceof THREE.MeshColorFillMaterial){if(j){w.copyRGB(d);a(I,H,w);n.copyRGBA(J.color);n.multiplySelfRGB(w);n.updateStyleString()}else{n=J.color}D.setAttribute("style","fill: "+n.__styleString)}else{if(J instanceof THREE.MeshColorStrokeMaterial){if(j){w.copyRGB(d);a(I,H,w);n.copyRGBA(J.color);n.multiplySelfRGB(w);n.updateStyleString()}else{n=J.color}D.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+J.lineWidth+"; stroke-linecap: round; stroke-linejoin: round")}}u.appendChild(D)}function f(I,G,E,O,N,M,H,F,J,L,K){D=p(q++);D.setAttribute("d","M "+I+" "+G+" L "+E+" "+O+" L "+N+","+M+" L "+H+","+F+"z");if(L instanceof THREE.MeshColorFillMaterial){if(j){w.copyRGB(d);a(K,J,w);n.copyRGBA(L.color);n.multiplySelfRGB(w);n.updateStyleString()}else{n=L.color}D.setAttribute("style","fill: "+n.__styleString)}else{if(L instanceof THREE.MeshColorStrokeMaterial){if(j){w.copyRGB(d);a(K,J,w);n.copyRGBA(L.color);n.multiplySelfRGB(w);n.updateStyleString()}else{n=L.color}D.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+L.lineWidth+"; stroke-linecap: round; stroke-linejoin: round")}}u.appendChild(D)}function p(E){if(e[E]==null){e[E]=document.createElementNS("http://www.w3.org/2000/svg","path");if(B==0){e[E].setAttribute("shape-rendering","crispEdges")}return e[E]}return e[E]}function v(E){if(o[E]==null){o[E]=document.createElementNS("http://www.w3.org/2000/svg","circle");if(B==0){o[E].setAttribute("shape-rendering","crispEdges")}return o[E]}return o[E]}};THREE.WebGLRenderer=function(){var j=document.createElement("canvas"),c,e,m=new THREE.Matrix4(),i;this.domElement=j;this.autoClear=true;g();f();var a=0,k=1,h=2,d=3;this.setSize=function(o,n){j.width=o;j.height=n;c.viewport(0,0,j.width,j.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(t){var r,s,n,q,p,o;c.uniform1i(e.enableLighting,t.lights.length);for(r=0,s=t.lights.length;r>24&255)/255;this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgba("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+","+this.a+")"},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", a: "+this.a+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(b,a){this.x=b.x+a.x;this.y=b.y+a.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(b,a){this.x=b.x-a.x;this.y=b.y-a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,b){this.x=a||0;this.y=c||0;this.z=b||0};THREE.Vector3.prototype={set:function(a,c,b){this.x=a;this.y=c;this.z=b;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(b,a){this.x=b.x+a.x;this.y=b.y+a.y;this.z=b.z+a.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(b,a){this.x=b.x-a.x;this.y=b.y-a.y;this.z=b.z-a.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},cross:function(b,a){this.x=b.y*a.z-b.z*a.y;this.y=b.z*a.x-b.x*a.z;this.z=b.x*a.y-b.y*a.x;return this},crossSelf:function(c){var b=this.x,a=this.y,d=this.z;this.x=a*c.z-d*c.y;this.y=d*c.x-b*c.z;this.z=b*c.y-a*c.x;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(d){var c=this.x-d.x,b=this.y-d.y,a=this.z-d.z;return c*c+b*b+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){if(this.length()>0){this.multiplyScalar(1/this.length())}else{this.multiplyScalar(0)}return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){var a=0.0001;return(Math.abs(this.x)=0&&Math.min(g,i.getY2())-Math.max(h,i.getY1())>=0};this.empty=function(){e=true;f=0;h=0;d=0;g=0;b()};this.isEmpty=function(){return e};this.toString=function(){return"THREE.Rectangle (x1: "+f+", y1: "+g+", x2: "+d+", y1: "+h+", width: "+a+", height: "+c+")"}};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.n12=0;this.n13=0;this.n14=0;this.n21=0;this.n22=1;this.n23=0;this.n24=0;this.n31=0;this.n32=0;this.n33=1;this.n34=0;this.n41=0;this.n42=0;this.n43=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(d,c,b){var a=this._x,f=this._y,e=this._z;e.sub(d,c);e.normalize();a.cross(b,e);a.normalize();f.cross(e,a);f.normalize();this.n11=a.x;this.n12=a.y;this.n13=a.z;this.n14=-a.dot(d);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(d);this.n31=e.x;this.n32=e.y;this.n33=e.z;this.n34=-e.dot(d);this.n41=0;this.n42=0;this.n43=0;this.n44=1},transform:function(a){var d=a.x,c=a.y,b=a.z,e=a.w?a.w:1;a.x=this.n11*d+this.n12*c+this.n13*b+this.n14*e;a.y=this.n21*d+this.n22*c+this.n23*b+this.n24*e;a.z=this.n31*d+this.n32*c+this.n33*b+this.n34*e;e=this.n41*d+this.n42*c+this.n43*b+this.n44*e;if(a.w){a.w=e}else{a.x=a.x/e;a.y=a.y/e;a.z=a.z/e}return a},crossVector:function(b){var c=new THREE.Vector4();c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=(b.w)?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(d,c){this.n11=d.n11*c.n11+d.n12*c.n21+d.n13*c.n31+d.n14*c.n41;this.n12=d.n11*c.n12+d.n12*c.n22+d.n13*c.n32+d.n14*c.n42;this.n13=d.n11*c.n13+d.n12*c.n23+d.n13*c.n33+d.n14*c.n43;this.n14=d.n11*c.n14+d.n12*c.n24+d.n13*c.n34+d.n14*c.n44;this.n21=d.n21*c.n11+d.n22*c.n21+d.n23*c.n31+d.n24*c.n41;this.n22=d.n21*c.n12+d.n22*c.n22+d.n23*c.n32+d.n24*c.n42;this.n23=d.n21*c.n13+d.n22*c.n23+d.n23*c.n33+d.n24*c.n43;this.n24=d.n21*c.n14+d.n22*c.n24+d.n23*c.n34+d.n24*c.n44;this.n31=d.n31*c.n11+d.n32*c.n21+d.n33*c.n31+d.n34*c.n41;this.n32=d.n31*c.n12+d.n32*c.n22+d.n33*c.n32+d.n34*c.n42;this.n33=d.n31*c.n13+d.n32*c.n23+d.n33*c.n33+d.n34*c.n43;this.n34=d.n31*c.n14+d.n32*c.n24+d.n33*c.n34+d.n34*c.n44;this.n41=d.n41*c.n11+d.n42*c.n21+d.n43*c.n31+d.n44*c.n41;this.n42=d.n41*c.n12+d.n42*c.n22+d.n43*c.n32+d.n44*c.n42;this.n43=d.n41*c.n13+d.n42*c.n23+d.n43*c.n33+d.n44*c.n43;this.n44=d.n41*c.n14+d.n42*c.n24+d.n43*c.n34+d.n44*c.n44},multiplySelf:function(c){var p=this.n11,o=this.n12,k=this.n13,i=this.n14,f=this.n21,e=this.n22,d=this.n23,b=this.n24,a=this.n31,s=this.n32,r=this.n33,q=this.n34,n=this.n41,j=this.n42,h=this.n43,g=this.n44;this.n11=p*c.n11+o*c.n21+k*c.n31+i*c.n41;this.n12=p*c.n12+o*c.n22+k*c.n32+i*c.n42;this.n13=p*c.n13+o*c.n23+k*c.n33+i*c.n43;this.n14=p*c.n14+o*c.n24+k*c.n34+i*c.n44;this.n21=f*c.n11+e*c.n21+d*c.n31+b*c.n41;this.n22=f*c.n12+e*c.n22+d*c.n32+b*c.n42;this.n23=f*c.n13+e*c.n23+d*c.n33+b*c.n43;this.n24=f*c.n14+e*c.n24+d*c.n34+b*c.n44;this.n31=a*c.n11+s*c.n21+r*c.n31+q*c.n41;this.n32=a*c.n12+s*c.n22+r*c.n32+q*c.n42;this.n33=a*c.n13+s*c.n23+r*c.n33+q*c.n43;this.n34=a*c.n14+s*c.n24+r*c.n34+q*c.n44;this.n41=n*c.n11+j*c.n21+h*c.n31+g*c.n41;this.n42=n*c.n12+j*c.n22+h*c.n32+g*c.n42;this.n43=n*c.n13+j*c.n23+h*c.n33+g*c.n43;this.n44=n*c.n14+j*c.n24+h*c.n34+g*c.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(d,e,c){var b=d[e];d[e]=d[c];d[c]=b}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(b,d,c){var a=new THREE.Matrix4();a.n14=b;a.n24=d;a.n34=c;return a};THREE.Matrix4.scaleMatrix=function(b,d,c){var a=new THREE.Matrix4();a.n11=b;a.n22=d;a.n33=c;return a};THREE.Matrix4.rotationXMatrix=function(b){var a=new THREE.Matrix4();a.n22=a.n33=Math.cos(b);a.n32=Math.sin(b);a.n23=-a.n32;return a};THREE.Matrix4.rotationYMatrix=function(b){var a=new THREE.Matrix4();a.n11=a.n33=Math.cos(b);a.n13=Math.sin(b);a.n31=-a.n13;return a};THREE.Matrix4.rotationZMatrix=function(b){var a=new THREE.Matrix4();a.n11=a.n22=Math.cos(b);a.n21=Math.sin(b);a.n12=-a.n21;return a};THREE.Matrix4.rotationAxisAngleMatrix=function(b,d){var a=new THREE.Matrix4(),f=Math.cos(d),j=Math.sin(d),i=1-f,h=b.x,g=b.y,e=b.z;a.n11=i*h*h+f;a.n12=i*h*g-j*e;a.n13=i*h*e+j*g;a.n21=i*h*g+j*e;a.n22=i*g*g+f;a.n23=i*g*e-j*h;a.n31=i*h*e-j*g;a.n32=i*g*e+j*h;a.n33=i*e*e+f;return a};THREE.Matrix4.makeInvert=function(b){var a=new THREE.Matrix4();a.n11=b.n23*b.n34*b.n42-b.n24*b.n33*b.n42+b.n24*b.n32*b.n43-b.n22*b.n34*b.n43-b.n23*b.n32*b.n44+b.n22*b.n33*b.n44;a.n12=b.n14*b.n33*b.n42-b.n13*b.n34*b.n42-b.n14*b.n32*b.n43+b.n12*b.n34*b.n43+b.n13*b.n32*b.n44-b.n12*b.n33*b.n44;a.n13=b.n13*b.n24*b.n42-b.n14*b.n23*b.n42+b.n14*b.n22*b.n43-b.n12*b.n24*b.n43-b.n13*b.n22*b.n44+b.n12*b.n23*b.n44;a.n14=b.n14*b.n23*b.n32-b.n13*b.n24*b.n32-b.n14*b.n22*b.n33+b.n12*b.n24*b.n33+b.n13*b.n22*b.n34-b.n12*b.n23*b.n34;a.n21=b.n24*b.n33*b.n41-b.n23*b.n34*b.n41-b.n24*b.n31*b.n43+b.n21*b.n34*b.n43+b.n23*b.n31*b.n44-b.n21*b.n33*b.n44;a.n22=b.n13*b.n34*b.n41-b.n14*b.n33*b.n41+b.n14*b.n31*b.n43-b.n11*b.n34*b.n43-b.n13*b.n31*b.n44+b.n11*b.n33*b.n44;a.n23=b.n14*b.n23*b.n41-b.n13*b.n24*b.n41-b.n14*b.n21*b.n43+b.n11*b.n24*b.n43+b.n13*b.n21*b.n44-b.n11*b.n23*b.n44;a.n24=b.n13*b.n24*b.n31-b.n14*b.n23*b.n31+b.n14*b.n21*b.n33-b.n11*b.n24*b.n33-b.n13*b.n21*b.n34+b.n11*b.n23*b.n34;a.n31=b.n22*b.n34*b.n41-b.n24*b.n32*b.n41+b.n24*b.n31*b.n42-b.n21*b.n34*b.n42-b.n22*b.n31*b.n44+b.n21*b.n32*b.n44;a.n32=b.n14*b.n32*b.n41-b.n12*b.n34*b.n41-b.n14*b.n31*b.n42+b.n11*b.n34*b.n42+b.n12*b.n31*b.n44-b.n11*b.n32*b.n44;a.n33=b.n13*b.n24*b.n41-b.n14*b.n22*b.n41+b.n14*b.n21*b.n42-b.n11*b.n24*b.n42-b.n12*b.n21*b.n44+b.n11*b.n22*b.n44;a.n34=b.n14*b.n22*b.n31-b.n12*b.n24*b.n31-b.n14*b.n21*b.n32+b.n11*b.n24*b.n32+b.n12*b.n21*b.n34-b.n11*b.n22*b.n34;a.n41=b.n23*b.n32*b.n41-b.n22*b.n33*b.n41-b.n23*b.n31*b.n42+b.n21*b.n33*b.n42+b.n22*b.n31*b.n43-b.n21*b.n32*b.n43;a.n42=b.n12*b.n33*b.n41-b.n13*b.n32*b.n41+b.n13*b.n31*b.n42-b.n11*b.n33*b.n42-b.n12*b.n31*b.n43+b.n11*b.n32*b.n43;a.n43=b.n13*b.n22*b.n41-b.n12*b.n23*b.n41-b.n13*b.n21*b.n42+b.n11*b.n23*b.n42+b.n12*b.n21*b.n43-b.n11*b.n22*b.n43;a.n44=b.n12*b.n23*b.n31-b.n13*b.n22*b.n31+b.n13*b.n21*b.n32-b.n11*b.n23*b.n32-b.n12*b.n21*b.n33+b.n11*b.n22*b.n33;a.multiplyScalar(1/b.determinant());return a};THREE.Matrix4.makeInvert3x3=function(p){var n=new THREE.Matrix3();var e=p.flatten();var o=e[10]*e[5]-e[6]*e[9],i=-e[10]*e[1]+e[2]*e[9],d=e[6]*e[1]-e[2]*e[5],k=-e[10]*e[4]+e[6]*e[8],g=e[10]*e[0]-e[2]*e[8],c=-e[6]*e[0]+e[2]*e[4],j=e[9]*e[4]-e[5]*e[8],f=-e[9]*e[0]+e[1]*e[8],a=e[5]*e[0]-e[1]*e[4];var h=e[0]*(o)+e[1]*(k)+e[2]*(j);if(h==0){throw"matrix not invertible"}var b=1/h;n.m[0]=b*o;n.m[1]=b*i;n.m[2]=b*d;n.m[3]=b*k;n.m[4]=b*g;n.m[5]=b*c;n.m[6]=b*j;n.m[7]=b*f;n.m[8]=b*a;return n};THREE.Matrix4.makeFrustum=function(f,s,e,p,i,h){var g,r,o,q,n,k,j;g=new THREE.Matrix4();r=2*i/(s-f);o=2*i/(p-e);q=(s+f)/(s-f);n=(p+e)/(p-e);k=-(h+i)/(h-i);j=-2*h*i/(h-i);g.n11=r;g.n12=0;g.n13=q;g.n14=0;g.n21=0;g.n22=o;g.n23=n;g.n24=0;g.n31=0;g.n32=0;g.n33=k;g.n34=j;g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(e,c,g,b){var a,f,h,d;a=g*Math.tan(e*Math.PI/360);f=-a;h=f*c;d=a*c;return THREE.Matrix4.makeFrustum(h,d,f,a,g,b)};THREE.Matrix4.makeOrtho=function(c,q,k,a,g,f){var d,n,j,i,o,e,b;d=new THREE.Matrix4();o=q-c;e=a-k;b=f-g;n=(q+c)/o;j=(a+k)/e;i=(f+g)/b;d.n11=2/o;d.n12=0;d.n13=0;d.n14=-n;d.n21=0;d.n22=2/e;d.n23=0;d.n24=-j;d.n31=0;d.n32=0;d.n33=-2/b;d.n34=-i;d.n41=0;d.n42=0;d.n43=0;d.n44=1;return d};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.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(e,d,i,h,f,g){this.a=e;this.b=d;this.c=i;this.centroid=new THREE.Vector3();this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3();this.color=f||new THREE.Color(4278190080);this.vertexNormals=h instanceof Array?h:[];this.material=g||0};THREE.Face3.prototype={getCenter:function(){return this.a.clone().addSelf(this.b).addSelf(this.c).divideScalar(3)},toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};THREE.Face4=function(f,e,k,j,i,g,h){this.a=f;this.b=e;this.c=k;this.d=j;this.centroid=new THREE.Vector3();this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3();this.color=g||new THREE.Color(4278190080);this.vertexNormals=i instanceof Array?i:[];this.material=h||0};THREE.Face4.prototype={getCenter:function(){return this.a.clone().addSelf(this.b).addSelf(this.c).addSelf(this.d).divideScalar(4)},toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(b,a){this.u=b||0;this.v=a||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 c,b,a;for(c=0,b=this.faces.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]};var a,b;for(a=1,b=this.vertices.length;athis.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(c,b,d,a){this.fov=c;this.aspect=b;this.position=new THREE.Vector3(0,0,0);this.target={position:new THREE.Vector3(0,0,0)};this.projectionMatrix=THREE.Matrix4.makePerspective(c,b,d,a);this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4();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.Light=function(a){this.color=new THREE.Color(255<<24|a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light();THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,a){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=a||1};THREE.DirectionalLight.prototype=new THREE.Light();THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,a){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=a||1};THREE.DirectionalLight.prototype=new THREE.Light();THREE.DirectionalLight.prototype.constructor=THREE.PointLight;THREE.Object3D=function(a){this.position=new THREE.Vector3();this.rotation=new THREE.Vector3();this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4();this.matrixTranslation=new THREE.Matrix4();this.matrixRotation=new THREE.Matrix4();this.matrixScale=new THREE.Matrix4();this.screen=new THREE.Vector3();this.autoUpdateMatrix=true;this.updateMatrix=function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);this.matrixRotation=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.matrixRotation.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.matrixRotation.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.matrixScale=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.matrixRotation);this.matrix.multiplySelf(this.matrixScale)}};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D();THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(b,a){THREE.Object3D.call(this);this.geometry=b;this.material=a instanceof Array?a:[a]};THREE.Line.prototype=new THREE.Object3D();THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(b,a,c){THREE.Object3D.call(this);this.geometry=b;this.material=a instanceof Array?a:[a];this.flipSided=false;this.doubleSided=false;this.overdraw=false;this.materialFaces={};this.sortFacesByMaterial();if(c){this.normalizeUVs()}this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D();THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.sortFacesByMaterial=function(){var d,c,b,a;for(d=0,c=this.geometry.faces.length;d=0?(b*255)<<24:4278190080)|c)};THREE.LineColorMaterial.prototype={toString:function(){return"THREE.LineColorMaterial ( color: "+this.color+", lineWidth: "+this.lineWidth+" )"}};THREE.MeshPhongMaterial=function(d,a,e,c,b){this.ambient=new THREE.Color((b>=0?(b*255)<<24:4278190080)|d);this.diffuse=new THREE.Color((b>=0?(b*255)<<24:4278190080)|a);this.specular=new THREE.Color((b>=0?(b*255)<<24:4278190080)|e);this.shininess=c;this.opacity=b;this.toString=function(){return"THREE.MeshPhongMaterial (
ambient: "+this.ambient+",
diffuse: "+this.diffuse+",
specular: "+this.specular+",
shininess: "+this.shininess+",
opacity: "+this.opacity+")"}};THREE.MeshBitmapUVMappingMaterial=function(a){this.bitmap=a;this.loaded=0;this.decalIndex=-1;this.toString=function(){return"THREE.MeshBitmapUVMappingMaterial ( bitmap: "+this.bitmap+" )"}};THREE.MeshColorFillMaterial=function(b,a){this.color=new THREE.Color((a>=0?(a*255)<<24:4278190080)|b);this.toString=function(){return"THREE.MeshColorFillMaterial ( color: "+this.color+" )"}};THREE.MeshColorStrokeMaterial=function(c,b,a){this.lineWidth=a||1;this.color=new THREE.Color((b>=0?(b*255)<<24:4278190080)|c);this.toString=function(){return"THREE.MeshColorStrokeMaterial ( lineWidth: "+this.lineWidth+", color: "+this.color+" )"}};THREE.MeshFaceColorFillMaterial=function(){this.toString=function(){return"THREE.MeshFaceColorFillMaterial ( )"}};THREE.MeshFaceColorStrokeMaterial=function(a){this.lineWidth=a||1;this.toString=function(){return"THREE.MeshFaceColorStrokeMaterial ( lineWidth: "+this.lineWidth+" )"}};THREE.ParticleBitmapMaterial=function(a){this.bitmap=a;this.offset=new THREE.Vector2();this.toString=function(){return"THREE.ParticleBitmapMaterial ( bitmap: "+this.bitmap+" )"}};THREE.ParticleCircleMaterial=function(b,a){this.color=new THREE.Color((a>=0?(a*255)<<24:4278190080)|b);this.toString=function(){return"THREE.ParticleCircleMaterial ( color: "+this.color+" )"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Scene=function(){this.objects=[];this.lights=[];this.addObject=function(a){this.objects.push(a)};this.removeObject=function(b){for(var c=0,a=this.objects.length;c0&&w.z<1}x=M.geometry.faces;for(J=0,C=x.length;J0&&w.z<1;if(E>0){D=M.geometry.vertices[E-1];if(I.__visible&&D.__visible){k=i[n]=i[n]||new THREE.RenderableLine();k.v1.copy(I.positionScreen);k.v2.copy(D.positionScreen);k.z=Math.max(I.positionScreen.z,D.positionScreen.z);k.material=M.material;e.push(k);n++}}}}else{if(M instanceof THREE.Particle){g.set(M.position.x,M.position.y,M.position.z,1);H.matrix.transform(g);H.projectionMatrix.transform(g);M.screen.set(g.x/g.w,g.y/g.w,g.z/g.w);if(M.screen.z>0&&M.screen.z<1){j=a[h]=a[h]||new THREE.RenderableParticle();j.x=M.screen.x;j.y=M.screen.y;j.z=M.screen.z;j.rotation=M.rotation.z;j.scale.x=M.scale.x*Math.abs(g.x/g.w-(g.x+H.projectionMatrix.n11)/(g.w+H.projectionMatrix.n14));j.scale.y=M.scale.y*Math.abs(g.y/g.w-(g.y+H.projectionMatrix.n22)/(g.w+H.projectionMatrix.n24));j.material=M.material;j.color=M.color;e.push(j);h++}}}}}e.sort(function(N,v){return v.z-N.z});return e}};THREE.DOMRenderer=function(){THREE.Renderer.call(this);var e=null,g=new THREE.Projector(),b=document.createElement("div"),a,c,f,d;this.domElement=b;this.setSize=function(i,h){a=i;c=h;f=a/2;d=c/2};this.render=function(q,s){var r,h,i,o,p,t,n,k,j;e=g.projectScene(q,s);for(r=0,h=e.length;r0;if(i){y(ad,f)}for(ac=0,G=x.length;ac0){F.r+=D.color.r*G;F.g+=D.color.g*G;F.b+=D.color.b*G}}else{if(D instanceof THREE.PointLight){g.sub(D.position,H.centroidWorld);g.normalize();G=H.normalWorld.dot(g)*D.intensity;if(G>0){F.r+=D.color.r*G;F.g+=D.color.g*G;F.b+=D.color.b*G}}}}}function s(W,L,K,R,Q,F,D,T,S,H,G,P,O){var E,V,U,J,I,N,M;p.beginPath();p.moveTo(L,K);p.lineTo(R,Q);p.lineTo(F,D);p.lineTo(L,K);p.closePath();p.save();p.clip();E=T*(O-G)-H*O+P*G+(H-P)*S;V=-(S*(F-R)-G*F+O*R+(G-O)*L)/E;U=(G*D+S*(Q-D)-O*Q+(O-G)*K)/E;J=(T*(F-R)-H*F+P*R+(H-P)*L)/E;I=-(H*D+T*(Q-D)-P*Q+(P-H)*K)/E;N=(T*(O*R-G*F)+S*(H*F-P*R)+(P*G-H*O)*L)/E;M=(T*(O*Q-G*D)+S*(H*D-P*Q)+(P*G-H*O)*K)/E;p.transform(V,U,J,I,N,M);p.drawImage(W,0,0);p.restore()}function c(E,D){h.sub(D,E);h.unit();h.multiplyScalar(0.75);D.addSelf(h);E.subSelf(h)}};THREE.SVGRenderer=function(){var r=null,m=new THREE.Projector(),n=document.createElementNS("http://www.w3.org/2000/svg","svg"),g,v,k,b,t=new THREE.Rectangle(),q=new THREE.Rectangle(),f=false,h=new THREE.Color(4294967295),p=new THREE.Color(4294967295),c=new THREE.Color(4294967295),e=new THREE.Vector3(),d=[],i=[],u=1;this.domElement=n;this.autoClear=true;this.setQuality=function(w){switch(w){case"high":u=1;break;case"low":u=0;break}};this.setSize=function(x,w){g=x;v=w;k=g/2;b=v/2;n.setAttribute("viewBox",(-k)+" "+(-b)+" "+g+" "+v);n.setAttribute("width",g);n.setAttribute("height",v);t.set(-k,-b,k,b)};this.clear=function(){while(n.childNodes.length>0){n.removeChild(n.childNodes[0])}};this.render=function(P,M){var O,y,J,N,z,F,I=0,A=0,G,D,B,L,K,x,w,E,C,H;if(this.autoClear){this.clear()}r=m.projectScene(P,M);f=P.lights.length>0;if(f){s(P,c)}for(O=0,y=r.length;O0){y.r+=w.color.r*z;y.g+=w.color.g*z;y.b+=w.color.b*z}}else{if(w instanceof THREE.PointLight){e.sub(w.position,A.centroidWorld);e.normalize();z=A.normalWorld.dot(e)*w.intensity;if(z>0){y.r+=w.color.r*z;y.g+=w.color.g*z;y.b+=w.color.b*z}}}}}function j(w){if(d[w]==null){d[w]=document.createElementNS("http://www.w3.org/2000/svg","path");if(u==0){d[w].setAttribute("shape-rendering","crispEdges")}return d[w]}return d[w]}function o(w){if(i[w]==null){i[w]=document.createElementNS("http://www.w3.org/2000/svg","circle");if(u==0){i[w].setAttribute("shape-rendering","crispEdges")}return i[w]}return i[w]}};THREE.WebGLRenderer=function(){var m=document.createElement("canvas"),c,e,o=new THREE.Matrix4(),k;this.domElement=m;this.autoClear=true;h();g();var a=0,n=1,f=2,j=3,i=4,d=5;this.setSize=function(q,p){m.width=q;m.height=p;c.viewport(0,0,m.width,m.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(v){var t,u,p,s,r,q;c.uniform1i(e.enableLighting,v.lights.length);for(t=0,u=v.lights.length;t>24&255)/255;this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgba("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+","+this.a+")"},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", a: "+this.a+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(b,a){this.x=b.x+a.x;this.y=b.y+a.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(b,a){this.x=b.x-a.x;this.y=b.y-a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,b){this.x=a||0;this.y=c||0;this.z=b||0};THREE.Vector3.prototype={set:function(a,c,b){this.x=a;this.y=c;this.z=b;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(b,a){this.x=b.x+a.x;this.y=b.y+a.y;this.z=b.z+a.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(b,a){this.x=b.x-a.x;this.y=b.y-a.y;this.z=b.z-a.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},cross:function(b,a){this.x=b.y*a.z-b.z*a.y;this.y=b.z*a.x-b.x*a.z;this.z=b.x*a.y-b.y*a.x;return this},crossSelf:function(c){var b=this.x,a=this.y,d=this.z;this.x=a*c.z-d*c.y;this.y=d*c.x-b*c.z;this.z=b*c.y-a*c.x;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(d){var c=this.x-d.x,b=this.y-d.y,a=this.z-d.z;return c*c+b*b+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){if(this.length()>0){this.multiplyScalar(1/this.length())}else{this.multiplyScalar(0)}return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){var a=0.0001;return(Math.abs(this.x)=0&&Math.min(g,i.getY2())-Math.max(h,i.getY1())>=0};this.empty=function(){e=true;f=0;h=0;d=0;g=0;b()};this.isEmpty=function(){return e};this.toString=function(){return"THREE.Rectangle (x1: "+f+", y1: "+g+", x2: "+d+", y1: "+h+", width: "+a+", height: "+c+")"}};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.n12=0;this.n13=0;this.n14=0;this.n21=0;this.n22=1;this.n23=0;this.n24=0;this.n31=0;this.n32=0;this.n33=1;this.n34=0;this.n41=0;this.n42=0;this.n43=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(d,c,b){var a=this._x,f=this._y,e=this._z;e.sub(d,c);e.normalize();a.cross(b,e);a.normalize();f.cross(e,a);f.normalize();this.n11=a.x;this.n12=a.y;this.n13=a.z;this.n14=-a.dot(d);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(d);this.n31=e.x;this.n32=e.y;this.n33=e.z;this.n34=-e.dot(d);this.n41=0;this.n42=0;this.n43=0;this.n44=1},transform:function(a){var d=a.x,c=a.y,b=a.z,e=a.w?a.w:1;a.x=this.n11*d+this.n12*c+this.n13*b+this.n14*e;a.y=this.n21*d+this.n22*c+this.n23*b+this.n24*e;a.z=this.n31*d+this.n32*c+this.n33*b+this.n34*e;e=this.n41*d+this.n42*c+this.n43*b+this.n44*e;if(a.w){a.w=e}else{a.x=a.x/e;a.y=a.y/e;a.z=a.z/e}return a},crossVector:function(b){var c=new THREE.Vector4();c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=(b.w)?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(d,c){this.n11=d.n11*c.n11+d.n12*c.n21+d.n13*c.n31+d.n14*c.n41;this.n12=d.n11*c.n12+d.n12*c.n22+d.n13*c.n32+d.n14*c.n42;this.n13=d.n11*c.n13+d.n12*c.n23+d.n13*c.n33+d.n14*c.n43;this.n14=d.n11*c.n14+d.n12*c.n24+d.n13*c.n34+d.n14*c.n44;this.n21=d.n21*c.n11+d.n22*c.n21+d.n23*c.n31+d.n24*c.n41;this.n22=d.n21*c.n12+d.n22*c.n22+d.n23*c.n32+d.n24*c.n42;this.n23=d.n21*c.n13+d.n22*c.n23+d.n23*c.n33+d.n24*c.n43;this.n24=d.n21*c.n14+d.n22*c.n24+d.n23*c.n34+d.n24*c.n44;this.n31=d.n31*c.n11+d.n32*c.n21+d.n33*c.n31+d.n34*c.n41;this.n32=d.n31*c.n12+d.n32*c.n22+d.n33*c.n32+d.n34*c.n42;this.n33=d.n31*c.n13+d.n32*c.n23+d.n33*c.n33+d.n34*c.n43;this.n34=d.n31*c.n14+d.n32*c.n24+d.n33*c.n34+d.n34*c.n44;this.n41=d.n41*c.n11+d.n42*c.n21+d.n43*c.n31+d.n44*c.n41;this.n42=d.n41*c.n12+d.n42*c.n22+d.n43*c.n32+d.n44*c.n42;this.n43=d.n41*c.n13+d.n42*c.n23+d.n43*c.n33+d.n44*c.n43;this.n44=d.n41*c.n14+d.n42*c.n24+d.n43*c.n34+d.n44*c.n44},multiplySelf:function(c){var p=this.n11,o=this.n12,k=this.n13,i=this.n14,f=this.n21,e=this.n22,d=this.n23,b=this.n24,a=this.n31,s=this.n32,r=this.n33,q=this.n34,n=this.n41,j=this.n42,h=this.n43,g=this.n44;this.n11=p*c.n11+o*c.n21+k*c.n31+i*c.n41;this.n12=p*c.n12+o*c.n22+k*c.n32+i*c.n42;this.n13=p*c.n13+o*c.n23+k*c.n33+i*c.n43;this.n14=p*c.n14+o*c.n24+k*c.n34+i*c.n44;this.n21=f*c.n11+e*c.n21+d*c.n31+b*c.n41;this.n22=f*c.n12+e*c.n22+d*c.n32+b*c.n42;this.n23=f*c.n13+e*c.n23+d*c.n33+b*c.n43;this.n24=f*c.n14+e*c.n24+d*c.n34+b*c.n44;this.n31=a*c.n11+s*c.n21+r*c.n31+q*c.n41;this.n32=a*c.n12+s*c.n22+r*c.n32+q*c.n42;this.n33=a*c.n13+s*c.n23+r*c.n33+q*c.n43;this.n34=a*c.n14+s*c.n24+r*c.n34+q*c.n44;this.n41=n*c.n11+j*c.n21+h*c.n31+g*c.n41;this.n42=n*c.n12+j*c.n22+h*c.n32+g*c.n42;this.n43=n*c.n13+j*c.n23+h*c.n33+g*c.n43;this.n44=n*c.n14+j*c.n24+h*c.n34+g*c.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(d,e,c){var b=d[e];d[e]=d[c];d[c]=b}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(b,d,c){var a=new THREE.Matrix4();a.n14=b;a.n24=d;a.n34=c;return a};THREE.Matrix4.scaleMatrix=function(b,d,c){var a=new THREE.Matrix4();a.n11=b;a.n22=d;a.n33=c;return a};THREE.Matrix4.rotationXMatrix=function(b){var a=new THREE.Matrix4();a.n22=a.n33=Math.cos(b);a.n32=Math.sin(b);a.n23=-a.n32;return a};THREE.Matrix4.rotationYMatrix=function(b){var a=new THREE.Matrix4();a.n11=a.n33=Math.cos(b);a.n13=Math.sin(b);a.n31=-a.n13;return a};THREE.Matrix4.rotationZMatrix=function(b){var a=new THREE.Matrix4();a.n11=a.n22=Math.cos(b);a.n21=Math.sin(b);a.n12=-a.n21;return a};THREE.Matrix4.rotationAxisAngleMatrix=function(b,d){var a=new THREE.Matrix4(),f=Math.cos(d),j=Math.sin(d),i=1-f,h=b.x,g=b.y,e=b.z;a.n11=i*h*h+f;a.n12=i*h*g-j*e;a.n13=i*h*e+j*g;a.n21=i*h*g+j*e;a.n22=i*g*g+f;a.n23=i*g*e-j*h;a.n31=i*h*e-j*g;a.n32=i*g*e+j*h;a.n33=i*e*e+f;return a};THREE.Matrix4.makeInvert=function(b){var a=new THREE.Matrix4();a.n11=b.n23*b.n34*b.n42-b.n24*b.n33*b.n42+b.n24*b.n32*b.n43-b.n22*b.n34*b.n43-b.n23*b.n32*b.n44+b.n22*b.n33*b.n44;a.n12=b.n14*b.n33*b.n42-b.n13*b.n34*b.n42-b.n14*b.n32*b.n43+b.n12*b.n34*b.n43+b.n13*b.n32*b.n44-b.n12*b.n33*b.n44;a.n13=b.n13*b.n24*b.n42-b.n14*b.n23*b.n42+b.n14*b.n22*b.n43-b.n12*b.n24*b.n43-b.n13*b.n22*b.n44+b.n12*b.n23*b.n44;a.n14=b.n14*b.n23*b.n32-b.n13*b.n24*b.n32-b.n14*b.n22*b.n33+b.n12*b.n24*b.n33+b.n13*b.n22*b.n34-b.n12*b.n23*b.n34;a.n21=b.n24*b.n33*b.n41-b.n23*b.n34*b.n41-b.n24*b.n31*b.n43+b.n21*b.n34*b.n43+b.n23*b.n31*b.n44-b.n21*b.n33*b.n44;a.n22=b.n13*b.n34*b.n41-b.n14*b.n33*b.n41+b.n14*b.n31*b.n43-b.n11*b.n34*b.n43-b.n13*b.n31*b.n44+b.n11*b.n33*b.n44;a.n23=b.n14*b.n23*b.n41-b.n13*b.n24*b.n41-b.n14*b.n21*b.n43+b.n11*b.n24*b.n43+b.n13*b.n21*b.n44-b.n11*b.n23*b.n44;a.n24=b.n13*b.n24*b.n31-b.n14*b.n23*b.n31+b.n14*b.n21*b.n33-b.n11*b.n24*b.n33-b.n13*b.n21*b.n34+b.n11*b.n23*b.n34;a.n31=b.n22*b.n34*b.n41-b.n24*b.n32*b.n41+b.n24*b.n31*b.n42-b.n21*b.n34*b.n42-b.n22*b.n31*b.n44+b.n21*b.n32*b.n44;a.n32=b.n14*b.n32*b.n41-b.n12*b.n34*b.n41-b.n14*b.n31*b.n42+b.n11*b.n34*b.n42+b.n12*b.n31*b.n44-b.n11*b.n32*b.n44;a.n33=b.n13*b.n24*b.n41-b.n14*b.n22*b.n41+b.n14*b.n21*b.n42-b.n11*b.n24*b.n42-b.n12*b.n21*b.n44+b.n11*b.n22*b.n44;a.n34=b.n14*b.n22*b.n31-b.n12*b.n24*b.n31-b.n14*b.n21*b.n32+b.n11*b.n24*b.n32+b.n12*b.n21*b.n34-b.n11*b.n22*b.n34;a.n41=b.n23*b.n32*b.n41-b.n22*b.n33*b.n41-b.n23*b.n31*b.n42+b.n21*b.n33*b.n42+b.n22*b.n31*b.n43-b.n21*b.n32*b.n43;a.n42=b.n12*b.n33*b.n41-b.n13*b.n32*b.n41+b.n13*b.n31*b.n42-b.n11*b.n33*b.n42-b.n12*b.n31*b.n43+b.n11*b.n32*b.n43;a.n43=b.n13*b.n22*b.n41-b.n12*b.n23*b.n41-b.n13*b.n21*b.n42+b.n11*b.n23*b.n42+b.n12*b.n21*b.n43-b.n11*b.n22*b.n43;a.n44=b.n12*b.n23*b.n31-b.n13*b.n22*b.n31+b.n13*b.n21*b.n32-b.n11*b.n23*b.n32-b.n12*b.n21*b.n33+b.n11*b.n22*b.n33;a.multiplyScalar(1/b.determinant());return a};THREE.Matrix4.makeInvert3x3=function(p){var n=new THREE.Matrix3();var e=p.flatten();var o=e[10]*e[5]-e[6]*e[9],i=-e[10]*e[1]+e[2]*e[9],d=e[6]*e[1]-e[2]*e[5],k=-e[10]*e[4]+e[6]*e[8],g=e[10]*e[0]-e[2]*e[8],c=-e[6]*e[0]+e[2]*e[4],j=e[9]*e[4]-e[5]*e[8],f=-e[9]*e[0]+e[1]*e[8],a=e[5]*e[0]-e[1]*e[4];var h=e[0]*(o)+e[1]*(k)+e[2]*(j);if(h==0){throw"matrix not invertible"}var b=1/h;n.m[0]=b*o;n.m[1]=b*i;n.m[2]=b*d;n.m[3]=b*k;n.m[4]=b*g;n.m[5]=b*c;n.m[6]=b*j;n.m[7]=b*f;n.m[8]=b*a;return n};THREE.Matrix4.makeFrustum=function(f,s,e,p,i,h){var g,r,o,q,n,k,j;g=new THREE.Matrix4();r=2*i/(s-f);o=2*i/(p-e);q=(s+f)/(s-f);n=(p+e)/(p-e);k=-(h+i)/(h-i);j=-2*h*i/(h-i);g.n11=r;g.n12=0;g.n13=q;g.n14=0;g.n21=0;g.n22=o;g.n23=n;g.n24=0;g.n31=0;g.n32=0;g.n33=k;g.n34=j;g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(e,c,g,b){var a,f,h,d;a=g*Math.tan(e*Math.PI/360);f=-a;h=f*c;d=a*c;return THREE.Matrix4.makeFrustum(h,d,f,a,g,b)};THREE.Matrix4.makeOrtho=function(c,q,k,a,g,f){var d,n,j,i,o,e,b;d=new THREE.Matrix4();o=q-c;e=a-k;b=f-g;n=(q+c)/o;j=(a+k)/e;i=(f+g)/b;d.n11=2/o;d.n12=0;d.n13=0;d.n14=-n;d.n21=0;d.n22=2/e;d.n23=0;d.n24=-j;d.n31=0;d.n32=0;d.n33=-2/b;d.n34=-i;d.n41=0;d.n42=0;d.n43=0;d.n44=1;return d};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.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(e,d,h,g,f){this.a=e;this.b=d;this.c=h;this.centroid=new THREE.Vector3();this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3();this.vertexNormals=g instanceof Array?g:[];this.material=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};THREE.Face4=function(f,e,j,i,h,g){this.a=f;this.b=e;this.c=j;this.d=i;this.centroid=new THREE.Vector3();this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3();this.vertexNormals=h instanceof Array?h:[];this.material=g instanceof Array?g:[g]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(b,a){this.u=b||0;this.v=a||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 c,b,a;for(c=0,b=this.faces.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;athis.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(c,b,d,a){this.fov=c;this.aspect=b;this.position=new THREE.Vector3(0,0,0);this.target={position:new THREE.Vector3(0,0,0)};this.projectionMatrix=THREE.Matrix4.makePerspective(c,b,d,a);this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4();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.Light=function(a){this.color=new THREE.Color(255<<24|a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light();THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,a){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=a||1};THREE.DirectionalLight.prototype=new THREE.Light();THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,a){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=a||1};THREE.DirectionalLight.prototype=new THREE.Light();THREE.DirectionalLight.prototype.constructor=THREE.PointLight;THREE.Object3D=function(a){this.position=new THREE.Vector3();this.rotation=new THREE.Vector3();this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4();this.matrixTranslation=new THREE.Matrix4();this.matrixRotation=new THREE.Matrix4();this.matrixScale=new THREE.Matrix4();this.screen=new THREE.Vector3();this.autoUpdateMatrix=true;this.updateMatrix=function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);this.matrixRotation=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.matrixRotation.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.matrixRotation.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.matrixScale=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.matrixRotation);this.matrix.multiplySelf(this.matrixScale)}};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D();THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(b,a){THREE.Object3D.call(this);this.geometry=b;this.material=a instanceof Array?a:[a]};THREE.Line.prototype=new THREE.Object3D();THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(b,a,c){THREE.Object3D.call(this);this.geometry=b;this.material=a instanceof Array?a:[a];this.flipSided=false;this.doubleSided=false;this.overdraw=false;this.materialFaceGroup={};this.sortFacesByMaterial();if(c){this.normalizeUVs()}this.geometry.computeBoundingBox()};THREE.Mesh.prototype=new THREE.Object3D();THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.sortFacesByMaterial=function(){function b(j){var h,f,k=[];for(h=0,f=j.length;h=0?(b*255)<<24:4278190080)|c)};THREE.LineColorMaterial.prototype={toString:function(){return"THREE.LineColorMaterial ( color: "+this.color+", lineWidth: "+this.lineWidth+" )"}};THREE.MeshPhongMaterial=function(d,a,e,c,b){this.ambient=new THREE.Color((b>=0?(b*255)<<24:4278190080)|d);this.diffuse=new THREE.Color((b>=0?(b*255)<<24:4278190080)|a);this.specular=new THREE.Color((b>=0?(b*255)<<24:4278190080)|e);this.shininess=c;this.opacity=b;this.toString=function(){return"THREE.MeshPhongMaterial (
ambient: "+this.ambient+",
diffuse: "+this.diffuse+",
specular: "+this.specular+",
shininess: "+this.shininess+",
opacity: "+this.opacity+")"}};THREE.MeshBitmapMaterial=function(a,b){this.bitmap=a;this.mode=b||THREE.MeshBitmapMaterialMode.UVMAPPING;this.id=THREE.MeshBitmapMaterialCounter.value++;this.toString=function(){return"THREE.MeshBitmapMaterial ( bitmap: "+this.bitmap+", mode: "+this.mode+", id: "+this.id+" )"}};THREE.MeshBitmapMaterialCounter={value:0};THREE.MeshBitmapMaterialMode={UVMAPPING:0};THREE.MeshColorFillMaterial=function(b,a){this.color=new THREE.Color((a>=0?(a*255)<<24:4278190080)|b);this.toString=function(){return"THREE.MeshColorFillMaterial ( color: "+this.color+" )"}};THREE.MeshColorStrokeMaterial=function(c,b,a){this.lineWidth=a||1;this.color=new THREE.Color((b>=0?(b*255)<<24:4278190080)|c);this.toString=function(){return"THREE.MeshColorStrokeMaterial ( lineWidth: "+this.lineWidth+", color: "+this.color+" )"}};THREE.MeshFaceMaterial=function(){this.toString=function(){return"THREE.MeshFaceMaterial"}};THREE.ParticleBitmapMaterial=function(a){this.bitmap=a;this.offset=new THREE.Vector2();this.toString=function(){return"THREE.ParticleBitmapMaterial ( bitmap: "+this.bitmap+" )"}};THREE.ParticleCircleMaterial=function(b,a){this.color=new THREE.Color((a>=0?(a*255)<<24:4278190080)|b);this.toString=function(){return"THREE.ParticleCircleMaterial ( color: "+this.color+" )"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Scene=function(){this.objects=[];this.lights=[];this.addObject=function(a){this.objects.push(a)};this.removeObject=function(b){for(var c=0,a=this.objects.length;c0&&w.z<1}x=M.geometry.faces;for(J=0,C=x.length;J0&&w.z<1;if(E>0){D=M.geometry.vertices[E-1];if(I.__visible&&D.__visible){k=i[n]=i[n]||new THREE.RenderableLine();k.v1.copy(I.positionScreen);k.v2.copy(D.positionScreen);k.z=Math.max(I.positionScreen.z,D.positionScreen.z);k.material=M.material;e.push(k);n++}}}}else{if(M instanceof THREE.Particle){g.set(M.position.x,M.position.y,M.position.z,1);H.matrix.transform(g);H.projectionMatrix.transform(g);M.screen.set(g.x/g.w,g.y/g.w,g.z/g.w);if(M.screen.z>0&&M.screen.z<1){j=a[h]=a[h]||new THREE.RenderableParticle();j.x=M.screen.x;j.y=M.screen.y;j.z=M.screen.z;j.rotation=M.rotation.z;j.scale.x=M.scale.x*Math.abs(g.x/g.w-(g.x+H.projectionMatrix.n11)/(g.w+H.projectionMatrix.n14));j.scale.y=M.scale.y*Math.abs(g.y/g.w-(g.y+H.projectionMatrix.n22)/(g.w+H.projectionMatrix.n24));j.material=M.material;j.color=M.color;e.push(j);h++}}}}}e.sort(function(N,v){return v.z-N.z});return e}};THREE.DOMRenderer=function(){THREE.Renderer.call(this);var e=null,g=new THREE.Projector(),b=document.createElement("div"),a,c,f,d;this.domElement=b;this.setSize=function(i,h){a=i;c=h;f=a/2;d=c/2};this.render=function(q,s){var r,h,i,o,p,t,n,k,j;e=g.projectScene(q,s);for(r=0,h=e.length;r0;if(m){B(aj,g)}for(ai=0,L=A.length;ai0){K.r+=I.color.r*L;K.g+=I.color.g*L;K.b+=I.color.b*L}}else{if(I instanceof THREE.PointLight){i.sub(I.position,M.centroidWorld);i.normalize();L=M.normalWorld.dot(i)*I.intensity;if(L>0){K.r+=I.color.r*L;K.g+=I.color.g*L;K.b+=I.color.b*L}}}}}function n(I,M,J,K,L){if(K instanceof THREE.ParticleCircleMaterial){if(m){x.copyRGB(g);u(L,J,x);p.copyRGBA(K.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=K.color}width=J.scale.x*r;height=J.scale.y*e;z.set(I-width,M-height,I+width,M+height);if(!D.instersects(z)){return}t.save();t.translate(I,M);t.rotate(-J.rotation);t.scale(width,height);t.beginPath();t.arc(0,0,1,0,y,true);t.closePath();t.fillStyle=p.__styleString;t.fill();t.restore()}else{if(K instanceof THREE.ParticleBitmapMaterial){bitmap=K.bitmap;bitmapWidth=bitmap.width/2;bitmapHeight=bitmap.height/2;scaleX=J.scale.x*r;scaleY=J.scale.y*e;width=scaleX*bitmapWidth;height=scaleY*bitmapHeight;offsetX=K.offset.x*scaleX;offsetY=K.offset.y*scaleY;z.set(I+offsetX-width,M+offsetY-height,I+offsetX+width,M+offsetY+height);if(!D.instersects(z)){return}t.save();t.translate(I,M);t.rotate(-J.rotation);t.scale(scaleX,-scaleY);t.translate(-bitmapWidth+K.offset.x,-bitmapHeight-K.offset.y);t.drawImage(bitmap,0,0);t.restore();t.beginPath();t.moveTo(I-10,M);t.lineTo(I+10,M);t.moveTo(I,M-10);t.lineTo(I,M+10);t.closePath();t.strokeStyle="rgb(255,255,0)";t.stroke()}}}function f(I,O,K,J,L,M,N){if(M instanceof THREE.LineColorMaterial){if(m){x.copyRGB(g);u(N,L,x);p.copyRGBA(M.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=M.color}t.lineWidth=M.lineWidth;t.lineJoin="round";t.lineCap="round";t.strokeStyle=p.__styleString;t.stroke();z.inflate(t.lineWidth)}}function j(K,J,I,Q,P,O,L,N,M){if(N instanceof THREE.MeshColorFillMaterial){if(m){x.copyRGB(g);a(M,L,x);p.copyRGBA(N.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=N.color}t.beginPath();t.moveTo(K,J);t.lineTo(I,Q);t.lineTo(P,O);t.lineTo(K,J);t.closePath();t.fillStyle=p.__styleString;t.fill()}else{if(N instanceof THREE.MeshColorStrokeMaterial){if(m){x.copyRGB(g);a(M,L,x);p.copyRGBA(N.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=N.color}t.beginPath();t.moveTo(K,J);t.lineTo(I,Q);t.lineTo(P,O);t.lineTo(K,J);t.closePath();t.lineWidth=N.lineWidth;t.lineJoin="round";t.lineCap="round";t.strokeStyle=p.__styleString;t.stroke();z.inflate(t.lineWidth)}else{if(N instanceof THREE.MeshBitmapMaterial){bitmap=N.bitmap;bitmapWidth=bitmap.width-1;bitmapHeight=bitmap.height-1;if(!L.uvs[0]||!L.uvs[1]||!L.uvs[2]){t.beginPath();t.moveTo(K,J);t.lineTo(I,Q);t.lineTo(P,O);t.lineTo(K,J);t.closePath();t.fillStyle="rgb(0, 255, 0)";t.fill();return}H.copy(L.uvs[0]);F.copy(L.uvs[1]);E.copy(L.uvs[2]);H.u*=bitmapWidth;H.v*=bitmapHeight;F.u*=bitmapWidth;F.v*=bitmapHeight;E.u*=bitmapWidth;E.v*=bitmapHeight;w(bitmap,K,J,I,Q,P,O,H.u,H.v,F.u,F.v,E.u,E.v)}}}}function h(M,K,I,W,T,S,L,J,V,U,R,Q,N,P,O){if(P instanceof THREE.MeshColorFillMaterial){if(m){x.copyRGB(g);a(O,N,x);p.copyRGBA(P.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=P.color}t.beginPath();t.moveTo(M,K);t.lineTo(I,W);t.lineTo(T,S);t.lineTo(L,J);t.lineTo(M,K);t.closePath();t.fillStyle=p.__styleString;t.fill()}else{if(P instanceof THREE.MeshColorStrokeMaterial){if(m){x.copyRGB(g);a(O,N,x);p.copyRGBA(P.color);p.multiplySelfRGB(x);p.updateStyleString()}else{p=P.color}t.beginPath();t.moveTo(M,K);t.lineTo(I,W);t.lineTo(T,S);t.lineTo(L,J);t.lineTo(M,K);t.closePath();t.lineWidth=P.lineWidth;t.lineJoin="round";t.lineCap="round";t.strokeStyle=p.__styleString;t.stroke();z.inflate(t.lineWidth)}else{if(P instanceof THREE.MeshBitmapMaterial){bitmap=P.bitmap;bitmapWidth=bitmap.width-1;bitmapHeight=bitmap.height-1;if(!N.uvs[0]||!N.uvs[1]||!N.uvs[2]||!N.uvs[3]||!N.uvs[4]){t.beginPath();t.moveTo(M,K);t.lineTo(I,W);t.lineTo(T,S);t.lineTo(L,J);t.lineTo(M,K);t.closePath();t.fillStyle="rgb(255, 0, 255)";t.fill();return}H.copy(N.uvs[0]);F.copy(N.uvs[1]);E.copy(N.uvs[2]);C.copy(N.uvs[3]);H.u*=bitmapWidth;H.v*=bitmapHeight;F.u*=bitmapWidth;F.v*=bitmapHeight;E.u*=bitmapWidth;E.v*=bitmapHeight;C.u*=bitmapWidth;C.v*=bitmapHeight;w(bitmap,M,K,I,W,L,J,H.u,H.v,F.u,F.v,C.u,C.v);w(bitmap,V,U,T,S,R,Q,F.u,F.v,E.u,E.v,C.u,C.v)}}}}function w(ab,Q,P,W,V,K,I,U,T,Y,X,M,L){var J,aa,Z,O,N,S,R;t.beginPath();t.moveTo(Q,P);t.lineTo(W,V);t.lineTo(K,I);t.lineTo(Q,P);t.closePath();t.save();t.clip();J=U*(L-X)-Y*L+M*X+(Y-M)*T;aa=-(T*(K-W)-X*K+L*W+(X-L)*Q)/J;Z=(X*I+T*(V-I)-L*V+(L-X)*P)/J;O=(U*(K-W)-Y*K+M*W+(Y-M)*Q)/J;N=-(Y*I+U*(V-I)-M*V+(M-Y)*P)/J;S=(U*(L*W-X*K)+T*(Y*K-M*W)+(M*X-Y*L)*Q)/J;R=(U*(L*V-X*I)+T*(Y*I-M*V)+(M*X-Y*L)*P)/J;t.transform(aa,Z,O,N,S,R);t.drawImage(ab,0,0);t.restore()}function c(J,I){k.sub(I,J);k.unit();k.multiplyScalar(0.75);I.addSelf(k);J.subSelf(k)}};THREE.SVGRenderer=function(){var y=null,t=new THREE.Projector(),u=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,C,r,b,A=new THREE.Rectangle(),x=new THREE.Rectangle(),j=false,n=new THREE.Color(4294967295),w=new THREE.Color(4294967295),d=new THREE.Color(4294967295),h=new THREE.Vector3(),e=[],o=[],D,q,g,B=1;this.domElement=u;this.autoClear=true;this.setQuality=function(E){switch(E){case"high":B=1;break;case"low":B=0;break}};this.setSize=function(F,E){m=F;C=E;r=m/2;b=C/2;u.setAttribute("viewBox",(-r)+" "+(-b)+" "+m+" "+C);u.setAttribute("width",m);u.setAttribute("height",C);A.set(-r,-b,r,b)};this.clear=function(){while(u.childNodes.length>0){u.removeChild(u.childNodes[0])}};this.render=function(W,T){var V,G,Q,U,L,I,H,O,M,J,S,R,F,E,N,K,P;if(this.autoClear){this.clear()}y=t.projectScene(W,T);q=0;g=0;j=W.lights.length>0;if(j){z(W,d)}for(V=0,G=y.length;V0){G.r+=E.color.r*H;G.g+=E.color.g*H;G.b+=E.color.b*H}}else{if(E instanceof THREE.PointLight){h.sub(E.position,I.centroidWorld);h.normalize();H=I.normalWorld.dot(h)*E.intensity;if(H>0){G.r+=E.color.r*H;G.g+=E.color.g*H;G.b+=E.color.b*H}}}}}function k(E,I,F,G,H){D=v(g++);D.setAttribute("cx",E);D.setAttribute("cy",I);D.setAttribute("r",F.scale.x*r);if(G instanceof THREE.ParticleCircleMaterial){if(j){w.copyRGB(d);s(H,F,w);n.copyRGBA(G.color);n.multiplySelfRGB(w);n.updateStyleString()}else{n=G.color}D.setAttribute("style","fill: "+n.__styleString)}u.appendChild(D)}function c(){}function i(G,F,E,M,L,K,H,J,I){D=p(q++);D.setAttribute("d","M "+G+" "+F+" L "+E+" "+M+" L "+L+","+K+"z");if(J instanceof THREE.MeshColorFillMaterial){if(j){w.copyRGB(d);a(I,H,w);n.copyRGBA(J.color);n.multiplySelfRGB(w);n.updateStyleString()}else{n=J.color}D.setAttribute("style","fill: "+n.__styleString)}else{if(J instanceof THREE.MeshColorStrokeMaterial){if(j){w.copyRGB(d);a(I,H,w);n.copyRGBA(J.color);n.multiplySelfRGB(w);n.updateStyleString()}else{n=J.color}D.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+J.lineWidth+"; stroke-linecap: round; stroke-linejoin: round")}}u.appendChild(D)}function f(I,G,E,O,N,M,H,F,J,L,K){D=p(q++);D.setAttribute("d","M "+I+" "+G+" L "+E+" "+O+" L "+N+","+M+" L "+H+","+F+"z");if(L instanceof THREE.MeshColorFillMaterial){if(j){w.copyRGB(d);a(K,J,w);n.copyRGBA(L.color);n.multiplySelfRGB(w);n.updateStyleString()}else{n=L.color}D.setAttribute("style","fill: "+n.__styleString)}else{if(L instanceof THREE.MeshColorStrokeMaterial){if(j){w.copyRGB(d);a(K,J,w);n.copyRGBA(L.color);n.multiplySelfRGB(w);n.updateStyleString()}else{n=L.color}D.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+L.lineWidth+"; stroke-linecap: round; stroke-linejoin: round")}}u.appendChild(D)}function p(E){if(e[E]==null){e[E]=document.createElementNS("http://www.w3.org/2000/svg","path");if(B==0){e[E].setAttribute("shape-rendering","crispEdges")}return e[E]}return e[E]}function v(E){if(o[E]==null){o[E]=document.createElementNS("http://www.w3.org/2000/svg","circle");if(B==0){o[E].setAttribute("shape-rendering","crispEdges")}return o[E]}return o[E]}};THREE.WebGLRenderer=function(){var j=document.createElement("canvas"),c,e,m=new THREE.Matrix4(),i;this.domElement=j;this.autoClear=true;g();f();var a=0,k=1,h=2,d=3;this.setSize=function(o,n){j.width=o;j.height=n;c.viewport(0,0,j.width,j.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(t){var r,s,n,q,p,o;c.uniform1i(e.enableLighting,t.lights.length);for(r=0,s=t.lights.length;r - + - - + diff --git a/examples/geometry/Qrcode.js b/examples/geometry/Qrcode.js index b6c4441a..b01f56e3 100644 --- a/examples/geometry/Qrcode.js +++ b/examples/geometry/Qrcode.js @@ -2,7 +2,9 @@ var Qrcode = function () { THREE.Geometry.call(this); - var scope = this; + var scope = this, + m1 = new THREE.MeshColorFillMaterial( 0x000000 ), + m2 = new THREE.MeshColorFillMaterial( 0xc0c0c0 ); v(-54,134,58); v(-54,146,58); @@ -689,747 +691,747 @@ var Qrcode = function () { v(-54,98,-41); v(-54,122,-41); - f3(151,150,152,0xff000000); - f3(644,398,399,0xff000000); - f3(493,494,492,0xff000000); - f3(301,65,62,0xff000000); - f3(585,375,586,0xff000000); - f3(243,244,33,0xff000000); - f3(156,149,157,0xff000000); - f3(498,499,491,0xff000000); - f3(532,537,526,0xff000000); - f3(102,90,40,0xff000000); - f3(302,57,56,0xff000000); - f3(526,529,530,0xff000000); - f3(215,219,216,0xff000000); - f3(642,413,641,0xff000000); - f3(382,432,444,0xff000000); - f3(71,300,299,0xff000000); - f3(489,480,486,0xff000000); - f3(144,138,147,0xff000000); - f3(80,182,176,0xff000000); - f3(262,261,266,0xff000000); - f3(422,518,524,0xff000000); - f3(604,608,603,0xff000000); - f3(387,388,386,0xff000000); - f3(45,44,46,0xff000000); - f3(605,524,606,0xff000000); - f3(569,552,556,0xff000000); - f3(555,556,554,0xff000000); - f3(521,522,520,0xff000000); - f3(482,483,484,0xff000000); - f3(481,484,485,0xff000000); - f3(479,475,476,0xff000000); - f3(385,456,453,0xff000000); - f3(451,452,450,0xff000000); - f3(441,437,438,0xff000000); - f3(424,425,419,0xff000000); - f3(413,414,415,0xff000000); - f3(412,408,409,0xff000000); - f3(643,404,407,0xff000000); - f3(428,396,397,0xff000000); - f3(264,182,263,0xff000000); - f3(226,223,215,0xff000000); - f3(214,210,227,0xff000000); - f3(213,212,214,0xff000000); - f3(179,178,180,0xff000000); - f3(142,141,140,0xff000000); - f3(143,142,139,0xff000000); - f3(134,133,137,0xff000000); - f3(43,111,114,0xff000000); - f3(109,108,110,0xff000000); - f3(96,95,99,0xff000000); - f3(82,77,83,0xff000000); - f3(73,72,71,0xff000000); - f3(67,66,70,0xff000000); - f3(55,54,86,0xff000000); - f4(85,56,55,86,0xff000000); - f4(69,68,67,70,0xff000000); - f4(299,76,73,71,0xff000000); - f4(84,302,56,85,0xff000000); - f4(114,111,110,108,0xff000000); - f4(136,135,134,137,0xff000000); - f4(280,279,278,281,0xff000000); - f4(427,428,397,398,0xff000000); - f4(408,642,643,407,0xff000000); - f4(411,412,409,410,0xff000000); - f4(641,413,415,418,0xff000000); - f4(426,427,398,644,0xff000000); - f4(456,450,452,453,0xff000000); - f4(478,479,476,477,0xff000000); - f4(622,623,620,621,0xff000000); - f4(604,430,605,606,0xff000000); - f4(481,478,482,484,0xff000000); - f4(262,264,263,88,0xff000000); - f4(139,142,140,136,0xff000000); - f4(43,42,41,44,0xff000000); - f4(98,97,96,99,0xff000000); - f4(138,144,143,139,0xff000000); - f4(178,177,176,180,0xff000000); - f4(210,214,212,211,0xff000000); - f4(226,215,214,227,0xff000000); - f4(278,277,282,281,0xff000000); - f4(385,386,383,384,0xff000000); - f4(440,441,438,439,0xff000000); - f4(480,481,485,486,0xff000000); - f4(520,522,518,519,0xff000000); - f4(552,553,554,556,0xff000000); - f4(568,569,556,557,0xff000000); - f4(620,623,624,619,0xff000000); - f4(615,619,624,625,0xff000000); - f4(273,283,282,277,0xff000000); - f4(46,44,41,53,0xff000000); - f4(182,181,180,176,0xff000000); - f4(524,518,522,523,0xff000000); - f4(558,565,568,557,0xff000000); - f4(601,602,603,608,0xff000000); - f4(259,266,261,260,0xff000000); - f4(145,144,147,146,0xff000000); - f4(383,431,432,382,0xff000000); - f4(487,488,489,486,0xff000000); - f4(299,83,77,76,0xff000000); - f4(641,418,419,425,0xff000000); - f4(388,395,383,386,0xff000000); - f4(223,222,219,215,0xff000000); - f4(19,22,23,24,0xff000000); - f4(39,107,106,105,0xff000000); - f4(147,133,129,148,0xff000000); - f4(162,161,153,163,0xff000000); - f4(164,163,69,72,0xff000000); - f4(197,202,201,200,0xff000000); - f4(230,229,218,231,0xff000000); - f4(222,241,240,235,0xff000000); - f4(98,101,254,255,0xff000000); - f4(267,268,27,30,0xff000000); - f4(285,284,282,286,0xff000000); - f4(336,335,186,337,0xff000000); - f4(365,364,361,366,0xff000000); - f4(448,449,381,447,0xff000000); - f4(471,475,489,490,0xff000000); - f4(495,503,504,505,0xff000000); - f4(411,505,506,414,0xff000000); - f4(543,544,539,542,0xff000000); - f4(560,571,572,573,0xff000000); - f4(582,583,564,577,0xff000000); - f4(596,443,440,597,0xff000000); - f4(369,610,609,372,0xff000000); - f4(624,626,627,628,0xff000000); - f4(528,677,678,679,0xff000000); - f4(669,670,671,672,0xff000000); - f4(661,662,663,664,0xff000000); - f4(649,650,651,652,0xff000000); - f4(645,646,647,648,0xff000000); - f4(640,637,638,639,0xff000000); - f4(576,573,574,575,0xff000000); - f4(551,548,549,550,0xff000000); - f4(539,540,541,538,0xff000000); - f4(512,511,510,420,0xff000000); - f4(509,488,507,508,0xff000000); - f4(502,499,500,501,0xff000000); - f4(434,435,436,437,0xff000000); - f4(405,406,407,404,0xff000000); - f4(401,402,399,400,0xff000000); - f4(371,372,373,374,0xff000000); - f4(360,357,358,359,0xff000000); - f4(329,328,327,330,0xff000000); - f4(319,322,321,320,0xff000000); - f4(309,308,307,310,0xff000000); - f4(305,304,303,306,0xff000000); - f4(298,297,296,295,0xff000000); - f4(232,231,234,233,0xff000000); - f4(207,206,209,208,0xff000000); - f4(199,198,197,196,0xff000000); - f4(168,169,170,78,0xff000000); - f4(165,146,167,166,0xff000000); - f4(158,157,160,159,0xff000000); - f4(94,93,92,95,0xff000000); - f4(65,64,63,62,0xff000000); - f4(57,60,59,58,0xff000000); - f4(31,30,29,32,0xff000000); - f4(18,17,16,15,0xff000000); - f4(183,178,195,184,0xff000000); - f4(525,526,537,520,0xff000000); - f4(608,604,606,607,0xff000000); - f4(449,450,456,457,0xff000000); - f4(394,395,388,389,0xff000000); - f4(266,265,264,262,0xff000000); - f4(107,115,114,108,0xff000000); - f4(52,47,46,53,0xff000000); - f4(250,249,248,251,0xff000000); - f4(590,591,592,593,0xff000000); - f4(584,588,589,590,0xff000000); - f4(569,570,550,552,0xff000000); - f4(379,371,374,377,0xff000000); - f4(247,246,242,248,0xff000000); - f4(208,228,227,210,0xff000000); - f4(32,29,37,35,0xff000000); - f4(251,241,224,250,0xff000000); - f4(566,583,593,592,0xff000000); - f4(593,581,584,590,0xff000000); - f4(375,376,377,374,0xff000000); - f4(380,370,371,379,0xff000000); - f4(242,239,251,248,0xff000000); - f4(35,34,33,32,0xff000000); - f4(29,28,38,37,0xff000000); - f4(489,475,479,480,0xff000000); - f4(441,442,434,437,0xff000000); - f4(147,138,137,133,0xff000000); - f4(99,95,92,100,0xff000000); - f4(568,565,566,567,0xff000000); - f4(434,442,432,433,0xff000000); - f4(226,225,224,223,0xff000000); - f4(92,91,90,100,0xff000000); - f4(195,190,187,184,0xff000000); - f4(565,558,561,564,0xff000000); - f4(532,526,530,531,0xff000000); - f4(413,642,408,412,0xff000000); - f4(66,300,71,70,0xff000000); - f4(595,596,591,594,0xff000000); - f4(581,582,577,580,0xff000000); - f4(249,254,253,252,0xff000000); - f4(239,238,235,240,0xff000000); - f4(444,432,442,443,0xff000000); - f4(187,190,189,188,0xff000000); - f4(100,90,102,101,0xff000000); - f4(90,89,41,40,0xff000000); - f4(116,132,124,119,0xff000000); - f4(458,461,466,474,0xff000000); - f4(598,591,596,597,0xff000000); - f4(578,579,580,577,0xff000000); - f4(562,563,564,561,0xff000000); - f4(465,466,461,462,0xff000000); - f4(402,643,644,399,0xff000000); - f4(256,255,254,249,0xff000000); - f4(236,235,238,237,0xff000000); - f4(220,219,222,221,0xff000000); - f4(123,120,119,124,0xff000000); - f4(60,57,302,301,0xff000000); - f4(43,113,112,111,0xff000000); - f4(454,455,385,453,0xff000000); - f4(613,616,617,618,0xff000000); - f4(588,586,373,587,0xff000000); - f4(536,533,534,535,0xff000000); - f4(532,533,536,537,0xff000000); - f4(468,472,473,467,0xff000000); - f4(466,467,473,474,0xff000000); - f4(423,424,421,422,0xff000000); - f4(275,274,271,276,0xff000000); - f4(31,244,246,245,0xff000000); - f4(192,191,194,193,0xff000000); - f4(131,130,126,125,0xff000000); - f4(131,125,124,132,0xff000000); - f4(79,82,81,80,0xff000000); - f4(2,6,5,4,0xff000000); - f4(35,37,21,36,0xff000000); - f4(113,49,132,116,0xff000000); - f4(175,174,171,168,0xff000000); - f4(206,205,193,96,0xff000000); - f4(228,97,256,225,0xff000000); - f4(339,338,199,335,0xff000000); - f4(270,341,340,34,0xff000000); - f4(347,348,344,346,0xff000000); - f4(363,379,377,378,0xff000000); - f4(455,458,474,391,0xff000000); - f4(517,510,513,516,0xff000000); - f4(548,438,535,547,0xff000000); - f4(598,439,570,567,0xff000000); - f4(541,680,681,677,0xff000000); - f4(612,376,682,683,0xff000000); - f4(673,674,675,676,0xff000000); - f4(665,666,667,668,0xff000000); - f4(660,657,655,656,0xff000000); - f4(658,654,655,657,0xff000000); - f4(654,658,659,653,0xff000000); - f4(653,659,660,656,0xff000000); - f4(636,633,631,632,0xff000000); - f4(634,630,631,633,0xff000000); - f4(630,634,635,629,0xff000000); - f4(629,635,636,632,0xff000000); - f4(613,614,615,616,0xff000000); - f4(345,611,378,612,0xff000000); - f4(601,523,599,600,0xff000000); - f4(585,586,588,584,0xff000000); - f4(561,558,559,560,0xff000000); - f4(546,547,535,545,0xff000000); - f4(526,527,528,529,0xff000000); - f4(515,516,513,514,0xff000000); - f4(497,498,494,496,0xff000000); - f4(410,496,494,495,0xff000000); - f4(494,498,491,492,0xff000000); - f4(482,491,499,502,0xff000000); - f4(471,472,469,470,0xff000000); - f4(465,469,472,468,0xff000000); - f4(463,464,465,462,0xff000000); - f4(460,461,458,459,0xff000000); - f4(445,446,382,444,0xff000000); - f4(431,429,426,430,0xff000000); - f4(641,425,426,644,0xff000000); - f4(420,421,424,419,0xff000000); - f4(418,415,416,417,0xff000000); - f4(404,643,402,403,0xff000000); - f4(431,396,428,429,0xff000000); - f4(393,394,391,392,0xff000000); - f4(390,391,394,389,0xff000000); - f4(395,396,431,383,0xff000000); - f4(368,381,382,446,0xff000000); - f4(380,368,369,370,0xff000000); - f4(362,367,368,380,0xff000000); - f4(348,361,362,363,0xff000000); - f4(356,353,351,352,0xff000000); - f4(354,350,351,353,0xff000000); - f4(350,354,355,349,0xff000000); - f4(349,355,356,352,0xff000000); - f4(344,345,342,343,0xff000000); - f4(333,332,331,334,0xff000000); - f4(325,324,323,326,0xff000000); - f4(313,315,318,314,0xff000000); - f4(313,312,316,315,0xff000000); - f4(317,316,312,311,0xff000000); - f4(318,317,311,314,0xff000000); - f4(289,291,294,290,0xff000000); - f4(289,288,292,291,0xff000000); - f4(293,292,288,287,0xff000000); - f4(294,293,287,290,0xff000000); - f4(271,274,273,272,0xff000000); - f4(3,270,36,269,0xff000000); - f4(257,181,259,258,0xff000000); - f4(243,242,246,244,0xff000000); - f4(219,218,217,216,0xff000000); - f4(204,203,193,205,0xff000000); - f4(191,190,195,194,0xff000000); - f4(184,187,186,185,0xff000000); - f4(173,172,171,174,0xff000000); - f4(155,154,152,156,0xff000000); - f4(68,153,152,154,0xff000000); - f4(152,150,149,156,0xff000000); - f4(140,160,157,149,0xff000000); - f4(126,130,129,128,0xff000000); - f4(123,126,128,127,0xff000000); - f4(121,120,123,122,0xff000000); - f4(116,119,118,117,0xff000000); - f4(103,102,40,104,0xff000000); - f4(89,88,84,87,0xff000000); - f4(299,302,84,83,0xff000000); - f4(82,79,78,77,0xff000000); - f4(76,75,74,73,0xff000000); - f4(66,65,301,300,0xff000000); - f4(62,61,60,301,0xff000000); - f4(89,87,86,54,0xff000000); - f4(47,52,51,50,0xff000000); - f4(48,47,50,49,0xff000000); - f4(53,41,89,54,0xff000000); - f4(26,104,40,39,0xff000000); - f4(38,28,27,26,0xff000000); - f4(20,38,26,25,0xff000000); - f4(6,21,20,19,0xff000000); - f4(9,11,14,10,0xff000000); - f4(9,8,12,11,0xff000000); - f4(13,12,8,7,0xff000000); - f4(14,13,7,10,0xff000000); - f4(0,3,2,1,0xff000000); - f4(2,4,346,344,0xffc0c0c0); - f4(6,2,344,348,0xffc0c0c0); - f4(5,6,348,347,0xffc0c0c0); - f4(4,5,347,346,0xffc0c0c0); - f4(319,661,664,322,0xffc0c0c0); - f4(322,664,663,321,0xffc0c0c0); - f4(321,663,662,320,0xffc0c0c0); - f4(320,662,661,319,0xffc0c0c0); - f4(318,315,657,660,0xffc0c0c0); - f4(317,318,660,659,0xffc0c0c0); - f4(316,317,659,658,0xffc0c0c0); - f4(315,316,658,657,0xffc0c0c0); - f4(311,653,656,314,0xffc0c0c0); - f4(314,656,655,313,0xffc0c0c0); - f4(313,655,654,312,0xffc0c0c0); - f4(312,654,653,311,0xffc0c0c0); - f4(310,307,649,652,0xffc0c0c0); - f4(309,310,652,651,0xffc0c0c0); - f4(308,309,651,650,0xffc0c0c0); - f4(307,308,650,649,0xffc0c0c0); - f4(15,357,360,18,0xffc0c0c0); - f4(18,360,359,17,0xffc0c0c0); - f4(17,359,358,16,0xffc0c0c0); - f4(16,358,357,15,0xffc0c0c0); - f4(14,11,353,356,0xffc0c0c0); - f4(13,14,356,355,0xffc0c0c0); - f4(12,13,355,354,0xffc0c0c0); - f4(11,12,354,353,0xffc0c0c0); - f4(306,303,645,648,0xffc0c0c0); - f4(305,306,648,647,0xffc0c0c0); - f4(304,305,647,646,0xffc0c0c0); - f4(303,304,646,645,0xffc0c0c0); - f4(7,349,352,10,0xffc0c0c0); - f4(10,352,351,9,0xffc0c0c0); - f4(9,351,350,8,0xffc0c0c0); - f4(8,350,349,7,0xffc0c0c0); - f4(299,641,644,302,0xffc0c0c0); - f4(302,644,643,301,0xffc0c0c0); - f4(301,643,642,300,0xffc0c0c0); - f4(300,642,641,299,0xffc0c0c0); - f4(334,331,673,676,0xffc0c0c0); - f4(333,334,676,675,0xffc0c0c0); - f4(332,333,675,674,0xffc0c0c0); - f4(331,332,674,673,0xffc0c0c0); - f4(326,323,665,668,0xffc0c0c0); - f4(325,326,668,667,0xffc0c0c0); - f4(324,325,667,666,0xffc0c0c0); - f4(323,324,666,665,0xffc0c0c0); - f4(330,327,669,672,0xffc0c0c0); - f4(329,330,672,671,0xffc0c0c0); - f4(328,329,671,670,0xffc0c0c0); - f4(327,328,670,669,0xffc0c0c0); - f4(295,637,640,298,0xffc0c0c0); - f4(298,640,639,297,0xffc0c0c0); - f4(297,639,638,296,0xffc0c0c0); - f4(296,638,637,295,0xffc0c0c0); - f4(294,291,633,636,0xffc0c0c0); - f4(293,294,636,635,0xffc0c0c0); - f4(292,293,635,634,0xffc0c0c0); - f4(291,292,634,633,0xffc0c0c0); - f4(287,629,632,290,0xffc0c0c0); - f4(290,632,631,289,0xffc0c0c0); - f4(289,631,630,288,0xffc0c0c0); - f4(288,630,629,287,0xffc0c0c0); - f4(282,284,626,624,0xffc0c0c0); - f4(286,282,624,628,0xffc0c0c0); - f4(285,286,628,627,0xffc0c0c0); - f4(284,285,627,626,0xffc0c0c0); - f4(273,277,619,615,0xffc0c0c0); - f4(283,273,615,625,0xffc0c0c0); - f4(282,283,625,624,0xffc0c0c0); - f4(281,282,624,623,0xffc0c0c0); - f4(280,281,623,622,0xffc0c0c0); - f4(279,280,622,621,0xffc0c0c0); - f4(278,279,621,620,0xffc0c0c0); - f4(277,278,620,619,0xffc0c0c0); - f4(271,613,618,276,0xffc0c0c0); - f4(275,276,618,617,0xffc0c0c0); - f4(274,275,617,616,0xffc0c0c0); - f4(273,274,616,615,0xffc0c0c0); - f4(272,273,615,614,0xffc0c0c0); - f4(271,272,614,613,0xffc0c0c0); - f4(3,0,342,345,0xffc0c0c0); - f4(2,3,345,344,0xffc0c0c0); - f4(1,2,344,343,0xffc0c0c0); - f4(0,1,343,342,0xffc0c0c0); - f4(270,3,345,612,0xffc0c0c0); - f4(36,270,612,378,0xffc0c0c0); - f4(269,36,378,611,0xffc0c0c0); - f4(3,269,611,345,0xffc0c0c0); - f4(34,340,682,376,0xffc0c0c0); - f4(270,34,376,612,0xffc0c0c0); - f4(341,270,612,683,0xffc0c0c0); - f4(340,341,683,682,0xffc0c0c0); - f4(268,610,369,27,0xffc0c0c0); - f4(267,609,610,268,0xffc0c0c0); - f4(30,372,609,267,0xffc0c0c0); - f4(27,369,372,30,0xffc0c0c0); - f4(259,260,602,601,0xffc0c0c0); - f4(266,259,601,608,0xffc0c0c0); - f4(265,266,608,607,0xffc0c0c0); - f4(264,265,607,606,0xffc0c0c0); - f4(182,264,606,524,0xffc0c0c0); - f4(263,182,524,605,0xffc0c0c0); - f4(88,263,605,430,0xffc0c0c0); - f4(262,88,430,604,0xffc0c0c0); - f4(261,262,604,603,0xffc0c0c0); - f4(260,261,603,602,0xffc0c0c0); - f4(181,257,599,523,0xffc0c0c0); - f4(259,181,523,601,0xffc0c0c0); - f4(258,259,601,600,0xffc0c0c0); - f4(257,258,600,599,0xffc0c0c0); - f4(256,97,439,598,0xffc0c0c0); - f4(225,256,598,567,0xffc0c0c0); - f4(228,225,567,570,0xffc0c0c0); - f4(97,228,570,439,0xffc0c0c0); - f4(252,594,591,249,0xffc0c0c0); - f4(256,249,591,598,0xffc0c0c0); - f4(255,256,598,597,0xffc0c0c0); - f4(98,255,597,440,0xffc0c0c0); - f4(101,98,440,443,0xffc0c0c0); - f4(254,101,443,596,0xffc0c0c0); - f4(253,254,596,595,0xffc0c0c0); - f4(252,253,595,594,0xffc0c0c0); - f4(239,242,584,581,0xffc0c0c0); - f4(251,239,581,593,0xffc0c0c0); - f4(241,251,593,583,0xffc0c0c0); - f4(224,241,583,566,0xffc0c0c0); - f4(250,224,566,592,0xffc0c0c0); - f4(249,250,592,591,0xffc0c0c0); - f4(248,249,591,590,0xffc0c0c0); - f4(247,248,590,589,0xffc0c0c0); - f4(246,247,589,588,0xffc0c0c0); - f4(245,246,588,587,0xffc0c0c0); - f4(31,245,587,373,0xffc0c0c0); - f4(244,31,373,586,0xffc0c0c0); - f4(33,244,586,375,0xffc0c0c0); - f4(243,33,375,585,0xffc0c0c0); - f4(243,585,584,242,0xffc0c0c0); - f4(222,235,577,564,0xffc0c0c0); - f4(241,222,564,583,0xffc0c0c0); - f4(240,241,583,582,0xffc0c0c0); - f4(239,240,582,581,0xffc0c0c0); - f4(238,239,581,580,0xffc0c0c0); - f4(238,580,579,237,0xffc0c0c0); - f4(236,237,579,578,0xffc0c0c0); - f4(235,236,578,577,0xffc0c0c0); - f4(231,232,574,573,0xffc0c0c0); - f4(234,231,573,576,0xffc0c0c0); - f4(233,234,576,575,0xffc0c0c0); - f4(232,233,575,574,0xffc0c0c0); - f4(218,229,571,560,0xffc0c0c0); - f4(231,218,560,573,0xffc0c0c0); - f4(230,231,573,572,0xffc0c0c0); - f4(229,230,572,571,0xffc0c0c0); - f4(208,210,552,550,0xffc0c0c0); - f4(228,208,550,570,0xffc0c0c0); - f4(227,228,570,569,0xffc0c0c0); - f4(226,227,569,568,0xffc0c0c0); - f4(225,226,568,567,0xffc0c0c0); - f4(224,225,567,566,0xffc0c0c0); - f4(223,224,566,565,0xffc0c0c0); - f4(222,223,565,564,0xffc0c0c0); - f4(222,564,563,221,0xffc0c0c0); - f4(220,221,563,562,0xffc0c0c0); - f4(219,220,562,561,0xffc0c0c0); - f4(218,219,561,560,0xffc0c0c0); - f4(217,218,560,559,0xffc0c0c0); - f4(216,217,559,558,0xffc0c0c0); - f4(215,216,558,557,0xffc0c0c0); - f4(214,215,557,556,0xffc0c0c0); - f4(213,214,556,555,0xffc0c0c0); - f4(212,213,555,554,0xffc0c0c0); - f4(211,212,554,553,0xffc0c0c0); - f4(210,211,553,552,0xffc0c0c0); - f4(206,207,549,548,0xffc0c0c0); - f4(209,206,548,551,0xffc0c0c0); - f4(208,209,551,550,0xffc0c0c0); - f4(207,208,550,549,0xffc0c0c0); - f4(193,203,545,535,0xffc0c0c0); - f4(96,193,535,438,0xffc0c0c0); - f4(206,96,438,548,0xffc0c0c0); - f4(205,206,548,547,0xffc0c0c0); - f4(204,205,547,546,0xffc0c0c0); - f4(203,204,546,545,0xffc0c0c0); - f4(197,200,542,539,0xffc0c0c0); - f4(202,197,539,544,0xffc0c0c0); - f4(201,202,544,543,0xffc0c0c0); - f4(200,201,543,542,0xffc0c0c0); - f4(199,196,538,541,0xffc0c0c0); - f4(198,199,541,540,0xffc0c0c0); - f4(197,198,540,539,0xffc0c0c0); - f4(196,197,539,538,0xffc0c0c0); - f4(335,199,541,677,0xffc0c0c0); - f4(339,335,677,681,0xffc0c0c0); - f4(338,339,681,680,0xffc0c0c0); - f4(199,338,680,541,0xffc0c0c0); - f4(186,335,677,528,0xffc0c0c0); - f4(337,186,528,679,0xffc0c0c0); - f4(336,337,679,678,0xffc0c0c0); - f4(335,336,678,677,0xffc0c0c0); - f4(178,183,525,520,0xffc0c0c0); - f4(195,178,520,537,0xffc0c0c0); - f4(195,537,536,194,0xffc0c0c0); - f4(193,194,536,535,0xffc0c0c0); - f4(192,193,535,534,0xffc0c0c0); - f4(191,192,534,533,0xffc0c0c0); - f4(190,191,533,532,0xffc0c0c0); - f4(189,190,532,531,0xffc0c0c0); - f4(189,531,530,188,0xffc0c0c0); - f4(187,188,530,529,0xffc0c0c0); - f4(186,187,529,528,0xffc0c0c0); - f4(185,186,528,527,0xffc0c0c0); - f4(184,185,527,526,0xffc0c0c0); - f4(183,184,526,525,0xffc0c0c0); - f4(80,176,518,422,0xffc0c0c0); - f4(182,80,422,524,0xffc0c0c0); - f4(181,182,524,523,0xffc0c0c0); - f4(180,181,523,522,0xffc0c0c0); - f4(179,180,522,521,0xffc0c0c0); - f4(178,179,521,520,0xffc0c0c0); - f4(177,178,520,519,0xffc0c0c0); - f4(176,177,519,518,0xffc0c0c0); - f4(168,171,513,510,0xffc0c0c0); - f4(175,168,510,517,0xffc0c0c0); - f4(174,175,517,516,0xffc0c0c0); - f4(173,174,516,515,0xffc0c0c0); - f4(172,173,515,514,0xffc0c0c0); - f4(171,172,514,513,0xffc0c0c0); - f4(170,512,420,78,0xffc0c0c0); - f4(169,511,512,170,0xffc0c0c0); - f4(168,510,511,169,0xffc0c0c0); - f4(78,420,510,168,0xffc0c0c0); - f4(146,165,507,488,0xffc0c0c0); - f4(167,146,488,509,0xffc0c0c0); - f4(166,167,509,508,0xffc0c0c0); - f4(165,166,508,507,0xffc0c0c0); - f4(163,164,506,505,0xffc0c0c0); - f4(69,163,505,411,0xffc0c0c0); - f4(72,69,411,414,0xffc0c0c0); - f4(164,72,414,506,0xffc0c0c0); - f4(153,161,503,495,0xffc0c0c0); - f4(163,153,495,505,0xffc0c0c0); - f4(162,163,505,504,0xffc0c0c0); - f4(161,162,504,503,0xffc0c0c0); - f4(140,149,491,482,0xffc0c0c0); - f4(160,140,482,502,0xffc0c0c0); - f4(159,160,502,501,0xffc0c0c0); - f4(158,159,501,500,0xffc0c0c0); - f4(157,158,500,499,0xffc0c0c0); - f4(156,157,499,498,0xffc0c0c0); - f4(155,156,498,497,0xffc0c0c0); - f4(154,155,497,496,0xffc0c0c0); - f4(68,154,496,410,0xffc0c0c0); - f4(153,68,410,495,0xffc0c0c0); - f4(152,153,495,494,0xffc0c0c0); - f4(151,152,494,493,0xffc0c0c0); - f4(150,151,493,492,0xffc0c0c0); - f4(150,492,491,149,0xffc0c0c0); - f4(129,133,475,471,0xffc0c0c0); - f4(148,129,471,490,0xffc0c0c0); - f4(147,148,490,489,0xffc0c0c0); - f4(146,147,489,488,0xffc0c0c0); - f4(145,146,488,487,0xffc0c0c0); - f4(144,145,487,486,0xffc0c0c0); - f4(143,144,486,485,0xffc0c0c0); - f4(142,143,485,484,0xffc0c0c0); - f4(141,142,484,483,0xffc0c0c0); - f4(140,141,483,482,0xffc0c0c0); - f4(136,140,482,478,0xffc0c0c0); - f4(139,136,478,481,0xffc0c0c0); - f4(138,139,481,480,0xffc0c0c0); - f4(137,138,480,479,0xffc0c0c0); - f4(136,137,479,478,0xffc0c0c0); - f4(135,136,478,477,0xffc0c0c0); - f4(134,135,477,476,0xffc0c0c0); - f4(133,134,476,475,0xffc0c0c0); - f4(113,116,458,455,0xffc0c0c0); - f4(49,113,455,391,0xffc0c0c0); - f4(132,49,391,474,0xffc0c0c0); - f4(131,132,474,473,0xffc0c0c0); - f4(131,473,472,130,0xffc0c0c0); - f4(129,130,472,471,0xffc0c0c0); - f4(128,129,471,470,0xffc0c0c0); - f4(128,470,469,127,0xffc0c0c0); - f4(123,127,469,465,0xffc0c0c0); - f4(126,123,465,468,0xffc0c0c0); - f4(125,126,468,467,0xffc0c0c0); - f4(124,125,467,466,0xffc0c0c0); - f4(123,124,466,465,0xffc0c0c0); - f4(122,123,465,464,0xffc0c0c0); - f4(121,122,464,463,0xffc0c0c0); - f4(120,121,463,462,0xffc0c0c0); - f4(119,120,462,461,0xffc0c0c0); - f4(118,119,461,460,0xffc0c0c0); - f4(117,118,460,459,0xffc0c0c0); - f4(116,117,459,458,0xffc0c0c0); - f4(107,108,450,449,0xffc0c0c0); - f4(115,107,449,457,0xffc0c0c0); - f4(114,115,457,456,0xffc0c0c0); - f4(43,114,456,385,0xffc0c0c0); - f4(43,385,455,113,0xffc0c0c0); - f4(112,113,455,454,0xffc0c0c0); - f4(111,112,454,453,0xffc0c0c0); - f4(110,111,453,452,0xffc0c0c0); - f4(109,110,452,451,0xffc0c0c0); - f4(108,109,451,450,0xffc0c0c0); - f4(39,105,447,381,0xffc0c0c0); - f4(107,39,381,449,0xffc0c0c0); - f4(106,107,449,448,0xffc0c0c0); - f4(105,106,448,447,0xffc0c0c0); - f4(26,39,381,368,0xffc0c0c0); - f4(104,26,368,446,0xffc0c0c0); - f4(103,104,446,445,0xffc0c0c0); - f4(102,103,445,444,0xffc0c0c0); - f4(101,102,444,443,0xffc0c0c0); - f4(100,101,443,442,0xffc0c0c0); - f4(99,100,442,441,0xffc0c0c0); - f4(98,99,441,440,0xffc0c0c0); - f4(97,98,440,439,0xffc0c0c0); - f4(96,97,439,438,0xffc0c0c0); - f4(95,96,438,437,0xffc0c0c0); - f4(94,95,437,436,0xffc0c0c0); - f4(93,94,436,435,0xffc0c0c0); - f4(92,93,435,434,0xffc0c0c0); - f4(91,92,434,433,0xffc0c0c0); - f4(90,91,433,432,0xffc0c0c0); - f4(90,432,431,89,0xffc0c0c0); - f4(88,89,431,430,0xffc0c0c0); - f4(84,88,430,426,0xffc0c0c0); - f4(87,84,426,429,0xffc0c0c0); - f4(86,87,429,428,0xffc0c0c0); - f4(85,86,428,427,0xffc0c0c0); - f4(84,85,427,426,0xffc0c0c0); - f4(84,426,425,83,0xffc0c0c0); - f4(82,83,425,424,0xffc0c0c0); - f4(81,82,424,423,0xffc0c0c0); - f4(80,81,423,422,0xffc0c0c0); - f4(80,422,421,79,0xffc0c0c0); - f4(78,79,421,420,0xffc0c0c0); - f4(77,78,420,419,0xffc0c0c0); - f4(76,77,419,418,0xffc0c0c0); - f4(75,76,418,417,0xffc0c0c0); - f4(74,75,417,416,0xffc0c0c0); - f4(73,74,416,415,0xffc0c0c0); - f4(72,73,415,414,0xffc0c0c0); - f4(71,72,414,413,0xffc0c0c0); - f4(70,71,413,412,0xffc0c0c0); - f4(69,70,412,411,0xffc0c0c0); - f4(68,69,411,410,0xffc0c0c0); - f4(67,68,410,409,0xffc0c0c0); - f4(66,67,409,408,0xffc0c0c0); - f4(65,66,408,407,0xffc0c0c0); - f4(64,65,407,406,0xffc0c0c0); - f4(63,64,406,405,0xffc0c0c0); - f4(62,63,405,404,0xffc0c0c0); - f4(61,62,404,403,0xffc0c0c0); - f4(60,61,403,402,0xffc0c0c0); - f4(59,60,402,401,0xffc0c0c0); - f4(58,59,401,400,0xffc0c0c0); - f4(57,58,400,399,0xffc0c0c0); - f4(56,57,399,398,0xffc0c0c0); - f4(55,56,398,397,0xffc0c0c0); - f4(54,55,397,396,0xffc0c0c0); - f4(53,54,396,395,0xffc0c0c0); - f4(52,53,395,394,0xffc0c0c0); - f4(51,52,394,393,0xffc0c0c0); - f4(50,51,393,392,0xffc0c0c0); - f4(50,392,391,49,0xffc0c0c0); - f4(48,49,391,390,0xffc0c0c0); - f4(47,48,390,389,0xffc0c0c0); - f4(46,47,389,388,0xffc0c0c0); - f4(45,46,388,387,0xffc0c0c0); - f4(44,45,387,386,0xffc0c0c0); - f4(43,44,386,385,0xffc0c0c0); - f4(42,43,385,384,0xffc0c0c0); - f4(42,384,383,41,0xffc0c0c0); - f4(40,41,383,382,0xffc0c0c0); - f4(40,382,381,39,0xffc0c0c0); - f4(20,25,367,362,0xffc0c0c0); - f4(38,20,362,380,0xffc0c0c0); - f4(37,38,380,379,0xffc0c0c0); - f4(21,37,379,363,0xffc0c0c0); - f4(36,21,363,378,0xffc0c0c0); - f4(35,36,378,377,0xffc0c0c0); - f4(34,35,377,376,0xffc0c0c0); - f4(33,34,376,375,0xffc0c0c0); - f4(32,33,375,374,0xffc0c0c0); - f4(31,32,374,373,0xffc0c0c0); - f4(30,31,373,372,0xffc0c0c0); - f4(29,30,372,371,0xffc0c0c0); - f4(28,29,371,370,0xffc0c0c0); - f4(27,28,370,369,0xffc0c0c0); - f4(26,27,369,368,0xffc0c0c0); - f4(26,368,367,25,0xffc0c0c0); - f4(24,366,361,19,0xffc0c0c0); - f4(23,365,366,24,0xffc0c0c0); - f4(22,364,365,23,0xffc0c0c0); - f4(19,361,364,22,0xffc0c0c0); - f4(6,19,361,348,0xffc0c0c0); - f4(21,6,348,363,0xffc0c0c0); - f4(20,21,363,362,0xffc0c0c0); - f4(19,20,362,361,0xffc0c0c0); + f3(151,150,152,m1); + f3(644,398,399,m1); + f3(493,494,492,m1); + f3(301,65,62,m1); + f3(585,375,586,m1); + f3(243,244,33,m1); + f3(156,149,157,m1); + f3(498,499,491,m1); + f3(532,537,526,m1); + f3(102,90,40,m1); + f3(302,57,56,m1); + f3(526,529,530,m1); + f3(215,219,216,m1); + f3(642,413,641,m1); + f3(382,432,444,m1); + f3(71,300,299,m1); + f3(489,480,486,m1); + f3(144,138,147,m1); + f3(80,182,176,m1); + f3(262,261,266,m1); + f3(422,518,524,m1); + f3(604,608,603,m1); + f3(387,388,386,m1); + f3(45,44,46,m1); + f3(605,524,606,m1); + f3(569,552,556,m1); + f3(555,556,554,m1); + f3(521,522,520,m1); + f3(482,483,484,m1); + f3(481,484,485,m1); + f3(479,475,476,m1); + f3(385,456,453,m1); + f3(451,452,450,m1); + f3(441,437,438,m1); + f3(424,425,419,m1); + f3(413,414,415,m1); + f3(412,408,409,m1); + f3(643,404,407,m1); + f3(428,396,397,m1); + f3(264,182,263,m1); + f3(226,223,215,m1); + f3(214,210,227,m1); + f3(213,212,214,m1); + f3(179,178,180,m1); + f3(142,141,140,m1); + f3(143,142,139,m1); + f3(134,133,137,m1); + f3(43,111,114,m1); + f3(109,108,110,m1); + f3(96,95,99,m1); + f3(82,77,83,m1); + f3(73,72,71,m1); + f3(67,66,70,m1); + f3(55,54,86,m1); + f4(85,56,55,86,m1); + f4(69,68,67,70,m1); + f4(299,76,73,71,m1); + f4(84,302,56,85,m1); + f4(114,111,110,108,m1); + f4(136,135,134,137,m1); + f4(280,279,278,281,m1); + f4(427,428,397,398,m1); + f4(408,642,643,407,m1); + f4(411,412,409,410,m1); + f4(641,413,415,418,m1); + f4(426,427,398,644,m1); + f4(456,450,452,453,m1); + f4(478,479,476,477,m1); + f4(622,623,620,621,m1); + f4(604,430,605,606,m1); + f4(481,478,482,484,m1); + f4(262,264,263,88,m1); + f4(139,142,140,136,m1); + f4(43,42,41,44,m1); + f4(98,97,96,99,m1); + f4(138,144,143,139,m1); + f4(178,177,176,180,m1); + f4(210,214,212,211,m1); + f4(226,215,214,227,m1); + f4(278,277,282,281,m1); + f4(385,386,383,384,m1); + f4(440,441,438,439,m1); + f4(480,481,485,486,m1); + f4(520,522,518,519,m1); + f4(552,553,554,556,m1); + f4(568,569,556,557,m1); + f4(620,623,624,619,m1); + f4(615,619,624,625,m1); + f4(273,283,282,277,m1); + f4(46,44,41,53,m1); + f4(182,181,180,176,m1); + f4(524,518,522,523,m1); + f4(558,565,568,557,m1); + f4(601,602,603,608,m1); + f4(259,266,261,260,m1); + f4(145,144,147,146,m1); + f4(383,431,432,382,m1); + f4(487,488,489,486,m1); + f4(299,83,77,76,m1); + f4(641,418,419,425,m1); + f4(388,395,383,386,m1); + f4(223,222,219,215,m1); + f4(19,22,23,24,m1); + f4(39,107,106,105,m1); + f4(147,133,129,148,m1); + f4(162,161,153,163,m1); + f4(164,163,69,72,m1); + f4(197,202,201,200,m1); + f4(230,229,218,231,m1); + f4(222,241,240,235,m1); + f4(98,101,254,255,m1); + f4(267,268,27,30,m1); + f4(285,284,282,286,m1); + f4(336,335,186,337,m1); + f4(365,364,361,366,m1); + f4(448,449,381,447,m1); + f4(471,475,489,490,m1); + f4(495,503,504,505,m1); + f4(411,505,506,414,m1); + f4(543,544,539,542,m1); + f4(560,571,572,573,m1); + f4(582,583,564,577,m1); + f4(596,443,440,597,m1); + f4(369,610,609,372,m1); + f4(624,626,627,628,m1); + f4(528,677,678,679,m1); + f4(669,670,671,672,m1); + f4(661,662,663,664,m1); + f4(649,650,651,652,m1); + f4(645,646,647,648,m1); + f4(640,637,638,639,m1); + f4(576,573,574,575,m1); + f4(551,548,549,550,m1); + f4(539,540,541,538,m1); + f4(512,511,510,420,m1); + f4(509,488,507,508,m1); + f4(502,499,500,501,m1); + f4(434,435,436,437,m1); + f4(405,406,407,404,m1); + f4(401,402,399,400,m1); + f4(371,372,373,374,m1); + f4(360,357,358,359,m1); + f4(329,328,327,330,m1); + f4(319,322,321,320,m1); + f4(309,308,307,310,m1); + f4(305,304,303,306,m1); + f4(298,297,296,295,m1); + f4(232,231,234,233,m1); + f4(207,206,209,208,m1); + f4(199,198,197,196,m1); + f4(168,169,170,78,m1); + f4(165,146,167,166,m1); + f4(158,157,160,159,m1); + f4(94,93,92,95,m1); + f4(65,64,63,62,m1); + f4(57,60,59,58,m1); + f4(31,30,29,32,m1); + f4(18,17,16,15,m1); + f4(183,178,195,184,m1); + f4(525,526,537,520,m1); + f4(608,604,606,607,m1); + f4(449,450,456,457,m1); + f4(394,395,388,389,m1); + f4(266,265,264,262,m1); + f4(107,115,114,108,m1); + f4(52,47,46,53,m1); + f4(250,249,248,251,m1); + f4(590,591,592,593,m1); + f4(584,588,589,590,m1); + f4(569,570,550,552,m1); + f4(379,371,374,377,m1); + f4(247,246,242,248,m1); + f4(208,228,227,210,m1); + f4(32,29,37,35,m1); + f4(251,241,224,250,m1); + f4(566,583,593,592,m1); + f4(593,581,584,590,m1); + f4(375,376,377,374,m1); + f4(380,370,371,379,m1); + f4(242,239,251,248,m1); + f4(35,34,33,32,m1); + f4(29,28,38,37,m1); + f4(489,475,479,480,m1); + f4(441,442,434,437,m1); + f4(147,138,137,133,m1); + f4(99,95,92,100,m1); + f4(568,565,566,567,m1); + f4(434,442,432,433,m1); + f4(226,225,224,223,m1); + f4(92,91,90,100,m1); + f4(195,190,187,184,m1); + f4(565,558,561,564,m1); + f4(532,526,530,531,m1); + f4(413,642,408,412,m1); + f4(66,300,71,70,m1); + f4(595,596,591,594,m1); + f4(581,582,577,580,m1); + f4(249,254,253,252,m1); + f4(239,238,235,240,m1); + f4(444,432,442,443,m1); + f4(187,190,189,188,m1); + f4(100,90,102,101,m1); + f4(90,89,41,40,m1); + f4(116,132,124,119,m1); + f4(458,461,466,474,m1); + f4(598,591,596,597,m1); + f4(578,579,580,577,m1); + f4(562,563,564,561,m1); + f4(465,466,461,462,m1); + f4(402,643,644,399,m1); + f4(256,255,254,249,m1); + f4(236,235,238,237,m1); + f4(220,219,222,221,m1); + f4(123,120,119,124,m1); + f4(60,57,302,301,m1); + f4(43,113,112,111,m1); + f4(454,455,385,453,m1); + f4(613,616,617,618,m1); + f4(588,586,373,587,m1); + f4(536,533,534,535,m1); + f4(532,533,536,537,m1); + f4(468,472,473,467,m1); + f4(466,467,473,474,m1); + f4(423,424,421,422,m1); + f4(275,274,271,276,m1); + f4(31,244,246,245,m1); + f4(192,191,194,193,m1); + f4(131,130,126,125,m1); + f4(131,125,124,132,m1); + f4(79,82,81,80,m1); + f4(2,6,5,4,m1); + f4(35,37,21,36,m1); + f4(113,49,132,116,m1); + f4(175,174,171,168,m1); + f4(206,205,193,96,m1); + f4(228,97,256,225,m1); + f4(339,338,199,335,m1); + f4(270,341,340,34,m1); + f4(347,348,344,346,m1); + f4(363,379,377,378,m1); + f4(455,458,474,391,m1); + f4(517,510,513,516,m1); + f4(548,438,535,547,m1); + f4(598,439,570,567,m1); + f4(541,680,681,677,m1); + f4(612,376,682,683,m1); + f4(673,674,675,676,m1); + f4(665,666,667,668,m1); + f4(660,657,655,656,m1); + f4(658,654,655,657,m1); + f4(654,658,659,653,m1); + f4(653,659,660,656,m1); + f4(636,633,631,632,m1); + f4(634,630,631,633,m1); + f4(630,634,635,629,m1); + f4(629,635,636,632,m1); + f4(613,614,615,616,m1); + f4(345,611,378,612,m1); + f4(601,523,599,600,m1); + f4(585,586,588,584,m1); + f4(561,558,559,560,m1); + f4(546,547,535,545,m1); + f4(526,527,528,529,m1); + f4(515,516,513,514,m1); + f4(497,498,494,496,m1); + f4(410,496,494,495,m1); + f4(494,498,491,492,m1); + f4(482,491,499,502,m1); + f4(471,472,469,470,m1); + f4(465,469,472,468,m1); + f4(463,464,465,462,m1); + f4(460,461,458,459,m1); + f4(445,446,382,444,m1); + f4(431,429,426,430,m1); + f4(641,425,426,644,m1); + f4(420,421,424,419,m1); + f4(418,415,416,417,m1); + f4(404,643,402,403,m1); + f4(431,396,428,429,m1); + f4(393,394,391,392,m1); + f4(390,391,394,389,m1); + f4(395,396,431,383,m1); + f4(368,381,382,446,m1); + f4(380,368,369,370,m1); + f4(362,367,368,380,m1); + f4(348,361,362,363,m1); + f4(356,353,351,352,m1); + f4(354,350,351,353,m1); + f4(350,354,355,349,m1); + f4(349,355,356,352,m1); + f4(344,345,342,343,m1); + f4(333,332,331,334,m1); + f4(325,324,323,326,m1); + f4(313,315,318,314,m1); + f4(313,312,316,315,m1); + f4(317,316,312,311,m1); + f4(318,317,311,314,m1); + f4(289,291,294,290,m1); + f4(289,288,292,291,m1); + f4(293,292,288,287,m1); + f4(294,293,287,290,m1); + f4(271,274,273,272,m1); + f4(3,270,36,269,m1); + f4(257,181,259,258,m1); + f4(243,242,246,244,m1); + f4(219,218,217,216,m1); + f4(204,203,193,205,m1); + f4(191,190,195,194,m1); + f4(184,187,186,185,m1); + f4(173,172,171,174,m1); + f4(155,154,152,156,m1); + f4(68,153,152,154,m1); + f4(152,150,149,156,m1); + f4(140,160,157,149,m1); + f4(126,130,129,128,m1); + f4(123,126,128,127,m1); + f4(121,120,123,122,m1); + f4(116,119,118,117,m1); + f4(103,102,40,104,m1); + f4(89,88,84,87,m1); + f4(299,302,84,83,m1); + f4(82,79,78,77,m1); + f4(76,75,74,73,m1); + f4(66,65,301,300,m1); + f4(62,61,60,301,m1); + f4(89,87,86,54,m1); + f4(47,52,51,50,m1); + f4(48,47,50,49,m1); + f4(53,41,89,54,m1); + f4(26,104,40,39,m1); + f4(38,28,27,26,m1); + f4(20,38,26,25,m1); + f4(6,21,20,19,m1); + f4(9,11,14,10,m1); + f4(9,8,12,11,m1); + f4(13,12,8,7,m1); + f4(14,13,7,10,m1); + f4(0,3,2,1,m1); + f4(2,4,346,344,m2); + f4(6,2,344,348,m2); + f4(5,6,348,347,m2); + f4(4,5,347,346,m2); + f4(319,661,664,322,m2); + f4(322,664,663,321,m2); + f4(321,663,662,320,m2); + f4(320,662,661,319,m2); + f4(318,315,657,660,m2); + f4(317,318,660,659,m2); + f4(316,317,659,658,m2); + f4(315,316,658,657,m2); + f4(311,653,656,314,m2); + f4(314,656,655,313,m2); + f4(313,655,654,312,m2); + f4(312,654,653,311,m2); + f4(310,307,649,652,m2); + f4(309,310,652,651,m2); + f4(308,309,651,650,m2); + f4(307,308,650,649,m2); + f4(15,357,360,18,m2); + f4(18,360,359,17,m2); + f4(17,359,358,16,m2); + f4(16,358,357,15,m2); + f4(14,11,353,356,m2); + f4(13,14,356,355,m2); + f4(12,13,355,354,m2); + f4(11,12,354,353,m2); + f4(306,303,645,648,m2); + f4(305,306,648,647,m2); + f4(304,305,647,646,m2); + f4(303,304,646,645,m2); + f4(7,349,352,10,m2); + f4(10,352,351,9,m2); + f4(9,351,350,8,m2); + f4(8,350,349,7,m2); + f4(299,641,644,302,m2); + f4(302,644,643,301,m2); + f4(301,643,642,300,m2); + f4(300,642,641,299,m2); + f4(334,331,673,676,m2); + f4(333,334,676,675,m2); + f4(332,333,675,674,m2); + f4(331,332,674,673,m2); + f4(326,323,665,668,m2); + f4(325,326,668,667,m2); + f4(324,325,667,666,m2); + f4(323,324,666,665,m2); + f4(330,327,669,672,m2); + f4(329,330,672,671,m2); + f4(328,329,671,670,m2); + f4(327,328,670,669,m2); + f4(295,637,640,298,m2); + f4(298,640,639,297,m2); + f4(297,639,638,296,m2); + f4(296,638,637,295,m2); + f4(294,291,633,636,m2); + f4(293,294,636,635,m2); + f4(292,293,635,634,m2); + f4(291,292,634,633,m2); + f4(287,629,632,290,m2); + f4(290,632,631,289,m2); + f4(289,631,630,288,m2); + f4(288,630,629,287,m2); + f4(282,284,626,624,m2); + f4(286,282,624,628,m2); + f4(285,286,628,627,m2); + f4(284,285,627,626,m2); + f4(273,277,619,615,m2); + f4(283,273,615,625,m2); + f4(282,283,625,624,m2); + f4(281,282,624,623,m2); + f4(280,281,623,622,m2); + f4(279,280,622,621,m2); + f4(278,279,621,620,m2); + f4(277,278,620,619,m2); + f4(271,613,618,276,m2); + f4(275,276,618,617,m2); + f4(274,275,617,616,m2); + f4(273,274,616,615,m2); + f4(272,273,615,614,m2); + f4(271,272,614,613,m2); + f4(3,0,342,345,m2); + f4(2,3,345,344,m2); + f4(1,2,344,343,m2); + f4(0,1,343,342,m2); + f4(270,3,345,612,m2); + f4(36,270,612,378,m2); + f4(269,36,378,611,m2); + f4(3,269,611,345,m2); + f4(34,340,682,376,m2); + f4(270,34,376,612,m2); + f4(341,270,612,683,m2); + f4(340,341,683,682,m2); + f4(268,610,369,27,m2); + f4(267,609,610,268,m2); + f4(30,372,609,267,m2); + f4(27,369,372,30,m2); + f4(259,260,602,601,m2); + f4(266,259,601,608,m2); + f4(265,266,608,607,m2); + f4(264,265,607,606,m2); + f4(182,264,606,524,m2); + f4(263,182,524,605,m2); + f4(88,263,605,430,m2); + f4(262,88,430,604,m2); + f4(261,262,604,603,m2); + f4(260,261,603,602,m2); + f4(181,257,599,523,m2); + f4(259,181,523,601,m2); + f4(258,259,601,600,m2); + f4(257,258,600,599,m2); + f4(256,97,439,598,m2); + f4(225,256,598,567,m2); + f4(228,225,567,570,m2); + f4(97,228,570,439,m2); + f4(252,594,591,249,m2); + f4(256,249,591,598,m2); + f4(255,256,598,597,m2); + f4(98,255,597,440,m2); + f4(101,98,440,443,m2); + f4(254,101,443,596,m2); + f4(253,254,596,595,m2); + f4(252,253,595,594,m2); + f4(239,242,584,581,m2); + f4(251,239,581,593,m2); + f4(241,251,593,583,m2); + f4(224,241,583,566,m2); + f4(250,224,566,592,m2); + f4(249,250,592,591,m2); + f4(248,249,591,590,m2); + f4(247,248,590,589,m2); + f4(246,247,589,588,m2); + f4(245,246,588,587,m2); + f4(31,245,587,373,m2); + f4(244,31,373,586,m2); + f4(33,244,586,375,m2); + f4(243,33,375,585,m2); + f4(243,585,584,242,m2); + f4(222,235,577,564,m2); + f4(241,222,564,583,m2); + f4(240,241,583,582,m2); + f4(239,240,582,581,m2); + f4(238,239,581,580,m2); + f4(238,580,579,237,m2); + f4(236,237,579,578,m2); + f4(235,236,578,577,m2); + f4(231,232,574,573,m2); + f4(234,231,573,576,m2); + f4(233,234,576,575,m2); + f4(232,233,575,574,m2); + f4(218,229,571,560,m2); + f4(231,218,560,573,m2); + f4(230,231,573,572,m2); + f4(229,230,572,571,m2); + f4(208,210,552,550,m2); + f4(228,208,550,570,m2); + f4(227,228,570,569,m2); + f4(226,227,569,568,m2); + f4(225,226,568,567,m2); + f4(224,225,567,566,m2); + f4(223,224,566,565,m2); + f4(222,223,565,564,m2); + f4(222,564,563,221,m2); + f4(220,221,563,562,m2); + f4(219,220,562,561,m2); + f4(218,219,561,560,m2); + f4(217,218,560,559,m2); + f4(216,217,559,558,m2); + f4(215,216,558,557,m2); + f4(214,215,557,556,m2); + f4(213,214,556,555,m2); + f4(212,213,555,554,m2); + f4(211,212,554,553,m2); + f4(210,211,553,552,m2); + f4(206,207,549,548,m2); + f4(209,206,548,551,m2); + f4(208,209,551,550,m2); + f4(207,208,550,549,m2); + f4(193,203,545,535,m2); + f4(96,193,535,438,m2); + f4(206,96,438,548,m2); + f4(205,206,548,547,m2); + f4(204,205,547,546,m2); + f4(203,204,546,545,m2); + f4(197,200,542,539,m2); + f4(202,197,539,544,m2); + f4(201,202,544,543,m2); + f4(200,201,543,542,m2); + f4(199,196,538,541,m2); + f4(198,199,541,540,m2); + f4(197,198,540,539,m2); + f4(196,197,539,538,m2); + f4(335,199,541,677,m2); + f4(339,335,677,681,m2); + f4(338,339,681,680,m2); + f4(199,338,680,541,m2); + f4(186,335,677,528,m2); + f4(337,186,528,679,m2); + f4(336,337,679,678,m2); + f4(335,336,678,677,m2); + f4(178,183,525,520,m2); + f4(195,178,520,537,m2); + f4(195,537,536,194,m2); + f4(193,194,536,535,m2); + f4(192,193,535,534,m2); + f4(191,192,534,533,m2); + f4(190,191,533,532,m2); + f4(189,190,532,531,m2); + f4(189,531,530,188,m2); + f4(187,188,530,529,m2); + f4(186,187,529,528,m2); + f4(185,186,528,527,m2); + f4(184,185,527,526,m2); + f4(183,184,526,525,m2); + f4(80,176,518,422,m2); + f4(182,80,422,524,m2); + f4(181,182,524,523,m2); + f4(180,181,523,522,m2); + f4(179,180,522,521,m2); + f4(178,179,521,520,m2); + f4(177,178,520,519,m2); + f4(176,177,519,518,m2); + f4(168,171,513,510,m2); + f4(175,168,510,517,m2); + f4(174,175,517,516,m2); + f4(173,174,516,515,m2); + f4(172,173,515,514,m2); + f4(171,172,514,513,m2); + f4(170,512,420,78,m2); + f4(169,511,512,170,m2); + f4(168,510,511,169,m2); + f4(78,420,510,168,m2); + f4(146,165,507,488,m2); + f4(167,146,488,509,m2); + f4(166,167,509,508,m2); + f4(165,166,508,507,m2); + f4(163,164,506,505,m2); + f4(69,163,505,411,m2); + f4(72,69,411,414,m2); + f4(164,72,414,506,m2); + f4(153,161,503,495,m2); + f4(163,153,495,505,m2); + f4(162,163,505,504,m2); + f4(161,162,504,503,m2); + f4(140,149,491,482,m2); + f4(160,140,482,502,m2); + f4(159,160,502,501,m2); + f4(158,159,501,500,m2); + f4(157,158,500,499,m2); + f4(156,157,499,498,m2); + f4(155,156,498,497,m2); + f4(154,155,497,496,m2); + f4(68,154,496,410,m2); + f4(153,68,410,495,m2); + f4(152,153,495,494,m2); + f4(151,152,494,493,m2); + f4(150,151,493,492,m2); + f4(150,492,491,149,m2); + f4(129,133,475,471,m2); + f4(148,129,471,490,m2); + f4(147,148,490,489,m2); + f4(146,147,489,488,m2); + f4(145,146,488,487,m2); + f4(144,145,487,486,m2); + f4(143,144,486,485,m2); + f4(142,143,485,484,m2); + f4(141,142,484,483,m2); + f4(140,141,483,482,m2); + f4(136,140,482,478,m2); + f4(139,136,478,481,m2); + f4(138,139,481,480,m2); + f4(137,138,480,479,m2); + f4(136,137,479,478,m2); + f4(135,136,478,477,m2); + f4(134,135,477,476,m2); + f4(133,134,476,475,m2); + f4(113,116,458,455,m2); + f4(49,113,455,391,m2); + f4(132,49,391,474,m2); + f4(131,132,474,473,m2); + f4(131,473,472,130,m2); + f4(129,130,472,471,m2); + f4(128,129,471,470,m2); + f4(128,470,469,127,m2); + f4(123,127,469,465,m2); + f4(126,123,465,468,m2); + f4(125,126,468,467,m2); + f4(124,125,467,466,m2); + f4(123,124,466,465,m2); + f4(122,123,465,464,m2); + f4(121,122,464,463,m2); + f4(120,121,463,462,m2); + f4(119,120,462,461,m2); + f4(118,119,461,460,m2); + f4(117,118,460,459,m2); + f4(116,117,459,458,m2); + f4(107,108,450,449,m2); + f4(115,107,449,457,m2); + f4(114,115,457,456,m2); + f4(43,114,456,385,m2); + f4(43,385,455,113,m2); + f4(112,113,455,454,m2); + f4(111,112,454,453,m2); + f4(110,111,453,452,m2); + f4(109,110,452,451,m2); + f4(108,109,451,450,m2); + f4(39,105,447,381,m2); + f4(107,39,381,449,m2); + f4(106,107,449,448,m2); + f4(105,106,448,447,m2); + f4(26,39,381,368,m2); + f4(104,26,368,446,m2); + f4(103,104,446,445,m2); + f4(102,103,445,444,m2); + f4(101,102,444,443,m2); + f4(100,101,443,442,m2); + f4(99,100,442,441,m2); + f4(98,99,441,440,m2); + f4(97,98,440,439,m2); + f4(96,97,439,438,m2); + f4(95,96,438,437,m2); + f4(94,95,437,436,m2); + f4(93,94,436,435,m2); + f4(92,93,435,434,m2); + f4(91,92,434,433,m2); + f4(90,91,433,432,m2); + f4(90,432,431,89,m2); + f4(88,89,431,430,m2); + f4(84,88,430,426,m2); + f4(87,84,426,429,m2); + f4(86,87,429,428,m2); + f4(85,86,428,427,m2); + f4(84,85,427,426,m2); + f4(84,426,425,83,m2); + f4(82,83,425,424,m2); + f4(81,82,424,423,m2); + f4(80,81,423,422,m2); + f4(80,422,421,79,m2); + f4(78,79,421,420,m2); + f4(77,78,420,419,m2); + f4(76,77,419,418,m2); + f4(75,76,418,417,m2); + f4(74,75,417,416,m2); + f4(73,74,416,415,m2); + f4(72,73,415,414,m2); + f4(71,72,414,413,m2); + f4(70,71,413,412,m2); + f4(69,70,412,411,m2); + f4(68,69,411,410,m2); + f4(67,68,410,409,m2); + f4(66,67,409,408,m2); + f4(65,66,408,407,m2); + f4(64,65,407,406,m2); + f4(63,64,406,405,m2); + f4(62,63,405,404,m2); + f4(61,62,404,403,m2); + f4(60,61,403,402,m2); + f4(59,60,402,401,m2); + f4(58,59,401,400,m2); + f4(57,58,400,399,m2); + f4(56,57,399,398,m2); + f4(55,56,398,397,m2); + f4(54,55,397,396,m2); + f4(53,54,396,395,m2); + f4(52,53,395,394,m2); + f4(51,52,394,393,m2); + f4(50,51,393,392,m2); + f4(50,392,391,49,m2); + f4(48,49,391,390,m2); + f4(47,48,390,389,m2); + f4(46,47,389,388,m2); + f4(45,46,388,387,m2); + f4(44,45,387,386,m2); + f4(43,44,386,385,m2); + f4(42,43,385,384,m2); + f4(42,384,383,41,m2); + f4(40,41,383,382,m2); + f4(40,382,381,39,m2); + f4(20,25,367,362,m2); + f4(38,20,362,380,m2); + f4(37,38,380,379,m2); + f4(21,37,379,363,m2); + f4(36,21,363,378,m2); + f4(35,36,378,377,m2); + f4(34,35,377,376,m2); + f4(33,34,376,375,m2); + f4(32,33,375,374,m2); + f4(31,32,374,373,m2); + f4(30,31,373,372,m2); + f4(29,30,372,371,m2); + f4(28,29,371,370,m2); + f4(27,28,370,369,m2); + f4(26,27,369,368,m2); + f4(26,368,367,25,m2); + f4(24,366,361,19,m2); + f4(23,365,366,24,m2); + f4(22,364,365,23,m2); + f4(19,361,364,22,m2); + f4(6,19,361,348,m2); + f4(21,6,348,363,m2); + f4(20,21,363,362,m2); + f4(19,20,362,361,m2); this.computeCentroids(); this.computeNormals(); @@ -1440,15 +1442,15 @@ var Qrcode = function () { } - function f3( a, b, c, color ) { + function f3( a, b, c, material ) { - scope.faces.push( new THREE.Face3( a, b, c, null, new THREE.Color(color) ) ); + scope.faces.push( new THREE.Face3( a, b, c, null, material ) ); } - function f4( a, b, c, d, color ) { + function f4( a, b, c, d, material ) { - scope.faces.push( new THREE.Face4( a, b, c, d, null, new THREE.Color(color) ) ); + scope.faces.push( new THREE.Face4( a, b, c, d, null, material ) ); } diff --git a/examples/geometry_cube.html b/examples/geometry_cube.html index ef247fe5..1b0e7c80 100644 --- a/examples/geometry_cube.html +++ b/examples/geometry_cube.html @@ -74,10 +74,10 @@ for (var i = 0; i < geometry.faces.length; i++) { - geometry.faces[i].color.setRGBA( Math.random() * 0.5, Math.random() * 0.5 + 0.5, Math.random() * 0.5 + 0.5, 1 ); + geometry.faces[i].material = [ new THREE.MeshColorFillMaterial( Math.random() * 0xffffff, 1 ) ]; } - cube = new THREE.Mesh(geometry, new THREE.MeshFaceColorFillMaterial() ); + cube = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial() ); cube.position.y = 150; scene.addObject( cube ); diff --git a/examples/geometry_earth.html b/examples/geometry_earth.html index 0427c497..90b31b50 100644 --- a/examples/geometry_earth.html +++ b/examples/geometry_earth.html @@ -98,7 +98,7 @@ canvas.width = 32; canvas.height = 32; - var material = new THREE.MeshBitmapUVMappingMaterial( canvas ); + var material = new THREE.MeshBitmapMaterial( canvas ); var image = new Image(); diff --git a/examples/geometry_terrain.html b/examples/geometry_terrain.html index a570c04f..1dd44541 100644 --- a/examples/geometry_terrain.html +++ b/examples/geometry_terrain.html @@ -145,7 +145,7 @@ var heightMap = height( 1024, 1024 ); var textureMap = shadow( heightMap ); - var material = new THREE.MeshBitmapUVMappingMaterial( textureMap ); + var material = new THREE.MeshBitmapMaterial( textureMap ); var quality = 20; var quality1 = quality + 1; diff --git a/examples/geometry_vr.html b/examples/geometry_vr.html index e39e6644..7b9e79c1 100644 --- a/examples/geometry_vr.html +++ b/examples/geometry_vr.html @@ -121,7 +121,7 @@ function loadTexture( path ) { - var material = new THREE.MeshBitmapUVMappingMaterial( texture_placeholder ); + var material = new THREE.MeshBitmapMaterial( texture_placeholder ); var texture = new Image(); diff --git a/examples/hci_clickcube.html b/examples/hci_clickcube.html index bfa0880f..b30780c4 100644 --- a/examples/hci_clickcube.html +++ b/examples/hci_clickcube.html @@ -37,11 +37,10 @@ - + - - + @@ -115,33 +114,33 @@ geometry = new ClickCube( 200, 200, 200, function ( s, c, o, f, p ) { - f.color.setRGBA( Math.random() * 0.5, Math.random() * 0.5, Math.random() * 0.5, opacity ); + f.material = [ new THREE.MeshColorFillMaterial( Math.random() * 0xffffff, opacity ) ]; document.getElementById( "msg" ).innerHTML = "Click detected at " + p; }); for (var i = 0; i < geometry.faces.length; i++) { - geometry.faces[i].color.setRGBA( Math.random() * 0.5, Math.random() * 0.5, Math.random() * 0.5, opacity ); + geometry.faces[i].material = [ new THREE.MeshColorFillMaterial( Math.random() * 0xffffff, opacity ) ]; } - cube = new THREE.Mesh( geometry, new THREE.MeshFaceColorFillMaterial() ); + cube = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() ); cube.position.y = 150; scene.addObject(cube); geometry2 = new ClickCube( 100, 100, 100, function ( s, c, o, f, p ) { - f.color.setRGBA( Math.random() * 0.5, Math.random() * 0.5, Math.random() * 0.5, opacity ); + f.material = [ new THREE.MeshColorFillMaterial( Math.random() * 0xffffff, opacity ) ]; document.getElementById( "msg" ).innerHTML = "Click detected at " + p; }); for (var i = 0; i < geometry2.faces.length; i++) { - geometry2.faces[i].color.setRGBA( Math.random() * 0.5, Math.random() * 0.5, Math.random() * 0.5, opacity ); + geometry2.faces[i].material = [ new THREE.MeshColorFillMaterial( Math.random() * 0xffffff, opacity ) ]; } - - cube2 = new THREE.Mesh( geometry2, new THREE.MeshFaceColorFillMaterial() ); + + cube2 = new THREE.Mesh( geometry2, new THREE.MeshFaceMaterial() ); cube2.position.y = 150; cube2.position.z = 200; scene.addObject(cube2); - + // Plane renderer = new THREE.CanvasRenderer(); renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); diff --git a/examples/lights_test.html b/examples/lights_test.html index ba04feb0..0420320e 100644 --- a/examples/lights_test.html +++ b/examples/lights_test.html @@ -39,11 +39,10 @@
- - diff --git a/examples/materials_test.html b/examples/materials_test.html index 0673c4cd..f51a4b0b 100644 --- a/examples/materials_test.html +++ b/examples/materials_test.html @@ -69,11 +69,10 @@ - + - - + @@ -221,14 +220,6 @@ geometry = new Female02( "obj/female02" ); - // full-mesh wireframe overlay - //geometry.materials.push ( new THREE.MeshColorStrokeMaterial(0xff0000, 1, 1.5) ); - - // full-mesh color overlay - var colorOverlay = new THREE.MeshColorFillMaterial(0xff0000, 0.5) - colorOverlay.decalIndex = 4; - geometry.materials.push ( colorOverlay ); - // PROCEDURAL TEXTURES (decals) var x1 = document.createElement( "canvas" ); @@ -258,18 +249,26 @@ xc2.fillRect(i*4, 5, 2, 54); } - var xm1 = new THREE.MeshBitmapUVMappingMaterial( x1 ); - xm1.loaded = 1; - xm1.decalIndex = 0; // index of the original UV mapped material + var xm1 = new THREE.MeshBitmapMaterial( x1 ); + xm1.loaded = 1; // this is procedurally generated texture - var xm2 = new THREE.MeshBitmapUVMappingMaterial( x2 ); - xm2.loaded = 1; - xm2.decalIndex = 1; // index of the original UV mapped material + var xm2 = new THREE.MeshBitmapMaterial( x2 ); + xm2.loaded = 1; // this is procedurally generated texture - geometry.materials.push ( xm1 ); - geometry.materials.push ( xm2 ); + geometry.materials[0].push ( xm1 ); // goes to faces with material 0 + geometry.materials[1].push ( xm2 ); // goes to faces with material 1 + + geometry.materials[4].push ( new THREE.MeshColorFillMaterial(0xff0000, 0.5) ); - zmesh = new THREE.Mesh( geometry, geometry.materials, 1 ); + var materials = [ new THREE.MeshFaceMaterial() ]; + + // full-mesh wireframe overlay + //materials.push( new THREE.MeshColorStrokeMaterial(0xff0000, 1, 1.5) ); + + // full-mesh color overlay + //materials.push( new THREE.MeshColorFillMaterial(0xff0000, 0.5) ); + + zmesh = new THREE.Mesh( geometry, materials, 1 ); zmesh.position.x = -80; zmesh.position.z = 50; zmesh.position.y = FLOOR; @@ -321,7 +320,7 @@ xc.font = "50pt arial bold"; xc.fillText(i, 10, 64); - var xm = new THREE.MeshBitmapUVMappingMaterial( x ); + var xm = new THREE.MeshBitmapMaterial( x ); xm.loaded = 1; mesh = new THREE.Mesh( new Plane( size, size ), xm ); diff --git a/examples/materials_video.html b/examples/materials_video.html index 817b1557..6ba7cb42 100644 --- a/examples/materials_video.html +++ b/examples/materials_video.html @@ -83,7 +83,7 @@ textureContext.fillStyle = '#000000'; textureContext.fillRect( 0, 0, 480, 204 ); - var material = new THREE.MeshBitmapUVMappingMaterial( texture ); + var material = new THREE.MeshBitmapMaterial( texture ); textureReflection = document.createElement( 'canvas' ); textureReflection.width = 480; @@ -97,7 +97,7 @@ textureReflectionGradient.addColorStop( 0.2, 'rgba(240, 240, 240, 1)' ); textureReflectionGradient.addColorStop( 1, 'rgba(240, 240, 240, 0.8)' ); - var materialReflection = new THREE.MeshBitmapUVMappingMaterial( textureReflection ); + var materialReflection = new THREE.MeshBitmapMaterial( textureReflection ); // diff --git a/examples/obj/female02/female02.js b/examples/obj/female02/female02.js index f0844889..d11f29c2 100644 --- a/examples/obj/female02/female02.js +++ b/examples/obj/female02/female02.js @@ -15859,18 +15859,18 @@ var Female02 = function ( urlbase ) { scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); } - function f3( a, b, c, material ) { - var color = material_color(material); - scope.faces.push( new THREE.Face3( a, b, c, null, new THREE.Color(color), material ) ); + function f3( a, b, c, mi ) { + var material = scope.materials[ mi ]; + scope.faces.push( new THREE.Face3( a, b, c, null, material ) ); } - function f4( a, b, c, d, material ) { - var color = material_color(material); - scope.faces.push( new THREE.Face4( a, b, c, d, null, new THREE.Color(color), material ) ); + function f4( a, b, c, d, mi ) { + var material = scope.materials[ mi ]; + scope.faces.push( new THREE.Face4( a, b, c, d, null, material ) ); } - function f3n( a, b, c, material, n1, n2, n3 ) { - var color = material_color(material); + function f3n( a, b, c, mi, n1, n2, n3 ) { + var material = scope.materials[ mi ]; var n1x = normals[n1][0]; var n1y = normals[n1][1]; var n1z = normals[n1][2]; @@ -15882,11 +15882,11 @@ var Female02 = function ( urlbase ) { var n3z = normals[n3][2]; scope.faces.push( new THREE.Face3( a, b, c, [new THREE.Vector3( n1x, n1y, n1z ), new THREE.Vector3( n2x, n2y, n2z ), new THREE.Vector3( n3x, n3y, n3z )], - new THREE.Color(color), material ) ); + material ) ); } - function f4n( a, b, c, d, material, n1, n2, n3, n4 ) { - var color = material_color(material); + function f4n( a, b, c, d, mi, n1, n2, n3, n4 ) { + var material = scope.materials[ mi ]; var n1x = normals[n1][0]; var n1y = normals[n1][1]; var n1z = normals[n1][2]; @@ -15901,7 +15901,7 @@ var Female02 = function ( urlbase ) { var n4z = normals[n4][2]; scope.faces.push( new THREE.Face4( a, b, c, d, [new THREE.Vector3( n1x, n1y, n1z ), new THREE.Vector3( n2x, n2y, n2z ), new THREE.Vector3( n3x, n3y, n3z ), new THREE.Vector3( n4x, n4y, n4z )], - new THREE.Color(color), material ) ); + material ) ); } function uv( u1, v1, u2, v2, u3, v3, u4, v4 ) { @@ -15916,7 +15916,7 @@ var Female02 = function ( urlbase ) { function init_materials() { scope.materials = []; for(var i=0; i - - @@ -161,7 +160,7 @@ xc.fillStyle = "#555"; xc.fillRect(96, 96, 32, 32); - var xm = new THREE.MeshBitmapUVMappingMaterial( x ); + var xm = new THREE.MeshBitmapMaterial( x ); xm.loaded = 1; geometry = new Plane( 100, 100, 15, 10 ); @@ -245,7 +244,7 @@ // MESH geometry = new Male02( "obj/male02" ); - zmesh = new THREE.Mesh( geometry, geometry.materials, 1 ); + zmesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial(), 1 ); zmesh.position.x = 90; zmesh.position.z = 50; zmesh.position.y = FLOOR; @@ -264,7 +263,7 @@ // MESH geometry = new Female02( "obj/female02" ); - zmesh = new THREE.Mesh( geometry, geometry.materials, 1 ); + zmesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial(), 1 ); zmesh.position.x = -80; zmesh.position.z = 50; zmesh.position.y = FLOOR; @@ -317,7 +316,7 @@ xc.font = "50pt arial bold"; xc.fillText(i, 10, 64); - var xm = new THREE.MeshBitmapUVMappingMaterial( x ); + var xm = new THREE.MeshBitmapMaterial( x ); xm.loaded = 1; mesh = new THREE.Mesh( new Plane( size, size ), xm ); diff --git a/examples/shader_test.html b/examples/shader_test.html index 2d5a0259..eed4e5c7 100644 --- a/examples/shader_test.html +++ b/examples/shader_test.html @@ -69,11 +69,10 @@ - + - - + diff --git a/examples/test.html b/examples/test.html index 1c029a5f..cb1e00f1 100644 --- a/examples/test.html +++ b/examples/test.html @@ -33,16 +33,15 @@ - + - + - - + @@ -105,7 +104,7 @@ // QRCODE - qrcode = mesh = new THREE.Mesh(new Qrcode(), new THREE.MeshFaceColorFillMaterial()); + qrcode = mesh = new THREE.Mesh( new Qrcode(), new THREE.MeshFaceMaterial() ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; mesh.updateMatrix(); scene.add(mesh); @@ -156,22 +155,22 @@ var v = new THREE.Vector3( Math.random() * 1000 - 500, Math.random() * 1000 - 500, Math.random() * 1000 - 500 ); - var v0 = new THREE.Vertex( new THREE.Vector3(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) ); - var v1 = new THREE.Vertex( new THREE.Vector3(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) ); - var v2 = new THREE.Vertex( new THREE.Vector3(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) ); + var v0 = new THREE.Vertex( new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) ); + var v1 = new THREE.Vertex( new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) ); + var v2 = new THREE.Vertex( new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 ) ); v0.position.addSelf( v ); v1.position.addSelf( v ); v2.position.addSelf( v ); - var face = new THREE.Face3( geometry.vertices.push( v0 ) - 1, geometry.vertices.push( v1 ) - 1, geometry.vertices.push( v2 ) - 1 ); - face.color.setRGBA( Math.random(), Math.random(), Math.random(), 1 ); + var face = new THREE.Face3( geometry.vertices.push( v0 ) - 1, geometry.vertices.push( v1 ) - 1, geometry.vertices.push( v2 ) - 1, null, new THREE.MeshColorFillMaterial( Math.random() * 0xffffff ) ); + geometry.faces.push( face ); } geometry.computeNormals(); - mesh = new THREE.Mesh( geometry, new THREE.MeshFaceColorFillMaterial() ); + mesh = new THREE.Mesh( geometry, [ new THREE.MeshFaceMaterial(), new THREE.MeshColorStrokeMaterial( 0xff0000, 0.5, 10 ) ] ); mesh.doubleSided = true; mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; scene.add(mesh); diff --git a/src/core/Face3.js b/src/core/Face3.js index 6cb268a8..40a5551a 100644 --- a/src/core/Face3.js +++ b/src/core/Face3.js @@ -2,32 +2,22 @@ * @author mr.doob / http://mrdoob.com/ */ -THREE.Face3 = function ( a, b, c, normal, color, material ) { +THREE.Face3 = function ( a, b, c, normal, material ) { this.a = a; this.b = b; this.c = c; this.centroid = new THREE.Vector3(); - this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3(); - - this.color = color || new THREE.Color( 0xff000000 ); + this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3(); + this.vertexNormals = normal instanceof Array ? normal : []; - this.vertexNormals = normal instanceof Array ? normal : []; - this.material = material || 0; + this.material = material instanceof Array ? material : [ material ]; }; THREE.Face3.prototype = { - // TODO: Dupe? (Geometry/computeCentroid) - - getCenter : function(){ - - return this.a.clone().addSelf( this.b ).addSelf( this.c ).divideScalar( 3 ); - - }, - toString: function () { return 'THREE.Face3 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' )'; diff --git a/src/core/Face4.js b/src/core/Face4.js index ac4ecd22..5c4981ea 100644 --- a/src/core/Face4.js +++ b/src/core/Face4.js @@ -2,7 +2,7 @@ * @author mr.doob / http://mrdoob.com/ */ -THREE.Face4 = function ( a, b, c, d, normal, color, material ) { +THREE.Face4 = function ( a, b, c, d, normal, material ) { this.a = a; this.b = b; @@ -11,25 +11,15 @@ THREE.Face4 = function ( a, b, c, d, normal, color, material ) { this.centroid = new THREE.Vector3(); this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3(); + this.vertexNormals = normal instanceof Array ? normal : []; - this.color = color || new THREE.Color( 0xff000000 ); + this.material = material instanceof Array ? material : [ material ]; - this.vertexNormals = normal instanceof Array ? normal : []; - this.material = material || 0; - }; THREE.Face4.prototype = { - // TODO: Dupe? (Geometry/computeCentroid) - - getCenter : function(){ - - return this.a.clone().addSelf( this.b ).addSelf( this.c ).addSelf( this.d ).divideScalar( 4 ); - - }, - toString: function () { return 'THREE.Face4 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' ' + this.d + ' )'; diff --git a/src/core/Geometry.js b/src/core/Geometry.js index ed67a205..c93b5516 100644 --- a/src/core/Geometry.js +++ b/src/core/Geometry.js @@ -58,86 +58,97 @@ THREE.Geometry.prototype = { face = this.faces[ f ]; - if ( useVertexNormals && face.vertexNormals.length ) { - - // set face normal to average of vertex normals - - cb.set( 0, 0, 0 ); + if ( useVertexNormals && face.vertexNormals.length ) { - for ( n = 0, nl = face.normal.length; n < nl; n++ ) { - cb.x += face.vertexNormals[n].x; - cb.y += face.vertexNormals[n].y; - cb.z += face.vertexNormals[n].z; - } + cb.set( 0, 0, 0 ); - cb.x /= 3; - cb.y /= 3; - cb.z /= 3; + for ( n = 0, nl = face.normal.length; n < nl; n++ ) { - if ( !cb.isZero() ) { + cd.addSelf( face.vertexNormals[n] ); - cb.normalize(); + } - } + cb.divideScalar( 3 ); - face.normal.copy( cb ); - } - - else { - - vA = this.vertices[ face.a ]; - vB = this.vertices[ face.b ]; - vC = this.vertices[ face.c ]; + if ( ! cb.isZero() ) { - cb.sub( vC.position, vB.position ); - ab.sub( vA.position, vB.position ); - cb.crossSelf( ab ); + cb.normalize(); - if ( !cb.isZero() ) { + } - cb.normalize(); + face.normal.copy( cb ); - } + } else { - face.normal.copy( cb ); - } + vA = this.vertices[ face.a ]; + vB = this.vertices[ face.b ]; + vC = this.vertices[ face.c ]; + + cb.sub( vC.position, vB.position ); + ab.sub( vA.position, vB.position ); + cb.crossSelf( ab ); + + if ( !cb.isZero() ) { + + cb.normalize(); + + } + + face.normal.copy( cb ); + + } } }, - - computeBoundingBox: function ( ) { - - if ( this.vertices.length > 0 ) { - - 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 ] }; - - var v, vl; - - for ( v = 1, vl = this.vertices.length; v < vl; v++ ) { - vertex = this.vertices[ v ]; - - if ( vertex.position.x < this.bbox.x[ 0 ] ) - this.bbox.x[ 0 ] = vertex.position.x; - else if ( vertex.position.x > this.bbox.x[ 1 ] ) - this.bbox.x[ 1 ] = vertex.position.x; + computeBoundingBox: function ( ) { - if ( vertex.position.y < this.bbox.y[ 0 ] ) - this.bbox.y[ 0 ] = vertex.position.y; - else if ( vertex.position.y > this.bbox.y[ 1 ] ) - this.bbox.y[ 1 ] = vertex.position.y; + if ( this.vertices.length > 0 ) { - if ( vertex.position.z < this.bbox.z[ 0 ] ) - this.bbox.z[ 0 ] = vertex.position.z; - else if ( vertex.position.z > this.bbox.z[ 1 ] ) - this.bbox.z[ 1 ] = vertex.position.z; + 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 v = 1, vl = this.vertices.length; v < vl; v++ ) { + + vertex = this.vertices[ v ]; + + if ( vertex.position.x < this.bbox.x[ 0 ] ) { + + this.bbox.x[ 0 ] = vertex.position.x; + + } else if ( vertex.position.x > this.bbox.x[ 1 ] ) { + + this.bbox.x[ 1 ] = vertex.position.x; + + } + + if ( vertex.position.y < this.bbox.y[ 0 ] ) { + + this.bbox.y[ 0 ] = vertex.position.y; + + } else if ( vertex.position.y > this.bbox.y[ 1 ] ) { + + this.bbox.y[ 1 ] = vertex.position.y; + + } + + if ( vertex.position.z < this.bbox.z[ 0 ] ) { + + this.bbox.z[ 0 ] = vertex.position.z; + + } else if ( vertex.position.z > this.bbox.z[ 1 ] ) { + + this.bbox.z[ 1 ] = vertex.position.z; + + } + + } + + } + + }, toString: function () { diff --git a/src/materials/MeshBitmapMaterial.js b/src/materials/MeshBitmapMaterial.js new file mode 100644 index 00000000..ff1b76d0 --- /dev/null +++ b/src/materials/MeshBitmapMaterial.js @@ -0,0 +1,22 @@ +/** + * @author mr.doob / http://mrdoob.com/ + */ + +THREE.MeshBitmapMaterial = function ( bitmap, mode ) { + + this.bitmap = bitmap; + this.mode = mode || THREE.MeshBitmapMaterialMode.UVMAPPING; + + this.id = THREE.MeshBitmapMaterialCounter.value++; + + this.toString = function () { + + return 'THREE.MeshBitmapMaterial ( bitmap: ' + this.bitmap + ', mode: ' + this.mode + ', id: ' + this.id + ' )'; + + }; + +}; + +THREE.MeshBitmapMaterialCounter = { value:0 }; + +THREE.MeshBitmapMaterialMode = { UVMAPPING: 0 }; diff --git a/src/materials/MeshBitmapUVMappingMaterial.js b/src/materials/MeshBitmapUVMappingMaterial.js deleted file mode 100644 index 43d5ca50..00000000 --- a/src/materials/MeshBitmapUVMappingMaterial.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @author mr.doob / http://mrdoob.com/ - */ - -THREE.MeshBitmapUVMappingMaterial = function ( bitmap ) { - - this.bitmap = bitmap; - - this.loaded = 0; - this.decalIndex = -1; - - this.toString = function () { - - return 'THREE.MeshBitmapUVMappingMaterial ( bitmap: ' + this.bitmap + ' )'; - - }; - -}; diff --git a/src/materials/MeshFaceColorFillMaterial.js b/src/materials/MeshFaceColorFillMaterial.js deleted file mode 100644 index 35fd395f..00000000 --- a/src/materials/MeshFaceColorFillMaterial.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @author mr.doob / http://mrdoob.com/ - */ - -THREE.MeshFaceColorFillMaterial = function () { - - this.toString = function () { - - return 'THREE.MeshFaceColorFillMaterial ( )'; - - }; - -}; diff --git a/src/materials/MeshFaceColorStrokeMaterial.js b/src/materials/MeshFaceColorStrokeMaterial.js deleted file mode 100644 index 4182b440..00000000 --- a/src/materials/MeshFaceColorStrokeMaterial.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @author mr.doob / http://mrdoob.com/ - */ - -THREE.MeshFaceColorStrokeMaterial = function ( lineWidth ) { - - this.lineWidth = lineWidth || 1; - - this.toString = function () { - - return 'THREE.MeshFaceColorStrokeMaterial ( lineWidth: ' + this.lineWidth + ' )'; - - }; - -}; diff --git a/src/materials/MeshFaceMaterial.js b/src/materials/MeshFaceMaterial.js new file mode 100644 index 00000000..8a9a6206 --- /dev/null +++ b/src/materials/MeshFaceMaterial.js @@ -0,0 +1,13 @@ +/** + * @author mr.doob / http://mrdoob.com/ + */ + +THREE.MeshFaceMaterial = function () { + + this.toString = function () { + + return 'THREE.MeshFaceMaterial'; + + }; + +}; diff --git a/src/objects/Mesh.js b/src/objects/Mesh.js index ac253886..4f2a3ffa 100644 --- a/src/objects/Mesh.js +++ b/src/objects/Mesh.js @@ -14,7 +14,7 @@ THREE.Mesh = function ( geometry, material, normUVs ) { this.overdraw = false; - this.materialFaces = {}; + this.materialFaceGroup = {}; this.sortFacesByMaterial(); if( normUVs ) this.normalizeUVs(); @@ -28,20 +28,50 @@ THREE.Mesh.prototype.constructor = THREE.Mesh; THREE.Mesh.prototype.sortFacesByMaterial = function () { - var f, fl, face, material; + // TODO + + // Should optimize by grouping faces with ColorFill / ColorStroke materials + // which could then use vertex color attributes instead of each being + // in its separate VBO + function materialHash( material ) { + + var i, l, hash_array = []; + + for ( i = 0, l = material.length; i 0; if ( _enableLighting ) { @@ -85,154 +87,109 @@ THREE.SVGRenderer = function () { element = _renderList[ e ]; - for ( m = 0, ml = element.material.length; m < ml; m++ ) { + _bboxRect.empty(); - material = element.material[ m ]; + if ( element instanceof THREE.RenderableParticle ) { - _bboxRect.empty(); + v1x = element.x * _widthHalf; v1y = element.y * -_heightHalf; - if ( element instanceof THREE.RenderableParticle ) { + for ( m = 0, ml = element.material.length; m < ml; m++ ) { - v1x = element.x * _widthHalf; v1y = element.y * -_heightHalf; - size = element.size * _widthHalf; + material = element.material[ m ]; - _bboxRect.set( v1x - size, v1y - size, v1x + size, v1y + size ); - - if ( !_clipRect.instersects( _bboxRect ) ) { - - continue; - - } - - svgNode = getCircleNode( circleCount++ ); - svgNode.setAttribute( 'cx', v1x ); - svgNode.setAttribute( 'cy', v1y ); - svgNode.setAttribute( 'r', size ); - - } else if ( element instanceof THREE.RenderableFace3 ) { - - v1x = element.v1.x * _widthHalf; v1y = element.v1.y * -_heightHalf; - v2x = element.v2.x * _widthHalf; v2y = element.v2.y * -_heightHalf; - v3x = element.v3.x * _widthHalf; v3y = element.v3.y * -_heightHalf; - - _bboxRect.addPoint( v1x, v1y ); - _bboxRect.addPoint( v2x, v2y ); - _bboxRect.addPoint( v3x, v3y ); - - if ( !_clipRect.instersects( _bboxRect ) ) { - - continue; - - } - - svgNode = getPathNode( pathCount++ ); - svgNode.setAttribute( 'd', 'M ' + v1x + ' ' + v1y + ' L ' + v2x + ' ' + v2y + ' L ' + v3x + ',' + v3y + 'z' ); - - } else if ( element instanceof THREE.RenderableFace4 ) { - - v1x = element.v1.x * _widthHalf; v1y = element.v1.y * -_heightHalf; - v2x = element.v2.x * _widthHalf; v2y = element.v2.y * -_heightHalf; - v3x = element.v3.x * _widthHalf; v3y = element.v3.y * -_heightHalf; - v4x = element.v4.x * _widthHalf; v4y = element.v4.y * -_heightHalf; - - _bboxRect.addPoint( v1x, v1y ); - _bboxRect.addPoint( v2x, v2y ); - _bboxRect.addPoint( v3x, v3y ); - _bboxRect.addPoint( v4x, v4y ); - - if ( !_clipRect.instersects( _bboxRect) ) { - - continue; - - } - - svgNode = getPathNode( pathCount++ ); - svgNode.setAttribute( 'd', 'M ' + v1x + ' ' + v1y + ' L ' + v2x + ' ' + v2y + ' L ' + v3x + ',' + v3y + ' L ' + v4x + ',' + v4y + 'z' ); + renderParticle( v1x, v1y, element, material, scene ); } + } else if ( element instanceof THREE.RenderableLine ) { - // TODO: Move out of materials loop + - if ( material instanceof THREE.MeshColorFillMaterial ) { + } else if ( element instanceof THREE.RenderableFace3 ) { - if ( _enableLighting ) { + v1x = element.v1.x * _widthHalf; v1y = element.v1.y * -_heightHalf; + v2x = element.v2.x * _widthHalf; v2y = element.v2.y * -_heightHalf; + v3x = element.v3.x * _widthHalf; v3y = element.v3.y * -_heightHalf; - _light.copyRGB( _ambientLight ); - calculateFaceLight( scene, element, _light ); + _bboxRect.addPoint( v1x, v1y ); + _bboxRect.addPoint( v2x, v2y ); + _bboxRect.addPoint( v3x, v3y ); - _color.copyRGBA( material.color ); - _color.multiplySelfRGB( _light ); - _color.updateStyleString(); + if ( !_clipRect.instersects( _bboxRect ) ) { - } else { - - _color = material.color; - - } - - svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString ); - - } else if ( material instanceof THREE.MeshFaceColorFillMaterial ) { - - if ( _enableLighting ) { - - _light.copyRGB( _ambientLight ); - calculateFaceLight( scene, element, _light ); - - _color.copyRGBA( element.color ); - _color.multiplySelfRGB( _light ); - _color.updateStyleString(); - - } else { - - _color = element.color; - - } - - svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString ); - - } else if ( material instanceof THREE.MeshColorStrokeMaterial ) { - - if ( _enableLighting ) { - - _light.copyRGB( _ambientLight ); - calculateFaceLight( scene, element, _light ); - - _color.copyRGBA( material.color ); - _color.multiplySelfRGB( _light ); - _color.updateStyleString(); - - } else { - - _color = material.color; - - } - - svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round' ); - - } else if ( material instanceof THREE.MeshFaceColorStrokeMaterial ) { - - if ( _enableLighting ) { - - _light.copyRGB( _ambientLight ); - calculateFaceLight( scene, element, _light ); - - _color.copyRGBA( element.color ); - _color.multiplySelfRGB( _light ); - _color.updateStyleString(); - - } else { - - _color = element.color; - - } - - svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round' ); + continue; } - _svg.appendChild( svgNode ); + m = 0; ml = element.meshMaterial.length; + + while ( m < ml ) { + + material = element.meshMaterial[ m ++ ]; + + if ( material instanceof THREE.MeshFaceMaterial ) { + + fm = 0; fml = element.faceMaterial.length; + + while ( fm < fml ) { + + material = element.faceMaterial[ fm ++ ]; + + renderFace3( v1x, v1y, v2x, v2y, v3x, v3y, element, material, scene ); + + } + + continue; + + } + + renderFace3( v1x, v1y, v2x, v2y, v3x, v3y, element, material, scene ); + + } + + } else if ( element instanceof THREE.RenderableFace4 ) { + + v1x = element.v1.x * _widthHalf; v1y = element.v1.y * -_heightHalf; + v2x = element.v2.x * _widthHalf; v2y = element.v2.y * -_heightHalf; + v3x = element.v3.x * _widthHalf; v3y = element.v3.y * -_heightHalf; + v4x = element.v4.x * _widthHalf; v4y = element.v4.y * -_heightHalf; + + _bboxRect.addPoint( v1x, v1y ); + _bboxRect.addPoint( v2x, v2y ); + _bboxRect.addPoint( v3x, v3y ); + _bboxRect.addPoint( v4x, v4y ); + + if ( !_clipRect.instersects( _bboxRect) ) { + + continue; + + } + + m = 0; ml = element.meshMaterial.length; + + while ( m < ml ) { + + material = element.meshMaterial[ m ++ ]; + + if ( material instanceof THREE.MeshFaceMaterial ) { + + fm = 0; fml = element.faceMaterial.length; + + while ( fm < fml ) { + + material = element.faceMaterial[ fm ++ ]; + + renderFace4( v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y, element, material, scene ); + + } + + continue; + + } + + renderFace4( v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y, element, material, scene ); + + } } @@ -262,6 +219,32 @@ THREE.SVGRenderer = function () { } + function calculateLight( scene, element, color ) { + + var l, ll, light; + + for ( l = 0, ll = scene.lights.length; l < ll; l++ ) { + + light = scene.lights[ l ]; + + if ( light instanceof THREE.DirectionalLight ) { + + color.r += light.color.r; + color.g += light.color.g; + color.b += light.color.b; + + } else if ( light instanceof THREE.PointLight ) { + + color.r += light.color.r; + color.g += light.color.g; + color.b += light.color.b; + + } + + } + + } + function calculateFaceLight( scene, element, color ) { var l, ll, light, amount; @@ -303,7 +286,143 @@ THREE.SVGRenderer = function () { } - function getPathNode( id ) { + function renderParticle ( v1x, v1y, element, material, scene ) { + + _svgNode = getCircleNode( _circleCount++ ); + _svgNode.setAttribute( 'cx', v1x ); + _svgNode.setAttribute( 'cy', v1y ); + _svgNode.setAttribute( 'r', element.scale.x * _widthHalf ); + + if ( material instanceof THREE.ParticleCircleMaterial ) { + + if ( _enableLighting ) { + + _light.copyRGB( _ambientLight ); + calculateLight( scene, element, _light ); + + _color.copyRGBA( material.color ); + _color.multiplySelfRGB( _light ); + _color.updateStyleString(); + + } else { + + _color = material.color; + + } + + _svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString ); + + } + + _svg.appendChild( _svgNode ); + + } + + function renderLine ( ) { + + + + } + + function renderFace3 ( v1x, v1y, v2x, v2y, v3x, v3y, element, material, scene ) { + + _svgNode = getPathNode( _pathCount ++ ); + _svgNode.setAttribute( 'd', 'M ' + v1x + ' ' + v1y + ' L ' + v2x + ' ' + v2y + ' L ' + v3x + ',' + v3y + 'z' ); + + if ( material instanceof THREE.MeshColorFillMaterial ) { + + if ( _enableLighting ) { + + _light.copyRGB( _ambientLight ); + calculateFaceLight( scene, element, _light ); + + _color.copyRGBA( material.color ); + _color.multiplySelfRGB( _light ); + _color.updateStyleString(); + + } else { + + _color = material.color; + + } + + _svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString ); + + } else if ( material instanceof THREE.MeshColorStrokeMaterial ) { + + if ( _enableLighting ) { + + _light.copyRGB( _ambientLight ); + calculateFaceLight( scene, element, _light ); + + _color.copyRGBA( material.color ); + _color.multiplySelfRGB( _light ); + _color.updateStyleString(); + + } else { + + _color = material.color; + + } + + _svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round' ); + + } + + _svg.appendChild( _svgNode ); + + } + + function renderFace4 ( v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y, element, material, scene ) { + + _svgNode = getPathNode( _pathCount ++ ); + _svgNode.setAttribute( 'd', 'M ' + v1x + ' ' + v1y + ' L ' + v2x + ' ' + v2y + ' L ' + v3x + ',' + v3y + ' L ' + v4x + ',' + v4y + 'z' ); + + if ( material instanceof THREE.MeshColorFillMaterial ) { + + if ( _enableLighting ) { + + _light.copyRGB( _ambientLight ); + calculateFaceLight( scene, element, _light ); + + _color.copyRGBA( material.color ); + _color.multiplySelfRGB( _light ); + _color.updateStyleString(); + + } else { + + _color = material.color; + + } + + _svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString ); + + } else if ( material instanceof THREE.MeshColorStrokeMaterial ) { + + if ( _enableLighting ) { + + _light.copyRGB( _ambientLight ); + calculateFaceLight( scene, element, _light ); + + _color.copyRGBA( material.color ); + _color.multiplySelfRGB( _light ); + _color.updateStyleString(); + + } else { + + _color = material.color; + + } + + _svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.lineWidth + '; stroke-linecap: round; stroke-linejoin: round' ); + + } + + _svg.appendChild( _svgNode ); + + } + + function getPathNode ( id ) { if ( _svgPathPool[ id ] == null ) { @@ -323,7 +442,7 @@ THREE.SVGRenderer = function () { } - function getCircleNode( id ) { + function getCircleNode ( id ) { if ( _svgCirclePool[id] == null ) { diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index e9b74ef9..65f380f9 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -16,7 +16,7 @@ THREE.WebGLRenderer = function () { initProgram(); // material constants used in shader - var COLORFILL = 0, COLORSTROKE = 1, FACECOLORFILL = 2, FACECOLORSTROKE = 3, BITMAP = 4, PHONG = 5; + var COLORFILL = 0, COLORSTROKE = 1, BITMAP = 2, PHONG = 3; this.setSize = function ( width, height ) { @@ -68,29 +68,26 @@ THREE.WebGLRenderer = function () { } }; - this.createBuffers = function ( object, materialIndex ) { + this.createBuffers = function ( object, mf ) { - var materialFace = object.materialFaces[ materialIndex ]; - var material = object.material[ materialIndex ]; + var materialFaceGroup = object.materialFaceGroup[ mf ]; var faceArray = []; var lineArray = []; var vertexArray = []; - var colorArray = []; var normalArray = []; var uvArray = []; var vertexIndex = 0; - var f, fl, fi, face, faceColor, vertexNormals, normal, uv, v1, v2, v3, v4; + var f, fl, fi, face, vertexNormals, normal, uv, v1, v2, v3, v4; - for ( f = 0, fl = materialFace.faces.length; f < fl; f++ ) { + for ( f = 0, fl = materialFaceGroup.faces.length; f < fl; f++ ) { - fi = materialFace.faces[f]; + fi = materialFaceGroup.faces[f]; face = object.geometry.faces[ fi ]; - faceColor = face.color; vertexNormals = face.vertexNormals; normal = face.normal; uv = object.geometry.uvs[ fi ]; @@ -120,10 +117,6 @@ THREE.WebGLRenderer = function () { } - colorArray.push( faceColor.r, faceColor.g, faceColor.b, faceColor.a ); - colorArray.push( faceColor.r, faceColor.g, faceColor.b, faceColor.a ); - colorArray.push( faceColor.r, faceColor.g, faceColor.b, faceColor.a ); - if ( uv ) { uvArray.push( uv[0].u, uv[0].v ); @@ -171,11 +164,6 @@ THREE.WebGLRenderer = function () { } - colorArray.push( faceColor.r, faceColor.g, faceColor.b, faceColor.a ); - colorArray.push( faceColor.r, faceColor.g, faceColor.b, faceColor.a ); - colorArray.push( faceColor.r, faceColor.g, faceColor.b, faceColor.a ); - colorArray.push( faceColor.r, faceColor.g, faceColor.b, faceColor.a ); - if ( uv ) { uvArray.push( uv[0].u, uv[0].v ); @@ -206,48 +194,146 @@ THREE.WebGLRenderer = function () { } - materialFace.__webGLVertexBuffer = _gl.createBuffer(); - _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFace.__webGLVertexBuffer ); + materialFaceGroup.__webGLVertexBuffer = _gl.createBuffer(); + _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFaceGroup.__webGLVertexBuffer ); _gl.bufferData( _gl.ARRAY_BUFFER, new Float32Array( vertexArray ), _gl.STATIC_DRAW ); - materialFace.__webGLNormalBuffer = _gl.createBuffer(); - _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFace.__webGLNormalBuffer ); + materialFaceGroup.__webGLNormalBuffer = _gl.createBuffer(); + _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFaceGroup.__webGLNormalBuffer ); _gl.bufferData( _gl.ARRAY_BUFFER, new Float32Array( normalArray ), _gl.STATIC_DRAW ); - materialFace.__webGLColorBuffer = _gl.createBuffer(); - _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFace.__webGLColorBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, new Float32Array( colorArray ), _gl.STATIC_DRAW ); - - materialFace.__webGLUVBuffer = _gl.createBuffer(); - _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFace.__webGLUVBuffer ); + materialFaceGroup.__webGLUVBuffer = _gl.createBuffer(); + _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFaceGroup.__webGLUVBuffer ); _gl.bufferData( _gl.ARRAY_BUFFER, new Float32Array( uvArray ), _gl.STATIC_DRAW ); - materialFace.__webGLFaceBuffer = _gl.createBuffer(); - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, materialFace.__webGLFaceBuffer ); + materialFaceGroup.__webGLFaceBuffer = _gl.createBuffer(); + _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, materialFaceGroup.__webGLFaceBuffer ); _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, new Uint16Array( faceArray ), _gl.STATIC_DRAW ); - materialFace.__webGLLineBuffer = _gl.createBuffer(); - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, materialFace.__webGLLineBuffer ); + materialFaceGroup.__webGLLineBuffer = _gl.createBuffer(); + _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, materialFaceGroup.__webGLLineBuffer ); _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, new Uint16Array( lineArray ), _gl.STATIC_DRAW ); - materialFace.__webGLFaceCount = faceArray.length; - materialFace.__webGLLineCount = lineArray.length; + materialFaceGroup.__webGLFaceCount = faceArray.length; + materialFaceGroup.__webGLLineCount = lineArray.length; - } + }; + + this.renderBuffer = function ( material, materialFaceGroup ) { + + if ( material instanceof THREE.MeshPhongMaterial ) { + + mAmbient = material.ambient; + mDiffuse = material.diffuse; + mSpecular = material.specular; + + _gl.uniform4f( _program.mAmbient, mAmbient.r, mAmbient.g, mAmbient.b, material.opacity ); + _gl.uniform4f( _program.mDiffuse, mDiffuse.r, mDiffuse.g, mDiffuse.b, material.opacity ); + _gl.uniform4f( _program.mSpecular, mSpecular.r, mSpecular.g, mSpecular.b, material.opacity ); + + _gl.uniform1f( _program.mShininess, material.shininess ); + + _gl.uniform1i( _program.material, PHONG ); + + } else if ( material instanceof THREE.MeshColorFillMaterial ) { + + color = material.color; + _gl.uniform4f( _program.uniformColor, color.r * color.a, color.g * color.a, color.b * color.a, color.a ); + + _gl.uniform1i( _program.material, COLORFILL ); + + } else if ( material instanceof THREE.MeshColorStrokeMaterial ) { + + lineWidth = material.lineWidth; + + color = material.color; + _gl.uniform4f( _program.uniformColor, color.r * color.a, color.g * color.a, color.b * color.a, color.a ); + + _gl.uniform1i( _program.material, COLORSTROKE ); + + } else if ( material instanceof THREE.MeshBitmapMaterial ) { + + if ( !material.__webGLTexture && material.loaded ) { + + material.__webGLTexture = _gl.createTexture(); + _gl.bindTexture( _gl.TEXTURE_2D, material.__webGLTexture ); + _gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, material.bitmap ) ; + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, _gl.LINEAR ); + //_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR_MIPMAP_NEAREST ); + _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR_MIPMAP_LINEAR ); + _gl.generateMipmap( _gl.TEXTURE_2D ); + _gl.bindTexture( _gl.TEXTURE_2D, null ); + + } + + _gl.activeTexture( _gl.TEXTURE0 ); + _gl.bindTexture( _gl.TEXTURE_2D, material.__webGLTexture ); + _gl.uniform1i( _program.diffuse, 0 ); + + _gl.uniform1i( _program.material, BITMAP ); + + } + + + // vertices + _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFaceGroup.__webGLVertexBuffer ); + _gl.vertexAttribPointer( _program.position, 3, _gl.FLOAT, false, 0, 0 ); + + // normals + _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFaceGroup.__webGLNormalBuffer ); + _gl.vertexAttribPointer( _program.normal, 3, _gl.FLOAT, false, 0, 0 ); + + // uvs + + if ( material instanceof THREE.MeshBitmapMaterial ) { + + _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFaceGroup.__webGLUVBuffer ); + + _gl.enableVertexAttribArray( _program.uv ); + _gl.vertexAttribPointer( _program.uv, 2, _gl.FLOAT, false, 0, 0 ); + + } + else { + + _gl.disableVertexAttribArray( _program.uv ); + + } + + // render triangles + + if ( material instanceof THREE.MeshBitmapMaterial || + material instanceof THREE.MeshColorFillMaterial || + material instanceof THREE.MeshPhongMaterial ) { + + _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, materialFaceGroup.__webGLFaceBuffer ); + _gl.drawElements( _gl.TRIANGLES, materialFaceGroup.__webGLFaceCount, _gl.UNSIGNED_SHORT, 0 ); + + } + + // render lines + + else if ( material instanceof THREE.MeshColorStrokeMaterial ) { + + _gl.lineWidth( lineWidth ); + _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, materialFaceGroup.__webGLLineBuffer ); + _gl.drawElements( _gl.LINES, materialFaceGroup.__webGLLineCount, _gl.UNSIGNED_SHORT, 0 ); + + } + }; this.renderMesh = function ( object, camera ) { - var m, ml, mf, material, materialFace, fi, lineWidth, mAmbient, mDiffuse, mSpecular; + var i, l, m, ml, mf, material, meshMaterial, materialFaceGroup, fi, lineWidth, mAmbient, mDiffuse, mSpecular; // create separate VBOs per material - for (var mf in object.materialFaces ) { - - materialFace = object.materialFaces[ mf ]; - material = object.material[ mf ]; - if( !material ) continue; + + for ( var mf in object.materialFaceGroup ) { + materialFaceGroup = object.materialFaceGroup[ mf ]; + // initialise on the first access - if( !materialFace.__webGLVertexBuffer ) { + + if( ! materialFaceGroup.__webGLVertexBuffer ) { this.createBuffers( object, mf ); @@ -255,135 +341,20 @@ THREE.WebGLRenderer = function () { for ( m = 0, ml = object.material.length; m < ml; m++ ) { - material = object.material[ m ]; + meshMaterial = object.material[ m ]; - // these materials can be either the only material for whole mesh - // or if they are overlays in multimaterials, they apply only to - // group of faces with single material (specified by decalIndex) - - if ( ( material instanceof THREE.MeshBitmapUVMappingMaterial || - material instanceof THREE.MeshFaceColorFillMaterial || - material instanceof THREE.MeshColorFillMaterial - ) - && - ! ( m == mf || mf == material.decalIndex ) ) { + if ( meshMaterial instanceof THREE.MeshFaceMaterial ) { - continue; - - } - - if ( material instanceof THREE.MeshPhongMaterial ) { - - mAmbient = material.ambient; - mDiffuse = material.diffuse; - mSpecular = material.specular; - - _gl.uniform4f( _program.mAmbient, mAmbient.r, mAmbient.g, mAmbient.b, material.opacity ); - _gl.uniform4f( _program.mDiffuse, mDiffuse.r, mDiffuse.g, mDiffuse.b, material.opacity ); - _gl.uniform4f( _program.mSpecular, mSpecular.r, mSpecular.g, mSpecular.b, material.opacity ); - - _gl.uniform1f( _program.mShininess, material.shininess ); - - _gl.uniform1i( _program.material, PHONG ); - - } else if ( material instanceof THREE.MeshColorFillMaterial ) { - - color = material.color; - _gl.uniform4f( _program.uniformColor, color.r * color.a, color.g * color.a, color.b * color.a, color.a ); - - _gl.uniform1i( _program.material, COLORFILL ); - - } else if ( material instanceof THREE.MeshColorStrokeMaterial ) { - - lineWidth = material.lineWidth; - - color = material.color; - _gl.uniform4f( _program.uniformColor, color.r * color.a, color.g * color.a, color.b * color.a, color.a ); - - _gl.uniform1i( _program.material, COLORSTROKE ); - - } else if ( material instanceof THREE.MeshFaceColorFillMaterial ) { - - _gl.uniform1i( _program.material, FACECOLORFILL ); - - } else if ( material instanceof THREE.MeshFaceColorStrokeMaterial ) { - - lineWidth = material.lineWidth; - - _gl.uniform1i( _program.material, FACECOLORSTROKE ); - - } else if ( material instanceof THREE.MeshBitmapUVMappingMaterial ) { - - if ( !material.__webGLTexture && material.loaded ) { - - material.__webGLTexture = _gl.createTexture(); - _gl.bindTexture( _gl.TEXTURE_2D, material.__webGLTexture ); - _gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, material.bitmap ) ; - _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, _gl.LINEAR ); - //_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR_MIPMAP_NEAREST ); - _gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR_MIPMAP_LINEAR ); - _gl.generateMipmap( _gl.TEXTURE_2D ); - _gl.bindTexture( _gl.TEXTURE_2D, null ); + for ( i = 0, l = materialFaceGroup.material.length; i < l; i++ ) { + material = materialFaceGroup.material[ i ]; + this.renderBuffer( material, materialFaceGroup ); } - _gl.activeTexture( _gl.TEXTURE0 ); - _gl.bindTexture( _gl.TEXTURE_2D, material.__webGLTexture ); - _gl.uniform1i( _program.diffuse, 0 ); + } else { - _gl.uniform1i( _program.material, BITMAP ); - - } - - - // vertices - _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFace.__webGLVertexBuffer ); - _gl.vertexAttribPointer( _program.position, 3, _gl.FLOAT, false, 0, 0 ); - - // normals - _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFace.__webGLNormalBuffer ); - _gl.vertexAttribPointer( _program.normal, 3, _gl.FLOAT, false, 0, 0 ); - - // colors - _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFace.__webGLColorBuffer ); - _gl.vertexAttribPointer( _program.color, 4, _gl.FLOAT, false, 0, 0 ); - - // uvs - - if ( material instanceof THREE.MeshBitmapUVMappingMaterial ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, materialFace.__webGLUVBuffer ); - - _gl.enableVertexAttribArray( _program.uv ); - _gl.vertexAttribPointer( _program.uv, 2, _gl.FLOAT, false, 0, 0 ); - - } - else { - - _gl.disableVertexAttribArray( _program.uv ); - - } - - // render triangles - - if ( material instanceof THREE.MeshBitmapUVMappingMaterial || - material instanceof THREE.MeshFaceColorFillMaterial || - material instanceof THREE.MeshColorFillMaterial || - material instanceof THREE.MeshPhongMaterial ) { - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, materialFace.__webGLFaceBuffer ); - _gl.drawElements( _gl.TRIANGLES, materialFace.__webGLFaceCount, _gl.UNSIGNED_SHORT, 0 ); - - } - - // render lines - - else if ( material instanceof THREE.MeshColorStrokeMaterial || - material instanceof THREE.MeshFaceColorStrokeMaterial ) { - - _gl.lineWidth( lineWidth ); - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, materialFace.__webGLLineBuffer ); - _gl.drawElements( _gl.LINES, materialFace.__webGLLineCount, _gl.UNSIGNED_SHORT, 0 ); + material = meshMaterial; + this.renderBuffer( material, materialFaceGroup ); } @@ -513,12 +484,11 @@ THREE.WebGLRenderer = function () { "uniform vec4 uniformColor;", "varying vec2 vertexUv;", - "varying vec4 vertexColor;", "varying vec3 lightWeighting;", "varying vec3 vNormal;", - "uniform int material;", // 0 - ColorFill, 1 - ColorStroke, 2 - FaceColorFill, 3 - FaceColorStroke, 4 - Bitmap, 5 - Phong + "uniform int material;", // 0 - ColorFill, 1 - ColorStroke, 2 - Bitmap, 3 - Phong "uniform vec4 mAmbient;", "uniform vec4 mDiffuse;", @@ -533,7 +503,7 @@ THREE.WebGLRenderer = function () { // Blinn-Phong // based on o3d example - "if(material==5) { ", + "if(material==3) { ", "vec3 lightVectorPoint = normalize(pLightVectorPoint);", "vec3 lightVectorDir = normalize(pLightVectorDirection);", @@ -571,18 +541,10 @@ THREE.WebGLRenderer = function () { "gl_FragColor = vec4((pointLight.xyz + dirLight.xyz) * lightWeighting, 1.0);", // Bitmap: texture - "} else if(material==4) {", + "} else if(material==2) {", "vec4 texelColor = texture2D(diffuse, vertexUv);", "gl_FragColor = vec4(texelColor.rgb * lightWeighting, texelColor.a);", - // FaceColorStroke: wireframe using vertex color - "} else if(material==3) {", - "gl_FragColor = vec4(vertexColor.rgb * lightWeighting, vertexColor.a);", - - // FaceColorFill: triangle using vertex color - "} else if(material==2) {", - "gl_FragColor = vec4(vertexColor.rgb * lightWeighting, vertexColor.a);", - // ColorStroke: wireframe using uniform color "} else if(material==1) {", "gl_FragColor = vec4(uniformColor.rgb * lightWeighting, uniformColor.a);", @@ -598,7 +560,6 @@ THREE.WebGLRenderer = function () { _gl.attachShader( _program, getShader( "vertex", [ "attribute vec3 position;", "attribute vec3 normal;", - "attribute vec4 color;", "attribute vec2 uv;", "uniform bool enableLighting;", @@ -653,7 +614,6 @@ THREE.WebGLRenderer = function () { "}", "vNormal = transformedNormal;", - "vertexColor = color;", "vertexUv = uv;", "gl_Position = projectionMatrix * mvPosition;", @@ -694,9 +654,6 @@ THREE.WebGLRenderer = function () { _program.cameraPosition = _gl.getUniformLocation(_program, 'cameraPosition'); - _program.color = _gl.getAttribLocation( _program, "color" ); - _gl.enableVertexAttribArray( _program.color ); - _program.position = _gl.getAttribLocation( _program, "position" ); _gl.enableVertexAttribArray( _program.position ); diff --git a/utils/Builder.py b/utils/Builder.py index b7939062..112f7c8e 100644 --- a/utils/Builder.py +++ b/utils/Builder.py @@ -29,11 +29,10 @@ files.append('objects/Line.js') files.append('objects/Mesh.js') files.append('materials/LineColorMaterial.js') files.append('materials/MeshPhongMaterial.js') -files.append('materials/MeshBitmapUVMappingMaterial.js') +files.append('materials/MeshBitmapMaterial.js') files.append('materials/MeshColorFillMaterial.js') files.append('materials/MeshColorStrokeMaterial.js') -files.append('materials/MeshFaceColorFillMaterial.js') -files.append('materials/MeshFaceColorStrokeMaterial.js') +files.append('materials/MeshFaceMaterial.js') files.append('materials/ParticleBitmapMaterial.js') files.append('materials/ParticleCircleMaterial.js') files.append('materials/ParticleDOMMaterial.js') diff --git a/utils/BuilderCanvas.py b/utils/BuilderCanvas.py index dd3fa17e..db19bc05 100644 --- a/utils/BuilderCanvas.py +++ b/utils/BuilderCanvas.py @@ -29,11 +29,10 @@ files.append('objects/Line.js') files.append('objects/Mesh.js') files.append('materials/LineColorMaterial.js') files.append('materials/MeshPhongMaterial.js') -files.append('materials/MeshBitmapUVMappingMaterial.js') +files.append('materials/MeshBitmapMaterial.js') files.append('materials/MeshColorFillMaterial.js') files.append('materials/MeshColorStrokeMaterial.js') -files.append('materials/MeshFaceColorFillMaterial.js') -files.append('materials/MeshFaceColorStrokeMaterial.js') +files.append('materials/MeshFaceMaterial.js') files.append('materials/ParticleBitmapMaterial.js') files.append('materials/ParticleCircleMaterial.js') files.append('scenes/Scene.js') diff --git a/utils/BuilderDebug.py b/utils/BuilderDebug.py index f4d2b626..a168acde 100644 --- a/utils/BuilderDebug.py +++ b/utils/BuilderDebug.py @@ -29,11 +29,10 @@ files.append('objects/Line.js') files.append('objects/Mesh.js') files.append('materials/LineColorMaterial.js') files.append('materials/MeshPhongMaterial.js') -files.append('materials/MeshBitmapUVMappingMaterial.js') +files.append('materials/MeshBitmapMaterial.js') files.append('materials/MeshColorFillMaterial.js') files.append('materials/MeshColorStrokeMaterial.js') -files.append('materials/MeshFaceColorFillMaterial.js') -files.append('materials/MeshFaceColorStrokeMaterial.js') +files.append('materials/MeshFaceMaterial.js') files.append('materials/ParticleBitmapMaterial.js') files.append('materials/ParticleCircleMaterial.js') files.append('materials/ParticleDOMMaterial.js') diff --git a/utils/BuilderSVG.py b/utils/BuilderSVG.py index 02bbbc52..8ada890b 100644 --- a/utils/BuilderSVG.py +++ b/utils/BuilderSVG.py @@ -27,11 +27,11 @@ files.append('objects/Object3D.js') files.append('objects/Particle.js') files.append('objects/Line.js') files.append('objects/Mesh.js') -files.append('materials/MeshBitmapUVMappingMaterial.js') +files.append('materials/LineColorMaterial.js') +files.append('materials/MeshBitmapMaterial.js') files.append('materials/MeshColorFillMaterial.js') files.append('materials/MeshColorStrokeMaterial.js') -files.append('materials/MeshFaceColorFillMaterial.js') -files.append('materials/MeshFaceColorStrokeMaterial.js') +files.append('materials/MeshFaceMaterial.js') files.append('materials/ParticleBitmapMaterial.js') files.append('materials/ParticleCircleMaterial.js') files.append('scenes/Scene.js') diff --git a/utils/BuilderWebGL.py b/utils/BuilderWebGL.py index 7f92d141..1c158905 100644 --- a/utils/BuilderWebGL.py +++ b/utils/BuilderWebGL.py @@ -29,11 +29,10 @@ files.append('objects/Line.js') files.append('objects/Mesh.js') files.append('materials/LineColorMaterial.js') files.append('materials/MeshPhongMaterial.js') -files.append('materials/MeshBitmapUVMappingMaterial.js') +files.append('materials/MeshBitmapMaterial.js') files.append('materials/MeshColorFillMaterial.js') files.append('materials/MeshColorStrokeMaterial.js') -files.append('materials/MeshFaceColorFillMaterial.js') -files.append('materials/MeshFaceColorStrokeMaterial.js') +files.append('materials/MeshFaceMaterial.js') files.append('materials/ParticleBitmapMaterial.js') files.append('materials/ParticleCircleMaterial.js') files.append('scenes/Scene.js') diff --git a/utils/REVISION b/utils/REVISION index a45fd52c..7273c0fa 100644 --- a/utils/REVISION +++ b/utils/REVISION @@ -1 +1 @@ -24 +25 diff --git a/utils/exporters/convert_obj_threejs.py b/utils/exporters/convert_obj_threejs.py index 9f396e9a..1fb3b200 100644 --- a/utils/exporters/convert_obj_threejs.py +++ b/utils/exporters/convert_obj_threejs.py @@ -163,18 +163,18 @@ var %(name)s = function ( urlbase ) { scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); } - function f3( a, b, c, material ) { - var color = material_color(material); - scope.faces.push( new THREE.Face3( a, b, c, null, new THREE.Color(color), material ) ); + function f3( a, b, c, mi ) { + var material = scope.materials[ mi ]; + scope.faces.push( new THREE.Face3( a, b, c, null, material ) ); } - function f4( a, b, c, d, material ) { - var color = material_color(material); - scope.faces.push( new THREE.Face4( a, b, c, d, null, new THREE.Color(color), material ) ); + function f4( a, b, c, d, mi ) { + var material = scope.materials[ mi ]; + scope.faces.push( new THREE.Face4( a, b, c, d, null, material ) ); } - function f3n( a, b, c, material, n1, n2, n3 ) { - var color = material_color(material); + function f3n( a, b, c, mi, n1, n2, n3 ) { + var material = scope.materials[ mi ]; var n1x = normals[n1][0]; var n1y = normals[n1][1]; var n1z = normals[n1][2]; @@ -186,11 +186,11 @@ var %(name)s = function ( urlbase ) { var n3z = normals[n3][2]; scope.faces.push( new THREE.Face3( a, b, c, [new THREE.Vector3( n1x, n1y, n1z ), new THREE.Vector3( n2x, n2y, n2z ), new THREE.Vector3( n3x, n3y, n3z )], - new THREE.Color(color), material ) ); + material ) ); } - function f4n( a, b, c, d, material, n1, n2, n3, n4 ) { - var color = material_color(material); + function f4n( a, b, c, d, mi, n1, n2, n3, n4 ) { + var material = scope.materials[ mi ]; var n1x = normals[n1][0]; var n1y = normals[n1][1]; var n1z = normals[n1][2]; @@ -205,7 +205,7 @@ var %(name)s = function ( urlbase ) { var n4z = normals[n4][2]; scope.faces.push( new THREE.Face4( a, b, c, d, [new THREE.Vector3( n1x, n1y, n1z ), new THREE.Vector3( n2x, n2y, n2z ), new THREE.Vector3( n3x, n3y, n3z ), new THREE.Vector3( n4x, n4y, n4z )], - new THREE.Color(color), material ) ); + material ) ); } function uv( u1, v1, u2, v2, u3, v3, u4, v4 ) { @@ -220,7 +220,7 @@ var %(name)s = function ( urlbase ) { function init_materials() { scope.materials = []; for(var i=0; i