From 66cd1198e303b5b6f8fdda7f4e09459b9f3fd44f Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Thu, 3 Mar 2011 08:31:00 +0000 Subject: [PATCH] Updated examples and utils that used Cube(). --- build/Three.js | 410 +++++++++--------- build/custom/ThreeCanvas.js | 2 +- build/custom/ThreeDOM.js | 2 +- build/custom/ThreeExtras.js | 132 +++--- build/custom/ThreeSVG.js | 2 +- build/custom/ThreeWebGL.js | 2 +- examples/canvas_geometry_cube.html | 4 +- examples/canvas_geometry_panorama.html | 2 +- .../canvas_geometry_panorama_fisheye.html | 2 +- examples/webgl_geometry_minecraft.html | 2 +- examples/webgl_geometry_minecraft_ao.html | 2 +- examples/webgl_lod.html | 9 +- examples/webgl_shader2.html | 2 +- src/extras/SceneUtils.js | 2 +- src/renderers/WebGLRenderer.js | 8 +- 15 files changed, 291 insertions(+), 292 deletions(-) diff --git a/build/Three.js b/build/Three.js index 3ca5692d8c..13d8fbff92 100755 --- a/build/Three.js +++ b/build/Three.js @@ -1,6 +1,6 @@ // Three.js r33 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)}; -THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,f,g,h,k,j;if(c==0)d=f=g=0;else{h=Math.floor(a*6);k=a*6-h;a=c*(1-b);j=c*(1-b*k);b=c*(1-b*(1-k));switch(h){case 1:d=j;f=c;g=a;break;case 2:d=a;f=c;g=b;break;case 3:d=a;f=j;g=c;break;case 4:d=b;f=a;g=c;break;case 5:d=c;f=a;g=j;break;case 6:case 0:d=c;f=b;g=a}}this.r=d;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex(); +THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,f,g,h,j,k;if(c==0)d=f=g=0;else{h=Math.floor(a*6);j=a*6-h;a=c*(1-b);k=c*(1-b*j);b=c*(1-b*(1-j));switch(h){case 1:d=k;f=c;g=a;break;case 2:d=a;f=c;g=b;break;case 3:d=a;f=k;g=c;break;case 4:d=b;f=a;g=c;break;case 5:d=c;f=a;g=k;break;case 6:case 0:d=c;f=b;g=a}}this.r=d;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex(); this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}}; THREE.Vector2=function(a,b){this.set(a||0,b||0)}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ @@ -11,74 +11,74 @@ a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-th this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)}; THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a0&&F>0&&N+F<1}var c,d,f,g,h,k,j,m,o,z, -q,t=a.geometry,B=t.vertices,C=[];c=0;for(d=t.faces.length;cj?d:j;f=f>m?f:m}a()}; -this.add3Points=function(j,m,o,z,q,t){if(k){k=!1;b=jo?j>q?j:q:o>q?o:q;f=m>z?m>t?m:t:z>t?z:t}else{b=jo?j>q?j>d?j:d:q>d?q:d:o>q?o>d?o:d:q>d?q:d;f=m>z?m>t?m>f?m:f:t>f?t:f:z>t?z>f?z:f:t>f?t:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=bj.getRight()? -d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;d+=j;f+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();d=d=0&&Math.min(f,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=!0;f=d=c=b=0;a()};this.isEmpty=function(){return k}}; +THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a0&&G>0&&I+G<1}var c,d,f,g,h,j,k,m,o,z, +q,t=a.geometry,B=t.vertices,D=[];c=0;for(d=t.faces.length;ck?d:k;f=f>m?f:m}a()}; +this.add3Points=function(k,m,o,z,q,t){if(j){j=!1;b=ko?k>q?k:q:o>q?o:q;f=m>z?m>t?m:t:z>t?z:t}else{b=ko?k>q?k>d?k:d:q>d?q:d:o>q?o>d?o:d:q>d?q:d;f=m>z?m>t?m>f?m:f:t>f?t:f:z>t?z>f?z:f:t>f?t:f}a()};this.addRectangle=function(k){if(j){j=!1;b=k.getLeft();c=k.getTop();d=k.getRight();f=k.getBottom()}else{b=bk.getRight()? +d:k.getRight();f=f>k.getBottom()?f:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;d+=k;f+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();d=d=0&&Math.min(f,k.getBottom())-Math.max(c,k.getTop())>=0};this.empty=function(){j=!0;f=d=c=b=0;a()};this.isEmpty=function(){return j}}; THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}}; -THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,o,z,q,t,B,C){this.set(a||1,b||0,c||0,d||0,f||0,g||1,h||0,k||0,j||0,m||0,o||1,z||0,q||0,t||0,B||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,h,k,j,m,o,z,q,t,B,C){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=o;this.n34=z;this.n41=q;this.n42=t;this.n43=B;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1, +THREE.Matrix4=function(a,b,c,d,f,g,h,j,k,m,o,z,q,t,B,D){this.set(a||1,b||0,c||0,d||0,f||0,g||1,h||0,j||0,k||0,m||0,o||1,z||0,q||0,t||0,B||0,D||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,h,j,k,m,o,z,q,t,B,D){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=m;this.n33=o;this.n34=z;this.n41=q;this.n42=t;this.n43=B;this.n44=D;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1, f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n14=a.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n24=a.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31* b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4; -b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,z=a.n32,q=a.n33,t=a.n34,B=a.n41,C=a.n42,F=a.n43,w=a.n44,H=b.n11,u=b.n12,I=b.n13,N=b.n14,e=b.n21,L=b.n22,M=b.n23,V=b.n24,R=b.n31,aa=b.n32,ca=b.n33,J=b.n34;this.n11= -c*H+d*e+f*R;this.n12=c*u+d*L+f*aa;this.n13=c*I+d*M+f*ca;this.n14=c*N+d*V+f*J+g;this.n21=h*H+k*e+j*R;this.n22=h*u+k*L+j*aa;this.n23=h*I+k*M+j*ca;this.n24=h*N+k*V+j*J+m;this.n31=o*H+z*e+q*R;this.n32=o*u+z*L+q*aa;this.n33=o*I+z*M+q*ca;this.n34=o*N+z*V+q*J+t;this.n41=B*H+C*e+F*R;this.n42=B*u+C*L+F*aa;this.n43=B*I+C*M+F*ca;this.n44=B*N+C*V+F*J+w;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,o=a.n24,z=a.n31,q=a.n32,t=a.n33,B=a.n34,C=a.n41,F=a.n42, -w=a.n43;a=a.n44;var H=b.n11,u=b.n12,I=b.n13,N=b.n14,e=b.n21,L=b.n22,M=b.n23,V=b.n24,R=b.n31,aa=b.n32,ca=b.n33,J=b.n34,Y=b.n41,oa=b.n42,ba=b.n43;b=b.n44;this.n11=d*H+f*e+g*R+h*Y;this.n12=d*u+f*L+g*aa+h*oa;this.n13=d*I+f*M+g*ca+h*ba;this.n14=d*N+f*V+g*J+h*b;this.n21=k*H+j*e+m*R+o*Y;this.n22=k*u+j*L+m*aa+o*oa;this.n23=k*I+j*M+m*ca+o*ba;this.n24=k*N+j*V+m*J+o*b;this.n31=z*H+q*e+t*R+B*Y;this.n32=z*u+q*L+t*aa+B*oa;this.n33=z*I+q*M+t*ca+B*ba;this.n34=z*N+q*V+t*J+B*b;this.n41=C*H+F*e+w*R+a*Y;this.n42=C*u+ -F*L+w*aa+a*oa;this.n43=C*I+F*M+w*ca+a*ba;this.n44=C*N+F*V+w*J+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,o=this.n32,z=this.n33,q=this.n34,t=this.n41,B=this.n42,C=this.n43, -F=this.n44,w=a.n11,H=a.n21,u=a.n31,I=a.n12,N=a.n22,e=a.n32,L=a.n13,M=a.n23,V=a.n33,R=a.n14,aa=a.n24;a=a.n34;this.n11=b*w+c*H+d*u;this.n12=b*I+c*N+d*e;this.n13=b*L+c*M+d*V;this.n14=b*R+c*aa+d*a+f;this.n21=g*w+h*H+k*u;this.n22=g*I+h*N+k*e;this.n23=g*L+h*M+k*V;this.n24=g*R+h*aa+k*a+j;this.n31=m*w+o*H+z*u;this.n32=m*I+o*N+z*e;this.n33=m*L+o*M+z*V;this.n34=m*R+o*aa+z*a+q;this.n41=t*w+B*H+C*u;this.n42=t*I+B*N+C*e;this.n43=t*L+B*M+C*V;this.n44=t*R+B*aa+C*a+F;return this},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;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,o=this.n33,z=this.n34,q=this.n41,t=this.n42,B=this.n43,C=this.n44;return d*h*m*q-c*k*m*q-d*g*o*q+b*k*o*q+c*g*z*q-b*h*z*q-d*h*j*t+c*k*j*t+d*f*o*t-a*k*o*t-c*f*z*t+a*h*z*t+ -d*g*j*B-b*k*j*B-d*f*m*B+a*k*m*B+b*f*z*B-a*g*z*B-c*g*j*C+b*h*j*C+c*f*m*C-a*h*m*C-b*f*o*C+a*g*o*C},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;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(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a, +b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,o=a.n31,z=a.n32,q=a.n33,t=a.n34,B=a.n41,D=a.n42,G=a.n43,v=a.n44,E=b.n11,w=b.n12,J=b.n13,I=b.n14,e=b.n21,M=b.n22,N=b.n23,U=b.n24,Q=b.n31,Z=b.n32,ca=b.n33,K=b.n34;this.n11= +c*E+d*e+f*Q;this.n12=c*w+d*M+f*Z;this.n13=c*J+d*N+f*ca;this.n14=c*I+d*U+f*K+g;this.n21=h*E+j*e+k*Q;this.n22=h*w+j*M+k*Z;this.n23=h*J+j*N+k*ca;this.n24=h*I+j*U+k*K+m;this.n31=o*E+z*e+q*Q;this.n32=o*w+z*M+q*Z;this.n33=o*J+z*N+q*ca;this.n34=o*I+z*U+q*K+t;this.n41=B*E+D*e+G*Q;this.n42=B*w+D*M+G*Z;this.n43=B*J+D*N+G*ca;this.n44=B*I+D*U+G*K+v;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,j=a.n21,k=a.n22,m=a.n23,o=a.n24,z=a.n31,q=a.n32,t=a.n33,B=a.n34,D=a.n41,G=a.n42,v= +a.n43;a=a.n44;var E=b.n11,w=b.n12,J=b.n13,I=b.n14,e=b.n21,M=b.n22,N=b.n23,U=b.n24,Q=b.n31,Z=b.n32,ca=b.n33,K=b.n34,W=b.n41,la=b.n42,ba=b.n43;b=b.n44;this.n11=d*E+f*e+g*Q+h*W;this.n12=d*w+f*M+g*Z+h*la;this.n13=d*J+f*N+g*ca+h*ba;this.n14=d*I+f*U+g*K+h*b;this.n21=j*E+k*e+m*Q+o*W;this.n22=j*w+k*M+m*Z+o*la;this.n23=j*J+k*N+m*ca+o*ba;this.n24=j*I+k*U+m*K+o*b;this.n31=z*E+q*e+t*Q+B*W;this.n32=z*w+q*M+t*Z+B*la;this.n33=z*J+q*N+t*ca+B*ba;this.n34=z*I+q*U+t*K+B*b;this.n41=D*E+G*e+v*Q+a*W;this.n42=D*w+G*M+v* +Z+a*la;this.n43=D*J+G*N+v*ca+a*ba;this.n44=D*I+G*U+v*K+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,z=this.n33,q=this.n34,t=this.n41,B=this.n42,D=this.n43,G=this.n44, +v=a.n11,E=a.n21,w=a.n31,J=a.n12,I=a.n22,e=a.n32,M=a.n13,N=a.n23,U=a.n33,Q=a.n14,Z=a.n24;a=a.n34;this.n11=b*v+c*E+d*w;this.n12=b*J+c*I+d*e;this.n13=b*M+c*N+d*U;this.n14=b*Q+c*Z+d*a+f;this.n21=g*v+h*E+j*w;this.n22=g*J+h*I+j*e;this.n23=g*M+h*N+j*U;this.n24=g*Q+h*Z+j*a+k;this.n31=m*v+o*E+z*w;this.n32=m*J+o*I+z*e;this.n33=m*M+o*N+z*U;this.n34=m*Q+o*Z+z*a+q;this.n41=t*v+B*E+D*w;this.n42=t*J+B*I+D*e;this.n43=t*M+B*N+D*U;this.n44=t*Q+B*Z+D*a+G;return this},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;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,m=this.n32,o=this.n33,z=this.n34,q=this.n41,t=this.n42,B=this.n43,D=this.n44;return d*h*m*q-c*j*m*q-d*g*o*q+b*j*o*q+c*g*z*q-b*h*z*q-d*h*k*t+c*j*k*t+d*f*o*t-a*j*o*t-c*f*z*t+a*h*z*t+d*g*k*B-b*j* +k*B-d*f*m*B+a*j*m*B+b*f*z*B-a*g*z*B-c*g*k*D+b*h*k*D+c*f*m*D-a*h*m*D-b*f*o*D+a*g*o*D},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;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(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a, b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1, -0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,k=a.z,j=f*g,m=f*h;this.set(j*g+c,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+c,m*k-d*g,0,j*k-d*h,m*k+d*g,f*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24= -a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=a*c,k=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=k*g+a*d;this.n22=-k*d+a*g;this.n23=-b*f;this.n31=-h*g+b*d;this.n32=h*d+b*g;this.n33=a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13= -b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d}; +0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,j=a.z,k=f*g,m=f*h;this.set(k*g+c,k*h-d*j,k*j+d*h,0,k*h+d*j,m*h+c,m*j-d*g,0,k*j-d*h,m*j+d*g,f*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24= +a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=a*c,j=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-b*f;this.n31=-h*g+b*d;this.n32=h*d+b*g;this.n33=a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,j=d+d;a=b*g;var k=b*h;b*=j;var m=c*h;c*=j;d*=j;g*=f;h*=f;f*=j;this.n11=1-(m+d);this.n12=k-f;this.n13= +b+h;this.n21=k+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d}; THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c}; -THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,z=a.n32,q=a.n33,t=a.n34,B=a.n41,C=a.n42,F=a.n43,w=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*t*C-m*q*C+m*z*F-k*t*F-j*z*w+k*q*w;b.n12=g*q*C-f*t*C-g*z*F+d*t*F+f*z*w-d*q*w;b.n13=f*m*C-g*j*C+g*k*F-d*m*F-f*k*w+d*j*w;b.n14=g*j*z-f*m*z-g*k*q+d*m*q+f*k*t-d*j*t;b.n21=m*q*B-j*t*B-m*o*F+h*t*F+j*o*w-h*q*w;b.n22=f*t*B-g*q*B+g*o*F-c*t*F-f*o*w+c*q*w;b.n23=g*j*B-f*m*B-g*h*F+c*m*F+f*h*w-c*j*w; -b.n24=f*m*o-g*j*o+g*h*q-c*m*q-f*h*t+c*j*t;b.n31=k*t*B-m*z*B+m*o*C-h*t*C-k*o*w+h*z*w;b.n32=g*z*B-d*t*B-g*o*C+c*t*C+d*o*w-c*z*w;b.n33=f*m*B-g*k*B+g*h*C-c*m*C-d*h*w+c*k*w;b.n34=g*k*o-d*m*o-g*h*z+c*m*z+d*h*t-c*k*t;b.n41=j*z*B-k*q*B-j*o*C+h*q*C+k*o*F-h*z*F;b.n42=d*q*B-f*z*B+f*o*C-c*q*C-d*o*F+c*z*F;b.n43=f*k*B-d*j*B-f*h*C+c*j*C+d*h*F-c*k*F;b.n44=d*j*o-f*k*o+f*h*z-c*j*z-d*h*q+c*k*q;b.multiplyScalar(1/a.determinant());return b}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*o;c[8]=a*z;return b}; +THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,o=a.n31,z=a.n32,q=a.n33,t=a.n34,B=a.n41,D=a.n42,G=a.n43,v=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*t*D-m*q*D+m*z*G-j*t*G-k*z*v+j*q*v;b.n12=g*q*D-f*t*D-g*z*G+d*t*G+f*z*v-d*q*v;b.n13=f*m*D-g*k*D+g*j*G-d*m*G-f*j*v+d*k*v;b.n14=g*k*z-f*m*z-g*j*q+d*m*q+f*j*t-d*k*t;b.n21=m*q*B-k*t*B-m*o*G+h*t*G+k*o*v-h*q*v;b.n22=f*t*B-g*q*B+g*o*G-c*t*G-f*o*v+c*q*v;b.n23=g*k*B-f*m*B-g*h*G+c*m*G+f*h*v-c*k*v; +b.n24=f*m*o-g*k*o+g*h*q-c*m*q-f*h*t+c*k*t;b.n31=j*t*B-m*z*B+m*o*D-h*t*D-j*o*v+h*z*v;b.n32=g*z*B-d*t*B-g*o*D+c*t*D+d*o*v-c*z*v;b.n33=f*m*B-g*j*B+g*h*D-c*m*D-d*h*v+c*j*v;b.n34=g*j*o-d*m*o-g*h*z+c*m*z+d*h*t-c*j*t;b.n41=k*z*B-j*q*B-k*o*D+h*q*D+j*o*G-h*z*G;b.n42=d*q*B-f*z*B+f*o*D-c*q*D-d*o*G+c*z*G;b.n43=f*j*B-d*k*B-f*h*D+c*k*D+d*h*G-c*j*G;b.n44=d*k*o-f*j*o+f*h*z-c*k*z-d*h*q+c*j*q;b.multiplyScalar(1/a.determinant());return b}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*j;c[5]=a*k;c[6]=a*m;c[7]=a*o;c[8]=a*z;return b}; THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)}; -THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,j,k,m;h=new THREE.Matrix4;j=b-a;k=c-d;m=g-f;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((b+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((c+d)/k);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1; this.visible=!0}; THREE.Object3D.prototype={addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation); if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0},update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);b=1/this.scale.x;a=1/this.scale.y;var d=1/this.scale.z;this.matrixRotationWorld.n11=this.matrixWorld.n11*b;this.matrixRotationWorld.n21= this.matrixWorld.n21*b;this.matrixRotationWorld.n31=this.matrixWorld.n31*b;this.matrixRotationWorld.n12=this.matrixWorld.n12*a;this.matrixRotationWorld.n22=this.matrixWorld.n22*a;this.matrixRotationWorld.n32=this.matrixWorld.n32*a;this.matrixRotationWorld.n13=this.matrixWorld.n13*d;this.matrixRotationWorld.n23=this.matrixWorld.n23*d;this.matrixRotationWorld.n33=this.matrixWorld.n33*d;this.matrixNeedsUpdate=!1;b=!0}a=0;for(d=this.children.length;a=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c}; +THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,j=d*f;this.w=h*g-j*c;this.x=h*c+j*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*= +-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=b*a+f*g+c*j-d*h;this.y=c*a+f*h+d*g-b*j;this.z=d*a+f*j+b*h-c*g;this.w=f*a-b*g-c*h-d*j;return this}, +multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,j=this.z,k=this.w,m=k*c+h*f-j*d,o=k*d+j*c-g*f,z=k*f+g*d-h*c;c=-g*c-h*d-j*f;b.x=m*k+c*-g+o*-j-z*-h;b.y=o*k+c*-h+z*-g-m*-j;b.z=z*k+c*-j+m*-h-o*-g;return b}}; +THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; THREE.Face3=function(a,b,c,d,f){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]}; THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], +this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;bq.length-2?f:f+1;b[3]=f>q.length-3?f:f+2;j=q[b[0]];m=q[b[1]];o=q[b[2]];z=q[b[3]];h=g*g;k=g*h;c.x=a(j.x,m.x,o.x,z.x,g,h,k);c.y=a(j.y,m.y,o.y,z.y,g,h,k);c.z=a(j.z,m.z,o.z,z.z,g,h,k);return c}}; +THREE.Spline=function(){function a(q,t,B,D,G,v,E){q=(B-q)*0.5;D=(D-t)*0.5;return(2*(t-B)+q+D)*E+(-3*(t-B)-2*q-D)*v+q*G+t}var b=[],c={x:0,y:0,z:0},d,f,g,h,j,k,m,o,z;this.get2DPoint=function(q,t){d=(q.length-1)*t;f=Math.floor(d);g=d-f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>q.length-2?f:f+1;b[3]=f>q.length-3?f:f+2;k=q[b[0]];m=q[b[1]];o=q[b[2]];z=q[b[3]];h=g*g;j=g*h;c.x=a(k.x,m.x,o.x,z.x,g,h,j);c.y=a(k.y,m.y,o.y,z.y,g,h,j);c.z=a(k.z,m.z,o.z,z.z,g,h,j);return c}}; THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;dthis.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.0010-j;j=(new Date).getTime()*0.0010-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var o=0,z=this.hierarchy.length;o1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;othis.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.001-k;k=(new Date).getTime()*0.001-this.startTime}h=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var o=0,z=this.hierarchy.length;o1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(j[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;oc?c:a} -THREE.QuakeCamera=function(a){THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!== +THREE.QuakeCamera=function(a){THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!== undefined)this.autoForward=a.autoForward;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phy=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.windowHalfX= window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward= !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?(clamp(this.position.y,this.heightMin,this.heightMax)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&& @@ -119,7 +119,7 @@ THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.L THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype; THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d=0&&ca>=0&&J>=0&&Y>=0)return!0;else if(aa<0&&ca<0||J<0&&Y<0)return!1;else{if(aa<0)V=Math.max(V,aa/(aa-ca));else ca<0&&(R=Math.min(R,aa/(aa-ca)));if(J<0)V=Math.max(V,J/(J-Y));else Y<0&&(R=Math.min(R,J/(J-Y)));if(Raa&&ba.z0&&F.z<1){q=B[t]=B[t]||new THREE.RenderableParticle;q.x=F.x/F.w;q.y=F.y/F.w;q.z=F.z;q.rotation=ga.rotation.z;q.scale.x=ga.scale.x*Math.abs(q.x- -(F.x+M.projectionMatrix.n11)/(F.w+M.projectionMatrix.n14));q.scale.y=ga.scale.y*Math.abs(q.y-(F.y+M.projectionMatrix.n22)/(F.w+M.projectionMatrix.n24));q.materials=ga.materials;R.push(q);t++}}}}V&&R.sort(a);return R};this.unprojectVector=function(L,M){var V=M.matrixWorld.clone();V.multiplySelf(THREE.Matrix4.makeInvert(M.projectionMatrix));V.multiplyVector3(L);return L}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,o,z,q,t,B,C;a=b.projectScene(h,k);j=0;for(m=a.length;j0){U.r+=Da.r*pa;U.g+=Da.g*pa;U.b+=Da.b*pa}}else if(pa instanceof THREE.PointLight){G.sub(pa.position,fa);G.normalize();pa=ha.dot(G)*Fa;if(pa>0){U.r+=Da.r*pa;U.g+=Da.g*pa;U.b+=Da.b*pa}}}}function $(Q,fa,ha){if(ha.opacity!= -0){a(ha.opacity);b(ha.blending);var U,ea,pa,Da,Fa,ya;if(ha instanceof THREE.ParticleBasicMaterial){if(ha.map){Da=ha.map.image;Fa=Da.width>>1;ya=Da.height>>1;ea=fa.scale.x*k;pa=fa.scale.y*j;ha=ea*Fa;U=pa*ya;p.set(Q.x-ha,Q.y-U,Q.x+ha,Q.y+U);if(y.instersects(p)){m.save();m.translate(Q.x,Q.y);m.rotate(-fa.rotation);m.scale(ea,-pa);m.translate(-Fa,-ya);m.drawImage(Da,0,0);m.restore()}}}else if(ha instanceof THREE.ParticleCircleMaterial){if(D){E.r=O.r+T.r+v.r;E.g=O.g+T.g+v.g;E.b=O.b+T.b+v.b;R.r=ha.color.r* -E.r;R.g=ha.color.g*E.g;R.b=ha.color.b*E.b;R.updateStyleString()}else R.__styleString=ha.color.__styleString;ha=fa.scale.x*k;U=fa.scale.y*j;p.set(Q.x-ha,Q.y-U,Q.x+ha,Q.y+U);if(y.instersects(p)){ea=R.__styleString;if(C!=ea)m.fillStyle=C=ea;m.save();m.translate(Q.x,Q.y);m.rotate(-fa.rotation);m.scale(ha,U);m.beginPath();m.arc(0,0,1,0,A,!0);m.closePath();m.fill();m.restore()}}}}function ta(Q,fa,ha,U){if(U.opacity!=0){a(U.opacity);b(U.blending);m.beginPath();m.moveTo(Q.positionScreen.x,Q.positionScreen.y); -m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(U instanceof THREE.LineBasicMaterial){R.__styleString=U.color.__styleString;Q=U.linewidth;if(F!=Q)m.lineWidth=F=Q;Q=R.__styleString;if(B!=Q)m.strokeStyle=B=Q;m.stroke();p.inflate(U.linewidth*2)}}}function ua(Q,fa,ha,U,ea,pa){if(ea.opacity!=0){a(ea.opacity);b(ea.blending);I=Q.positionScreen.x;N=Q.positionScreen.y;e=fa.positionScreen.x;L=fa.positionScreen.y;M=ha.positionScreen.x;V=ha.positionScreen.y;m.beginPath();m.moveTo(I,N);m.lineTo(e, -L);m.lineTo(M,V);m.lineTo(I,N);m.closePath();if(ea instanceof THREE.MeshBasicMaterial)if(ea.map)ea.map.mapping instanceof THREE.UVMapping&&K(I,N,e,L,M,V,ea.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);else if(ea.envMap){if(ea.envMap.mapping instanceof THREE.SphericalReflectionMapping){Q=Aa.matrixWorldInverse;G.copy(U.vertexNormalsWorld[0]);ia=(G.x*Q.n11+G.y*Q.n12+G.z*Q.n13)*0.5+0.5;ga=-(G.x*Q.n21+G.y*Q.n22+G.z*Q.n23)*0.5+0.5;G.copy(U.vertexNormalsWorld[1]);qa=(G.x* -Q.n11+G.y*Q.n12+G.z*Q.n13)*0.5+0.5;wa=-(G.x*Q.n21+G.y*Q.n22+G.z*Q.n23)*0.5+0.5;G.copy(U.vertexNormalsWorld[2]);l=(G.x*Q.n11+G.y*Q.n12+G.z*Q.n13)*0.5+0.5;x=-(G.x*Q.n21+G.y*Q.n22+G.z*Q.n23)*0.5+0.5;K(I,N,e,L,M,V,ea.envMap.image,ia,ga,qa,wa,l,x)}}else ea.wireframe?Ga(ea.color.__styleString,ea.wireframeLinewidth):za(ea.color.__styleString);else if(ea instanceof THREE.MeshLambertMaterial){if(ea.map&&!ea.wireframe){ea.map.mapping instanceof THREE.UVMapping&&K(I,N,e,L,M,V,ea.map.image,U.uvs[0].u,U.uvs[0].v, -U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);b(THREE.SubtractiveBlending)}if(D)if(!ea.wireframe&&ea.shading==THREE.SmoothShading&&U.vertexNormalsWorld.length==3){aa.r=ca.r=J.r=O.r;aa.g=ca.g=J.g=O.g;aa.b=ca.b=J.b=O.b;X(pa,U.v1.positionWorld,U.vertexNormalsWorld[0],aa);X(pa,U.v2.positionWorld,U.vertexNormalsWorld[1],ca);X(pa,U.v3.positionWorld,U.vertexNormalsWorld[2],J);Y.r=(ca.r+J.r)*0.5;Y.g=(ca.g+J.g)*0.5;Y.b=(ca.b+J.b)*0.5;la=Ba(aa,ca,J,Y);K(I,N,e,L,M,V,la,0,0,1,0,0,1)}else{E.r=O.r;E.g=O.g;E.b=O.b; -X(pa,U.centroidWorld,U.normalWorld,E);R.r=ea.color.r*E.r;R.g=ea.color.g*E.g;R.b=ea.color.b*E.b;R.updateStyleString();ea.wireframe?Ga(R.__styleString,ea.wireframeLinewidth):za(R.__styleString)}else ea.wireframe?Ga(ea.color.__styleString,ea.wireframeLinewidth):za(ea.color.__styleString)}else if(ea instanceof THREE.MeshDepthMaterial){oa=Aa.near;ba=Aa.far;aa.r=aa.g=aa.b=1-Pa(Q.positionScreen.z,oa,ba);ca.r=ca.g=ca.b=1-Pa(fa.positionScreen.z,oa,ba);J.r=J.g=J.b=1-Pa(ha.positionScreen.z,oa,ba);Y.r=(ca.r+ -J.r)*0.5;Y.g=(ca.g+J.g)*0.5;Y.b=(ca.b+J.b)*0.5;la=Ba(aa,ca,J,Y);K(I,N,e,L,M,V,la,0,0,1,0,0,1)}else if(ea instanceof THREE.MeshNormalMaterial){R.r=Qa(U.normalWorld.x);R.g=Qa(U.normalWorld.y);R.b=Qa(U.normalWorld.z);R.updateStyleString();ea.wireframe?Ga(R.__styleString,ea.wireframeLinewidth):za(R.__styleString)}}}function Ga(Q,fa){if(B!=Q)m.strokeStyle=B=Q;if(F!=fa)m.lineWidth=F=fa;m.stroke();p.inflate(fa*2)}function za(Q){if(C!=Q)m.fillStyle=C=Q;m.fill()}function K(Q,fa,ha,U,ea,pa,Da,Fa,ya,Na,La,Oa, -Sa){var Ha,Ja;Ha=Da.width-1;Ja=Da.height-1;Fa*=Ha;ya*=Ja;Na*=Ha;La*=Ja;Oa*=Ha;Sa*=Ja;ha-=Q;U-=fa;ea-=Q;pa-=fa;Na-=Fa;La-=ya;Oa-=Fa;Sa-=ya;Ha=Na*Sa-Oa*La;if(Ha!=0){Ja=1/Ha;Ha=(Sa*ha-La*ea)*Ja;La=(Sa*U-La*pa)*Ja;ha=(Na*ea-Oa*ha)*Ja;U=(Na*pa-Oa*U)*Ja;Q=Q-Ha*Fa-ha*ya;fa=fa-La*Fa-U*ya;m.save();m.transform(Ha,La,ha,U,Q,fa);m.clip();m.drawImage(Da,0,0);m.restore()}}function Ba(Q,fa,ha,U){var ea=~~(Q.r*255),pa=~~(Q.g*255);Q=~~(Q.b*255);var Da=~~(fa.r*255),Fa=~~(fa.g*255);fa=~~(fa.b*255);var ya=~~(ha.r*255), -Na=~~(ha.g*255);ha=~~(ha.b*255);var La=~~(U.r*255),Oa=~~(U.g*255);U=~~(U.b*255);ja[0]=ea<0?0:ea>255?255:ea;ja[1]=pa<0?0:pa>255?255:pa;ja[2]=Q<0?0:Q>255?255:Q;ja[4]=Da<0?0:Da>255?255:Da;ja[5]=Fa<0?0:Fa>255?255:Fa;ja[6]=fa<0?0:fa>255?255:fa;ja[8]=ya<0?0:ya>255?255:ya;ja[9]=Na<0?0:Na>255?255:Na;ja[10]=ha<0?0:ha>255?255:ha;ja[12]=La<0?0:La>255?255:La;ja[13]=Oa<0?0:Oa>255?255:Oa;ja[14]=U<0?0:U>255?255:U;W.putImageData(da,0,0);P.drawImage(S,0,0);return xa}function Pa(Q,fa,ha){Q=(Q-fa)/(ha-fa);return Q* -Q*(3-2*Q)}function Qa(Q){Q=(Q+1)*0.5;return Q<0?0:Q>1?1:Q}function Ka(Q,fa){var ha=fa.x-Q.x,U=fa.y-Q.y,ea=1/Math.sqrt(ha*ha+U*U);ha*=ea;U*=ea;fa.x+=ha;fa.y+=U;Q.x-=ha;Q.y-=U}var sa,Ca,ka,na,ra,va,Ma,Ia;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(ma,Aa,this.sortElements);(D=ma.lights.length>0)&&Z(ma);sa=0;for(Ca=c.length;sa0){qa.r+=x.color.r*y;qa.g+=x.color.g*y;qa.b+=x.color.b*y}}else if(x instanceof THREE.PointLight){V.sub(x.position,ga.centroidWorld);V.normalize();y=ga.normalWorld.dot(V)*x.intensity;if(y>0){qa.r+=x.color.r*y;qa.g+=x.color.g*y;qa.b+=x.color.b*y}}}}function b(ia,ga,qa,wa,l,x){J=d(Y++);J.setAttribute("d", -"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)u.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(H){I.r=N.r;I.g=N.g;I.b=N.b;a(x,wa,I);u.r=l.color.r*I.r;u.g=l.color.g*I.g;u.b=l.color.b*I.b;u.updateStyleString()}else u.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){M=1-l.__2near/(l.__farPlusNear- -wa.z*l.__farMinusNear);u.setRGB(M,M,M)}else l instanceof THREE.MeshNormalMaterial&&u.setRGB(f(wa.normalWorld.x),f(wa.normalWorld.y),f(wa.normalWorld.z));l.wireframe?J.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):J.setAttribute("style","fill: "+u.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(J)}function c(ia,ga,qa,wa,l, -x,y){J=d(Y++);J.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)u.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(H){I.r=N.r;I.g=N.g;I.b=N.b;a(y,l,I);u.r=x.color.r*I.r;u.g=x.color.g*I.g;u.b=x.color.b*I.b;u.updateStyleString()}else u.__styleString=x.color.__styleString; -else if(x instanceof THREE.MeshDepthMaterial){M=1-x.__2near/(x.__farPlusNear-l.z*x.__farMinusNear);u.setRGB(M,M,M)}else x instanceof THREE.MeshNormalMaterial&&u.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));x.wireframe?J.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+x.wireframeLinewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.wireframeLinecap+"; stroke-linejoin: "+x.wireframeLinejoin):J.setAttribute("style","fill: "+u.__styleString+ -"; fill-opacity: "+x.opacity);k.appendChild(J)}function d(ia){if(R[ia]==null){R[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");la==0&&R[ia].setAttribute("shape-rendering","crispEdges")}return R[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,o,z,q,t,B,C,F=new THREE.Rectangle,w=new THREE.Rectangle,H=!1,u=new THREE.Color(16777215),I=new THREE.Color(16777215), -N=new THREE.Color(0),e=new THREE.Color(0),L=new THREE.Color(0),M,V=new THREE.Vector3,R=[],aa=[],ca=[],J,Y,oa,ba,la=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":la=1;break;case "low":la=0}};this.setSize=function(ia,ga){j=ia;m=ga;o=j/2;z=m/2;k.setAttribute("viewBox",-o+" "+-z+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);F.set(-o,-z,o,z)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])}; -this.render=function(ia,ga){var qa,wa,l,x,y,n,p,D;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);ba=oa=Y=0;if(H=ia.lights.length>0){p=ia.lights;N.setRGB(0,0,0);e.setRGB(0,0,0);L.setRGB(0,0,0);qa=0;for(wa=p.length;qa=0&&ca>=0&&K>=0&&W>=0)return!0;else if(Z<0&&ca<0||K<0&&W<0)return!1;else{if(Z<0)U=Math.max(U,Z/(Z-ca));else ca<0&&(Q=Math.min(Q,Z/(Z-ca)));if(K<0)U=Math.max(U,K/(K-W));else W<0&&(Q=Math.min(Q,K/(K-W)));if(QZ&&ba.z0&&G.z<1){q=B[t]=B[t]||new THREE.RenderableParticle;q.x=G.x/G.w;q.y=G.y/G.w;q.z=G.z;q.rotation=ha.rotation.z;q.scale.x=ha.scale.x*Math.abs(q.x- +(G.x+N.projectionMatrix.n11)/(G.w+N.projectionMatrix.n14));q.scale.y=ha.scale.y*Math.abs(q.y-(G.y+N.projectionMatrix.n22)/(G.w+N.projectionMatrix.n24));q.materials=ha.materials;Q.push(q);t++}}}}U&&Q.sort(a);return Q};this.unprojectVector=function(M,N){var U=N.matrixWorld.clone();U.multiplySelf(THREE.Matrix4.makeInvert(N.projectionMatrix));U.multiplyVector3(M);return M}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,j){c=h;d=j;f=c/2;g=d/2};this.render=function(h,j){var k,m,o,z,q,t,B,D;a=b.projectScene(h,j);k=0;for(m=a.length;k0){V.r+=Da.r*pa;V.g+=Da.g*pa;V.b+=Da.b*pa}}else if(pa instanceof THREE.PointLight){H.sub(pa.position,fa);H.normalize();pa=ia.dot(H)*Fa;if(pa>0){V.r+=Da.r*pa;V.g+=Da.g*pa;V.b+=Da.b*pa}}}}function aa(R,fa,ia){if(ia.opacity!= +0){a(ia.opacity);b(ia.blending);var V,ea,pa,Da,Fa,ya;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map){Da=ia.map.image;Fa=Da.width>>1;ya=Da.height>>1;ea=fa.scale.x*j;pa=fa.scale.y*k;ia=ea*Fa;V=pa*ya;p.set(R.x-ia,R.y-V,R.x+ia,R.y+V);if(y.instersects(p)){m.save();m.translate(R.x,R.y);m.rotate(-fa.rotation);m.scale(ea,-pa);m.translate(-Fa,-ya);m.drawImage(Da,0,0);m.restore()}}}else if(ia instanceof THREE.ParticleCircleMaterial){if(C){F.r=O.r+T.r+u.r;F.g=O.g+T.g+u.g;F.b=O.b+T.b+u.b;Q.r=ia.color.r* +F.r;Q.g=ia.color.g*F.g;Q.b=ia.color.b*F.b;Q.updateStyleString()}else Q.__styleString=ia.color.__styleString;ia=fa.scale.x*j;V=fa.scale.y*k;p.set(R.x-ia,R.y-V,R.x+ia,R.y+V);if(y.instersects(p)){ea=Q.__styleString;if(D!=ea)m.fillStyle=D=ea;m.save();m.translate(R.x,R.y);m.rotate(-fa.rotation);m.scale(ia,V);m.beginPath();m.arc(0,0,1,0,A,!0);m.closePath();m.fill();m.restore()}}}}function ta(R,fa,ia,V){if(V.opacity!=0){a(V.opacity);b(V.blending);m.beginPath();m.moveTo(R.positionScreen.x,R.positionScreen.y); +m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(V instanceof THREE.LineBasicMaterial){Q.__styleString=V.color.__styleString;R=V.linewidth;if(G!=R)m.lineWidth=G=R;R=Q.__styleString;if(B!=R)m.strokeStyle=B=R;m.stroke();p.inflate(V.linewidth*2)}}}function ua(R,fa,ia,V,ea,pa){if(ea.opacity!=0){a(ea.opacity);b(ea.blending);J=R.positionScreen.x;I=R.positionScreen.y;e=fa.positionScreen.x;M=fa.positionScreen.y;N=ia.positionScreen.x;U=ia.positionScreen.y;m.beginPath();m.moveTo(J,I);m.lineTo(e, +M);m.lineTo(N,U);m.lineTo(J,I);m.closePath();if(ea instanceof THREE.MeshBasicMaterial)if(ea.map)ea.map.mapping instanceof THREE.UVMapping&&L(J,I,e,M,N,U,ea.map.image,V.uvs[0].u,V.uvs[0].v,V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);else if(ea.envMap){if(ea.envMap.mapping instanceof THREE.SphericalReflectionMapping){R=Aa.matrixWorldInverse;H.copy(V.vertexNormalsWorld[0]);ga=(H.x*R.n11+H.y*R.n12+H.z*R.n13)*0.5+0.5;ha=-(H.x*R.n21+H.y*R.n22+H.z*R.n23)*0.5+0.5;H.copy(V.vertexNormalsWorld[1]);qa=(H.x* +R.n11+H.y*R.n12+H.z*R.n13)*0.5+0.5;wa=-(H.x*R.n21+H.y*R.n22+H.z*R.n23)*0.5+0.5;H.copy(V.vertexNormalsWorld[2]);l=(H.x*R.n11+H.y*R.n12+H.z*R.n13)*0.5+0.5;x=-(H.x*R.n21+H.y*R.n22+H.z*R.n23)*0.5+0.5;L(J,I,e,M,N,U,ea.envMap.image,ga,ha,qa,wa,l,x)}}else ea.wireframe?Ga(ea.color.__styleString,ea.wireframeLinewidth):za(ea.color.__styleString);else if(ea instanceof THREE.MeshLambertMaterial){if(ea.map&&!ea.wireframe){ea.map.mapping instanceof THREE.UVMapping&&L(J,I,e,M,N,U,ea.map.image,V.uvs[0].u,V.uvs[0].v, +V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);b(THREE.SubtractiveBlending)}if(C)if(!ea.wireframe&&ea.shading==THREE.SmoothShading&&V.vertexNormalsWorld.length==3){Z.r=ca.r=K.r=O.r;Z.g=ca.g=K.g=O.g;Z.b=ca.b=K.b=O.b;Y(pa,V.v1.positionWorld,V.vertexNormalsWorld[0],Z);Y(pa,V.v2.positionWorld,V.vertexNormalsWorld[1],ca);Y(pa,V.v3.positionWorld,V.vertexNormalsWorld[2],K);W.r=(ca.r+K.r)*0.5;W.g=(ca.g+K.g)*0.5;W.b=(ca.b+K.b)*0.5;na=Ba(Z,ca,K,W);L(J,I,e,M,N,U,na,0,0,1,0,0,1)}else{F.r=O.r;F.g=O.g;F.b=O.b;Y(pa, +V.centroidWorld,V.normalWorld,F);Q.r=ea.color.r*F.r;Q.g=ea.color.g*F.g;Q.b=ea.color.b*F.b;Q.updateStyleString();ea.wireframe?Ga(Q.__styleString,ea.wireframeLinewidth):za(Q.__styleString)}else ea.wireframe?Ga(ea.color.__styleString,ea.wireframeLinewidth):za(ea.color.__styleString)}else if(ea instanceof THREE.MeshDepthMaterial){la=Aa.near;ba=Aa.far;Z.r=Z.g=Z.b=1-Pa(R.positionScreen.z,la,ba);ca.r=ca.g=ca.b=1-Pa(fa.positionScreen.z,la,ba);K.r=K.g=K.b=1-Pa(ia.positionScreen.z,la,ba);W.r=(ca.r+K.r)*0.5; +W.g=(ca.g+K.g)*0.5;W.b=(ca.b+K.b)*0.5;na=Ba(Z,ca,K,W);L(J,I,e,M,N,U,na,0,0,1,0,0,1)}else if(ea instanceof THREE.MeshNormalMaterial){Q.r=Qa(V.normalWorld.x);Q.g=Qa(V.normalWorld.y);Q.b=Qa(V.normalWorld.z);Q.updateStyleString();ea.wireframe?Ga(Q.__styleString,ea.wireframeLinewidth):za(Q.__styleString)}}}function Ga(R,fa){if(B!=R)m.strokeStyle=B=R;if(G!=fa)m.lineWidth=G=fa;m.stroke();p.inflate(fa*2)}function za(R){if(D!=R)m.fillStyle=D=R;m.fill()}function L(R,fa,ia,V,ea,pa,Da,Fa,ya,Na,La,Oa,Sa){var Ha, +Ja;Ha=Da.width-1;Ja=Da.height-1;Fa*=Ha;ya*=Ja;Na*=Ha;La*=Ja;Oa*=Ha;Sa*=Ja;ia-=R;V-=fa;ea-=R;pa-=fa;Na-=Fa;La-=ya;Oa-=Fa;Sa-=ya;Ha=Na*Sa-Oa*La;if(Ha!=0){Ja=1/Ha;Ha=(Sa*ia-La*ea)*Ja;La=(Sa*V-La*pa)*Ja;ia=(Na*ea-Oa*ia)*Ja;V=(Na*pa-Oa*V)*Ja;R=R-Ha*Fa-ia*ya;fa=fa-La*Fa-V*ya;m.save();m.transform(Ha,La,ia,V,R,fa);m.clip();m.drawImage(Da,0,0);m.restore()}}function Ba(R,fa,ia,V){var ea=~~(R.r*255),pa=~~(R.g*255);R=~~(R.b*255);var Da=~~(fa.r*255),Fa=~~(fa.g*255);fa=~~(fa.b*255);var ya=~~(ia.r*255),Na=~~(ia.g* +255);ia=~~(ia.b*255);var La=~~(V.r*255),Oa=~~(V.g*255);V=~~(V.b*255);ja[0]=ea<0?0:ea>255?255:ea;ja[1]=pa<0?0:pa>255?255:pa;ja[2]=R<0?0:R>255?255:R;ja[4]=Da<0?0:Da>255?255:Da;ja[5]=Fa<0?0:Fa>255?255:Fa;ja[6]=fa<0?0:fa>255?255:fa;ja[8]=ya<0?0:ya>255?255:ya;ja[9]=Na<0?0:Na>255?255:Na;ja[10]=ia<0?0:ia>255?255:ia;ja[12]=La<0?0:La>255?255:La;ja[13]=Oa<0?0:Oa>255?255:Oa;ja[14]=V<0?0:V>255?255:V;X.putImageData(da,0,0);P.drawImage(S,0,0);return xa}function Pa(R,fa,ia){R=(R-fa)/(ia-fa);return R*R*(3-2*R)}function Qa(R){R= +(R+1)*0.5;return R<0?0:R>1?1:R}function Ka(R,fa){var ia=fa.x-R.x,V=fa.y-R.y,ea=1/Math.sqrt(ia*ia+V*V);ia*=ea;V*=ea;fa.x+=ia;fa.y+=V;R.x-=ia;R.y-=V}var sa,Ca,ka,oa,ra,va,Ma,Ia;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,k);c=d.projectScene(ma,Aa,this.sortElements);(C=ma.lights.length>0)&&$(ma);sa=0;for(Ca=c.length;sa0){qa.r+=x.color.r*y;qa.g+=x.color.g*y;qa.b+=x.color.b*y}}else if(x instanceof THREE.PointLight){U.sub(x.position,ha.centroidWorld);U.normalize();y=ha.normalWorld.dot(U)*x.intensity;if(y>0){qa.r+=x.color.r*y;qa.g+=x.color.g*y;qa.b+=x.color.b*y}}}}function b(ga,ha,qa,wa,l,x){K=d(W++);K.setAttribute("d", +"M "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)w.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(E){J.r=I.r;J.g=I.g;J.b=I.b;a(x,wa,J);w.r=l.color.r*J.r;w.g=l.color.g*J.g;w.b=l.color.b*J.b;w.updateStyleString()}else w.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){N=1-l.__2near/(l.__farPlusNear- +wa.z*l.__farMinusNear);w.setRGB(N,N,N)}else l instanceof THREE.MeshNormalMaterial&&w.setRGB(f(wa.normalWorld.x),f(wa.normalWorld.y),f(wa.normalWorld.z));l.wireframe?K.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):K.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+l.opacity);j.appendChild(K)}function c(ga,ha,qa,wa,l, +x,y){K=d(W++);K.setAttribute("d","M "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)w.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(E){J.r=I.r;J.g=I.g;J.b=I.b;a(y,l,J);w.r=x.color.r*J.r;w.g=x.color.g*J.g;w.b=x.color.b*J.b;w.updateStyleString()}else w.__styleString=x.color.__styleString; +else if(x instanceof THREE.MeshDepthMaterial){N=1-x.__2near/(x.__farPlusNear-l.z*x.__farMinusNear);w.setRGB(N,N,N)}else x instanceof THREE.MeshNormalMaterial&&w.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));x.wireframe?K.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+x.wireframeLinewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.wireframeLinecap+"; stroke-linejoin: "+x.wireframeLinejoin):K.setAttribute("style","fill: "+w.__styleString+ +"; fill-opacity: "+x.opacity);j.appendChild(K)}function d(ga){if(Q[ga]==null){Q[ga]=document.createElementNS("http://www.w3.org/2000/svg","path");na==0&&Q[ga].setAttribute("shape-rendering","crispEdges")}return Q[ga]}function f(ga){return ga<0?Math.min((1+ga)*0.5,0.5):0.5+Math.min(ga*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,o,z,q,t,B,D,G=new THREE.Rectangle,v=new THREE.Rectangle,E=!1,w=new THREE.Color(16777215),J=new THREE.Color(16777215), +I=new THREE.Color(0),e=new THREE.Color(0),M=new THREE.Color(0),N,U=new THREE.Vector3,Q=[],Z=[],ca=[],K,W,la,ba,na=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ga){switch(ga){case "high":na=1;break;case "low":na=0}};this.setSize=function(ga,ha){k=ga;m=ha;o=k/2;z=m/2;j.setAttribute("viewBox",-o+" "+-z+" "+k+" "+m);j.setAttribute("width",k);j.setAttribute("height",m);G.set(-o,-z,o,z)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])}; +this.render=function(ga,ha){var qa,wa,l,x,y,n,p,C;this.autoClear&&this.clear();g=h.projectScene(ga,ha,this.sortElements);ba=la=W=0;if(E=ga.lights.length>0){p=ga.lights;I.setRGB(0,0,0);e.setRGB(0,0,0);M.setRGB(0,0,0);qa=0;for(wa=p.length;qa=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLNormalBuffer);e.vertexAttribPointer(l.normal, +y.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,y.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,J(y.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,J(y.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,J(y.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,J(y.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}else{y.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,y.__webGLTexture);e.texImage2D(e.TEXTURE_2D, +0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,y.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,J(y.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,J(y.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,J(y.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,J(y.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null);y.__wasSetOnce=!0}y.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_2D,y.__webGLTexture)}}}e.uniformMatrix4fv(F.modelViewMatrix, +!1,p._modelViewMatrixArray);e.uniformMatrix3fv(F.normalMatrix,!1,p._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||n instanceof THREE.MeshPhongMaterial||n.envMap)&&e.uniform3f(F.cameraPosition,l.position.x,l.position.y,l.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&e.uniformMatrix4fv(F.objectMatrix,!1,p._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&e.uniformMatrix4fv(F.viewMatrix, +!1,na);if(n.skinning){e.uniformMatrix4fv(F.cameraInverseMatrix,!1,na);e.uniformMatrix4fv(F.boneGlobalMatrices,!1,p.boneMatrices)}return C}function f(l,x,y,n,p,C){l=d(l,x,y,n,C).attributes;e.bindBuffer(e.ARRAY_BUFFER,p.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLNormalBuffer);e.vertexAttribPointer(l.normal, 3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(p.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(p.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2); if(n.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight, -4,e.FLOAT,!1,0,0)}if(D instanceof THREE.Mesh)if(n.wireframe){e.lineWidth(n.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);e.drawElements(e.LINES,p.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,p.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(D instanceof THREE.Line){D=D.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(n.linewidth);e.drawArrays(D,0,p.__webGLLineCount)}else if(D instanceof -THREE.ParticleSystem)e.drawArrays(e.POINTS,0,p.__webGLParticleCount);else D instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,p.__webGLVertexCount)}function g(l,x){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.position);e.vertexAttribPointer(x.attributes.position, -3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.normal);e.vertexAttribPointer(x.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(R!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);R=l.doubleSided}if(aa!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);aa=l.flipSided}}function k(l){if(J!= -l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);J=l}}function j(l){Y[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);Y[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);Y[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);Y[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);Y[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);Y[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var x;for(l=0;l<6;l++){x=Y[l];x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z))}} -function m(l){for(var x=l.matrixWorld,y=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=Y[n].x*x.n14+Y[n].y*x.n24+Y[n].z*x.n34+Y[n].w;if(l<=y)return!1}return!0}function o(l,x){l.list[l.count]=x;l.count+=1}function z(l){var x,y,n=l.object,p=l.opaque,D=l.transparent;D.count=0;l=p.count=0;for(x=n.materials.length;l65535){A[T].counter+=1;v=A[T].hash+ -"_"+A[T].counter;l.geometryGroups[v]==undefined&&(l.geometryGroups[v]={faces:[],materials:O,vertices:0})}l.geometryGroups[v].faces.push(p);l.geometryGroups[v].vertices+=E}}function F(l,x,y){l.push({buffer:x,object:y,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD); -e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ca=l}}function H(l,x){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER, -e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,I(l.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,I(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,I(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,I(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,I(l.format),l.width,l.height,0,I(l.format),I(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER, -e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var y,n,p;if(l){y=l.__webGLFramebuffer;n=l.width;p=l.height}else{y=null;n=N.width;p=N.height}if(y!=M){e.bindFramebuffer(e.FRAMEBUFFER,y);e.viewport(0,0,n,p);x&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);M=y}}function u(l,x){var y;if(l== -"fragment")y=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(y=e.createShader(e.VERTEX_SHADER));e.shaderSource(y,x);e.compileShader(y);if(!e.getShaderParameter(y,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(y));return null}return y}function I(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST; +4,e.FLOAT,!1,0,0)}if(C instanceof THREE.Mesh)if(n.wireframe){e.lineWidth(n.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);e.drawElements(e.LINES,p.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,p.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(C instanceof THREE.Line){C=C.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(n.linewidth);e.drawArrays(C,0,p.__webGLLineCount)}else if(C instanceof +THREE.ParticleSystem)e.drawArrays(e.POINTS,0,p.__webGLParticleCount);else C instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,p.__webGLVertexCount)}function g(l,x){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.position);e.vertexAttribPointer(x.attributes.position, +3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.normal);e.vertexAttribPointer(x.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(Q!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);Q=l.doubleSided}if(Z!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);Z=l.flipSided}}function j(l){if(K!= +l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);K=l}}function k(l){W[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);W[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);W[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);W[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);W[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);W[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var x;for(l=0;l<6;l++){x=W[l];x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z))}} +function m(l){for(var x=l.matrixWorld,y=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=W[n].x*x.n14+W[n].y*x.n24+W[n].z*x.n34+W[n].w;if(l<=y)return!1}return!0}function o(l,x){l.list[l.count]=x;l.count+=1}function z(l){var x,y,n=l.object,p=l.opaque,C=l.transparent;C.count=0;l=p.count=0;for(x=n.materials.length;l65535){A[T].counter+=1;u=A[T].hash+ +"_"+A[T].counter;l.geometryGroups[u]==undefined&&(l.geometryGroups[u]={faces:[],materials:O,vertices:0})}l.geometryGroups[u].faces.push(p);l.geometryGroups[u].vertices+=F}}function G(l,x,y){l.push({buffer:x,object:y,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD); +e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ca=l}}function E(l,x){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER, +e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,J(l.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,J(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,J(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,J(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,J(l.format),l.width,l.height,0,J(l.format),J(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER, +e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var y,n,p;if(l){y=l.__webGLFramebuffer;n=l.width;p=l.height}else{y=null;n=I.width;p=I.height}if(y!=N){e.bindFramebuffer(e.FRAMEBUFFER,y);e.viewport(0,0,n,p);x&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);N=y}}function w(l,x){var y;if(l== +"fragment")y=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(y=e.createShader(e.VERTEX_SHADER));e.shaderSource(y,x);e.compileShader(y);if(!e.getShaderParameter(y,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(y));return null}return y}function J(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST; case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT; -case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var N=document.createElement("canvas"),e,L=null,M=null,V=this,R=null,aa=null,ca=null,J=null,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Matrix4,ba=new Float32Array(16),la=new Float32Array(16),ia=new THREE.Vector4, -ga=!0,qa=new THREE.Color(0),wa=0;if(a){if(a.antialias!==undefined)ga=a.antialias;a.clearColor!==undefined&&qa.setHex(a.clearColor);if(a.clearAlpha!==undefined)wa=a.clearAlpha}this.domElement=N;this.autoClear=!0;this.sortObjects=!1;(function(l,x,y){try{e=N.getContext("experimental-webgl",{antialias:l})}catch(n){console.log(n)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE); -e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(x.r,x.g,x.b,y);_cullEnabled=!0})(ga,qa,wa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,x){N.width=l;N.height=x;e.viewport(0,0,N.width,N.height)};this.setClearColorHex=function(l,x){var y=new THREE.Color(l);e.clearColor(y.r,y.g,y.b,x)};this.setClearColor=function(l,x){e.clearColor(l.r,l.g,l.b,x)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT| +case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var I=document.createElement("canvas"),e,M=null,N=null,U=this,Q=null,Z=null,ca=null,K=null,W=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],la=new THREE.Matrix4,ba=new Float32Array(16),na=new Float32Array(16),ga=new THREE.Vector4, +ha=!0,qa=new THREE.Color(0),wa=0;if(a){if(a.antialias!==undefined)ha=a.antialias;a.clearColor!==undefined&&qa.setHex(a.clearColor);if(a.clearAlpha!==undefined)wa=a.clearAlpha}this.domElement=I;this.autoClear=!0;this.sortObjects=!1;(function(l,x,y){try{e=I.getContext("experimental-webgl",{antialias:l})}catch(n){console.log(n)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE); +e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(x.r,x.g,x.b,y);_cullEnabled=!0})(ha,qa,wa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,x){I.width=l;I.height=x;e.viewport(0,0,I.width,I.height)};this.setClearColorHex=function(l,x){var y=new THREE.Color(l);e.clearColor(y.r,y.g,y.b,x)};this.setClearColor=function(l,x){e.clearColor(l.r,l.g,l.b,x)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT| e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,x,y){var n,p;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof -THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var D,E,O,T;p=O=T=0;for(D=x.length;p0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+ -D.maxPointLights,D.map?"#define USE_MAP":"",D.envMap?"#define USE_ENVMAP":"",D.lightMap?"#define USE_LIGHTMAP":"",D.vertexColors?"#define USE_COLOR":"",D.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); -e.attachShader(y,u("fragment",p+T));e.attachShader(y,u("vertex",D+x));e.linkProgram(y);e.getProgramParameter(y,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");y.uniforms={};y.attributes={};l.program=y;y=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(n in l.uniforms)y.push(n);n=l.program;T=0;for(x=y.length;T< +THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var C,F,O,T;p=O=T=0;for(C=x.length;p0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+ +C.maxPointLights,C.map?"#define USE_MAP":"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":"",C.vertexColors?"#define USE_COLOR":"",C.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); +e.attachShader(y,w("fragment",p+T));e.attachShader(y,w("vertex",C+x));e.linkProgram(y);e.getProgramParameter(y,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");y.uniforms={};y.attributes={};l.program=y;y=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(n in l.uniforms)y.push(n);n=l.program;T=0;for(x=y.length;T< x;T++){p=y[T];n.uniforms[p]=e.getUniformLocation(n,p)}n=l.program;y=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];T=0;for(x=y.length;T=0&&e.enableVertexAttribArray(n.color);n.normal>=0&&e.enableVertexAttribArray(n.normal);n.tangent>=0&&e.enableVertexAttribArray(n.tangent);if(l.skinning&&n.skinVertexA>=0&&n.skinVertexB>= -0&&n.skinIndex>=0&&n.skinWeight>=0){e.enableVertexAttribArray(n.skinVertexA);e.enableVertexAttribArray(n.skinVertexB);e.enableVertexAttribArray(n.skinIndex);e.enableVertexAttribArray(n.skinWeight)}};this.render=function(l,x,y,n){var p,D,E,O,T,v,A,G,S=l.lights,W=l.fog;x.matrixAutoUpdate&&x.update();x.matrixWorldInverse.flattenToArray(la);x.projectionMatrix.flattenToArray(ba);oa.multiply(x.projectionMatrix,x.matrixWorldInverse);j(oa);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined, -!1,x);this.initWebGLObjects(l,x);H(y,n!==undefined?n:!0);this.autoClear&&this.clear();T=l.__webglObjects.length;for(n=0;n=0;n--){p=y.__webglObjects[n].object;x==p&&y.__webglObjects.splice(n,1)}l.__objectsRemoved.splice(0,1)}for(;l.__objectsAdded.length;){x=l.__objectsAdded[0];var D=l;n=void 0;y=void 0;p=void 0;if(x._modelViewMatrix==undefined){x._modelViewMatrix=new THREE.Matrix4;x._normalMatrixArray= -new Float32Array(9);x._modelViewMatrixArray=new Float32Array(16);x._objectMatrixArray=new Float32Array(16);x.matrixWorld.flattenToArray(x._objectMatrixArray)}objlist=D.__webglObjects;if(x instanceof THREE.Mesh){y=x.geometry;y.geometryGroups==undefined&&C(y);for(n in y.geometryGroups){p=y.geometryGroups[n];if(!p.__webGLVertexBuffer){D=p;D.__webGLVertexBuffer=e.createBuffer();D.__webGLNormalBuffer=e.createBuffer();D.__webGLTangentBuffer=e.createBuffer();D.__webGLColorBuffer=e.createBuffer();D.__webGLUVBuffer= -e.createBuffer();D.__webGLUV2Buffer=e.createBuffer();D.__webGLSkinVertexABuffer=e.createBuffer();D.__webGLSkinVertexBBuffer=e.createBuffer();D.__webGLSkinIndicesBuffer=e.createBuffer();D.__webGLSkinWeightsBuffer=e.createBuffer();D.__webGLFaceBuffer=e.createBuffer();D.__webGLLineBuffer=e.createBuffer();D=p;var E=x,O=void 0,T=void 0,v=0,A=0,G=0,S=E.geometry.faces,W=D.faces;O=0;for(T=W.length;O0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,G)}if(ea&&W>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Qa,G)}if(U){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ma,G);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,G)}if(K>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ka,G);e.bindBuffer(e.ARRAY_BUFFER, -A.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,na,G);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ra,G);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,va,G)}}}n.__dirtyVertices=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(D instanceof THREE.Ribbon){n=D.geometry;if(n.__dirtyVertices||n.__dirtyColors){p=n;D=e.DYNAMIC_DRAW;E=void 0;E=void 0;v=void 0;A=void 0; -S=p.vertices;G=p.colors;W=S.length;O=G.length;da=p.__vertexArray;T=p.__colorArray;ja=p.__dirtyColors;if(p.__dirtyVertices){for(E=0;E0}}; +0&&n.skinIndex>=0&&n.skinWeight>=0){e.enableVertexAttribArray(n.skinVertexA);e.enableVertexAttribArray(n.skinVertexB);e.enableVertexAttribArray(n.skinIndex);e.enableVertexAttribArray(n.skinWeight)}};this.render=function(l,x,y,n){var p,C,F,O,T,u,A,H,S=l.lights,X=l.fog;x.matrixAutoUpdate&&x.update();x.matrixWorldInverse.flattenToArray(na);x.projectionMatrix.flattenToArray(ba);la.multiply(x.projectionMatrix,x.matrixWorldInverse);k(la);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined, +!1,x);this.initWebGLObjects(l,x);E(y,n!==undefined?n:!0);this.autoClear&&this.clear();T=l.__webglObjects.length;for(n=0;n=0;n--){p=y.__webglObjects[n].object;x==p&&y.__webglObjects.splice(n,1)}l.__objectsRemoved.splice(0,1)}for(;l.__objectsAdded.length;){x=l.__objectsAdded[0];var C=l;n=void 0;y=void 0;p=void 0;if(x._modelViewMatrix==undefined){x._modelViewMatrix=new THREE.Matrix4;x._normalMatrixArray= +new Float32Array(9);x._modelViewMatrixArray=new Float32Array(16);x._objectMatrixArray=new Float32Array(16);x.matrixWorld.flattenToArray(x._objectMatrixArray)}objlist=C.__webglObjects;if(x instanceof THREE.Mesh){y=x.geometry;y.geometryGroups==undefined&&D(y);for(n in y.geometryGroups){p=y.geometryGroups[n];if(!p.__webGLVertexBuffer){C=p;C.__webGLVertexBuffer=e.createBuffer();C.__webGLNormalBuffer=e.createBuffer();C.__webGLTangentBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C.__webGLUVBuffer= +e.createBuffer();C.__webGLUV2Buffer=e.createBuffer();C.__webGLSkinVertexABuffer=e.createBuffer();C.__webGLSkinVertexBBuffer=e.createBuffer();C.__webGLSkinIndicesBuffer=e.createBuffer();C.__webGLSkinWeightsBuffer=e.createBuffer();C.__webGLFaceBuffer=e.createBuffer();C.__webGLLineBuffer=e.createBuffer();C=p;var F=x,O=void 0,T=void 0,u=0,A=0,H=0,S=F.geometry.faces,X=C.faces;O=0;for(T=X.length;O0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,H)}if(ea&&X>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Qa,H)}if(V){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ma,H);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,H)}if(L>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexABuffer); +e.bufferData(e.ARRAY_BUFFER,ka,H);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,oa,H);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ra,H);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,va,H)}}}n.__dirtyVertices=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(C instanceof THREE.Ribbon){n=C.geometry;if(n.__dirtyVertices||n.__dirtyColors){p= +n;C=e.DYNAMIC_DRAW;F=void 0;F=void 0;u=void 0;A=void 0;S=p.vertices;H=p.colors;X=S.length;O=H.length;da=p.__vertexArray;T=p.__colorArray;ja=p.__dirtyColors;if(p.__dirtyVertices){for(F=0;F0}}; THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif", envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif", @@ -274,17 +274,17 @@ THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"ve THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(z,k,q)))-1);m.push(o)}b.push(m)}var t,B,C;f=b.length;for(c=0;c0)for(d=0;d1){t=this.vertices[h].position.clone(); -B=this.vertices[j].position.clone();C=this.vertices[m].position.clone();t.normalize();B.normalize();C.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([o,z,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(z,j,q)))-1);m.push(o)}b.push(m)}var t,B,D;f=b.length;for(c=0;c0)for(d=0;d1){t=this.vertices[h].position.clone(); +B=this.vertices[k].position.clone();D=this.vertices[m].position.clone();t.normalize();B.normalize();D.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(D.x,D.y,D.z)]));this.uvs.push([o,z,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c= 1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; var Icosahedron=function(a){function b(z,q,t){var B=Math.sqrt(z*z+q*q+t*t);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(z/B,q/B,t/B)))-1}function c(z,q,t,B){B.faces.push(new THREE.Face3(z,q,t))}function d(z,q){var t=f.vertices[z].position,B=f.vertices[q].position;return b((t.x+B.x)/2,(t.y+B.y)/2,(t.z+B.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0, -1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a=this.maxCount-3&&k(this)};this.begin= -function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;dthis.size-1&&(j=this.size-1);var q=Math.floor(m-k);q<1&&(q=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k); -k>this.size-1&&(k=this.size-1);for(var B,C,F,w,H,u;z0&&(this.field[F+B]+=w)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,o=this.yd,z=this.zd,q=this.field,t=m*Math.sqrt(c/d);t>m&&(t=m);for(f=0;f0)for(g=0;go&&(B=o);for(g=0;g0){j=g*z;for(f=0;fsize&&(dist=size);for(h=0;h0){j=zd*h;for(g=0;g=this.maxCount-3&&j(this)};this.begin= +function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;dthis.size-1&&(k=this.size-1);var q=Math.floor(m-j);q<1&&(q=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var t=Math.floor(o-j);t<1&&(t=1);j=Math.floor(o+j); +j>this.size-1&&(j=this.size-1);for(var B,D,G,v,E,w;z0&&(this.field[G+B]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,j,k,m=this.size,o=this.yd,z=this.zd,q=this.field,t=m*Math.sqrt(c/d);t>m&&(t=m);for(f=0;f0)for(g=0;go&&(B=o);for(g=0;g0){k=g*z;for(f=0;fsize&&(dist=size);for(h=0;h0){k=zd*h;for(g=0;g>7)-127;G|=(W&127)<<16|S<<8;if(G==0&&ja==-127)return 0;return(1-2*(da>>7))*(1+G*Math.pow(2,-23))*Math.pow(2,ja)}function k(v,A){var G=o(v,A),S=o(v,A+1),W=o(v,A+2);return(o(v,A+3)<<24)+(W<<16)+(S<<8)+G}function j(v,A){var G=o(v,A);return(o(v,A+1)<<8)+G}function m(v,A){var G=o(v,A);return G>127?G-256:G}function o(v,A){return v.charCodeAt(A)&255}function z(v){var A,G,S;A= -k(a,v);G=k(a,v+e);S=k(a,v+L);v=j(a,v+M);THREE.Loader.prototype.f3(w,A,G,S,v)}function q(v){var A,G,S,W,da,ja;A=k(a,v);G=k(a,v+e);S=k(a,v+L);W=j(a,v+M);da=k(a,v+V);ja=k(a,v+R);v=k(a,v+aa);THREE.Loader.prototype.f3n(w,I,A,G,S,W,da,ja,v)}function t(v){var A,G,S,W;A=k(a,v);G=k(a,v+ca);S=k(a,v+J);W=k(a,v+Y);v=j(a,v+oa);THREE.Loader.prototype.f4(w,A,G,S,W,v)}function B(v){var A,G,S,W,da,ja,xa,P;A=k(a,v);G=k(a,v+ca);S=k(a,v+J);W=k(a,v+Y);da=j(a,v+oa);ja=k(a,v+ba);xa=k(a,v+la);P=k(a,v+ia);v=k(a,v+ga);THREE.Loader.prototype.f4n(w, -I,A,G,S,W,da,ja,xa,P,v)}function C(v){var A,G;A=k(a,v);G=k(a,v+qa);v=k(a,v+wa);THREE.Loader.prototype.uv3(w.uvs,N[A*2],N[A*2+1],N[G*2],N[G*2+1],N[v*2],N[v*2+1])}function F(v){var A,G,S;A=k(a,v);G=k(a,v+l);S=k(a,v+x);v=k(a,v+y);THREE.Loader.prototype.uv4(w.uvs,N[A*2],N[A*2+1],N[G*2],N[G*2+1],N[S*2],N[S*2+1],N[v*2],N[v*2+1])}var w=this,H=0,u,I=[],N=[],e,L,M,V,R,aa,ca,J,Y,oa,ba,la,ia,ga,qa,wa,l,x,y,n,p,D,E,O,T;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,d,g);u={signature:a.substr(H, -8),header_bytes:o(a,H+8),vertex_coordinate_bytes:o(a,H+9),normal_coordinate_bytes:o(a,H+10),uv_coordinate_bytes:o(a,H+11),vertex_index_bytes:o(a,H+12),normal_index_bytes:o(a,H+13),uv_index_bytes:o(a,H+14),material_index_bytes:o(a,H+15),nvertices:k(a,H+16),nnormals:k(a,H+16+4),nuvs:k(a,H+16+8),ntri_flat:k(a,H+16+12),ntri_smooth:k(a,H+16+16),ntri_flat_uv:k(a,H+16+20),ntri_smooth_uv:k(a,H+16+24),nquad_flat:k(a,H+16+28),nquad_smooth:k(a,H+16+32),nquad_flat_uv:k(a,H+16+36),nquad_smooth_uv:k(a,H+16+40)}; -H+=u.header_bytes;e=u.vertex_index_bytes;L=u.vertex_index_bytes*2;M=u.vertex_index_bytes*3;V=u.vertex_index_bytes*3+u.material_index_bytes;R=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes;aa=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*2;ca=u.vertex_index_bytes;J=u.vertex_index_bytes*2;Y=u.vertex_index_bytes*3;oa=u.vertex_index_bytes*4;ba=u.vertex_index_bytes*4+u.material_index_bytes;la=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes;ia= -u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*2;ga=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*3;qa=u.uv_index_bytes;wa=u.uv_index_bytes*2;l=u.uv_index_bytes;x=u.uv_index_bytes*2;y=u.uv_index_bytes*3;g=u.vertex_index_bytes*3+u.material_index_bytes;T=u.vertex_index_bytes*4+u.material_index_bytes;n=u.ntri_flat*g;p=u.ntri_smooth*(g+u.normal_index_bytes*3);D=u.ntri_flat_uv*(g+u.uv_index_bytes*3);E=u.ntri_smooth_uv*(g+u.normal_index_bytes*3+u.uv_index_bytes* -3);O=u.nquad_flat*T;g=u.nquad_smooth*(T+u.normal_index_bytes*4);T=u.nquad_flat_uv*(T+u.uv_index_bytes*4);H+=function(v){for(var A,G,S,W=u.vertex_coordinate_bytes*3,da=v+u.nvertices*W;v>7)-127;H|=(X&127)<<16|S<<8;if(H==0&&ja==-127)return 0;return(1-2*(da>>7))*(1+H*Math.pow(2,-23))*Math.pow(2,ja)}function j(u,A){var H=o(u,A),S=o(u,A+1),X=o(u,A+2);return(o(u,A+3)<<24)+(X<<16)+(S<<8)+H}function k(u,A){var H=o(u,A);return(o(u,A+1)<<8)+H}function m(u,A){var H=o(u,A);return H>127?H-256:H}function o(u,A){return u.charCodeAt(A)&255}function z(u){var A,H,S;A= +j(a,u);H=j(a,u+e);S=j(a,u+M);u=k(a,u+N);THREE.Loader.prototype.f3(v,A,H,S,u)}function q(u){var A,H,S,X,da,ja;A=j(a,u);H=j(a,u+e);S=j(a,u+M);X=k(a,u+N);da=j(a,u+U);ja=j(a,u+Q);u=j(a,u+Z);THREE.Loader.prototype.f3n(v,J,A,H,S,X,da,ja,u)}function t(u){var A,H,S,X;A=j(a,u);H=j(a,u+ca);S=j(a,u+K);X=j(a,u+W);u=k(a,u+la);THREE.Loader.prototype.f4(v,A,H,S,X,u)}function B(u){var A,H,S,X,da,ja,xa,P;A=j(a,u);H=j(a,u+ca);S=j(a,u+K);X=j(a,u+W);da=k(a,u+la);ja=j(a,u+ba);xa=j(a,u+na);P=j(a,u+ga);u=j(a,u+ha);THREE.Loader.prototype.f4n(v, +J,A,H,S,X,da,ja,xa,P,u)}function D(u){var A,H;A=j(a,u);H=j(a,u+qa);u=j(a,u+wa);THREE.Loader.prototype.uv3(v.uvs,I[A*2],I[A*2+1],I[H*2],I[H*2+1],I[u*2],I[u*2+1])}function G(u){var A,H,S;A=j(a,u);H=j(a,u+l);S=j(a,u+x);u=j(a,u+y);THREE.Loader.prototype.uv4(v.uvs,I[A*2],I[A*2+1],I[H*2],I[H*2+1],I[S*2],I[S*2+1],I[u*2],I[u*2+1])}var v=this,E=0,w,J=[],I=[],e,M,N,U,Q,Z,ca,K,W,la,ba,na,ga,ha,qa,wa,l,x,y,n,p,C,F,O,T;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);w={signature:a.substr(E, +8),header_bytes:o(a,E+8),vertex_coordinate_bytes:o(a,E+9),normal_coordinate_bytes:o(a,E+10),uv_coordinate_bytes:o(a,E+11),vertex_index_bytes:o(a,E+12),normal_index_bytes:o(a,E+13),uv_index_bytes:o(a,E+14),material_index_bytes:o(a,E+15),nvertices:j(a,E+16),nnormals:j(a,E+16+4),nuvs:j(a,E+16+8),ntri_flat:j(a,E+16+12),ntri_smooth:j(a,E+16+16),ntri_flat_uv:j(a,E+16+20),ntri_smooth_uv:j(a,E+16+24),nquad_flat:j(a,E+16+28),nquad_smooth:j(a,E+16+32),nquad_flat_uv:j(a,E+16+36),nquad_smooth_uv:j(a,E+16+40)}; +E+=w.header_bytes;e=w.vertex_index_bytes;M=w.vertex_index_bytes*2;N=w.vertex_index_bytes*3;U=w.vertex_index_bytes*3+w.material_index_bytes;Q=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;Z=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;ca=w.vertex_index_bytes;K=w.vertex_index_bytes*2;W=w.vertex_index_bytes*3;la=w.vertex_index_bytes*4;ba=w.vertex_index_bytes*4+w.material_index_bytes;na=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;ga= +w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;ha=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;qa=w.uv_index_bytes;wa=w.uv_index_bytes*2;l=w.uv_index_bytes;x=w.uv_index_bytes*2;y=w.uv_index_bytes*3;g=w.vertex_index_bytes*3+w.material_index_bytes;T=w.vertex_index_bytes*4+w.material_index_bytes;n=w.ntri_flat*g;p=w.ntri_smooth*(g+w.normal_index_bytes*3);C=w.ntri_flat_uv*(g+w.uv_index_bytes*3);F=w.ntri_smooth_uv*(g+w.normal_index_bytes*3+w.uv_index_bytes* +3);O=w.nquad_flat*T;g=w.nquad_smooth*(T+w.normal_index_bytes*4);T=w.nquad_flat_uv*(T+w.uv_index_bytes*4);E+=function(u){for(var A,H,S,X=w.vertex_coordinate_bytes*3,da=u+w.nvertices*X;u=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]}; THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; diff --git a/build/custom/ThreeDOM.js b/build/custom/ThreeDOM.js index 0789027154..0ac9deb1b5 100644 --- a/build/custom/ThreeDOM.js +++ b/build/custom/ThreeDOM.js @@ -49,7 +49,7 @@ THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*= -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this}, multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,n=h*d+i*c-f*e,l=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+n*-i-l*-g;b.y=n*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-n*-f;return b}}; -THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]}; THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}}; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index 37c6e1b136..3eaa4fd44c 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -1,18 +1,18 @@ // ThreeExtras.js r33 - http://github.com/mrdoob/three.js -var GeometryUtils={merge:function(a,d){var b=d instanceof THREE.Mesh,f=a.vertices.length,g=b?d.geometry:d,c=a.vertices,e=g.vertices,h=a.faces,j=g.faces,l=a.uvs;g=g.uvs;b&&d.matrixAutoUpdate&&d.updateMatrix();for(var m=0,v=e.length;m= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}", @@ -21,39 +21,39 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i25&&(c=25);g=(c-1)*0.5;b=Array(c);for(d=f=0;d25&&(c=25);h=(c-1)*0.5;b=Array(c);for(d=f=0;d0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,h,q)))-1);l.push(m)}d.push(l)}var n,p,t;g=d.length;for(b=0;b0)for(f=0;f1){n=this.vertices[e].position.clone(); -p=this.vertices[j].position.clone();t=this.vertices[l].position.clone();n.normalize();p.normalize();t.normalize();this.faces.push(new THREE.Face3(e,j,l,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(t.x,t.y,t.z)]));this.uvs.push([m,v,z])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; -var Torus=function(a,d,b,f){this.radius=a||100;this.tube=d||40;this.segmentsR=b||8;this.segmentsT=f||6;a=[];THREE.Geometry.call(this);for(d=0;d<=this.segmentsR;++d)for(b=0;b<=this.segmentsT;++b){f=b/this.segmentsT*2*Math.PI;var g=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));a.push([b/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(b= -1;b<=this.segmentsT;++b){f=(this.segmentsT+1)*d+b;g=(this.segmentsT+1)*d+b-1;var c=(this.segmentsT+1)*(d-1)+b-1,e=(this.segmentsT+1)*(d-1)+b;this.faces.push(new THREE.Face4(f,g,c,e));this.uvs.push([new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[e][0],a[e][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=g.vertices[v].position,p=g.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var g=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0, -1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,g,q)))-1);m.push(k)}d.push(m)}var n,p,u;h=d.length;for(b=0;b0)for(f=0;f1){n=this.vertices[e].position.clone(); +p=this.vertices[j].position.clone();u=this.vertices[m].position.clone();n.normalize();p.normalize();u.normalize();this.faces.push(new THREE.Face3(e,j,m,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z)]));this.uvs.push([k,v,z])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Torus=function(a,d,b,f){this.radius=a||100;this.tube=d||40;this.segmentsR=b||8;this.segmentsT=f||6;a=[];THREE.Geometry.call(this);for(d=0;d<=this.segmentsR;++d)for(b=0;b<=this.segmentsT;++b){f=b/this.segmentsT*2*Math.PI;var h=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(h))*Math.cos(f),(this.radius+this.tube*Math.cos(h))*Math.sin(f),this.tube*Math.sin(h))));a.push([b/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(b= +1;b<=this.segmentsT;++b){f=(this.segmentsT+1)*d+b;h=(this.segmentsT+1)*d+b-1;var c=(this.segmentsT+1)*(d-1)+b-1,e=(this.segmentsT+1)*(d-1)+b;this.faces.push(new THREE.Face4(f,h,c,e));this.uvs.push([new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[e][0],a[e][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; +var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=h.vertices[v].position,p=h.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var h=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0, +1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a=this.maxCount-3&&h(this)};this.begin= -function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var f=this.count*3;fthis.size-1&&(j=this.size-1);var q=Math.floor(l-h);q<1&&(q=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var n=Math.floor(m-h);n<1&&(n=1);h=Math.floor(m+h); -h>this.size-1&&(h=this.size-1);for(var p,t,z,w,x,k;v0&&(this.field[z+p]+=w)}}}};this.addPlaneX=function(b,f){var g,c,e,h,j,l=this.size,m=this.yd,v=this.zd,q=this.field,n=l*Math.sqrt(b/f);n>l&&(n=l);for(g=0;g0)for(c=0;cm&&(p=m);for(c=0;c0){j=c*v;for(g=0;gsize&&(dist=size);for(e=0;e0){j=zd*e;for(c=0;c=this.maxCount-3&&g(this)};this.begin= +function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var f=this.count*3;fthis.size-1&&(j=this.size-1);var q=Math.floor(m-g);q<1&&(q=1);m=Math.floor(m+g);m>this.size-1&&(m=this.size-1);var n=Math.floor(k-g);n<1&&(n=1);g=Math.floor(k+g); +g>this.size-1&&(g=this.size-1);for(var p,u,z,w,x,l;v0&&(this.field[z+p]+=w)}}}};this.addPlaneX=function(b,f){var h,c,e,g,j,m=this.size,k=this.yd,v=this.zd,q=this.field,n=m*Math.sqrt(b/f);n>m&&(n=m);for(h=0;h0)for(c=0;ck&&(p=k);for(c=0;c0){j=c*v;for(h=0;hsize&&(dist=size);for(e=0;e0){j=zd*e;for(c=0;c>7)-127;y|=(G&127)<<16|B<<8;if(y==0&&N==-127)return 0;return(1-2*(L>>7))*(1+y*Math.pow(2,-23))*Math.pow(2,N)}function h(o,u){var y=m(o,u),B=m(o,u+1),G=m(o,u+2);return(m(o,u+3)<<24)+(G<<16)+(B<<8)+y}function j(o,u){var y=m(o,u);return(m(o,u+1)<<8)+y}function l(o,u){var y=m(o,u);return y>127?y-256:y}function m(o,u){return o.charCodeAt(u)&255}function v(o){var u,y,B;u=h(a,o); -y=h(a,o+J);B=h(a,o+A);o=j(a,o+C);THREE.Loader.prototype.f3(w,u,y,B,o)}function q(o){var u,y,B,G,L,N;u=h(a,o);y=h(a,o+J);B=h(a,o+A);G=j(a,o+C);L=h(a,o+H);N=h(a,o+I);o=h(a,o+K);THREE.Loader.prototype.f3n(w,D,u,y,B,G,L,N,o)}function n(o){var u,y,B,G;u=h(a,o);y=h(a,o+M);B=h(a,o+F);G=h(a,o+P);o=j(a,o+Q);THREE.Loader.prototype.f4(w,u,y,B,G,o)}function p(o){var u,y,B,G,L,N,Y,Z;u=h(a,o);y=h(a,o+M);B=h(a,o+F);G=h(a,o+P);L=j(a,o+Q);N=h(a,o+R);Y=h(a,o+S);Z=h(a,o+$);o=h(a,o+aa);THREE.Loader.prototype.f4n(w,D, -u,y,B,G,L,N,Y,Z,o)}function t(o){var u,y;u=h(a,o);y=h(a,o+ba);o=h(a,o+ca);THREE.Loader.prototype.uv3(w.uvs,E[u*2],E[u*2+1],E[y*2],E[y*2+1],E[o*2],E[o*2+1])}function z(o){var u,y,B;u=h(a,o);y=h(a,o+da);B=h(a,o+ea);o=h(a,o+fa);THREE.Loader.prototype.uv4(w.uvs,E[u*2],E[u*2+1],E[y*2],E[y*2+1],E[B*2],E[B*2+1],E[o*2],E[o*2+1])}var w=this,x=0,k,D=[],E=[],J,A,C,H,I,K,M,F,P,Q,R,S,$,aa,ba,ca,da,ea,fa,T,U,V,W,X,O;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,f,c);k={signature:a.substr(x, -8),header_bytes:m(a,x+8),vertex_coordinate_bytes:m(a,x+9),normal_coordinate_bytes:m(a,x+10),uv_coordinate_bytes:m(a,x+11),vertex_index_bytes:m(a,x+12),normal_index_bytes:m(a,x+13),uv_index_bytes:m(a,x+14),material_index_bytes:m(a,x+15),nvertices:h(a,x+16),nnormals:h(a,x+16+4),nuvs:h(a,x+16+8),ntri_flat:h(a,x+16+12),ntri_smooth:h(a,x+16+16),ntri_flat_uv:h(a,x+16+20),ntri_smooth_uv:h(a,x+16+24),nquad_flat:h(a,x+16+28),nquad_smooth:h(a,x+16+32),nquad_flat_uv:h(a,x+16+36),nquad_smooth_uv:h(a,x+16+40)}; -x+=k.header_bytes;J=k.vertex_index_bytes;A=k.vertex_index_bytes*2;C=k.vertex_index_bytes*3;H=k.vertex_index_bytes*3+k.material_index_bytes;I=k.vertex_index_bytes*3+k.material_index_bytes+k.normal_index_bytes;K=k.vertex_index_bytes*3+k.material_index_bytes+k.normal_index_bytes*2;M=k.vertex_index_bytes;F=k.vertex_index_bytes*2;P=k.vertex_index_bytes*3;Q=k.vertex_index_bytes*4;R=k.vertex_index_bytes*4+k.material_index_bytes;S=k.vertex_index_bytes*4+k.material_index_bytes+k.normal_index_bytes;$=k.vertex_index_bytes* -4+k.material_index_bytes+k.normal_index_bytes*2;aa=k.vertex_index_bytes*4+k.material_index_bytes+k.normal_index_bytes*3;ba=k.uv_index_bytes;ca=k.uv_index_bytes*2;da=k.uv_index_bytes;ea=k.uv_index_bytes*2;fa=k.uv_index_bytes*3;c=k.vertex_index_bytes*3+k.material_index_bytes;O=k.vertex_index_bytes*4+k.material_index_bytes;T=k.ntri_flat*c;U=k.ntri_smooth*(c+k.normal_index_bytes*3);V=k.ntri_flat_uv*(c+k.uv_index_bytes*3);W=k.ntri_smooth_uv*(c+k.normal_index_bytes*3+k.uv_index_bytes*3);X=k.nquad_flat* -O;c=k.nquad_smooth*(O+k.normal_index_bytes*4);O=k.nquad_flat_uv*(O+k.uv_index_bytes*4);x+=function(o){for(var u,y,B,G=k.vertex_coordinate_bytes*3,L=o+k.nvertices*G;o>7)-127;y|=(H&127)<<16|B<<8;if(y==0&&P==-127)return 0;return(1-2*(L>>7))*(1+y*Math.pow(2,-23))*Math.pow(2,P)}function g(o,t){var y=k(o,t),B=k(o,t+1),H=k(o,t+2);return(k(o,t+3)<<24)+(H<<16)+(B<<8)+y}function j(o,t){var y=k(o,t);return(k(o,t+1)<<8)+y}function m(o,t){var y=k(o,t);return y>127?y-256:y}function k(o,t){return o.charCodeAt(t)&255}function v(o){var t,y,B;t=g(a,o); +y=g(a,o+I);B=g(a,o+C);o=j(a,o+E);THREE.Loader.prototype.f3(w,t,y,B,o)}function q(o){var t,y,B,H,L,P;t=g(a,o);y=g(a,o+I);B=g(a,o+C);H=j(a,o+E);L=g(a,o+F);P=g(a,o+J);o=g(a,o+K);THREE.Loader.prototype.f3n(w,D,t,y,B,H,L,P,o)}function n(o){var t,y,B,H;t=g(a,o);y=g(a,o+O);B=g(a,o+G);H=g(a,o+N);o=j(a,o+M);THREE.Loader.prototype.f4(w,t,y,B,H,o)}function p(o){var t,y,B,H,L,P,Z,$;t=g(a,o);y=g(a,o+O);B=g(a,o+G);H=g(a,o+N);L=j(a,o+M);P=g(a,o+X);Z=g(a,o+Y);$=g(a,o+R);o=g(a,o+aa);THREE.Loader.prototype.f4n(w,D, +t,y,B,H,L,P,Z,$,o)}function u(o){var t,y;t=g(a,o);y=g(a,o+ba);o=g(a,o+ca);THREE.Loader.prototype.uv3(w.uvs,A[t*2],A[t*2+1],A[y*2],A[y*2+1],A[o*2],A[o*2+1])}function z(o){var t,y,B;t=g(a,o);y=g(a,o+da);B=g(a,o+ea);o=g(a,o+fa);THREE.Loader.prototype.uv4(w.uvs,A[t*2],A[t*2+1],A[y*2],A[y*2+1],A[B*2],A[B*2+1],A[o*2],A[o*2+1])}var w=this,x=0,l,D=[],A=[],I,C,E,F,J,K,O,G,N,M,X,Y,R,aa,ba,ca,da,ea,fa,S,T,U,V,W,Q;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,f,c);l={signature:a.substr(x, +8),header_bytes:k(a,x+8),vertex_coordinate_bytes:k(a,x+9),normal_coordinate_bytes:k(a,x+10),uv_coordinate_bytes:k(a,x+11),vertex_index_bytes:k(a,x+12),normal_index_bytes:k(a,x+13),uv_index_bytes:k(a,x+14),material_index_bytes:k(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)}; +x+=l.header_bytes;I=l.vertex_index_bytes;C=l.vertex_index_bytes*2;E=l.vertex_index_bytes*3;F=l.vertex_index_bytes*3+l.material_index_bytes;J=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes;K=l.vertex_index_bytes*3+l.material_index_bytes+l.normal_index_bytes*2;O=l.vertex_index_bytes;G=l.vertex_index_bytes*2;N=l.vertex_index_bytes*3;M=l.vertex_index_bytes*4;X=l.vertex_index_bytes*4+l.material_index_bytes;Y=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes;R=l.vertex_index_bytes* +4+l.material_index_bytes+l.normal_index_bytes*2;aa=l.vertex_index_bytes*4+l.material_index_bytes+l.normal_index_bytes*3;ba=l.uv_index_bytes;ca=l.uv_index_bytes*2;da=l.uv_index_bytes;ea=l.uv_index_bytes*2;fa=l.uv_index_bytes*3;c=l.vertex_index_bytes*3+l.material_index_bytes;Q=l.vertex_index_bytes*4+l.material_index_bytes;S=l.ntri_flat*c;T=l.ntri_smooth*(c+l.normal_index_bytes*3);U=l.ntri_flat_uv*(c+l.uv_index_bytes*3);V=l.ntri_smooth_uv*(c+l.normal_index_bytes*3+l.uv_index_bytes*3);W=l.nquad_flat* +Q;c=l.nquad_smooth*(Q+l.normal_index_bytes*4);Q=l.nquad_flat_uv*(Q+l.uv_index_bytes*4);x+=function(o){for(var t,y,B,H=l.vertex_coordinate_bytes*3,L=o+l.nvertices*H;o=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]}; THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index 8716579479..df6b7f46b4 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -49,7 +49,7 @@ THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,d,e){this.set(a||0 THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,h=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-h);h=Math.sin(-h);var m=Math.cos(d);d=Math.sin(d);var k=a*b,o=e*h;this.w=k*m-o*d;this.x=k*d+o*m;this.y=e*b*m+a*h*d;this.z=a*h*m-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*= -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,h=this.w,m=a.x,k=a.y,o=a.z;a=a.w;this.x=b*a+h*m+d*o-e*k;this.y=d*a+h*k+e*m-b*o;this.z=e*a+h*o+b*k-d*m;this.w=h*a-b*m-d*k-e*o;return this}, multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,h=a.z,m=this.x,k=this.y,o=this.z,n=this.w,t=n*d+k*h-o*e,y=n*e+o*d-m*h,w=n*h+m*e-k*d;d=-m*d-k*e-o*h;b.x=t*n+d*-m+y*-o-w*-k;b.y=y*n+d*-k+w*-m-t*-o;b.z=w*n+d*-o+t*-k-y*-m;return b}}; -THREE.Quaternion.slerp=function(a,b,d,e){var h=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(h)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}h=Math.sin((1-e)*m)/k;e=Math.sin(e*m)/k;d.w=a.w*h+b.w*e;d.x=a.x*h+b.x*e;d.y=a.y*h+b.y*e;d.z=a.z*h+b.z*e;return d}; +THREE.Quaternion.slerp=function(a,b,d,e){var h=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(h)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}h=Math.sin((1-e)*m)/k;e=Math.sin(e*m)/k;d.w=a.w*h+b.w*e;d.x=a.x*h+b.x*e;d.y=a.y*h+b.y*e;d.z=a.z*h+b.z*e;return d}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; THREE.Face3=function(a,b,d,e,h){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=h instanceof Array?h:[h]};THREE.Face4=function(a,b,d,e,h,m){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=m instanceof Array?m:[m]}; THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; diff --git a/examples/canvas_geometry_cube.html b/examples/canvas_geometry_cube.html index 09235383a8..20f6ac2776 100644 --- a/examples/canvas_geometry_cube.html +++ b/examples/canvas_geometry_cube.html @@ -70,7 +70,7 @@ } - cube = new THREE.Mesh( new Cube( 200, 200, 200, 1, 1, materials ), new THREE.MeshFaceMaterial() ); + cube = new THREE.Mesh( new Cube( 200, 200, 200, 1, 1, 1, materials ), new THREE.MeshFaceMaterial() ); cube.position.y = 150; cube.overdraw = true; scene.addObject( cube ); @@ -78,7 +78,7 @@ // Plane plane = new THREE.Mesh( new Plane( 200, 200 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0 } ) ); - plane.rotation.x = -90 * ( Math.PI / 180 ); + plane.rotation.x = - 90 * ( Math.PI / 180 ); plane.overdraw = true; scene.addObject( plane ); diff --git a/examples/canvas_geometry_panorama.html b/examples/canvas_geometry_panorama.html index b9b658032c..91096c2ac8 100644 --- a/examples/canvas_geometry_panorama.html +++ b/examples/canvas_geometry_panorama.html @@ -77,7 +77,7 @@ ]; - mesh = new THREE.Mesh( new Cube( 300, 300, 300, 7, 7, materials, true ), new THREE.MeshFaceMaterial() ); + mesh = new THREE.Mesh( new Cube( 300, 300, 300, 7, 7, 7, materials, true ), new THREE.MeshFaceMaterial() ); mesh.overdraw = true; scene.addObject( mesh ); diff --git a/examples/canvas_geometry_panorama_fisheye.html b/examples/canvas_geometry_panorama_fisheye.html index 48e6aab9e0..87c78d0a14 100644 --- a/examples/canvas_geometry_panorama_fisheye.html +++ b/examples/canvas_geometry_panorama_fisheye.html @@ -77,7 +77,7 @@ ]; - mesh = new THREE.Mesh( new Cube( 300, 300, 300, 7, 7, materials, true ), new THREE.MeshFaceMaterial() ); + mesh = new THREE.Mesh( new Cube( 300, 300, 300, 7, 7, 7, materials, true ), new THREE.MeshFaceMaterial() ); mesh.overdraw = true; scene.addObject( mesh ); diff --git a/examples/webgl_geometry_minecraft.html b/examples/webgl_geometry_minecraft.html index 9b2b234f63..e5f4e57aa2 100644 --- a/examples/webgl_geometry_minecraft.html +++ b/examples/webgl_geometry_minecraft.html @@ -105,7 +105,7 @@ nx = (i & 4) == 4; pz = (i & 2) == 2; nz = (i & 1) == 1; - cubes[ i ] = new Cube( 100, 100, 100, 1, 1, materials, false, { px: px, nx: nx, py: true, ny: false, pz: pz, nz: nz } ); + cubes[ i ] = new Cube( 100, 100, 100, 1, 1, 1, materials, false, { px: px, nx: nx, py: true, ny: false, pz: pz, nz: nz } ); } diff --git a/examples/webgl_geometry_minecraft_ao.html b/examples/webgl_geometry_minecraft_ao.html index 56f3a501a1..65056cd861 100644 --- a/examples/webgl_geometry_minecraft_ao.html +++ b/examples/webgl_geometry_minecraft_ao.html @@ -368,7 +368,7 @@ sides = { px: px, nx: nx, py: true, ny: false, pz: pz, nz: nz }; - cube = new Cube( 100, 100, 100, 1, 1, materials, false, sides ); + cube = new Cube( 100, 100, 100, 1, 1, 1, materials, false, sides ); // set UV tiles diff --git a/examples/webgl_lod.html b/examples/webgl_lod.html index 8e6757e6a1..33a33ad96c 100644 --- a/examples/webgl_lod.html +++ b/examples/webgl_lod.html @@ -87,11 +87,10 @@ ]; var geometry = [ - [ new Sphere( 100, 128, 64 ), 0 ], - [ new Sphere( 100, 64, 32 ), 200 ], - [ new Sphere( 100, 32, 16 ), 400 ], - [ new Sphere( 100, 16, 8 ), 6000 ], - [ new Sphere( 100, 8, 4 ), 12000 ] + [ new Sphere( 100, 64, 32 ), 300 ], + [ new Sphere( 100, 32, 16 ), 1000 ], + [ new Sphere( 100, 16, 8 ), 2000 ], + [ new Sphere( 100, 8, 4 ), 10000 ] ]; var i, j, mesh, lod; diff --git a/examples/webgl_shader2.html b/examples/webgl_shader2.html index 37cd60530a..b172feaa54 100644 --- a/examples/webgl_shader2.html +++ b/examples/webgl_shader2.html @@ -228,7 +228,7 @@ mlib[ i ] = material; - mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, [ mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ] ], false ), new THREE.MeshFaceMaterial() ); + mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, 1, [ mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ] ], false ), new THREE.MeshFaceMaterial() ); mesh.position.x = i - (params.length - 1)/2; mesh.position.y = i % 2 - 0.5; scene.addObject( mesh ); diff --git a/src/extras/SceneUtils.js b/src/extras/SceneUtils.js index 04ae0474a9..5b46922542 100644 --- a/src/extras/SceneUtils.js +++ b/src/extras/SceneUtils.js @@ -427,7 +427,7 @@ var SceneUtils = { uniforms: shader.uniforms } ), - mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, null, true ), material ); + mesh = new THREE.Mesh( new Cube( size, size, size, 1, 1, 1, null, true ), material ); scene.addObject( mesh ); return mesh; diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 884a914770..3960020a71 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -2306,16 +2306,16 @@ THREE.WebGLRenderer = function ( parameters ) { geometry.__dirtyVertices = false; geometry.__dirtyColors = false; - } else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes ) { + }/* else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes ) { // it updates itself in render callback - - }/*else if ( object instanceof THREE.Particle ) { + + } else if ( object instanceof THREE.Particle ) { }*/ }; - + function sortFacesByMaterial( geometry ) { // TODO -- GitLab