From 506d7e1fa0ac016b62b9384e0d3bcdf11ddbf4c1 Mon Sep 17 00:00:00 2001 From: alteredq Date: Wed, 26 Jan 2011 21:15:55 +0100 Subject: [PATCH 1/4] Added progress reporting to scene loader. --- build/ThreeExtras.js | 344 +++++++++++++++++++-------------------- examples/scene_test.html | 40 ++++- src/extras/SceneUtils.js | 18 +- 3 files changed, 223 insertions(+), 179 deletions(-) diff --git a/build/ThreeExtras.js b/build/ThreeExtras.js index 1c08bc60..cd204a58 100644 --- a/build/ThreeExtras.js +++ b/build/ThreeExtras.js @@ -12,50 +12,50 @@ THREE.Vector4=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1} THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){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)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a0&&H>0&&m+H<1}var d,e,g,f,h,c,k,l,q,C, -o,v=a.geometry,x=v.vertices,t=[];d=0;for(e=v.faces.length;dk?e:k;g=g>l? -g:l}a()};this.add3Points=function(k,l,q,C,o,v){if(c){c=false;b=kq?k>o?k:o:q>o?q:o;g=l>C?l>v?l:v:C>v?C:v}else{b=kq?k>o?k>e?k:e:o>e?o:e:q>o?q>e?q:e:o>e?o:e;g=l>C?l>v?l>g?l:g:v>g?v:g:C>v?C>g?C:g:v>g?v:g}a()};this.addRectangle=function(k){if(c){c=false;b=k.getLeft();d=k.getTop();e=k.getRight();g=k.getBottom()}else{b=bk.getRight()?e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;d-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e=0&&Math.min(g,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){c=true;g=e=d=b=0;a()};this.isEmpty=function(){return c};this.toString= -function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+d+", bottom: "+g+", width: "+f+", height: "+h+" )"}};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}}; -THREE.Matrix4=function(a,b,d,e,g,f,h,c,k,l,q,C,o,v,x,t){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=f||1;this.n23=h||0;this.n24=c||0;this.n31=k||0;this.n32=l||0;this.n33=q||1;this.n34=C||0;this.n41=o||0;this.n42=v||0;this.n43=x||0;this.n44=t||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,g,f,h,c,k,l,q,C,o,v,x,t){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=f;this.n23=h;this.n24=c;this.n31=k;this.n32=l;this.n33=q;this.n34=C;this.n41=o;this.n42=v;this.n43=x;this.n44=t;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();e.cross(d,f).normalize();g.cross(f,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); -this.n31=f.x;this.n32=f.y;this.n33=f.z;this.n34=-f.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23* -e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;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 d=a.n11,e=a.n12,g=a.n13,f=a.n14,h=a.n21,c=a.n22,k=a.n23,l=a.n24,q=a.n31, -C=a.n32,o=a.n33,v=a.n34,x=a.n41,t=a.n42,H=a.n43,w=a.n44,J=b.n11,n=b.n12,j=b.n13,m=b.n14,B=b.n21,u=b.n22,p=b.n23,M=b.n24,y=b.n31,D=b.n32,F=b.n33,E=b.n34,A=b.n41,O=b.n42,K=b.n43,U=b.n44;this.n11=d*J+e*B+g*y+f*A;this.n12=d*n+e*u+g*D+f*O;this.n13=d*j+e*p+g*F+f*K;this.n14=d*m+e*M+g*E+f*U;this.n21=h*J+c*B+k*y+l*A;this.n22=h*n+c*u+k*D+l*O;this.n23=h*j+c*p+k*F+l*K;this.n24=h*m+c*M+k*E+l*U;this.n31=q*J+C*B+o*y+v*A;this.n32=q*n+C*u+o*D+v*O;this.n33=q*j+C*p+o*F+v*K;this.n34=q*m+C*M+o*E+v*U;this.n41=x*J+t*B+ -H*y+w*A;this.n42=x*n+t*u+H*D+w*O;this.n43=x*j+t*p+H*F+w*K;this.n44=x*m+t*M+H*E+w*U;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,f=this.n21,h=this.n22,c=this.n23,k=this.n24,l=this.n31,q=this.n32,C=this.n33,o=this.n34,v=this.n41,x=this.n42,t=this.n43,H=this.n44,w=a.n11,J=a.n21,n=a.n31,j=a.n41,m=a.n12,B=a.n22,u=a.n32,p=a.n42,M=a.n13,y=a.n23,D=a.n33,F=a.n43,E=a.n14,A=a.n24,O=a.n34;a=a.n44;this.n11=b*w+d*J+e*n+g*j;this.n12=b*m+d*B+e*u+g*p;this.n13=b*M+d*y+e*D+g* -F;this.n14=b*E+d*A+e*O+g*a;this.n21=f*w+h*J+c*n+k*j;this.n22=f*m+h*B+c*u+k*p;this.n23=f*M+h*y+c*D+k*F;this.n24=f*E+h*A+c*O+k*a;this.n31=l*w+q*J+C*n+o*j;this.n32=l*m+q*B+C*u+o*p;this.n33=l*M+q*y+C*D+o*F;this.n34=l*E+q*A+C*O+o*a;this.n41=v*w+x*J+t*n+H*j;this.n42=v*m+x*B+t*u+H*p;this.n43=v*M+x*y+t*D+H*F;this.n44=v*E+x*A+t*O+H*a;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,d=this.n13,e=this.n14,g=this.n21,f=this.n22,h=this.n23,c=this.n24,k=this.n31,l=this.n32,q=this.n33,C=this.n34,o=this.n41,v=this.n42,x=this.n43,t=this.n44;return e*h*l*o-d*c*l*o-e*f*q*o+b*c*q*o+d*f*C*o-b*h*C*o-e*h*k*v+d*c*k*v+e*g*q*v-a*c*q*v-d*g*C*v+a*h*C*v+e*f*k*x-b*c*k*x-e*g*l*x+a*c*l*x+b*g*C*x-a*f*C*x-d*f*k*t+b*h*k*t+d*g*l*t-a*h*l*t-b*g*q*t+a*f*q*t},transpose:function(){function a(b,d, -e){var g=b[d];b[d]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11; +THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,f=[];a=0;for(b=e.length;a0&&G>0&&o+G<1}var d,e,f,g,k,c,h,l,t,B, +p,v=a.geometry,u=v.vertices,D=[];d=0;for(e=v.faces.length;dh?e:h;f=f>l? +f:l}a()};this.add3Points=function(h,l,t,B,p,v){if(c){c=false;b=ht?h>p?h:p:t>p?t:p;f=l>B?l>v?l:v:B>v?B:v}else{b=ht?h>p?h>e?h:e:p>e?p:e:t>p?t>e?t:e:p>e?p:e;f=l>B?l>v?l>f?l:f:v>f?v:f:B>v?B>f?B:f:v>f?v:f}a()};this.addRectangle=function(h){if(c){c=false;b=h.getLeft();d=h.getTop();e=h.getRight();f=h.getBottom()}else{b=bh.getRight()?e:h.getRight();f=f>h.getBottom()?f:h.getBottom()}a()};this.inflate=function(h){b-=h;d-=h;e+=h;f+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e=0&&Math.min(f,h.getBottom())-Math.max(d,h.getTop())>=0};this.empty=function(){c=true;f=e=d=b=0;a()};this.isEmpty=function(){return c};this.toString= +function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+d+", bottom: "+f+", width: "+g+", height: "+k+" )"}};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}}; +THREE.Matrix4=function(a,b,d,e,f,g,k,c,h,l,t,B,p,v,u,D){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=f||0;this.n22=g||1;this.n23=k||0;this.n24=c||0;this.n31=h||0;this.n32=l||0;this.n33=t||1;this.n34=B||0;this.n41=p||0;this.n42=v||0;this.n43=u||0;this.n44=D||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,f,g,k,c,h,l,t,B,p,v,u,D){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=f;this.n22=g;this.n23=k;this.n24=c;this.n31=h;this.n32=l;this.n33=t;this.n34=B;this.n41=p;this.n42=v;this.n43=u;this.n44=D;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();e.cross(d,g).normalize();f.cross(g,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a); +this.n31=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,f=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*d+this.n23* +e+this.n24*f;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*d+this.n43*e+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 d=a.n11,e=a.n12,f=a.n13,g=a.n14,k=a.n21,c=a.n22,h=a.n23,l=a.n24,t=a.n31, +B=a.n32,p=a.n33,v=a.n34,u=a.n41,D=a.n42,G=a.n43,n=a.n44,I=b.n11,m=b.n12,j=b.n13,o=b.n14,C=b.n21,q=b.n22,y=b.n23,K=b.n24,w=b.n31,E=b.n32,A=b.n33,F=b.n34,z=b.n41,O=b.n42,L=b.n43,U=b.n44;this.n11=d*I+e*C+f*w+g*z;this.n12=d*m+e*q+f*E+g*O;this.n13=d*j+e*y+f*A+g*L;this.n14=d*o+e*K+f*F+g*U;this.n21=k*I+c*C+h*w+l*z;this.n22=k*m+c*q+h*E+l*O;this.n23=k*j+c*y+h*A+l*L;this.n24=k*o+c*K+h*F+l*U;this.n31=t*I+B*C+p*w+v*z;this.n32=t*m+B*q+p*E+v*O;this.n33=t*j+B*y+p*A+v*L;this.n34=t*o+B*K+p*F+v*U;this.n41=u*I+D*C+ +G*w+n*z;this.n42=u*m+D*q+G*E+n*O;this.n43=u*j+D*y+G*A+n*L;this.n44=u*o+D*K+G*F+n*U;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,k=this.n22,c=this.n23,h=this.n24,l=this.n31,t=this.n32,B=this.n33,p=this.n34,v=this.n41,u=this.n42,D=this.n43,G=this.n44,n=a.n11,I=a.n21,m=a.n31,j=a.n41,o=a.n12,C=a.n22,q=a.n32,y=a.n42,K=a.n13,w=a.n23,E=a.n33,A=a.n43,F=a.n14,z=a.n24,O=a.n34;a=a.n44;this.n11=b*n+d*I+e*m+f*j;this.n12=b*o+d*C+e*q+f*y;this.n13=b*K+d*w+e*E+f* +A;this.n14=b*F+d*z+e*O+f*a;this.n21=g*n+k*I+c*m+h*j;this.n22=g*o+k*C+c*q+h*y;this.n23=g*K+k*w+c*E+h*A;this.n24=g*F+k*z+c*O+h*a;this.n31=l*n+t*I+B*m+p*j;this.n32=l*o+t*C+B*q+p*y;this.n33=l*K+t*w+B*E+p*A;this.n34=l*F+t*z+B*O+p*a;this.n41=v*n+u*I+D*m+G*j;this.n42=v*o+u*C+D*q+G*y;this.n43=v*K+u*w+D*E+G*A;this.n44=v*F+u*z+D*O+G*a;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,d=this.n13,e=this.n14,f=this.n21,g=this.n22,k=this.n23,c=this.n24,h=this.n31,l=this.n32,t=this.n33,B=this.n34,p=this.n41,v=this.n42,u=this.n43,D=this.n44;return e*k*l*p-d*c*l*p-e*g*t*p+b*c*t*p+d*g*B*p-b*k*B*p-e*k*h*v+d*c*h*v+e*f*t*v-a*c*t*v-d*f*B*v+a*k*B*v+e*g*h*u-b*c*h*u-e*f*l*u+a*c*l*u+b*f*B*u-a*g*B*u-d*g*h*D+b*k*h*D+d*f*l*D-a*k*l*D-b*f*t*D+a*g*t*D},transpose:function(){function a(b,d, +e){var f=b[d];b[d]=b[e];b[e]=f}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;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},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,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 d=Math.cos(b),e=Math.sin(b),g=1-d,f=a.x,h=a.y,c=a.z,k=g*f,l=g*h;this.set(k*f+d,k*h-e*c,k*c+e*h,0,k*h+e*c,l*h+d,l*c-e*f,0,k*c-e*h,l*c+e*f,g*c*c+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +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 d=Math.cos(b),e=Math.sin(b),f=1-d,g=a.x,k=a.y,c=a.z,h=f*g,l=f*k;this.set(h*g+d,h*k-e*c,h*c+e*k,0,h*k+e*c,l*k+d,l*c-e*g,0,h*c-e*k,l*c+e*g,f*c*c+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};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 d=new THREE.Matrix4;d.setRotAxis(a,b);return d}; -THREE.Matrix4.makeInvert=function(a){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,c=a.n23,k=a.n24,l=a.n31,q=a.n32,C=a.n33,o=a.n34,v=a.n41,x=a.n42,t=a.n43,H=a.n44,w=new THREE.Matrix4;w.n11=c*o*x-k*C*x+k*q*t-h*o*t-c*q*H+h*C*H;w.n12=g*C*x-e*o*x-g*q*t+d*o*t+e*q*H-d*C*H;w.n13=e*k*x-g*c*x+g*h*t-d*k*t-e*h*H+d*c*H;w.n14=g*c*q-e*k*q-g*h*C+d*k*C+e*h*o-d*c*o;w.n21=k*C*v-c*o*v-k*l*t+f*o*t+c*l*H-f*C*H;w.n22=e*o*v-g*C*v+g*l*t-b*o*t-e*l*H+b*C*H;w.n23=g*c*v-e*k*v-g*f*t+b*k*t+e*f*H-b*c*H;w.n24=e*k*l-g*c*l+ -g*f*C-b*k*C-e*f*o+b*c*o;w.n31=h*o*v-k*q*v+k*l*x-f*o*x-h*l*H+f*q*H;w.n32=g*q*v-d*o*v-g*l*x+b*o*x+d*l*H-b*q*H;w.n33=e*k*v-g*h*v+g*f*x-b*k*x-d*f*H+b*h*H;w.n34=g*h*l-d*k*l-g*f*q+b*k*q+d*f*o-b*h*o;w.n41=c*q*v-h*C*v-c*l*x+f*C*x+h*l*t-f*q*t;w.n42=d*C*v-e*q*v+e*l*x-b*C*x-d*l*t+b*q*t;w.n43=e*h*v-d*c*v-e*f*x+b*c*x+d*f*t-b*h*t;w.n44=d*c*l-e*h*l+e*f*q-b*c*q-d*f*C+b*h*C;w.multiplyScalar(1/a.determinant());return w}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=a.m33;var d=a.m,e=b[10]*b[5]-b[6]*b[9],g=-b[10]*b[1]+b[2]*b[9],f=b[6]*b[1]-b[2]*b[5],h=-b[10]*b[4]+b[6]*b[8],c=b[10]*b[0]-b[2]*b[8],k=-b[6]*b[0]+b[2]*b[4],l=b[9]*b[4]-b[5]*b[8],q=-b[9]*b[0]+b[1]*b[8],C=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*h+b[2]*l;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*e;d[1]=b*g;d[2]=b*f;d[3]=b*h;d[4]=b*c;d[5]=b*k;d[6]=b*l;d[7]=b*q;d[8]=b*C;return a}; -THREE.Matrix4.makeFrustum=function(a,b,d,e,g,f){var h,c,k;h=new THREE.Matrix4;c=2*g/(b-a);k=2*g/(e-d);a=(b+a)/(b-a);d=(e+d)/(e-d);e=-(f+g)/(f-g);g=-2*f*g/(f-g);h.n11=c;h.n12=0;h.n13=a;h.n14=0;h.n21=0;h.n22=k;h.n23=d;h.n24=0;h.n31=0;h.n32=0;h.n33=e;h.n34=g;h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)}; -THREE.Matrix4.makeOrtho=function(a,b,d,e,g,f){var h,c,k,l;h=new THREE.Matrix4;c=b-a;k=d-e;l=f-g;a=(b+a)/c;d=(d+e)/k;g=(f+g)/l;h.n11=2/c;h.n12=0;h.n13=0;h.n14=-a;h.n21=0;h.n22=2/k;h.n23=0;h.n24=-d;h.n31=0;h.n32=0;h.n33=-2/l;h.n34=-g;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.makeInvert=function(a){var b=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,k=a.n22,c=a.n23,h=a.n24,l=a.n31,t=a.n32,B=a.n33,p=a.n34,v=a.n41,u=a.n42,D=a.n43,G=a.n44,n=new THREE.Matrix4;n.n11=c*p*u-h*B*u+h*t*D-k*p*D-c*t*G+k*B*G;n.n12=f*B*u-e*p*u-f*t*D+d*p*D+e*t*G-d*B*G;n.n13=e*h*u-f*c*u+f*k*D-d*h*D-e*k*G+d*c*G;n.n14=f*c*t-e*h*t-f*k*B+d*h*B+e*k*p-d*c*p;n.n21=h*B*v-c*p*v-h*l*D+g*p*D+c*l*G-g*B*G;n.n22=e*p*v-f*B*v+f*l*D-b*p*D-e*l*G+b*B*G;n.n23=f*c*v-e*h*v-f*g*D+b*h*D+e*g*G-b*c*G;n.n24=e*h*l-f*c*l+ +f*g*B-b*h*B-e*g*p+b*c*p;n.n31=k*p*v-h*t*v+h*l*u-g*p*u-k*l*G+g*t*G;n.n32=f*t*v-d*p*v-f*l*u+b*p*u+d*l*G-b*t*G;n.n33=e*h*v-f*k*v+f*g*u-b*h*u-d*g*G+b*k*G;n.n34=f*k*l-d*h*l-f*g*t+b*h*t+d*g*p-b*k*p;n.n41=c*t*v-k*B*v-c*l*u+g*B*u+k*l*D-g*t*D;n.n42=d*B*v-e*t*v+e*l*u-b*B*u-d*l*D+b*t*D;n.n43=e*k*v-d*c*v-e*g*u+b*c*u+d*g*D-b*k*D;n.n44=d*c*l-e*k*l+e*g*t-b*c*t-d*g*B+b*k*B;n.multiplyScalar(1/a.determinant());return n}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=a.m33;var d=a.m,e=b[10]*b[5]-b[6]*b[9],f=-b[10]*b[1]+b[2]*b[9],g=b[6]*b[1]-b[2]*b[5],k=-b[10]*b[4]+b[6]*b[8],c=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],l=b[9]*b[4]-b[5]*b[8],t=-b[9]*b[0]+b[1]*b[8],B=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*k+b[2]*l;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*g;d[3]=b*k;d[4]=b*c;d[5]=b*h;d[6]=b*l;d[7]=b*t;d[8]=b*B;return a}; +THREE.Matrix4.makeFrustum=function(a,b,d,e,f,g){var k,c,h;k=new THREE.Matrix4;c=2*f/(b-a);h=2*f/(e-d);a=(b+a)/(b-a);d=(e+d)/(e-d);e=-(g+f)/(g-f);f=-2*g*f/(g-f);k.n11=c;k.n12=0;k.n13=a;k.n14=0;k.n21=0;k.n22=h;k.n23=d;k.n24=0;k.n31=0;k.n32=0;k.n33=e;k.n34=f;k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,b,d,e,f,g){var k,c,h,l;k=new THREE.Matrix4;c=b-a;h=d-e;l=g-f;a=(b+a)/c;d=(d+e)/h;f=(g+f)/l;k.n11=2/c;k.n12=0;k.n13=0;k.n14=-a;k.n21=0;k.n22=2/h;k.n23=0;k.n24=-d;k.n31=0;k.n32=0;k.n33=-2/l;k.n34=-f;k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; 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=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,b,d,e,g){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=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,b,d,e,g,f){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=f instanceof Array?f:[f]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; +THREE.Face3=function(a,b,d,e,f){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=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,b,d,e,f,g){this.a=a;this.b=b;this.c=d;this.d=e;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.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;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], +b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(F,z,O,L,U,W,P){g=F.vertices[z].position;k=F.vertices[O].position;c=F.vertices[L].position;h=f[U];l=f[W];t=f[P];B=k.x-g.x;p=c.x-g.x;v=k.y-g.y;u=c.y-g.y; +D=k.z-g.z;G=c.z-g.z;n=l.u-h.u;I=t.u-h.u;m=l.v-h.v;j=t.v-h.v;o=1/(n*j-I*m);y.set((j*B-m*p)*o,(j*v-m*u)*o,(j*D-m*G)*o);K.set((n*p-I*B)*o,(n*u-I*v)*o,(n*G-I*D)*o);C[z].addSelf(y);C[O].addSelf(y);C[L].addSelf(y);q[z].addSelf(K);q[O].addSelf(K);q[L].addSelf(K)}var b,d,e,f,g,k,c,h,l,t,B,p,v,u,D,G,n,I,m,j,o,C=[],q=[],y=new THREE.Vector3,K=new THREE.Vector3,w=new THREE.Vector3,E=new THREE.Vector3,A=new THREE.Vector3;b=0;for(d=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,d=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,d=this.vertices.length;b65535){l[c].counter+=1;k=l[c].hash+"_"+l[c].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:h,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+ +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,d=this.vertices.length;b65535){l[c].counter+=1;h=l[c].hash+"_"+l[c].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:k,vertices:0}}this.geometryChunks[h].faces.push(e);this.geometryChunks[h].vertices+=g}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,b,d,e){this.fov=a;this.aspect=b;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; -this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; +THREE.Camera=function(a,b,d,e){this.fov=a;this.aspect=b;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(f){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(f){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; @@ -89,101 +89,101 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}}; -THREE.Texture=function(a,b,d,e,g,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter}; +THREE.Texture=function(a,b,d,e,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=g!==undefined?g:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var b,d,e,g={};for(b in a){g[b]={};for(d in a[b]){e=a[b][d];g[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,d,e,g={};for(b=0;b=0&&F>=0&&E>=0&&A>=0)return true;else if(D<0&&F<0||E<0&&A<0)return false;else{if(D<0)M=Math.max(M,D/(D-F));else if(F<0)y=Math.min(y,D/(D-F));if(E<0)M=Math.max(M,E/(E-A));else if(A<0)y=Math.min(y,E/(E-A));if(yD&&K.z0&&H.z<1){o=x[v]=x[v]||new THREE.RenderableParticle;o.x=H.x/H.w;o.y=H.y/H.w;o.z=H.z;o.rotation=P.rotation.z;o.scale.x=P.scale.x*Math.abs(o.x-(H.x+p.projectionMatrix.n11)/(H.w+p.projectionMatrix.n14)); -o.scale.y=P.scale.y*Math.abs(o.y-(H.y+p.projectionMatrix.n22)/(H.w+p.projectionMatrix.n24));o.materials=P.materials;y.push(o);v++}}}}M&&y.sort(a);return y};this.unprojectVector=function(u,p){var M=THREE.Matrix4.makeInvert(p.matrix);M.multiplySelf(THREE.Matrix4.makeInvert(p.projectionMatrix));M.multiplyVector3(u);return u}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,g,f;this.domElement=document.createElement("div");this.setSize=function(h,c){d=h;e=c;g=d/2;f=e/2};this.render=function(h,c){var k,l,q,C,o,v,x,t;a=b.projectScene(h,c);k=0;for(l=a.length;k0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}else if(fa instanceof THREE.PointLight){I.sub(fa.position,ea);I.normalize();fa=aa.dot(I)*na;if(fa>0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}}}function Qa(N,ea,aa){if(aa.opacity!= -0){a(aa.opacity);b(aa.blending);var Q,$,fa,la,na,oa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map){la=aa.map;na=la.width>>1;oa=la.height>>1;$=ea.scale.x*c;fa=ea.scale.y*k;aa=$*na;Q=fa*oa;G.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(G)){l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale($,-fa);l.translate(-na,-oa);l.drawImage(la,0,0);l.restore()}}}else if(aa instanceof THREE.ParticleCircleMaterial){if(S){V.r=ia.r+ha.r+z.r;V.g=ia.g+ha.g+z.g;V.b=ia.b+ha.b+z.b;y.r=aa.color.r* -V.r;y.g=aa.color.g*V.g;y.b=aa.color.b*V.b;y.updateStyleString()}else y.__styleString=aa.color.__styleString;aa=ea.scale.x*c;Q=ea.scale.y*k;G.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(G)){$=y.__styleString;if(t!=$)l.fillStyle=t=$;l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale(aa,Q);l.beginPath();l.arc(0,0,1,0,L,true);l.closePath();l.fill();l.restore()}}}}function Ra(N,ea,aa,Q){if(Q.opacity!=0){a(Q.opacity);b(Q.blending);l.beginPath();l.moveTo(N.positionScreen.x,N.positionScreen.y); -l.lineTo(ea.positionScreen.x,ea.positionScreen.y);l.closePath();if(Q instanceof THREE.LineBasicMaterial){y.__styleString=Q.color.__styleString;N=Q.linewidth;if(H!=N)l.lineWidth=H=N;N=y.__styleString;if(x!=N)l.strokeStyle=x=N;l.stroke();G.inflate(Q.linewidth*2)}}}function La(N,ea,aa,Q,$,fa){if($.opacity!=0){a($.opacity);b($.blending);j=N.positionScreen.x;m=N.positionScreen.y;B=ea.positionScreen.x;u=ea.positionScreen.y;p=aa.positionScreen.x;M=aa.positionScreen.y;l.beginPath();l.moveTo(j,m);l.lineTo(B, -u);l.lineTo(p,M);l.lineTo(j,m);l.closePath();if($ instanceof THREE.MeshBasicMaterial)if($.map)$.map.image.loaded&&$.map.mapping instanceof THREE.UVMapping&&Aa(j,m,B,u,p,M,$.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);else if($.env_map){if($.env_map.image.loaded)if($.env_map.mapping instanceof THREE.SphericalReflectionMapping){N=wa.matrix;I.copy(Q.vertexNormalsWorld[0]);W=(I.x*N.n11+I.y*N.n12+I.z*N.n13)*0.5+0.5;P=-(I.x*N.n21+I.y*N.n22+I.z*N.n23)*0.5+0.5;I.copy(Q.vertexNormalsWorld[1]); -da=(I.x*N.n11+I.y*N.n12+I.z*N.n13)*0.5+0.5;X=-(I.x*N.n21+I.y*N.n22+I.z*N.n23)*0.5+0.5;I.copy(Q.vertexNormalsWorld[2]);R=(I.x*N.n11+I.y*N.n12+I.z*N.n13)*0.5+0.5;T=-(I.x*N.n21+I.y*N.n22+I.z*N.n23)*0.5+0.5;Aa(j,m,B,u,p,M,$.env_map.image,W,P,da,X,R,T)}}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){$.map.mapping instanceof THREE.UVMapping&&Aa(j,m,B,u,p,M,$.map.image,Q.uvs[0].u,Q.uvs[0].v, -Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);b(THREE.SubtractiveBlending)}if(S)if(!$.wireframe&&$.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){D.r=F.r=E.r=ia.r;D.g=F.g=E.g=ia.g;D.b=F.b=E.b=ia.b;Da(fa,Q.v1.positionWorld,Q.vertexNormalsWorld[0],D);Da(fa,Q.v2.positionWorld,Q.vertexNormalsWorld[1],F);Da(fa,Q.v3.positionWorld,Q.vertexNormalsWorld[2],E);A.r=(F.r+E.r)*0.5;A.g=(F.g+E.g)*0.5;A.b=(F.b+E.b)*0.5;U=Ma(D,F,E,A);Aa(j,m,B,u,p,M,U,0,0,1,0,0,1)}else{V.r=ia.r;V.g=ia.g;V.b=ia.b;Da(fa, -Q.centroidWorld,Q.normalWorld,V);y.r=$.color.r*V.r;y.g=$.color.g*V.g;y.b=$.color.b*V.b;y.updateStyleString();$.wireframe?Ea(y.__styleString,$.wireframe_linewidth):Fa(y.__styleString)}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){O=wa.near;K=wa.far;D.r=D.g=D.b=1-Ha(N.positionScreen.z,O,K);F.r=F.g=F.b=1-Ha(ea.positionScreen.z,O,K);E.r=E.g=E.b=1-Ha(aa.positionScreen.z,O,K);A.r=(F.r+E.r)*0.5;A.g=(F.g+E.g)*0.5;A.b= -(F.b+E.b)*0.5;U=Ma(D,F,E,A);Aa(j,m,B,u,p,M,U,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){y.r=Ia(Q.normalWorld.x);y.g=Ia(Q.normalWorld.y);y.b=Ia(Q.normalWorld.z);y.updateStyleString();$.wireframe?Ea(y.__styleString,$.wireframe_linewidth):Fa(y.__styleString)}}}function Ea(N,ea){if(x!=N)l.strokeStyle=x=N;if(H!=ea)l.lineWidth=H=ea;l.stroke();G.inflate(ea*2)}function Fa(N){if(t!=N)l.fillStyle=t=N;l.fill()}function Aa(N,ea,aa,Q,$,fa,la,na,oa,ta,pa,ua,Ba){var xa,va;xa=la.width-1;va=la.height- +THREE.Projector=function(){function a(q,y){return y.z-q.z}function b(q,y){var K=0,w=1,E=q.z+q.w,A=y.z+y.w,F=-q.z+q.w,z=-y.z+y.w;if(E>=0&&A>=0&&F>=0&&z>=0)return true;else if(E<0&&A<0||F<0&&z<0)return false;else{if(E<0)K=Math.max(K,E/(E-A));else if(A<0)w=Math.min(w,E/(E-A));if(F<0)K=Math.max(K,F/(F-z));else if(z<0)w=Math.min(w,F/(F-z));if(wE&&L.z0&&G.z<1){p=u[v]=u[v]||new THREE.RenderableParticle;p.x=G.x/G.w;p.y=G.y/G.w;p.z=G.z;p.rotation=P.rotation.z;p.scale.x=P.scale.x*Math.abs(p.x-(G.x+y.projectionMatrix.n11)/(G.w+y.projectionMatrix.n14)); +p.scale.y=P.scale.y*Math.abs(p.y-(G.y+y.projectionMatrix.n22)/(G.w+y.projectionMatrix.n24));p.materials=P.materials;w.push(p);v++}}}}K&&w.sort(a);return w};this.unprojectVector=function(q,y){var K=THREE.Matrix4.makeInvert(y.matrix);K.multiplySelf(THREE.Matrix4.makeInvert(y.projectionMatrix));K.multiplyVector3(q);return q}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,f,g;this.domElement=document.createElement("div");this.setSize=function(k,c){d=k;e=c;f=d/2;g=e/2};this.render=function(k,c){var h,l,t,B,p,v,u,D;a=b.projectScene(k,c);h=0;for(l=a.length;h0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}else if(fa instanceof THREE.PointLight){J.sub(fa.position,ea);J.normalize();fa=aa.dot(J)*na;if(fa>0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}}}function Qa(N,ea,aa){if(aa.opacity!= +0){a(aa.opacity);b(aa.blending);var Q,$,fa,la,na,oa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map){la=aa.map;na=la.width>>1;oa=la.height>>1;$=ea.scale.x*c;fa=ea.scale.y*h;aa=$*na;Q=fa*oa;H.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(H)){l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale($,-fa);l.translate(-na,-oa);l.drawImage(la,0,0);l.restore()}}}else if(aa instanceof THREE.ParticleCircleMaterial){if(S){V.r=ia.r+ha.r+x.r;V.g=ia.g+ha.g+x.g;V.b=ia.b+ha.b+x.b;w.r=aa.color.r* +V.r;w.g=aa.color.g*V.g;w.b=aa.color.b*V.b;w.updateStyleString()}else w.__styleString=aa.color.__styleString;aa=ea.scale.x*c;Q=ea.scale.y*h;H.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(H)){$=w.__styleString;if(D!=$)l.fillStyle=D=$;l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale(aa,Q);l.beginPath();l.arc(0,0,1,0,M,true);l.closePath();l.fill();l.restore()}}}}function Ra(N,ea,aa,Q){if(Q.opacity!=0){a(Q.opacity);b(Q.blending);l.beginPath();l.moveTo(N.positionScreen.x,N.positionScreen.y); +l.lineTo(ea.positionScreen.x,ea.positionScreen.y);l.closePath();if(Q instanceof THREE.LineBasicMaterial){w.__styleString=Q.color.__styleString;N=Q.linewidth;if(G!=N)l.lineWidth=G=N;N=w.__styleString;if(u!=N)l.strokeStyle=u=N;l.stroke();H.inflate(Q.linewidth*2)}}}function La(N,ea,aa,Q,$,fa){if($.opacity!=0){a($.opacity);b($.blending);j=N.positionScreen.x;o=N.positionScreen.y;C=ea.positionScreen.x;q=ea.positionScreen.y;y=aa.positionScreen.x;K=aa.positionScreen.y;l.beginPath();l.moveTo(j,o);l.lineTo(C, +q);l.lineTo(y,K);l.lineTo(j,o);l.closePath();if($ instanceof THREE.MeshBasicMaterial)if($.map)$.map.image.loaded&&$.map.mapping instanceof THREE.UVMapping&&Aa(j,o,C,q,y,K,$.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);else if($.env_map){if($.env_map.image.loaded)if($.env_map.mapping instanceof THREE.SphericalReflectionMapping){N=wa.matrix;J.copy(Q.vertexNormalsWorld[0]);W=(J.x*N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;P=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;J.copy(Q.vertexNormalsWorld[1]); +da=(J.x*N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;X=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;J.copy(Q.vertexNormalsWorld[2]);R=(J.x*N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;T=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;Aa(j,o,C,q,y,K,$.env_map.image,W,P,da,X,R,T)}}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){$.map.mapping instanceof THREE.UVMapping&&Aa(j,o,C,q,y,K,$.map.image,Q.uvs[0].u,Q.uvs[0].v, +Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);b(THREE.SubtractiveBlending)}if(S)if(!$.wireframe&&$.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){E.r=A.r=F.r=ia.r;E.g=A.g=F.g=ia.g;E.b=A.b=F.b=ia.b;Da(fa,Q.v1.positionWorld,Q.vertexNormalsWorld[0],E);Da(fa,Q.v2.positionWorld,Q.vertexNormalsWorld[1],A);Da(fa,Q.v3.positionWorld,Q.vertexNormalsWorld[2],F);z.r=(A.r+F.r)*0.5;z.g=(A.g+F.g)*0.5;z.b=(A.b+F.b)*0.5;U=Ma(E,A,F,z);Aa(j,o,C,q,y,K,U,0,0,1,0,0,1)}else{V.r=ia.r;V.g=ia.g;V.b=ia.b;Da(fa, +Q.centroidWorld,Q.normalWorld,V);w.r=$.color.r*V.r;w.g=$.color.g*V.g;w.b=$.color.b*V.b;w.updateStyleString();$.wireframe?Ea(w.__styleString,$.wireframe_linewidth):Fa(w.__styleString)}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){O=wa.near;L=wa.far;E.r=E.g=E.b=1-Ha(N.positionScreen.z,O,L);A.r=A.g=A.b=1-Ha(ea.positionScreen.z,O,L);F.r=F.g=F.b=1-Ha(aa.positionScreen.z,O,L);z.r=(A.r+F.r)*0.5;z.g=(A.g+F.g)*0.5;z.b= +(A.b+F.b)*0.5;U=Ma(E,A,F,z);Aa(j,o,C,q,y,K,U,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){w.r=Ia(Q.normalWorld.x);w.g=Ia(Q.normalWorld.y);w.b=Ia(Q.normalWorld.z);w.updateStyleString();$.wireframe?Ea(w.__styleString,$.wireframe_linewidth):Fa(w.__styleString)}}}function Ea(N,ea){if(u!=N)l.strokeStyle=u=N;if(G!=ea)l.lineWidth=G=ea;l.stroke();H.inflate(ea*2)}function Fa(N){if(D!=N)l.fillStyle=D=N;l.fill()}function Aa(N,ea,aa,Q,$,fa,la,na,oa,ta,pa,ua,Ba){var xa,va;xa=la.width-1;va=la.height- 1;na*=xa;oa*=va;ta*=xa;pa*=va;ua*=xa;Ba*=va;aa-=N;Q-=ea;$-=N;fa-=ea;ta-=na;pa-=oa;ua-=na;Ba-=oa;va=1/(ta*Ba-ua*pa);xa=(Ba*aa-pa*$)*va;pa=(Ba*Q-pa*fa)*va;aa=(ta*$-ua*aa)*va;Q=(ta*fa-ua*Q)*va;N=N-xa*na-aa*oa;ea=ea-pa*na-Q*oa;l.save();l.transform(xa,pa,aa,Q,N,ea);l.clip();l.drawImage(la,0,0);l.restore()}function Ma(N,ea,aa,Q){var $=~~(N.r*255),fa=~~(N.g*255);N=~~(N.b*255);var la=~~(ea.r*255),na=~~(ea.g*255);ea=~~(ea.b*255);var oa=~~(aa.r*255),ta=~~(aa.g*255);aa=~~(aa.b*255);var pa=~~(Q.r*255),ua=~~(Q.g* 255);Q=~~(Q.b*255);ja[0]=$<0?0:$>255?255:$;ja[1]=fa<0?0:fa>255?255:fa;ja[2]=N<0?0:N>255?255:N;ja[4]=la<0?0:la>255?255:la;ja[5]=na<0?0:na>255?255:na;ja[6]=ea<0?0:ea>255?255:ea;ja[8]=oa<0?0:oa>255?255:oa;ja[9]=ta<0?0:ta>255?255:ta;ja[10]=aa<0?0:aa>255?255:aa;ja[12]=pa<0?0:pa>255?255:pa;ja[13]=ua<0?0:ua>255?255:ua;ja[14]=Q<0?0:Q>255?255:Q;ca.putImageData(ga,0,0);sa.drawImage(Z,0,0);return qa}function Ha(N,ea,aa){N=(N-ea)/(aa-ea);return N*N*(3-2*N)}function Ia(N){N=(N+1)*0.5;return N<0?0:N>1?1:N}function Ja(N, -ea){var aa=ea.x-N.x,Q=ea.y-N.y,$=1/Math.sqrt(aa*aa+Q*Q);aa*=$;Q*=$;ea.x+=aa;ea.y+=Q;N.x-=aa;N.y-=Q}var Ga,Na,ka,ra,za,Ka,Oa,Ca;l.setTransform(1,0,0,-1,c,k);this.autoClear&&this.clear();d=e.projectScene(ma,wa,this.sortElements);(S=ma.lights.length>0)&&Pa(ma);Ga=0;for(Na=d.length;Ga0)&&Pa(ma);Ga=0;for(Na=d.length;Ga0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}else if(T instanceof THREE.PointLight){M.sub(T.position,P.centroidWorld);M.normalize();ba=P.normalWorld.dot(M)*T.intensity;if(ba>0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}}}function b(W,P,da,X,R,T){E=e(A++);E.setAttribute("d", -"M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)n.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(J){j.r=m.r;j.g=m.g;j.b=m.b;a(T,X,j);n.r=R.color.r*j.r;n.g=R.color.g*j.g;n.b=R.color.b*j.b;n.updateStyleString()}else n.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshDepthMaterial){p=1-R.__2near/(R.__farPlusNear- -X.z*R.__farMinusNear);n.setRGB(p,p,p)}else R instanceof THREE.MeshNormalMaterial&&n.setRGB(g(X.normalWorld.x),g(X.normalWorld.y),g(X.normalWorld.z));R.wireframe?E.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):E.setAttribute("style","fill: "+n.__styleString+"; fill-opacity: "+R.opacity);c.appendChild(E)}function d(W,P,da,X,R,T,ba){E= -e(A++);E.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(T instanceof THREE.MeshBasicMaterial)n.__styleString=T.color.__styleString;else if(T instanceof THREE.MeshLambertMaterial)if(J){j.r=m.r;j.g=m.g;j.b=m.b;a(ba,R,j);n.r=T.color.r*j.r;n.g=T.color.g*j.g;n.b=T.color.b*j.b;n.updateStyleString()}else n.__styleString=T.color.__styleString; -else if(T instanceof THREE.MeshDepthMaterial){p=1-T.__2near/(T.__farPlusNear-R.z*T.__farMinusNear);n.setRGB(p,p,p)}else T instanceof THREE.MeshNormalMaterial&&n.setRGB(g(R.normalWorld.x),g(R.normalWorld.y),g(R.normalWorld.z));T.wireframe?E.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+T.wireframe_linewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.wireframe_linecap+"; stroke-linejoin: "+T.wireframe_linejoin):E.setAttribute("style","fill: "+n.__styleString+ -"; fill-opacity: "+T.opacity);c.appendChild(E)}function e(W){if(y[W]==null){y[W]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&y[W].setAttribute("shape-rendering","crispEdges");return y[W]}return y[W]}function g(W){return W<0?Math.min((1+W)*0.5,0.5):0.5+Math.min(W*0.5,0.5)}var f=null,h=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,q,C,o,v,x,t,H=new THREE.Rectangle,w=new THREE.Rectangle,J=false,n=new THREE.Color(16777215),j=new THREE.Color(16777215), -m=new THREE.Color(0),B=new THREE.Color(0),u=new THREE.Color(0),p,M=new THREE.Vector3,y=[],D=[],F=[],E,A,O,K,U=1;this.domElement=c;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(W){switch(W){case "high":U=1;break;case "low":U=0}};this.setSize=function(W,P){k=W;l=P;q=k/2;C=l/2;c.setAttribute("viewBox",-q+" "+-C+" "+k+" "+l);c.setAttribute("width",k);c.setAttribute("height",l);H.set(-q,-C,q,C)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])}; -this.render=function(W,P){var da,X,R,T,ba,Y,G,S;this.autoClear&&this.clear();f=h.projectScene(W,P,this.sortElements);K=O=A=0;if(J=W.lights.length>0){G=W.lights;m.setRGB(0,0,0);B.setRGB(0,0,0);u.setRGB(0,0,0);da=0;for(X=G.length;da0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}else if(T instanceof THREE.PointLight){K.sub(T.position,P.centroidWorld);K.normalize();ba=P.normalWorld.dot(K)*T.intensity;if(ba>0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}}}function b(W,P,da,X,R,T){F=e(z++);F.setAttribute("d", +"M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)m.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(I){j.r=o.r;j.g=o.g;j.b=o.b;a(T,X,j);m.r=R.color.r*j.r;m.g=R.color.g*j.g;m.b=R.color.b*j.b;m.updateStyleString()}else m.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshDepthMaterial){y=1-R.__2near/(R.__farPlusNear- +X.z*R.__farMinusNear);m.setRGB(y,y,y)}else R instanceof THREE.MeshNormalMaterial&&m.setRGB(f(X.normalWorld.x),f(X.normalWorld.y),f(X.normalWorld.z));R.wireframe?F.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):F.setAttribute("style","fill: "+m.__styleString+"; fill-opacity: "+R.opacity);c.appendChild(F)}function d(W,P,da,X,R,T,ba){F= +e(z++);F.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(T instanceof THREE.MeshBasicMaterial)m.__styleString=T.color.__styleString;else if(T instanceof THREE.MeshLambertMaterial)if(I){j.r=o.r;j.g=o.g;j.b=o.b;a(ba,R,j);m.r=T.color.r*j.r;m.g=T.color.g*j.g;m.b=T.color.b*j.b;m.updateStyleString()}else m.__styleString=T.color.__styleString; +else if(T instanceof THREE.MeshDepthMaterial){y=1-T.__2near/(T.__farPlusNear-R.z*T.__farMinusNear);m.setRGB(y,y,y)}else T instanceof THREE.MeshNormalMaterial&&m.setRGB(f(R.normalWorld.x),f(R.normalWorld.y),f(R.normalWorld.z));T.wireframe?F.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+T.wireframe_linewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.wireframe_linecap+"; stroke-linejoin: "+T.wireframe_linejoin):F.setAttribute("style","fill: "+m.__styleString+ +"; fill-opacity: "+T.opacity);c.appendChild(F)}function e(W){if(w[W]==null){w[W]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&w[W].setAttribute("shape-rendering","crispEdges");return w[W]}return w[W]}function f(W){return W<0?Math.min((1+W)*0.5,0.5):0.5+Math.min(W*0.5,0.5)}var g=null,k=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,l,t,B,p,v,u,D,G=new THREE.Rectangle,n=new THREE.Rectangle,I=false,m=new THREE.Color(16777215),j=new THREE.Color(16777215), +o=new THREE.Color(0),C=new THREE.Color(0),q=new THREE.Color(0),y,K=new THREE.Vector3,w=[],E=[],A=[],F,z,O,L,U=1;this.domElement=c;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(W){switch(W){case "high":U=1;break;case "low":U=0}};this.setSize=function(W,P){h=W;l=P;t=h/2;B=l/2;c.setAttribute("viewBox",-t+" "+-B+" "+h+" "+l);c.setAttribute("width",h);c.setAttribute("height",l);G.set(-t,-B,t,B)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])}; +this.render=function(W,P){var da,X,R,T,ba,Y,H,S;this.autoClear&&this.clear();g=k.projectScene(W,P,this.sortElements);L=O=z=0;if(I=W.lights.length>0){H=W.lights;o.setRGB(0,0,0);C.setRGB(0,0,0);q.setRGB(0,0,0);da=0;for(X=H.length;da0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,ia,B)}if(p){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, -j.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,L,B);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,I,B)}};this.setLineBuffers=function(j,m,B,u){var p,M,y=j.vertices,D=y.length,F=j.__vertexArray,E=j.__lineArray;if(B)for(B=0;B0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights, -E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");c.attachShader(O,g("fragment",K+D));c.attachShader(O,g("vertex",E+A));c.linkProgram(O);c.getProgramParameter(O,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+ -c.getProgramParameter(O,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");O.uniforms={};O.attributes={};u.program=O;D=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(y in u.uniforms)D.push(y);y=u.program;A=0;for(O=D.length;A=0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLNormalBuffer);c.vertexAttribPointer(F.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.normal)}if(F.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLTangentBuffer); -c.vertexAttribPointer(F.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.tangent)}if(F.uv>=0)if(p.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLUVBuffer);c.vertexAttribPointer(F.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.uv)}else c.disableVertexAttribArray(F.uv);if(u.wireframe||u instanceof THREE.LineBasicMaterial){F=u.wireframe_linewidth!==undefined?u.wireframe_linewidth:u.linewidth!==undefined?u.linewidth:1;u=u instanceof THREE.LineBasicMaterial&&M.type==THREE.LineStrip? -c.LINE_STRIP:c.LINES;c.lineWidth(F);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);c.drawElements(u,p.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,p.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(j,m,B,u,p,M,y){var D,F,E,A,O;E=0;for(A=u.materials.length;E=0;B--){u=j.__webGLObjects[B].object;m==u&&j.__webGLObjects.splice(B,1)}};this.setupMatrices=function(j,m){j.autoUpdateMatrix&& -j.updateMatrix();q.multiply(m.matrix,j.matrix);v.set(q.flatten());C=THREE.Matrix4.makeInvert3x3(q).transpose();t.set(C.m);H.set(j.matrix.flatten())};this.loadMatrices=function(j){c.uniformMatrix4fv(j.uniforms.viewMatrix,false,o);c.uniformMatrix4fv(j.uniforms.modelViewMatrix,false,v);c.uniformMatrix4fv(j.uniforms.projectionMatrix,false,x);c.uniformMatrix3fv(j.uniforms.normalMatrix,false,t);c.uniformMatrix4fv(j.uniforms.objectMatrix,false,H)};this.loadCamera=function(j,m){c.uniform3f(j.uniforms.cameraPosition, -m.position.x,m.position.y,m.position.z)};this.setBlending=function(j){switch(j){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(j,m){if(j){!m||m=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(j=="back")c.cullFace(c.BACK);else j=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK); +case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var k=document.createElement("canvas"),c,h=null,l=null,t=new THREE.Matrix4,B,p=new Float32Array(16),v=new Float32Array(16),u=new Float32Array(16),D=new Float32Array(9), +G=new Float32Array(16),n=true,I=new THREE.Color(0),m=0;if(a){if(a.antialias!==undefined)n=a.antialias;a.clearColor!==undefined&&I.setHex(a.clearColor);if(a.clearAlpha!==undefined)m=a.clearAlpha}this.domElement=k;this.autoClear=true;(function(j,o,C){try{c=k.getContext("experimental-webgl",{antialias:j})}catch(q){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK); +c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(o.r,o.g,o.b,C)})(n,I,m);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(j,o){k.width=j;k.height=o;c.viewport(0,0,k.width,k.height)};this.setClearColor=function(j,o){var C=new THREE.Color(j);c.clearColor(C.r,C.g,C.b,o)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights= +function(j,o){var C,q,y,K=0,w=0,E=0,A,F,z,O=this.lights,L=O.directional.colors,U=O.directional.positions,W=O.point.colors,P=O.point.positions,da=0,X=0;C=0;for(q=o.length;C0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,ia,C)}if(y){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, +j.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,M,C);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,J,C)}};this.setLineBuffers=function(j,o,C,q){var y,K,w=j.vertices,E=w.length,A=j.__vertexArray,F=j.__lineArray;if(C)for(C=0;C0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights, +F.map?"#define USE_MAP":"",F.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");c.attachShader(O,f("fragment",L+E));c.attachShader(O,f("vertex",F+z));c.linkProgram(O);c.getProgramParameter(O,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+ +c.getProgramParameter(O,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");O.uniforms={};O.attributes={};q.program=O;E=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(w in q.uniforms)E.push(w);w=q.program;z=0;for(O=E.length;z=0){c.bindBuffer(c.ARRAY_BUFFER,y.__webGLNormalBuffer);c.vertexAttribPointer(A.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(A.normal)}if(A.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,y.__webGLTangentBuffer); +c.vertexAttribPointer(A.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(A.tangent)}if(A.uv>=0)if(y.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,y.__webGLUVBuffer);c.vertexAttribPointer(A.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(A.uv)}else c.disableVertexAttribArray(A.uv);if(q.wireframe||q instanceof THREE.LineBasicMaterial){A=q.wireframe_linewidth!==undefined?q.wireframe_linewidth:q.linewidth!==undefined?q.linewidth:1;q=q instanceof THREE.LineBasicMaterial&&K.type==THREE.LineStrip? +c.LINE_STRIP:c.LINES;c.lineWidth(A);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y.__webGLLineBuffer);c.drawElements(q,y.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,y.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(j,o,C,q,y,K,w){var E,A,F,z,O;F=0;for(z=q.materials.length;F=0;C--){q=j.__webGLObjects[C].object;o==q&&j.__webGLObjects.splice(C,1)}};this.setupMatrices=function(j,o){j.autoUpdateMatrix&& +j.updateMatrix();t.multiply(o.matrix,j.matrix);v.set(t.flatten());B=THREE.Matrix4.makeInvert3x3(t).transpose();D.set(B.m);G.set(j.matrix.flatten())};this.loadMatrices=function(j){c.uniformMatrix4fv(j.uniforms.viewMatrix,false,p);c.uniformMatrix4fv(j.uniforms.modelViewMatrix,false,v);c.uniformMatrix4fv(j.uniforms.projectionMatrix,false,u);c.uniformMatrix3fv(j.uniforms.normalMatrix,false,D);c.uniformMatrix4fv(j.uniforms.objectMatrix,false,G)};this.loadCamera=function(j,o){c.uniform3f(j.uniforms.cameraPosition, +o.position.x,o.position.y,o.position.z)};this.setBlending=function(j){switch(j){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(j,o){if(j){!o||o=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(j=="back")c.cullFace(c.BACK);else j=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK); c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; 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, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", @@ -201,63 +201,63 @@ shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform "gl_FragColor = mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;", THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]}; THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null}; -var GeometryUtils={merge:function(a,b){var d=b instanceof THREE.Mesh,e=a.vertices.length,g=d?b.geometry:b,f=a.vertices,h=g.vertices,c=a.faces,k=g.faces,l=a.uvs;g=g.uvs;d&&b.autoUpdateMatrix&&b.updateMatrix();for(var q=0,C=h.length;q= 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}", vertex_shader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"}, cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},basic:{uniforms:{}, -vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"void main() {\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\n}"}}},Cube=function(a,b,d,e,g,f,h,c){function k(t,H,w,J,n,j,m,B){var u,p,M=e||1,y=g||1,D=M+1,F=y+1,E=n/2,A=j/2;n=n/M;var O=j/y,K=l.vertices.length;if(t=="x"&&H=="y"||t=="y"&&H=="x")u="z";else if(t=="x"&&H=="z"||t=="z"&&H=="x")u="y";else if(t=="z"&&H=="y"||t=="y"&&H=="z")u="x";for(p=0;p0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(C,c,o)))-1);l.push(q)}b.push(l)}var v,x,t;g=b.length;for(d=0;d0)for(e=0;e1){v=this.vertices[h].position.clone(); -x=this.vertices[k].position.clone();t=this.vertices[l].position.clone();v.normalize();x.normalize();t.normalize();this.faces.push(new THREE.Face3(h,k,l,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(t.x,t.y,t.z)]));this.uvs.push([q,C,H])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; -var Torus=function(a,b,d,e){this.radius=a||100;this.tube=b||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(d=0;d<=this.segmentsT;++d){e=d/this.segmentsT*2*Math.PI;var g=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));a.push([d/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(d= -1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*b+d;g=(this.segmentsT+1)*b+d-1;var f=(this.segmentsT+1)*(b-1)+d-1,h=(this.segmentsT+1)*(b-1)+d;this.faces.push(new THREE.Face4(e,g,f,h));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var Icosahedron=function(a){function b(C,o,v){var x=Math.sqrt(C*C+o*o+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(C/x,o/x,v/x)))-1}function d(C,o,v,x){x.faces.push(new THREE.Face3(C,o,v))}function e(C,o){var v=g.vertices[C].position,x=g.vertices[o].position;return b((v.x+x.x)/2,(v.y+x.y)/2,(v.z+x.z)/2)}var g=this,f=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);d(0,11,5,f);d(0,5,1,f);d(0,1,7,f);d(0,7,10,f);d(0,10,11,f);d(1,5,9,f);d(5,11,4,f);d(11,10,2,f);d(10,7,6,f);d(7,1,8,f);d(3,9,4,f);d(3,4,2,f);d(3,2,6,f);d(3,6,8,f);d(3,8,9,f);d(4,9,5,f);d(2,4,11,f);d(6,2,10,f);d(8,6,7,f);d(9,8,1,f);for(a=0;a0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(B,c,p)))-1);l.push(t)}b.push(l)}var v,u,D;f=b.length;for(d=0;d0)for(e=0;e1){v=this.vertices[k].position.clone(); +u=this.vertices[h].position.clone();D=this.vertices[l].position.clone();v.normalize();u.normalize();D.normalize();this.faces.push(new THREE.Face3(k,h,l,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(D.x,D.y,D.z)]));this.uvs.push([t,B,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Torus=function(a,b,d,e){this.radius=a||100;this.tube=b||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(d=0;d<=this.segmentsT;++d){e=d/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(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([d/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(d= +1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*b+d;f=(this.segmentsT+1)*b+d-1;var g=(this.segmentsT+1)*(b-1)+d-1,k=(this.segmentsT+1)*(b-1)+d;this.faces.push(new THREE.Face4(e,f,g,k));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[k][0],a[k][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; +var Icosahedron=function(a){function b(B,p,v){var u=Math.sqrt(B*B+p*p+v*v);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(B/u,p/u,v/u)))-1}function d(B,p,v,u){u.faces.push(new THREE.Face3(B,p,v))}function e(B,p){var v=f.vertices[B].position,u=f.vertices[p].position;return b((v.x+u.x)/2,(v.y+u.y)/2,(v.z+u.z)/2)}var f=this,g=new THREE.Geometry,k;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);d(0,11,5,g);d(0,5,1,g);d(0,1,7,g);d(0,7,10,g);d(0,10,11,g);d(1,5,9,g);d(5,11,4,g);d(11,10,2,g);d(10,7,6,g);d(7,1,8,g);d(3,9,4,g);d(3,4,2,g);d(3,2,6,g);d(3,6,8,g);d(3,8,9,g);d(4,9,5,g);d(2,4,11,g);d(6,2,10,g);d(8,6,7,g);d(9,8,1,g);for(a=0;a>7)-127;I=(ca&127)<<16|Z<<8|I;if(I==0&&ja==-127)return 0;return(1-2*(ga>>7))*(1+I*Math.pow(2,-23))*Math.pow(2,ja)}function c(z,L){var I=q(z,L),Z=q(z,L+1),ca=q(z,L+2);return(q(z,L+3)<<24)+(ca<<16)+(Z<<8)+I}function k(z,L){var I=q(z,L);return(q(z,L+1)<<8)+I}function l(z,L){var I=q(z,L);return I>127?I-256:I}function q(z,L){return z.charCodeAt(L)&255}function C(z){var L, -I,Z;L=c(a,z);I=c(a,z+B);Z=c(a,z+u);z=k(a,z+p);THREE.Loader.prototype.f3(w,L,I,Z,z)}function o(z){var L,I,Z,ca,ga,ja;L=c(a,z);I=c(a,z+B);Z=c(a,z+u);ca=k(a,z+p);ga=c(a,z+M);ja=c(a,z+y);z=c(a,z+D);THREE.Loader.prototype.f3n(w,j,L,I,Z,ca,ga,ja,z)}function v(z){var L,I,Z,ca;L=c(a,z);I=c(a,z+F);Z=c(a,z+E);ca=c(a,z+A);z=k(a,z+O);THREE.Loader.prototype.f4(w,L,I,Z,ca,z)}function x(z){var L,I,Z,ca,ga,ja,qa,sa;L=c(a,z);I=c(a,z+F);Z=c(a,z+E);ca=c(a,z+A);ga=k(a,z+O);ja=c(a,z+K);qa=c(a,z+U);sa=c(a,z+W);z=c(a,z+ -P);THREE.Loader.prototype.f4n(w,j,L,I,Z,ca,ga,ja,qa,sa,z)}function t(z){var L,I;L=c(a,z);I=c(a,z+da);z=c(a,z+X);THREE.Loader.prototype.uv3(w,m[L*2],m[L*2+1],m[I*2],m[I*2+1],m[z*2],m[z*2+1])}function H(z){var L,I,Z;L=c(a,z);I=c(a,z+R);Z=c(a,z+T);z=c(a,z+ba);THREE.Loader.prototype.uv4(w,m[L*2],m[L*2+1],m[I*2],m[I*2+1],m[Z*2],m[Z*2+1],m[z*2],m[z*2+1])}var w=this,J=0,n,j=[],m=[],B,u,p,M,y,D,F,E,A,O,K,U,W,P,da,X,R,T,ba,Y,G,S,V,ia,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,e,f); -n={signature:a.substr(J,8),header_bytes:q(a,J+8),vertex_coordinate_bytes:q(a,J+9),normal_coordinate_bytes:q(a,J+10),uv_coordinate_bytes:q(a,J+11),vertex_index_bytes:q(a,J+12),normal_index_bytes:q(a,J+13),uv_index_bytes:q(a,J+14),material_index_bytes:q(a,J+15),nvertices:c(a,J+16),nnormals:c(a,J+16+4),nuvs:c(a,J+16+8),ntri_flat:c(a,J+16+12),ntri_smooth:c(a,J+16+16),ntri_flat_uv:c(a,J+16+20),ntri_smooth_uv:c(a,J+16+24),nquad_flat:c(a,J+16+28),nquad_smooth:c(a,J+16+32),nquad_flat_uv:c(a,J+16+36),nquad_smooth_uv:c(a, -J+16+40)};J+=n.header_bytes;B=n.vertex_index_bytes;u=n.vertex_index_bytes*2;p=n.vertex_index_bytes*3;M=n.vertex_index_bytes*3+n.material_index_bytes;y=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;D=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;F=n.vertex_index_bytes;E=n.vertex_index_bytes*2;A=n.vertex_index_bytes*3;O=n.vertex_index_bytes*4;K=n.vertex_index_bytes*4+n.material_index_bytes;U=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes; -W=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;P=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;da=n.uv_index_bytes;X=n.uv_index_bytes*2;R=n.uv_index_bytes;T=n.uv_index_bytes*2;ba=n.uv_index_bytes*3;f=n.vertex_index_bytes*3+n.material_index_bytes;ha=n.vertex_index_bytes*4+n.material_index_bytes;Y=n.ntri_flat*f;G=n.ntri_smooth*(f+n.normal_index_bytes*3);S=n.ntri_flat_uv*(f+n.uv_index_bytes*3);V=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes* -3);ia=n.nquad_flat*ha;f=n.nquad_smooth*(ha+n.normal_index_bytes*4);ha=n.nquad_flat_uv*(ha+n.uv_index_bytes*4);J+=function(z){var L,I,Z,ca=n.vertex_coordinate_bytes*3,ga=z+n.nvertices*ca;for(z=z;z>7)-127;J=(ca&127)<<16|Z<<8|J;if(J==0&&ja==-127)return 0;return(1-2*(ga>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,ja)}function c(x,M){var J=t(x,M),Z=t(x,M+1),ca=t(x,M+2);return(t(x,M+3)<<24)+(ca<<16)+(Z<<8)+J}function h(x,M){var J=t(x,M);return(t(x,M+1)<<8)+J}function l(x,M){var J=t(x,M);return J>127?J-256:J}function t(x,M){return x.charCodeAt(M)&255}function B(x){var M, +J,Z;M=c(a,x);J=c(a,x+C);Z=c(a,x+q);x=h(a,x+y);THREE.Loader.prototype.f3(n,M,J,Z,x)}function p(x){var M,J,Z,ca,ga,ja;M=c(a,x);J=c(a,x+C);Z=c(a,x+q);ca=h(a,x+y);ga=c(a,x+K);ja=c(a,x+w);x=c(a,x+E);THREE.Loader.prototype.f3n(n,j,M,J,Z,ca,ga,ja,x)}function v(x){var M,J,Z,ca;M=c(a,x);J=c(a,x+A);Z=c(a,x+F);ca=c(a,x+z);x=h(a,x+O);THREE.Loader.prototype.f4(n,M,J,Z,ca,x)}function u(x){var M,J,Z,ca,ga,ja,qa,sa;M=c(a,x);J=c(a,x+A);Z=c(a,x+F);ca=c(a,x+z);ga=h(a,x+O);ja=c(a,x+L);qa=c(a,x+U);sa=c(a,x+W);x=c(a,x+ +P);THREE.Loader.prototype.f4n(n,j,M,J,Z,ca,ga,ja,qa,sa,x)}function D(x){var M,J;M=c(a,x);J=c(a,x+da);x=c(a,x+X);THREE.Loader.prototype.uv3(n,o[M*2],o[M*2+1],o[J*2],o[J*2+1],o[x*2],o[x*2+1])}function G(x){var M,J,Z;M=c(a,x);J=c(a,x+R);Z=c(a,x+T);x=c(a,x+ba);THREE.Loader.prototype.uv4(n,o[M*2],o[M*2+1],o[J*2],o[J*2+1],o[Z*2],o[Z*2+1],o[x*2],o[x*2+1])}var n=this,I=0,m,j=[],o=[],C,q,y,K,w,E,A,F,z,O,L,U,W,P,da,X,R,T,ba,Y,H,S,V,ia,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(n,e,g); +m={signature:a.substr(I,8),header_bytes:t(a,I+8),vertex_coordinate_bytes:t(a,I+9),normal_coordinate_bytes:t(a,I+10),uv_coordinate_bytes:t(a,I+11),vertex_index_bytes:t(a,I+12),normal_index_bytes:t(a,I+13),uv_index_bytes:t(a,I+14),material_index_bytes:t(a,I+15),nvertices:c(a,I+16),nnormals:c(a,I+16+4),nuvs:c(a,I+16+8),ntri_flat:c(a,I+16+12),ntri_smooth:c(a,I+16+16),ntri_flat_uv:c(a,I+16+20),ntri_smooth_uv:c(a,I+16+24),nquad_flat:c(a,I+16+28),nquad_smooth:c(a,I+16+32),nquad_flat_uv:c(a,I+16+36),nquad_smooth_uv:c(a, +I+16+40)};I+=m.header_bytes;C=m.vertex_index_bytes;q=m.vertex_index_bytes*2;y=m.vertex_index_bytes*3;K=m.vertex_index_bytes*3+m.material_index_bytes;w=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;E=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;A=m.vertex_index_bytes;F=m.vertex_index_bytes*2;z=m.vertex_index_bytes*3;O=m.vertex_index_bytes*4;L=m.vertex_index_bytes*4+m.material_index_bytes;U=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes; +W=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;P=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;da=m.uv_index_bytes;X=m.uv_index_bytes*2;R=m.uv_index_bytes;T=m.uv_index_bytes*2;ba=m.uv_index_bytes*3;g=m.vertex_index_bytes*3+m.material_index_bytes;ha=m.vertex_index_bytes*4+m.material_index_bytes;Y=m.ntri_flat*g;H=m.ntri_smooth*(g+m.normal_index_bytes*3);S=m.ntri_flat_uv*(g+m.uv_index_bytes*3);V=m.ntri_smooth_uv*(g+m.normal_index_bytes*3+m.uv_index_bytes* +3);ia=m.nquad_flat*ha;g=m.nquad_smooth*(ha+m.normal_index_bytes*4);ha=m.nquad_flat_uv*(ha+m.uv_index_bytes*4);I+=function(x){var M,J,Z,ca=m.vertex_coordinate_bytes*3,ga=x+m.nvertices*ca;for(x=x;x Loading ... -
Start
+ +
+
+
Start
+

@@ -133,6 +150,16 @@
 
 				setInterval( loop, 1000/60 );
 
+				var callback_progress = function( progress ) {
+				
+					var bar = 250;
+					if ( progress.total_models + progress.total_textures ) 
+						bar = Math.floor( 250 * ( progress.loaded_models + progress.loaded_textures ) / ( progress.total_models + progress.total_textures ) );
+					
+					$( "bar" ).style.width = bar + "px";
+					
+				}
+				
 				var callback_sync = function( result ) {
 				
 					/*
@@ -162,13 +189,14 @@
 					mat_veyron[ 5 ][ 0 ] = result.materials[ "chrome" ];
 					
 					$( "message" ).style.display = "none";
+					$( "progressbar" ).style.display = "none";
 					$( "start" ).style.display = "block";
 					$( "start" ).className = "enabled";
 					
 				}
 				
 				$( "progress" ).style.display = "block";
-				SceneUtils.loadScene( "scenes/test_scene.js", callback_sync, callback_async );
+				SceneUtils.loadScene( "scenes/test_scene.js", callback_sync, callback_async, callback_progress );
 
 				stats = new Stats();
 				stats.domElement.style.position = 'absolute';
diff --git a/src/extras/SceneUtils.js b/src/extras/SceneUtils.js
index 55a3953c..fd30904c 100644
--- a/src/extras/SceneUtils.js
+++ b/src/extras/SceneUtils.js
@@ -1,6 +1,6 @@
 var SceneUtils = {
 	
-	loadScene : function( url, callback_sync, callback_async ) {
+	loadScene : function( url, callback_sync, callback_async, callback_progress ) {
 
 		var worker = new Worker( url );
 		worker.postMessage( 0 );
@@ -14,6 +14,7 @@ var SceneUtils = {
 				materials,
 				data, loader, 
 				counter_models, counter_textures,
+				total_models, total_textures,
 				result;
 
 			data = event.data;
@@ -100,6 +101,17 @@ var SceneUtils = {
 			
 			function async_callback_gate() {
 				
+				var progress = {
+					
+					total_models: total_models,
+					total_textures: total_textures,
+					loaded_models: total_models - counter_models,
+					loaded_textures: total_textures - counter_textures
+					
+				};
+				
+				callback_progress( progress );
+				
 				if( counter_models == 0 && counter_textures == 0 ) {
 					
 					callback_async( result );
@@ -124,6 +136,8 @@ var SceneUtils = {
 				
 			}
 			
+			total_models = counter_models;
+			
 			for( dg in data.geometries ) {
 				
 				g = data.geometries[ dg ];
@@ -194,6 +208,8 @@ var SceneUtils = {
 				
 			}
 			
+			total_textures = counter_textures;
+			
 			var callback_texture = function( images ) {
 				
 				counter_textures -= 1; 

From 1fea9391b81c41d9e2496c3f46a9e00308ce856f Mon Sep 17 00:00:00 2001
From: alteredq 
Date: Wed, 26 Jan 2011 23:14:19 +0100
Subject: [PATCH 2/4] Added very simple user interface for checking what's
 inside the scene (in scene loader example).

Click on small [+] in the upper left corner.
---
 examples/scene_test.html | 127 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 127 insertions(+)

diff --git a/examples/scene_test.html b/examples/scene_test.html
index 6132530f..4c140564 100644
--- a/examples/scene_test.html
+++ b/examples/scene_test.html
@@ -83,6 +83,48 @@
 			a { color:red }
 			canvas { pointer-events:none; z-index:10; }
 			#log { position:absolute; top:0; display:block; text-align:left; z-index:1000; pointer-events:none; }
+			
+			#scene_explorer {
+				background:transparent;
+				color:#fff;
+				width:200px;
+				position:absolute;
+				text-align:left;
+				top:0px;
+				z-index:200;
+				overflow:auto;
+			}
+			
+			#section_exp {
+				background:rgba(0,0,50,0.5);
+				padding:0.5em 0;
+				display:none;
+			}
+			
+			#scene_explorer h3 { 
+				font-size:1em;
+				padding:0;
+				margin:0;
+				color:orange;
+			}
+			
+			#scene_explorer a {
+				color:#555;
+				font-weight:bold;
+				text-decoration:none;
+				font-size:1.2em;
+				font-family:Monospace;
+			}
+			#scene_explorer a:hover {
+				background:#555;
+				color:rgba(0,0,50,1);
+			}
+			
+			.part {
+				display:none;
+				padding:0 0 0.5em 2em;
+			}
+			
 		
 	
 
@@ -90,6 +132,11 @@
 		
three.js - scene loader test
+ +
+ [+] +
+
Loading ... @@ -173,6 +220,8 @@ */ + refreshSceneView( result ); + } var callback_async = function( result ) { @@ -193,6 +242,8 @@ $( "start" ).style.display = "block"; $( "start" ).className = "enabled"; + refreshSceneView( result ); + } $( "progress" ).style.display = "block"; @@ -201,8 +252,11 @@ stats = new Stats(); stats.domElement.style.position = 'absolute'; stats.domElement.style.top = '0px'; + stats.domElement.style.right = '0px'; stats.domElement.style.zIndex = 100; container.appendChild( stats.domElement ); + + $( "plus_exp" ).addEventListener( 'click', createToggle( "exp" ), false ); } @@ -291,6 +345,79 @@ } + // Scene explorer user interface + + function toggle( id ) { + + var scn = $( "section_" + id ).style, + btn = $( "plus_" + id ); + + if ( scn.display == "block" ) { + + scn.display = "none"; + btn.innerHTML = "[+]"; + + } + else { + + scn.display = "block"; + btn.innerHTML = "[-]"; + + } + + } + + function createToggle( label ) { return function() { toggle( label ) } }; + + function refreshSceneView( result ) { + + $( "section_exp" ).innerHTML = generateSceneView( result ); + + var config = [ "obj", "geo", "mat", "tex", "lit", "cam" ]; + + for ( var i = 0; i < config.length; i++ ) + $( "plus_" + config[i] ).addEventListener( 'click', createToggle( config[i] ), false ); + + } + + function generateSection( label, id, objects ) { + + var html = ""; + + html += "

[+] " + label + "

"; + html += "
"; + + for( var o in objects ) { + + html += o + "
"; + + } + html += "
"; + + return html; + + } + + function generateSceneView( result ) { + + var config = [ + [ "Objects", "obj", result.objects ], + [ "Geometries", "geo", result.geometries ], + [ "Materials", "mat", result.materials ], + [ "Textures", "tex", result.textures ], + [ "Lights", "lit", result.lights ], + [ "Cameras", "cam", result.cameras ] + ]; + + var html = ""; + + for ( var i = 0; i < config.length; i++ ) + html += generateSection( config[i][0], config[i][1], config[i][2] ); + + return html; + + } + From 549f90854b921406ef992d6afea322c9c136b8b9 Mon Sep 17 00:00:00 2001 From: alteredq Date: Thu, 27 Jan 2011 01:10:29 +0100 Subject: [PATCH 3/4] Small improvement in scene loading blocking. Creating all GPU stuff when rendering the first frame doesn't work well with gated initialization :(. --- build/ThreeExtras.js | 336 +++++++++++++++++++-------------------- examples/scene_test.html | 18 ++- src/extras/SceneUtils.js | 226 +++++++++++++------------- 3 files changed, 297 insertions(+), 283 deletions(-) diff --git a/build/ThreeExtras.js b/build/ThreeExtras.js index 9bce276d..acbb4c51 100644 --- a/build/ThreeExtras.js +++ b/build/ThreeExtras.js @@ -12,50 +12,50 @@ THREE.Vector4=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1} THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){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)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,f=[];a=0;for(b=e.length;a0&&G>0&&o+G<1}var d,e,f,g,k,c,h,l,t,B, -p,v=a.geometry,u=v.vertices,D=[];d=0;for(e=v.faces.length;dh?e:h;f=f>l? -f:l}a()};this.add3Points=function(h,l,t,B,p,v){if(c){c=false;b=ht?h>p?h:p:t>p?t:p;f=l>B?l>v?l:v:B>v?B:v}else{b=ht?h>p?h>e?h:e:p>e?p:e:t>p?t>e?t:e:p>e?p:e;f=l>B?l>v?l>f?l:f:v>f?v:f:B>v?B>f?B:f:v>f?v:f}a()};this.addRectangle=function(h){if(c){c=false;b=h.getLeft();d=h.getTop();e=h.getRight();f=h.getBottom()}else{b=bh.getRight()?e:h.getRight();f=f>h.getBottom()?f:h.getBottom()}a()};this.inflate=function(h){b-=h;d-=h;e+=h;f+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e=0&&Math.min(f,h.getBottom())-Math.max(d,h.getTop())>=0};this.empty=function(){c=true;f=e=d=b=0;a()};this.isEmpty=function(){return c};this.toString= -function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+d+", bottom: "+f+", width: "+g+", height: "+k+" )"}};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}}; -THREE.Matrix4=function(a,b,d,e,f,g,k,c,h,l,t,B,p,v,u,D){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=f||0;this.n22=g||1;this.n23=k||0;this.n24=c||0;this.n31=h||0;this.n32=l||0;this.n33=t||1;this.n34=B||0;this.n41=p||0;this.n42=v||0;this.n43=u||0;this.n44=D||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,f,g,k,c,h,l,t,B,p,v,u,D){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=f;this.n22=g;this.n23=k;this.n24=c;this.n31=h;this.n32=l;this.n33=t;this.n34=B;this.n41=p;this.n42=v;this.n43=u;this.n44=D;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();e.cross(d,g).normalize();f.cross(g,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a); -this.n31=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,f=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*d+this.n23* -e+this.n24*f;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*d+this.n43*e+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 d=a.n11,e=a.n12,f=a.n13,g=a.n14,k=a.n21,c=a.n22,h=a.n23,l=a.n24,t=a.n31, -B=a.n32,p=a.n33,v=a.n34,u=a.n41,D=a.n42,G=a.n43,n=a.n44,I=b.n11,m=b.n12,j=b.n13,o=b.n14,C=b.n21,q=b.n22,y=b.n23,K=b.n24,w=b.n31,E=b.n32,A=b.n33,F=b.n34,z=b.n41,O=b.n42,L=b.n43,U=b.n44;this.n11=d*I+e*C+f*w+g*z;this.n12=d*m+e*q+f*E+g*O;this.n13=d*j+e*y+f*A+g*L;this.n14=d*o+e*K+f*F+g*U;this.n21=k*I+c*C+h*w+l*z;this.n22=k*m+c*q+h*E+l*O;this.n23=k*j+c*y+h*A+l*L;this.n24=k*o+c*K+h*F+l*U;this.n31=t*I+B*C+p*w+v*z;this.n32=t*m+B*q+p*E+v*O;this.n33=t*j+B*y+p*A+v*L;this.n34=t*o+B*K+p*F+v*U;this.n41=u*I+D*C+ -G*w+n*z;this.n42=u*m+D*q+G*E+n*O;this.n43=u*j+D*y+G*A+n*L;this.n44=u*o+D*K+G*F+n*U;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,k=this.n22,c=this.n23,h=this.n24,l=this.n31,t=this.n32,B=this.n33,p=this.n34,v=this.n41,u=this.n42,D=this.n43,G=this.n44,n=a.n11,I=a.n21,m=a.n31,j=a.n41,o=a.n12,C=a.n22,q=a.n32,y=a.n42,K=a.n13,w=a.n23,E=a.n33,A=a.n43,F=a.n14,z=a.n24,O=a.n34;a=a.n44;this.n11=b*n+d*I+e*m+f*j;this.n12=b*o+d*C+e*q+f*y;this.n13=b*K+d*w+e*E+f* -A;this.n14=b*F+d*z+e*O+f*a;this.n21=g*n+k*I+c*m+h*j;this.n22=g*o+k*C+c*q+h*y;this.n23=g*K+k*w+c*E+h*A;this.n24=g*F+k*z+c*O+h*a;this.n31=l*n+t*I+B*m+p*j;this.n32=l*o+t*C+B*q+p*y;this.n33=l*K+t*w+B*E+p*A;this.n34=l*F+t*z+B*O+p*a;this.n41=v*n+u*I+D*m+G*j;this.n42=v*o+u*C+D*q+G*y;this.n43=v*K+u*w+D*E+G*A;this.n44=v*F+u*z+D*O+G*a;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,d=this.n13,e=this.n14,f=this.n21,g=this.n22,k=this.n23,c=this.n24,h=this.n31,l=this.n32,t=this.n33,B=this.n34,p=this.n41,v=this.n42,u=this.n43,D=this.n44;return e*k*l*p-d*c*l*p-e*g*t*p+b*c*t*p+d*g*B*p-b*k*B*p-e*k*h*v+d*c*h*v+e*f*t*v-a*c*t*v-d*f*B*v+a*k*B*v+e*g*h*u-b*c*h*u-e*f*l*u+a*c*l*u+b*f*B*u-a*g*B*u-d*g*h*D+b*k*h*D+d*f*l*D-a*k*l*D-b*f*t*D+a*g*t*D},transpose:function(){function a(b,d, -e){var f=b[d];b[d]=b[e];b[e]=f}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11; +THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a0&&G>0&&t+G<1}var d,e,g,f,k,c,h,l,u,A, +p,n=a.geometry,v=n.vertices,D=[];d=0;for(e=n.faces.length;dh?e:h;g=g>l? +g:l}a()};this.add3Points=function(h,l,u,A,p,n){if(c){c=false;b=hu?h>p?h:p:u>p?u:p;g=l>A?l>n?l:n:A>n?A:n}else{b=hu?h>p?h>e?h:e:p>e?p:e:u>p?u>e?u:e:p>e?p:e;g=l>A?l>n?l>g?l:g:n>g?n:g:A>n?A>g?A:g:n>g?n:g}a()};this.addRectangle=function(h){if(c){c=false;b=h.getLeft();d=h.getTop();e=h.getRight();g=h.getBottom()}else{b=bh.getRight()?e:h.getRight();g=g>h.getBottom()?g:h.getBottom()}a()};this.inflate=function(h){b-=h;d-=h;e+=h;g+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e=0&&Math.min(g,h.getBottom())-Math.max(d,h.getTop())>=0};this.empty=function(){c=true;g=e=d=b=0;a()};this.isEmpty=function(){return c};this.toString= +function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+d+", bottom: "+g+", width: "+f+", height: "+k+" )"}};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}}; +THREE.Matrix4=function(a,b,d,e,g,f,k,c,h,l,u,A,p,n,v,D){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=f||1;this.n23=k||0;this.n24=c||0;this.n31=h||0;this.n32=l||0;this.n33=u||1;this.n34=A||0;this.n41=p||0;this.n42=n||0;this.n43=v||0;this.n44=D||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,g,f,k,c,h,l,u,A,p,n,v,D){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=f;this.n23=k;this.n24=c;this.n31=h;this.n32=l;this.n33=u;this.n34=A;this.n41=p;this.n42=n;this.n43=v;this.n44=D;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();e.cross(d,f).normalize();g.cross(f,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); +this.n31=f.x;this.n32=f.y;this.n33=f.z;this.n34=-f.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23* +e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;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 d=a.n11,e=a.n12,g=a.n13,f=a.n14,k=a.n21,c=a.n22,h=a.n23,l=a.n24,u=a.n31, +A=a.n32,p=a.n33,n=a.n34,v=a.n41,D=a.n42,G=a.n43,o=a.n44,I=b.n11,m=b.n12,j=b.n13,t=b.n14,C=b.n21,q=b.n22,B=b.n23,K=b.n24,w=b.n31,E=b.n32,F=b.n33,x=b.n34,z=b.n41,O=b.n42,L=b.n43,U=b.n44;this.n11=d*I+e*C+g*w+f*z;this.n12=d*m+e*q+g*E+f*O;this.n13=d*j+e*B+g*F+f*L;this.n14=d*t+e*K+g*x+f*U;this.n21=k*I+c*C+h*w+l*z;this.n22=k*m+c*q+h*E+l*O;this.n23=k*j+c*B+h*F+l*L;this.n24=k*t+c*K+h*x+l*U;this.n31=u*I+A*C+p*w+n*z;this.n32=u*m+A*q+p*E+n*O;this.n33=u*j+A*B+p*F+n*L;this.n34=u*t+A*K+p*x+n*U;this.n41=v*I+D*C+ +G*w+o*z;this.n42=v*m+D*q+G*E+o*O;this.n43=v*j+D*B+G*F+o*L;this.n44=v*t+D*K+G*x+o*U;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,f=this.n21,k=this.n22,c=this.n23,h=this.n24,l=this.n31,u=this.n32,A=this.n33,p=this.n34,n=this.n41,v=this.n42,D=this.n43,G=this.n44,o=a.n11,I=a.n21,m=a.n31,j=a.n41,t=a.n12,C=a.n22,q=a.n32,B=a.n42,K=a.n13,w=a.n23,E=a.n33,F=a.n43,x=a.n14,z=a.n24,O=a.n34;a=a.n44;this.n11=b*o+d*I+e*m+g*j;this.n12=b*t+d*C+e*q+g*B;this.n13=b*K+d*w+e*E+g* +F;this.n14=b*x+d*z+e*O+g*a;this.n21=f*o+k*I+c*m+h*j;this.n22=f*t+k*C+c*q+h*B;this.n23=f*K+k*w+c*E+h*F;this.n24=f*x+k*z+c*O+h*a;this.n31=l*o+u*I+A*m+p*j;this.n32=l*t+u*C+A*q+p*B;this.n33=l*K+u*w+A*E+p*F;this.n34=l*x+u*z+A*O+p*a;this.n41=n*o+v*I+D*m+G*j;this.n42=n*t+v*C+D*q+G*B;this.n43=n*K+v*w+D*E+G*F;this.n44=n*x+v*z+D*O+G*a;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,d=this.n13,e=this.n14,g=this.n21,f=this.n22,k=this.n23,c=this.n24,h=this.n31,l=this.n32,u=this.n33,A=this.n34,p=this.n41,n=this.n42,v=this.n43,D=this.n44;return e*k*l*p-d*c*l*p-e*f*u*p+b*c*u*p+d*f*A*p-b*k*A*p-e*k*h*n+d*c*h*n+e*g*u*n-a*c*u*n-d*g*A*n+a*k*A*n+e*f*h*v-b*c*h*v-e*g*l*v+a*c*l*v+b*g*A*v-a*f*A*v-d*f*h*D+b*k*h*D+d*g*l*D-a*k*l*D-b*g*u*D+a*f*u*D},transpose:function(){function a(b,d, +e){var g=b[d];b[d]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;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},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,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 d=Math.cos(b),e=Math.sin(b),f=1-d,g=a.x,k=a.y,c=a.z,h=f*g,l=f*k;this.set(h*g+d,h*k-e*c,h*c+e*k,0,h*k+e*c,l*k+d,l*c-e*g,0,h*c-e*k,l*c+e*g,f*c*c+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +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 d=Math.cos(b),e=Math.sin(b),g=1-d,f=a.x,k=a.y,c=a.z,h=g*f,l=g*k;this.set(h*f+d,h*k-e*c,h*c+e*k,0,h*k+e*c,l*k+d,l*c-e*f,0,h*c-e*k,l*c+e*f,g*c*c+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};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 d=new THREE.Matrix4;d.setRotAxis(a,b);return d}; -THREE.Matrix4.makeInvert=function(a){var b=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,k=a.n22,c=a.n23,h=a.n24,l=a.n31,t=a.n32,B=a.n33,p=a.n34,v=a.n41,u=a.n42,D=a.n43,G=a.n44,n=new THREE.Matrix4;n.n11=c*p*u-h*B*u+h*t*D-k*p*D-c*t*G+k*B*G;n.n12=f*B*u-e*p*u-f*t*D+d*p*D+e*t*G-d*B*G;n.n13=e*h*u-f*c*u+f*k*D-d*h*D-e*k*G+d*c*G;n.n14=f*c*t-e*h*t-f*k*B+d*h*B+e*k*p-d*c*p;n.n21=h*B*v-c*p*v-h*l*D+g*p*D+c*l*G-g*B*G;n.n22=e*p*v-f*B*v+f*l*D-b*p*D-e*l*G+b*B*G;n.n23=f*c*v-e*h*v-f*g*D+b*h*D+e*g*G-b*c*G;n.n24=e*h*l-f*c*l+ -f*g*B-b*h*B-e*g*p+b*c*p;n.n31=k*p*v-h*t*v+h*l*u-g*p*u-k*l*G+g*t*G;n.n32=f*t*v-d*p*v-f*l*u+b*p*u+d*l*G-b*t*G;n.n33=e*h*v-f*k*v+f*g*u-b*h*u-d*g*G+b*k*G;n.n34=f*k*l-d*h*l-f*g*t+b*h*t+d*g*p-b*k*p;n.n41=c*t*v-k*B*v-c*l*u+g*B*u+k*l*D-g*t*D;n.n42=d*B*v-e*t*v+e*l*u-b*B*u-d*l*D+b*t*D;n.n43=e*k*v-d*c*v-e*g*u+b*c*u+d*g*D-b*k*D;n.n44=d*c*l-e*k*l+e*g*t-b*c*t-d*g*B+b*k*B;n.multiplyScalar(1/a.determinant());return n}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=a.m33;var d=a.m,e=b[10]*b[5]-b[6]*b[9],f=-b[10]*b[1]+b[2]*b[9],g=b[6]*b[1]-b[2]*b[5],k=-b[10]*b[4]+b[6]*b[8],c=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],l=b[9]*b[4]-b[5]*b[8],t=-b[9]*b[0]+b[1]*b[8],B=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*k+b[2]*l;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*g;d[3]=b*k;d[4]=b*c;d[5]=b*h;d[6]=b*l;d[7]=b*t;d[8]=b*B;return a}; -THREE.Matrix4.makeFrustum=function(a,b,d,e,f,g){var k,c,h;k=new THREE.Matrix4;c=2*f/(b-a);h=2*f/(e-d);a=(b+a)/(b-a);d=(e+d)/(e-d);e=-(g+f)/(g-f);f=-2*g*f/(g-f);k.n11=c;k.n12=0;k.n13=a;k.n14=0;k.n21=0;k.n22=h;k.n23=d;k.n24=0;k.n31=0;k.n32=0;k.n33=e;k.n34=f;k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,d,e)}; -THREE.Matrix4.makeOrtho=function(a,b,d,e,f,g){var k,c,h,l;k=new THREE.Matrix4;c=b-a;h=d-e;l=g-f;a=(b+a)/c;d=(d+e)/h;f=(g+f)/l;k.n11=2/c;k.n12=0;k.n13=0;k.n14=-a;k.n21=0;k.n22=2/h;k.n23=0;k.n24=-d;k.n31=0;k.n32=0;k.n33=-2/l;k.n34=-f;k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,k=a.n22,c=a.n23,h=a.n24,l=a.n31,u=a.n32,A=a.n33,p=a.n34,n=a.n41,v=a.n42,D=a.n43,G=a.n44,o=new THREE.Matrix4;o.n11=c*p*v-h*A*v+h*u*D-k*p*D-c*u*G+k*A*G;o.n12=g*A*v-e*p*v-g*u*D+d*p*D+e*u*G-d*A*G;o.n13=e*h*v-g*c*v+g*k*D-d*h*D-e*k*G+d*c*G;o.n14=g*c*u-e*h*u-g*k*A+d*h*A+e*k*p-d*c*p;o.n21=h*A*n-c*p*n-h*l*D+f*p*D+c*l*G-f*A*G;o.n22=e*p*n-g*A*n+g*l*D-b*p*D-e*l*G+b*A*G;o.n23=g*c*n-e*h*n-g*f*D+b*h*D+e*f*G-b*c*G;o.n24=e*h*l-g*c*l+ +g*f*A-b*h*A-e*f*p+b*c*p;o.n31=k*p*n-h*u*n+h*l*v-f*p*v-k*l*G+f*u*G;o.n32=g*u*n-d*p*n-g*l*v+b*p*v+d*l*G-b*u*G;o.n33=e*h*n-g*k*n+g*f*v-b*h*v-d*f*G+b*k*G;o.n34=g*k*l-d*h*l-g*f*u+b*h*u+d*f*p-b*k*p;o.n41=c*u*n-k*A*n-c*l*v+f*A*v+k*l*D-f*u*D;o.n42=d*A*n-e*u*n+e*l*v-b*A*v-d*l*D+b*u*D;o.n43=e*k*n-d*c*n-e*f*v+b*c*v+d*f*D-b*k*D;o.n44=d*c*l-e*k*l+e*f*u-b*c*u-d*f*A+b*k*A;o.multiplyScalar(1/a.determinant());return o}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=a.m33;var d=a.m,e=b[10]*b[5]-b[6]*b[9],g=-b[10]*b[1]+b[2]*b[9],f=b[6]*b[1]-b[2]*b[5],k=-b[10]*b[4]+b[6]*b[8],c=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],l=b[9]*b[4]-b[5]*b[8],u=-b[9]*b[0]+b[1]*b[8],A=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*k+b[2]*l;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*e;d[1]=b*g;d[2]=b*f;d[3]=b*k;d[4]=b*c;d[5]=b*h;d[6]=b*l;d[7]=b*u;d[8]=b*A;return a}; +THREE.Matrix4.makeFrustum=function(a,b,d,e,g,f){var k,c,h;k=new THREE.Matrix4;c=2*g/(b-a);h=2*g/(e-d);a=(b+a)/(b-a);d=(e+d)/(e-d);e=-(f+g)/(f-g);g=-2*f*g/(f-g);k.n11=c;k.n12=0;k.n13=a;k.n14=0;k.n21=0;k.n22=h;k.n23=d;k.n24=0;k.n31=0;k.n32=0;k.n33=e;k.n34=g;k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,b,d,e,g,f){var k,c,h,l;k=new THREE.Matrix4;c=b-a;h=d-e;l=f-g;a=(b+a)/c;d=(d+e)/h;g=(f+g)/l;k.n11=2/c;k.n12=0;k.n13=0;k.n14=-a;k.n21=0;k.n22=2/h;k.n23=0;k.n24=-d;k.n31=0;k.n32=0;k.n33=-2/l;k.n34=-g;k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; 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=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,b,d,e,f){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=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,b,d,e,f,g){this.a=a;this.b=b;this.c=d;this.d=e;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.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; +THREE.Face3=function(a,b,d,e,g){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=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,b,d,e,g,f){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=f instanceof Array?f:[f]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;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], +b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(x,z,O,L,U,W,P){f=x.vertices[z].position;k=x.vertices[O].position;c=x.vertices[L].position;h=g[U];l=g[W];u=g[P];A=k.x-f.x;p=c.x-f.x;n=k.y-f.y;v=c.y-f.y; +D=k.z-f.z;G=c.z-f.z;o=l.u-h.u;I=u.u-h.u;m=l.v-h.v;j=u.v-h.v;t=1/(o*j-I*m);B.set((j*A-m*p)*t,(j*n-m*v)*t,(j*D-m*G)*t);K.set((o*p-I*A)*t,(o*v-I*n)*t,(o*G-I*D)*t);C[z].addSelf(B);C[O].addSelf(B);C[L].addSelf(B);q[z].addSelf(K);q[O].addSelf(K);q[L].addSelf(K)}var b,d,e,g,f,k,c,h,l,u,A,p,n,v,D,G,o,I,m,j,t,C=[],q=[],B=new THREE.Vector3,K=new THREE.Vector3,w=new THREE.Vector3,E=new THREE.Vector3,F=new THREE.Vector3;b=0;for(d=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,d=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,d=this.vertices.length;b65535){l[c].counter+=1;h=l[c].hash+"_"+l[c].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:k,vertices:0}}this.geometryChunks[h].faces.push(e);this.geometryChunks[h].vertices+=g}},toString:function(){return"THREE.Geometry ( vertices: "+ +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,d=this.vertices.length;b65535){l[c].counter+=1;h=l[c].hash+"_"+l[c].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:k,vertices:0}}this.geometryChunks[h].faces.push(e);this.geometryChunks[h].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,b,d,e){this.fov=a;this.aspect=b;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(f){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; -this.translateZ=function(f){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; +THREE.Camera=function(a,b,d,e){this.fov=a;this.aspect=b;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; @@ -89,101 +89,101 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}}; -THREE.Texture=function(a,b,d,e,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=g!==undefined?g:THREE.LinearMipMapLinearFilter}; +THREE.Texture=function(a,b,d,e,g,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var b,d,e,f={};for(b in a){f[b]={};for(d in a[b]){e=a[b][d];f[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return f},merge:function(a){var b,d,e,f={};for(b=0;b=0&&A>=0&&F>=0&&z>=0)return true;else if(E<0&&A<0||F<0&&z<0)return false;else{if(E<0)K=Math.max(K,E/(E-A));else if(A<0)w=Math.min(w,E/(E-A));if(F<0)K=Math.max(K,F/(F-z));else if(z<0)w=Math.min(w,F/(F-z));if(wE&&L.z0&&G.z<1){p=u[v]=u[v]||new THREE.RenderableParticle;p.x=G.x/G.w;p.y=G.y/G.w;p.z=G.z;p.rotation=P.rotation.z;p.scale.x=P.scale.x*Math.abs(p.x-(G.x+y.projectionMatrix.n11)/(G.w+y.projectionMatrix.n14)); -p.scale.y=P.scale.y*Math.abs(p.y-(G.y+y.projectionMatrix.n22)/(G.w+y.projectionMatrix.n24));p.materials=P.materials;w.push(p);v++}}}}K&&w.sort(a);return w};this.unprojectVector=function(q,y){var K=THREE.Matrix4.makeInvert(y.matrix);K.multiplySelf(THREE.Matrix4.makeInvert(y.projectionMatrix));K.multiplyVector3(q);return q}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,f,g;this.domElement=document.createElement("div");this.setSize=function(k,c){d=k;e=c;f=d/2;g=e/2};this.render=function(k,c){var h,l,t,B,p,v,u,D;a=b.projectScene(k,c);h=0;for(l=a.length;h0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}else if(fa instanceof THREE.PointLight){J.sub(fa.position,ea);J.normalize();fa=aa.dot(J)*na;if(fa>0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}}}function Qa(N,ea,aa){if(aa.opacity!=0){a(aa.opacity); -b(aa.blending);var Q,$,fa,la,na,oa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map){la=aa.map;na=la.width>>1;oa=la.height>>1;$=ea.scale.x*c;fa=ea.scale.y*h;aa=$*na;Q=fa*oa;H.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(H)){l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale($,-fa);l.translate(-na,-oa);l.drawImage(la,0,0);l.restore()}}}else if(aa instanceof THREE.ParticleCircleMaterial){if(S){V.r=ia.r+ha.r+x.r;V.g=ia.g+ha.g+x.g;V.b=ia.b+ha.b+x.b;w.r=aa.color.r*V.r;w.g=aa.color.g* +THREE.Projector=function(){function a(q,B){return B.z-q.z}function b(q,B){var K=0,w=1,E=q.z+q.w,F=B.z+B.w,x=-q.z+q.w,z=-B.z+B.w;if(E>=0&&F>=0&&x>=0&&z>=0)return true;else if(E<0&&F<0||x<0&&z<0)return false;else{if(E<0)K=Math.max(K,E/(E-F));else if(F<0)w=Math.min(w,E/(E-F));if(x<0)K=Math.max(K,x/(x-z));else if(z<0)w=Math.min(w,x/(x-z));if(wE&&L.z0&&G.z<1){p=v[n]=v[n]||new THREE.RenderableParticle;p.x=G.x/G.w;p.y=G.y/G.w;p.z=G.z;p.rotation=P.rotation.z;p.scale.x=P.scale.x*Math.abs(p.x-(G.x+B.projectionMatrix.n11)/(G.w+B.projectionMatrix.n14)); +p.scale.y=P.scale.y*Math.abs(p.y-(G.y+B.projectionMatrix.n22)/(G.w+B.projectionMatrix.n24));p.materials=P.materials;w.push(p);n++}}}}K&&w.sort(a);return w};this.unprojectVector=function(q,B){var K=THREE.Matrix4.makeInvert(B.matrix);K.multiplySelf(THREE.Matrix4.makeInvert(B.projectionMatrix));K.multiplyVector3(q);return q}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,g,f;this.domElement=document.createElement("div");this.setSize=function(k,c){d=k;e=c;g=d/2;f=e/2};this.render=function(k,c){var h,l,u,A,p,n,v,D;a=b.projectScene(k,c);h=0;for(l=a.length;h0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}else if(fa instanceof THREE.PointLight){J.sub(fa.position,ea);J.normalize();fa=aa.dot(J)*na;if(fa>0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}}}function Qa(N,ea,aa){if(aa.opacity!=0){a(aa.opacity); +b(aa.blending);var Q,$,fa,la,na,oa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map){la=aa.map;na=la.width>>1;oa=la.height>>1;$=ea.scale.x*c;fa=ea.scale.y*h;aa=$*na;Q=fa*oa;H.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(H)){l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale($,-fa);l.translate(-na,-oa);l.drawImage(la,0,0);l.restore()}}}else if(aa instanceof THREE.ParticleCircleMaterial){if(S){V.r=ia.r+ha.r+y.r;V.g=ia.g+ha.g+y.g;V.b=ia.b+ha.b+y.b;w.r=aa.color.r*V.r;w.g=aa.color.g* V.g;w.b=aa.color.b*V.b;w.updateStyleString()}else w.__styleString=aa.color.__styleString;aa=ea.scale.x*c;Q=ea.scale.y*h;H.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(H)){$=w.__styleString;if(D!=$)l.fillStyle=D=$;l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale(aa,Q);l.beginPath();l.arc(0,0,1,0,M,true);l.closePath();l.fill();l.restore()}}}}function Ra(N,ea,aa,Q){if(Q.opacity!=0){a(Q.opacity);b(Q.blending);l.beginPath();l.moveTo(N.positionScreen.x,N.positionScreen.y);l.lineTo(ea.positionScreen.x, -ea.positionScreen.y);l.closePath();if(Q instanceof THREE.LineBasicMaterial){w.__styleString=Q.color.__styleString;N=Q.linewidth;if(G!=N)l.lineWidth=G=N;N=w.__styleString;if(u!=N)l.strokeStyle=u=N;l.stroke();H.inflate(Q.linewidth*2)}}}function La(N,ea,aa,Q,$,fa){if($.opacity!=0){a($.opacity);b($.blending);j=N.positionScreen.x;o=N.positionScreen.y;C=ea.positionScreen.x;q=ea.positionScreen.y;y=aa.positionScreen.x;K=aa.positionScreen.y;l.beginPath();l.moveTo(j,o);l.lineTo(C,q);l.lineTo(y,K);l.lineTo(j, -o);l.closePath();if($ instanceof THREE.MeshBasicMaterial)if($.map)$.map.image.loaded&&$.map.mapping instanceof THREE.UVMapping&&Aa(j,o,C,q,y,K,$.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);else if($.env_map){if($.env_map.image.loaded)if($.env_map.mapping instanceof THREE.SphericalReflectionMapping){N=wa.matrix;J.copy(Q.vertexNormalsWorld[0]);W=(J.x*N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;P=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;J.copy(Q.vertexNormalsWorld[1]);da=(J.x* -N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;X=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;J.copy(Q.vertexNormalsWorld[2]);R=(J.x*N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;T=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;Aa(j,o,C,q,y,K,$.env_map.image,W,P,da,X,R,T)}}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){$.map.mapping instanceof THREE.UVMapping&&Aa(j,o,C,q,y,K,$.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u, -Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);b(THREE.SubtractiveBlending)}if(S)if(!$.wireframe&&$.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){E.r=A.r=F.r=ia.r;E.g=A.g=F.g=ia.g;E.b=A.b=F.b=ia.b;Da(fa,Q.v1.positionWorld,Q.vertexNormalsWorld[0],E);Da(fa,Q.v2.positionWorld,Q.vertexNormalsWorld[1],A);Da(fa,Q.v3.positionWorld,Q.vertexNormalsWorld[2],F);z.r=(A.r+F.r)*0.5;z.g=(A.g+F.g)*0.5;z.b=(A.b+F.b)*0.5;U=Ma(E,A,F,z);Aa(j,o,C,q,y,K,U,0,0,1,0,0,1)}else{V.r=ia.r;V.g=ia.g;V.b=ia.b;Da(fa,Q.centroidWorld, -Q.normalWorld,V);w.r=$.color.r*V.r;w.g=$.color.g*V.g;w.b=$.color.b*V.b;w.updateStyleString();$.wireframe?Ea(w.__styleString,$.wireframe_linewidth):Fa(w.__styleString)}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){O=wa.near;L=wa.far;E.r=E.g=E.b=1-Ha(N.positionScreen.z,O,L);A.r=A.g=A.b=1-Ha(ea.positionScreen.z,O,L);F.r=F.g=F.b=1-Ha(aa.positionScreen.z,O,L);z.r=(A.r+F.r)*0.5;z.g=(A.g+F.g)*0.5;z.b=(A.b+F.b)*0.5; -U=Ma(E,A,F,z);Aa(j,o,C,q,y,K,U,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){w.r=Ia(Q.normalWorld.x);w.g=Ia(Q.normalWorld.y);w.b=Ia(Q.normalWorld.z);w.updateStyleString();$.wireframe?Ea(w.__styleString,$.wireframe_linewidth):Fa(w.__styleString)}}}function Ea(N,ea){if(u!=N)l.strokeStyle=u=N;if(G!=ea)l.lineWidth=G=ea;l.stroke();H.inflate(ea*2)}function Fa(N){if(D!=N)l.fillStyle=D=N;l.fill()}function Aa(N,ea,aa,Q,$,fa,la,na,oa,ta,pa,ua,Ba){var xa,va;xa=la.width-1;va=la.height-1;na*=xa; +ea.positionScreen.y);l.closePath();if(Q instanceof THREE.LineBasicMaterial){w.__styleString=Q.color.__styleString;N=Q.linewidth;if(G!=N)l.lineWidth=G=N;N=w.__styleString;if(v!=N)l.strokeStyle=v=N;l.stroke();H.inflate(Q.linewidth*2)}}}function La(N,ea,aa,Q,$,fa){if($.opacity!=0){a($.opacity);b($.blending);j=N.positionScreen.x;t=N.positionScreen.y;C=ea.positionScreen.x;q=ea.positionScreen.y;B=aa.positionScreen.x;K=aa.positionScreen.y;l.beginPath();l.moveTo(j,t);l.lineTo(C,q);l.lineTo(B,K);l.lineTo(j, +t);l.closePath();if($ instanceof THREE.MeshBasicMaterial)if($.map)$.map.image.loaded&&$.map.mapping instanceof THREE.UVMapping&&Aa(j,t,C,q,B,K,$.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);else if($.env_map){if($.env_map.image.loaded)if($.env_map.mapping instanceof THREE.SphericalReflectionMapping){N=wa.matrix;J.copy(Q.vertexNormalsWorld[0]);W=(J.x*N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;P=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;J.copy(Q.vertexNormalsWorld[1]);da=(J.x* +N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;X=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;J.copy(Q.vertexNormalsWorld[2]);R=(J.x*N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;T=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;Aa(j,t,C,q,B,K,$.env_map.image,W,P,da,X,R,T)}}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){$.map.mapping instanceof THREE.UVMapping&&Aa(j,t,C,q,B,K,$.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u, +Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);b(THREE.SubtractiveBlending)}if(S)if(!$.wireframe&&$.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){E.r=F.r=x.r=ia.r;E.g=F.g=x.g=ia.g;E.b=F.b=x.b=ia.b;Da(fa,Q.v1.positionWorld,Q.vertexNormalsWorld[0],E);Da(fa,Q.v2.positionWorld,Q.vertexNormalsWorld[1],F);Da(fa,Q.v3.positionWorld,Q.vertexNormalsWorld[2],x);z.r=(F.r+x.r)*0.5;z.g=(F.g+x.g)*0.5;z.b=(F.b+x.b)*0.5;U=Ma(E,F,x,z);Aa(j,t,C,q,B,K,U,0,0,1,0,0,1)}else{V.r=ia.r;V.g=ia.g;V.b=ia.b;Da(fa,Q.centroidWorld, +Q.normalWorld,V);w.r=$.color.r*V.r;w.g=$.color.g*V.g;w.b=$.color.b*V.b;w.updateStyleString();$.wireframe?Ea(w.__styleString,$.wireframe_linewidth):Fa(w.__styleString)}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){O=wa.near;L=wa.far;E.r=E.g=E.b=1-Ha(N.positionScreen.z,O,L);F.r=F.g=F.b=1-Ha(ea.positionScreen.z,O,L);x.r=x.g=x.b=1-Ha(aa.positionScreen.z,O,L);z.r=(F.r+x.r)*0.5;z.g=(F.g+x.g)*0.5;z.b=(F.b+x.b)*0.5; +U=Ma(E,F,x,z);Aa(j,t,C,q,B,K,U,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){w.r=Ia(Q.normalWorld.x);w.g=Ia(Q.normalWorld.y);w.b=Ia(Q.normalWorld.z);w.updateStyleString();$.wireframe?Ea(w.__styleString,$.wireframe_linewidth):Fa(w.__styleString)}}}function Ea(N,ea){if(v!=N)l.strokeStyle=v=N;if(G!=ea)l.lineWidth=G=ea;l.stroke();H.inflate(ea*2)}function Fa(N){if(D!=N)l.fillStyle=D=N;l.fill()}function Aa(N,ea,aa,Q,$,fa,la,na,oa,ta,pa,ua,Ba){var xa,va;xa=la.width-1;va=la.height-1;na*=xa; oa*=va;ta*=xa;pa*=va;ua*=xa;Ba*=va;aa-=N;Q-=ea;$-=N;fa-=ea;ta-=na;pa-=oa;ua-=na;Ba-=oa;va=1/(ta*Ba-ua*pa);xa=(Ba*aa-pa*$)*va;pa=(Ba*Q-pa*fa)*va;aa=(ta*$-ua*aa)*va;Q=(ta*fa-ua*Q)*va;N=N-xa*na-aa*oa;ea=ea-pa*na-Q*oa;l.save();l.transform(xa,pa,aa,Q,N,ea);l.clip();l.drawImage(la,0,0);l.restore()}function Ma(N,ea,aa,Q){var $=~~(N.r*255),fa=~~(N.g*255);N=~~(N.b*255);var la=~~(ea.r*255),na=~~(ea.g*255);ea=~~(ea.b*255);var oa=~~(aa.r*255),ta=~~(aa.g*255);aa=~~(aa.b*255);var pa=~~(Q.r*255),ua=~~(Q.g*255); Q=~~(Q.b*255);ja[0]=$<0?0:$>255?255:$;ja[1]=fa<0?0:fa>255?255:fa;ja[2]=N<0?0:N>255?255:N;ja[4]=la<0?0:la>255?255:la;ja[5]=na<0?0:na>255?255:na;ja[6]=ea<0?0:ea>255?255:ea;ja[8]=oa<0?0:oa>255?255:oa;ja[9]=ta<0?0:ta>255?255:ta;ja[10]=aa<0?0:aa>255?255:aa;ja[12]=pa<0?0:pa>255?255:pa;ja[13]=ua<0?0:ua>255?255:ua;ja[14]=Q<0?0:Q>255?255:Q;ca.putImageData(ga,0,0);sa.drawImage(Z,0,0);return qa}function Ha(N,ea,aa){N=(N-ea)/(aa-ea);return N*N*(3-2*N)}function Ia(N){N=(N+1)*0.5;return N<0?0:N>1?1:N}function Ja(N, -ea){var aa=ea.x-N.x,Q=ea.y-N.y,$=1/Math.sqrt(aa*aa+Q*Q);aa*=$;Q*=$;ea.x+=aa;ea.y+=Q;N.x-=aa;N.y-=Q}var Ga,Na,ka,ra,za,Ka,Oa,Ca;l.setTransform(1,0,0,-1,c,h);this.autoClear&&this.clear();d=e.projectScene(ma,wa,this.sortElements);(S=ma.lights.length>0)&&Pa(ma);Ga=0;for(Na=d.length;Ga0)&&Pa(ma);Ga=0;for(Na=d.length;Ga0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}else if(T instanceof THREE.PointLight){K.sub(T.position,P.centroidWorld);K.normalize();ba=P.normalWorld.dot(K)*T.intensity;if(ba>0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}}}function b(W,P,da,X,R,T){F=e(z++);F.setAttribute("d", -"M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)m.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(I){j.r=o.r;j.g=o.g;j.b=o.b;a(T,X,j);m.r=R.color.r*j.r;m.g=R.color.g*j.g;m.b=R.color.b*j.b;m.updateStyleString()}else m.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshDepthMaterial){y=1-R.__2near/(R.__farPlusNear- -X.z*R.__farMinusNear);m.setRGB(y,y,y)}else R instanceof THREE.MeshNormalMaterial&&m.setRGB(f(X.normalWorld.x),f(X.normalWorld.y),f(X.normalWorld.z));R.wireframe?F.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):F.setAttribute("style","fill: "+m.__styleString+"; fill-opacity: "+R.opacity);c.appendChild(F)}function d(W,P,da,X,R,T,ba){F= -e(z++);F.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(T instanceof THREE.MeshBasicMaterial)m.__styleString=T.color.__styleString;else if(T instanceof THREE.MeshLambertMaterial)if(I){j.r=o.r;j.g=o.g;j.b=o.b;a(ba,R,j);m.r=T.color.r*j.r;m.g=T.color.g*j.g;m.b=T.color.b*j.b;m.updateStyleString()}else m.__styleString=T.color.__styleString; -else if(T instanceof THREE.MeshDepthMaterial){y=1-T.__2near/(T.__farPlusNear-R.z*T.__farMinusNear);m.setRGB(y,y,y)}else T instanceof THREE.MeshNormalMaterial&&m.setRGB(f(R.normalWorld.x),f(R.normalWorld.y),f(R.normalWorld.z));T.wireframe?F.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+T.wireframe_linewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.wireframe_linecap+"; stroke-linejoin: "+T.wireframe_linejoin):F.setAttribute("style","fill: "+m.__styleString+ -"; fill-opacity: "+T.opacity);c.appendChild(F)}function e(W){if(w[W]==null){w[W]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&w[W].setAttribute("shape-rendering","crispEdges");return w[W]}return w[W]}function f(W){return W<0?Math.min((1+W)*0.5,0.5):0.5+Math.min(W*0.5,0.5)}var g=null,k=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,l,t,B,p,v,u,D,G=new THREE.Rectangle,n=new THREE.Rectangle,I=false,m=new THREE.Color(16777215),j=new THREE.Color(16777215), -o=new THREE.Color(0),C=new THREE.Color(0),q=new THREE.Color(0),y,K=new THREE.Vector3,w=[],E=[],A=[],F,z,O,L,U=1;this.domElement=c;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(W){switch(W){case "high":U=1;break;case "low":U=0}};this.setSize=function(W,P){h=W;l=P;t=h/2;B=l/2;c.setAttribute("viewBox",-t+" "+-B+" "+h+" "+l);c.setAttribute("width",h);c.setAttribute("height",l);G.set(-t,-B,t,B)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])}; -this.render=function(W,P){var da,X,R,T,ba,Y,H,S;this.autoClear&&this.clear();g=k.projectScene(W,P,this.sortElements);L=O=z=0;if(I=W.lights.length>0){H=W.lights;o.setRGB(0,0,0);C.setRGB(0,0,0);q.setRGB(0,0,0);da=0;for(X=H.length;da0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}else if(T instanceof THREE.PointLight){K.sub(T.position,P.centroidWorld);K.normalize();ba=P.normalWorld.dot(K)*T.intensity;if(ba>0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}}}function b(W,P,da,X,R,T){x=e(z++);x.setAttribute("d", +"M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)m.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(I){j.r=t.r;j.g=t.g;j.b=t.b;a(T,X,j);m.r=R.color.r*j.r;m.g=R.color.g*j.g;m.b=R.color.b*j.b;m.updateStyleString()}else m.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshDepthMaterial){B=1-R.__2near/(R.__farPlusNear- +X.z*R.__farMinusNear);m.setRGB(B,B,B)}else R instanceof THREE.MeshNormalMaterial&&m.setRGB(g(X.normalWorld.x),g(X.normalWorld.y),g(X.normalWorld.z));R.wireframe?x.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):x.setAttribute("style","fill: "+m.__styleString+"; fill-opacity: "+R.opacity);c.appendChild(x)}function d(W,P,da,X,R,T,ba){x= +e(z++);x.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(T instanceof THREE.MeshBasicMaterial)m.__styleString=T.color.__styleString;else if(T instanceof THREE.MeshLambertMaterial)if(I){j.r=t.r;j.g=t.g;j.b=t.b;a(ba,R,j);m.r=T.color.r*j.r;m.g=T.color.g*j.g;m.b=T.color.b*j.b;m.updateStyleString()}else m.__styleString=T.color.__styleString; +else if(T instanceof THREE.MeshDepthMaterial){B=1-T.__2near/(T.__farPlusNear-R.z*T.__farMinusNear);m.setRGB(B,B,B)}else T instanceof THREE.MeshNormalMaterial&&m.setRGB(g(R.normalWorld.x),g(R.normalWorld.y),g(R.normalWorld.z));T.wireframe?x.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+T.wireframe_linewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.wireframe_linecap+"; stroke-linejoin: "+T.wireframe_linejoin):x.setAttribute("style","fill: "+m.__styleString+ +"; fill-opacity: "+T.opacity);c.appendChild(x)}function e(W){if(w[W]==null){w[W]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&w[W].setAttribute("shape-rendering","crispEdges");return w[W]}return w[W]}function g(W){return W<0?Math.min((1+W)*0.5,0.5):0.5+Math.min(W*0.5,0.5)}var f=null,k=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,l,u,A,p,n,v,D,G=new THREE.Rectangle,o=new THREE.Rectangle,I=false,m=new THREE.Color(16777215),j=new THREE.Color(16777215), +t=new THREE.Color(0),C=new THREE.Color(0),q=new THREE.Color(0),B,K=new THREE.Vector3,w=[],E=[],F=[],x,z,O,L,U=1;this.domElement=c;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(W){switch(W){case "high":U=1;break;case "low":U=0}};this.setSize=function(W,P){h=W;l=P;u=h/2;A=l/2;c.setAttribute("viewBox",-u+" "+-A+" "+h+" "+l);c.setAttribute("width",h);c.setAttribute("height",l);G.set(-u,-A,u,A)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])}; +this.render=function(W,P){var da,X,R,T,ba,Y,H,S;this.autoClear&&this.clear();f=k.projectScene(W,P,this.sortElements);L=O=z=0;if(I=W.lights.length>0){H=W.lights;t.setRGB(0,0,0);C.setRGB(0,0,0);q.setRGB(0,0,0);da=0;for(X=H.length;da0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,ia,C)}if(y){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, -j.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,M,C);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,J,C)}};this.setLineBuffers=function(j,o,C,q){var y,K,w=j.vertices,E=w.length,A=j.__vertexArray,F=j.__lineArray;if(C)for(C=0;C0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights, -F.map?"#define USE_MAP":"",F.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");c.attachShader(O,f("fragment",L+E));c.attachShader(O,f("vertex",F+z));c.linkProgram(O);c.getProgramParameter(O,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+ +case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var k=document.createElement("canvas"),c,h=null,l=null,u=new THREE.Matrix4,A,p=new Float32Array(16),n=new Float32Array(16),v=new Float32Array(16),D=new Float32Array(9), +G=new Float32Array(16),o=true,I=new THREE.Color(0),m=0;if(a){if(a.antialias!==undefined)o=a.antialias;a.clearColor!==undefined&&I.setHex(a.clearColor);if(a.clearAlpha!==undefined)m=a.clearAlpha}this.domElement=k;this.autoClear=true;(function(j,t,C){try{c=k.getContext("experimental-webgl",{antialias:j})}catch(q){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK); +c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(t.r,t.g,t.b,C)})(o,I,m);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(j,t){k.width=j;k.height=t;c.viewport(0,0,k.width,k.height)};this.setClearColor=function(j,t){var C=new THREE.Color(j);c.clearColor(C.r,C.g,C.b,t)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights= +function(j,t){var C,q,B,K=0,w=0,E=0,F,x,z,O=this.lights,L=O.directional.colors,U=O.directional.positions,W=O.point.colors,P=O.point.positions,da=0,X=0;C=0;for(q=t.length;C0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,ia,C)}if(B){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, +j.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,M,C);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,J,C)}};this.setLineBuffers=function(j,t,C,q){var B,K,w=j.vertices,E=w.length,F=j.__vertexArray,x=j.__lineArray;if(C)for(C=0;C0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights, +x.map?"#define USE_MAP":"",x.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");c.attachShader(O,g("fragment",L+E));c.attachShader(O,g("vertex",x+z));c.linkProgram(O);c.getProgramParameter(O,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+ c.getProgramParameter(O,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");O.uniforms={};O.attributes={};q.program=O;E=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(w in q.uniforms)E.push(w);w=q.program;z=0;for(O=E.length;z=0){c.bindBuffer(c.ARRAY_BUFFER,y.__webGLNormalBuffer);c.vertexAttribPointer(A.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(A.normal)}if(A.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,y.__webGLTangentBuffer); -c.vertexAttribPointer(A.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(A.tangent)}if(A.uv>=0)if(y.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,y.__webGLUVBuffer);c.vertexAttribPointer(A.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(A.uv)}else c.disableVertexAttribArray(A.uv);if(q.wireframe||q instanceof THREE.LineBasicMaterial){A=q.wireframe_linewidth!==undefined?q.wireframe_linewidth:q.linewidth!==undefined?q.linewidth:1;q=q instanceof THREE.LineBasicMaterial&&K.type==THREE.LineStrip? -c.LINE_STRIP:c.LINES;c.lineWidth(A);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y.__webGLLineBuffer);c.drawElements(q,y.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,y.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(j,o,C,q,y,K,w){var E,A,F,z,O;F=0;for(z=q.materials.length;F=0;C--){q=j.__webGLObjects[C].object;o==q&&j.__webGLObjects.splice(C,1)}};this.setupMatrices=function(j,o){j.autoUpdateMatrix&& -j.updateMatrix();t.multiply(o.matrix,j.matrix);v.set(t.flatten());B=THREE.Matrix4.makeInvert3x3(t).transpose();D.set(B.m);G.set(j.matrix.flatten())};this.loadMatrices=function(j){c.uniformMatrix4fv(j.uniforms.viewMatrix,false,p);c.uniformMatrix4fv(j.uniforms.modelViewMatrix,false,v);c.uniformMatrix4fv(j.uniforms.projectionMatrix,false,u);c.uniformMatrix3fv(j.uniforms.normalMatrix,false,D);c.uniformMatrix4fv(j.uniforms.objectMatrix,false,G)};this.loadCamera=function(j,o){c.uniform3f(j.uniforms.cameraPosition, -o.position.x,o.position.y,o.position.z)};this.setBlending=function(j){switch(j){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(j,o){if(j){!o||o=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(j=="back")c.cullFace(c.BACK);else j=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK); +h=w}this.loadCamera(w,j);this.loadMatrices(w);if(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial){this.setupLights(w,t);j=this.lights;q.uniforms.enableLighting.value=j.directional.length+j.point.length;q.uniforms.ambientLightColor.value=j.ambient;q.uniforms.directionalLightColor.value=j.directional.colors;q.uniforms.directionalLightDirection.value=j.directional.positions;q.uniforms.pointLightColor.value=j.point.colors;q.uniforms.pointLightPosition.value=j.point.positions}if(q instanceof +THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial)d(q,C);q instanceof THREE.LineBasicMaterial&&e(q,C);if(q instanceof THREE.MeshPhongMaterial){q.uniforms.ambient.value.setRGB(q.ambient.r,q.ambient.g,q.ambient.b);q.uniforms.specular.value.setRGB(q.specular.r,q.specular.g,q.specular.b);q.uniforms.shininess.value=q.shininess}C=q.uniforms;for(F in C)if(z=w.uniforms[F]){t=C[F];E=t.type;j=t.value;if(E=="i")c.uniform1i(z,j);else if(E=="f")c.uniform1f(z, +j);else if(E=="fv1")c.uniform1fv(z,j);else if(E=="fv")c.uniform3fv(z,j);else if(E=="v2")c.uniform2f(z,j.x,j.y);else if(E=="v3")c.uniform3f(z,j.x,j.y,j.z);else if(E=="c")c.uniform3f(z,j.r,j.g,j.b);else if(E=="t"){c.uniform1i(z,j);if(t=t.texture)if(t.image instanceof Array&&t.image.length==6){t=t;j=j;if(t.image.length==6){if(!t.image.__webGLTextureCube&&!t.image.__cubeMapInitialized&&t.image.loadCount==6){t.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,t.image.__webGLTextureCube); +c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(E=0;E<6;++E)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,t.image[E]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);t.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+ +j);c.bindTexture(c.TEXTURE_CUBE_MAP,t.image.__webGLTextureCube)}}else{t=t;j=j;if(!t.__webGLTexture&&t.image.loaded){t.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,t.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,t.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,f(t.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,f(t.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,f(t.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,f(t.min_filter)); +c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_2D,t.__webGLTexture)}}}F=w.attributes;c.bindBuffer(c.ARRAY_BUFFER,B.__webGLVertexBuffer);c.vertexAttribPointer(F.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.position);if(F.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,B.__webGLNormalBuffer);c.vertexAttribPointer(F.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.normal)}if(F.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,B.__webGLTangentBuffer); +c.vertexAttribPointer(F.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.tangent)}if(F.uv>=0)if(B.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,B.__webGLUVBuffer);c.vertexAttribPointer(F.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.uv)}else c.disableVertexAttribArray(F.uv);if(q.wireframe||q instanceof THREE.LineBasicMaterial){F=q.wireframe_linewidth!==undefined?q.wireframe_linewidth:q.linewidth!==undefined?q.linewidth:1;q=q instanceof THREE.LineBasicMaterial&&K.type==THREE.LineStrip? +c.LINE_STRIP:c.LINES;c.lineWidth(F);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);c.drawElements(q,B.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,B.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(j,t,C,q,B,K,w){var E,F,x,z,O;x=0;for(z=q.materials.length;x=0;C--){q=j.__webGLObjects[C].object;t==q&&j.__webGLObjects.splice(C,1)}};this.setupMatrices=function(j,t){j.autoUpdateMatrix&& +j.updateMatrix();u.multiply(t.matrix,j.matrix);n.set(u.flatten());A=THREE.Matrix4.makeInvert3x3(u).transpose();D.set(A.m);G.set(j.matrix.flatten())};this.loadMatrices=function(j){c.uniformMatrix4fv(j.uniforms.viewMatrix,false,p);c.uniformMatrix4fv(j.uniforms.modelViewMatrix,false,n);c.uniformMatrix4fv(j.uniforms.projectionMatrix,false,v);c.uniformMatrix3fv(j.uniforms.normalMatrix,false,D);c.uniformMatrix4fv(j.uniforms.objectMatrix,false,G)};this.loadCamera=function(j,t){c.uniform3f(j.uniforms.cameraPosition, +t.position.x,t.position.y,t.position.z)};this.setBlending=function(j){switch(j){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(j,t){if(j){!t||t=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(j=="back")c.cullFace(c.BACK);else j=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK); c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; 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, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", @@ -201,63 +201,63 @@ shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform "gl_FragColor = mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;", THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]}; THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null}; -var GeometryUtils={merge:function(a,b){var d=b instanceof THREE.Mesh,e=a.vertices.length,f=d?b.geometry:b,g=a.vertices,k=f.vertices,c=a.faces,h=f.faces,l=a.uvs;f=f.uvs;d&&b.autoUpdateMatrix&&b.updateMatrix();for(var t=0,B=k.length;t= 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}", vertex_shader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"}, cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},basic:{uniforms:{}, -vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"void main() {\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\n}"}}},Cube=function(a,b,d,e,f,g,k,c){function h(D,G,n,I,m,j,o,C){var q,y,K=e||1,w=f||1,E=K+1,A=w+1,F=m/2,z=j/2;m=m/K;var O=j/w,L=l.vertices.length;if(D=="x"&&G=="y"||D=="y"&&G=="x")q="z";else if(D=="x"&&G=="z"||D=="z"&&G=="x")q="y";else if(D=="z"&&G=="y"||D=="y"&&G=="z")q="x";for(y=0;y0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(B,c,p)))-1);l.push(t)}b.push(l)}var v,u,D;f=b.length;for(d=0;d0)for(e=0;e1){v=this.vertices[k].position.clone(); -u=this.vertices[h].position.clone();D=this.vertices[l].position.clone();v.normalize();u.normalize();D.normalize();this.faces.push(new THREE.Face3(k,h,l,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(D.x,D.y,D.z)]));this.uvs.push([t,B,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; -var Torus=function(a,b,d,e){this.radius=a||100;this.tube=b||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(d=0;d<=this.segmentsT;++d){e=d/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(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([d/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(d= -1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*b+d;f=(this.segmentsT+1)*b+d-1;var g=(this.segmentsT+1)*(b-1)+d-1,k=(this.segmentsT+1)*(b-1)+d;this.faces.push(new THREE.Face4(e,f,g,k));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[k][0],a[k][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var Icosahedron=function(a){function b(B,p,v){var u=Math.sqrt(B*B+p*p+v*v);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(B/u,p/u,v/u)))-1}function d(B,p,v,u){u.faces.push(new THREE.Face3(B,p,v))}function e(B,p){var v=f.vertices[B].position,u=f.vertices[p].position;return b((v.x+u.x)/2,(v.y+u.y)/2,(v.z+u.z)/2)}var f=this,g=new THREE.Geometry,k;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);d(0,11,5,g);d(0,5,1,g);d(0,1,7,g);d(0,7,10,g);d(0,10,11,g);d(1,5,9,g);d(5,11,4,g);d(11,10,2,g);d(10,7,6,g);d(7,1,8,g);d(3,9,4,g);d(3,4,2,g);d(3,2,6,g);d(3,6,8,g);d(3,8,9,g);d(4,9,5,g);d(2,4,11,g);d(6,2,10,g);d(8,6,7,g);d(9,8,1,g);for(a=0;a0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(A,c,p)))-1);l.push(u)}b.push(l)}var n,v,D;g=b.length;for(d=0;d0)for(e=0;e1){n=this.vertices[k].position.clone(); +v=this.vertices[h].position.clone();D=this.vertices[l].position.clone();n.normalize();v.normalize();D.normalize();this.faces.push(new THREE.Face3(k,h,l,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(D.x,D.y,D.z)]));this.uvs.push([u,A,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Torus=function(a,b,d,e){this.radius=a||100;this.tube=b||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(d=0;d<=this.segmentsT;++d){e=d/this.segmentsT*2*Math.PI;var g=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));a.push([d/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(d= +1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*b+d;g=(this.segmentsT+1)*b+d-1;var f=(this.segmentsT+1)*(b-1)+d-1,k=(this.segmentsT+1)*(b-1)+d;this.faces.push(new THREE.Face4(e,g,f,k));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[k][0],a[k][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; +var Icosahedron=function(a){function b(A,p,n){var v=Math.sqrt(A*A+p*p+n*n);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(A/v,p/v,n/v)))-1}function d(A,p,n,v){v.faces.push(new THREE.Face3(A,p,n))}function e(A,p){var n=g.vertices[A].position,v=g.vertices[p].position;return b((n.x+v.x)/2,(n.y+v.y)/2,(n.z+v.z)/2)}var g=this,f=new THREE.Geometry,k;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);d(0,11,5,f);d(0,5,1,f);d(0,1,7,f);d(0,7,10,f);d(0,10,11,f);d(1,5,9,f);d(5,11,4,f);d(11,10,2,f);d(10,7,6,f);d(7,1,8,f);d(3,9,4,f);d(3,4,2,f);d(3,2,6,f);d(3,6,8,f);d(3,8,9,f);d(4,9,5,f);d(2,4,11,f);d(6,2,10,f);d(8,6,7,f);d(9,8,1,f);for(a=0;a>7)-127;J=(ca&127)<<16|Z<<8|J;if(J==0&&ja==-127)return 0;return(1-2*(ga>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,ja)}function c(x,M){var J=t(x,M),Z=t(x,M+1),ca=t(x,M+2);return(t(x,M+3)<<24)+(ca<<16)+(Z<<8)+J}function h(x,M){var J=t(x,M);return(t(x,M+1)<<8)+J}function l(x,M){var J=t(x,M);return J>127?J-256:J}function t(x,M){return x.charCodeAt(M)&255}function B(x){var M, -J,Z;M=c(a,x);J=c(a,x+C);Z=c(a,x+q);x=h(a,x+y);THREE.Loader.prototype.f3(n,M,J,Z,x)}function p(x){var M,J,Z,ca,ga,ja;M=c(a,x);J=c(a,x+C);Z=c(a,x+q);ca=h(a,x+y);ga=c(a,x+K);ja=c(a,x+w);x=c(a,x+E);THREE.Loader.prototype.f3n(n,j,M,J,Z,ca,ga,ja,x)}function v(x){var M,J,Z,ca;M=c(a,x);J=c(a,x+A);Z=c(a,x+F);ca=c(a,x+z);x=h(a,x+O);THREE.Loader.prototype.f4(n,M,J,Z,ca,x)}function u(x){var M,J,Z,ca,ga,ja,qa,sa;M=c(a,x);J=c(a,x+A);Z=c(a,x+F);ca=c(a,x+z);ga=h(a,x+O);ja=c(a,x+L);qa=c(a,x+U);sa=c(a,x+W);x=c(a,x+ -P);THREE.Loader.prototype.f4n(n,j,M,J,Z,ca,ga,ja,qa,sa,x)}function D(x){var M,J;M=c(a,x);J=c(a,x+da);x=c(a,x+X);THREE.Loader.prototype.uv3(n,o[M*2],o[M*2+1],o[J*2],o[J*2+1],o[x*2],o[x*2+1])}function G(x){var M,J,Z;M=c(a,x);J=c(a,x+R);Z=c(a,x+T);x=c(a,x+ba);THREE.Loader.prototype.uv4(n,o[M*2],o[M*2+1],o[J*2],o[J*2+1],o[Z*2],o[Z*2+1],o[x*2],o[x*2+1])}var n=this,I=0,m,j=[],o=[],C,q,y,K,w,E,A,F,z,O,L,U,W,P,da,X,R,T,ba,Y,H,S,V,ia,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(n,e,g); -m={signature:a.substr(I,8),header_bytes:t(a,I+8),vertex_coordinate_bytes:t(a,I+9),normal_coordinate_bytes:t(a,I+10),uv_coordinate_bytes:t(a,I+11),vertex_index_bytes:t(a,I+12),normal_index_bytes:t(a,I+13),uv_index_bytes:t(a,I+14),material_index_bytes:t(a,I+15),nvertices:c(a,I+16),nnormals:c(a,I+16+4),nuvs:c(a,I+16+8),ntri_flat:c(a,I+16+12),ntri_smooth:c(a,I+16+16),ntri_flat_uv:c(a,I+16+20),ntri_smooth_uv:c(a,I+16+24),nquad_flat:c(a,I+16+28),nquad_smooth:c(a,I+16+32),nquad_flat_uv:c(a,I+16+36),nquad_smooth_uv:c(a, -I+16+40)};I+=m.header_bytes;C=m.vertex_index_bytes;q=m.vertex_index_bytes*2;y=m.vertex_index_bytes*3;K=m.vertex_index_bytes*3+m.material_index_bytes;w=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;E=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;A=m.vertex_index_bytes;F=m.vertex_index_bytes*2;z=m.vertex_index_bytes*3;O=m.vertex_index_bytes*4;L=m.vertex_index_bytes*4+m.material_index_bytes;U=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes; -W=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;P=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;da=m.uv_index_bytes;X=m.uv_index_bytes*2;R=m.uv_index_bytes;T=m.uv_index_bytes*2;ba=m.uv_index_bytes*3;g=m.vertex_index_bytes*3+m.material_index_bytes;ha=m.vertex_index_bytes*4+m.material_index_bytes;Y=m.ntri_flat*g;H=m.ntri_smooth*(g+m.normal_index_bytes*3);S=m.ntri_flat_uv*(g+m.uv_index_bytes*3);V=m.ntri_smooth_uv*(g+m.normal_index_bytes*3+m.uv_index_bytes* -3);ia=m.nquad_flat*ha;g=m.nquad_smooth*(ha+m.normal_index_bytes*4);ha=m.nquad_flat_uv*(ha+m.uv_index_bytes*4);I+=function(x){var M,J,Z,ca=m.vertex_coordinate_bytes*3,ga=x+m.nvertices*ca;for(x=x;x>7)-127;J=(ca&127)<<16|Z<<8|J;if(J==0&&ja==-127)return 0;return(1-2*(ga>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,ja)}function c(y,M){var J=u(y,M),Z=u(y,M+1),ca=u(y,M+2);return(u(y,M+3)<<24)+(ca<<16)+(Z<<8)+J}function h(y,M){var J=u(y,M);return(u(y,M+1)<<8)+J}function l(y,M){var J=u(y,M);return J>127?J-256:J}function u(y,M){return y.charCodeAt(M)&255}function A(y){var M, +J,Z;M=c(a,y);J=c(a,y+C);Z=c(a,y+q);y=h(a,y+B);THREE.Loader.prototype.f3(o,M,J,Z,y)}function p(y){var M,J,Z,ca,ga,ja;M=c(a,y);J=c(a,y+C);Z=c(a,y+q);ca=h(a,y+B);ga=c(a,y+K);ja=c(a,y+w);y=c(a,y+E);THREE.Loader.prototype.f3n(o,j,M,J,Z,ca,ga,ja,y)}function n(y){var M,J,Z,ca;M=c(a,y);J=c(a,y+F);Z=c(a,y+x);ca=c(a,y+z);y=h(a,y+O);THREE.Loader.prototype.f4(o,M,J,Z,ca,y)}function v(y){var M,J,Z,ca,ga,ja,qa,sa;M=c(a,y);J=c(a,y+F);Z=c(a,y+x);ca=c(a,y+z);ga=h(a,y+O);ja=c(a,y+L);qa=c(a,y+U);sa=c(a,y+W);y=c(a,y+ +P);THREE.Loader.prototype.f4n(o,j,M,J,Z,ca,ga,ja,qa,sa,y)}function D(y){var M,J;M=c(a,y);J=c(a,y+da);y=c(a,y+X);THREE.Loader.prototype.uv3(o,t[M*2],t[M*2+1],t[J*2],t[J*2+1],t[y*2],t[y*2+1])}function G(y){var M,J,Z;M=c(a,y);J=c(a,y+R);Z=c(a,y+T);y=c(a,y+ba);THREE.Loader.prototype.uv4(o,t[M*2],t[M*2+1],t[J*2],t[J*2+1],t[Z*2],t[Z*2+1],t[y*2],t[y*2+1])}var o=this,I=0,m,j=[],t=[],C,q,B,K,w,E,F,x,z,O,L,U,W,P,da,X,R,T,ba,Y,H,S,V,ia,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(o,e,f); +m={signature:a.substr(I,8),header_bytes:u(a,I+8),vertex_coordinate_bytes:u(a,I+9),normal_coordinate_bytes:u(a,I+10),uv_coordinate_bytes:u(a,I+11),vertex_index_bytes:u(a,I+12),normal_index_bytes:u(a,I+13),uv_index_bytes:u(a,I+14),material_index_bytes:u(a,I+15),nvertices:c(a,I+16),nnormals:c(a,I+16+4),nuvs:c(a,I+16+8),ntri_flat:c(a,I+16+12),ntri_smooth:c(a,I+16+16),ntri_flat_uv:c(a,I+16+20),ntri_smooth_uv:c(a,I+16+24),nquad_flat:c(a,I+16+28),nquad_smooth:c(a,I+16+32),nquad_flat_uv:c(a,I+16+36),nquad_smooth_uv:c(a, +I+16+40)};I+=m.header_bytes;C=m.vertex_index_bytes;q=m.vertex_index_bytes*2;B=m.vertex_index_bytes*3;K=m.vertex_index_bytes*3+m.material_index_bytes;w=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;E=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;F=m.vertex_index_bytes;x=m.vertex_index_bytes*2;z=m.vertex_index_bytes*3;O=m.vertex_index_bytes*4;L=m.vertex_index_bytes*4+m.material_index_bytes;U=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes; +W=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;P=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;da=m.uv_index_bytes;X=m.uv_index_bytes*2;R=m.uv_index_bytes;T=m.uv_index_bytes*2;ba=m.uv_index_bytes*3;f=m.vertex_index_bytes*3+m.material_index_bytes;ha=m.vertex_index_bytes*4+m.material_index_bytes;Y=m.ntri_flat*f;H=m.ntri_smooth*(f+m.normal_index_bytes*3);S=m.ntri_flat_uv*(f+m.uv_index_bytes*3);V=m.ntri_smooth_uv*(f+m.normal_index_bytes*3+m.uv_index_bytes* +3);ia=m.nquad_flat*ha;f=m.nquad_smooth*(ha+m.normal_index_bytes*4);ha=m.nquad_flat_uv*(ha+m.uv_index_bytes*4);I+=function(y){var M,J,Z,ca=m.vertex_coordinate_bytes*3,ga=y+m.nvertices*ca;for(y=y;y Date: Thu, 27 Jan 2011 02:52:19 +0100 Subject: [PATCH 4/4] Another small improvement of scene loader blocking. Also shader program building is now spread over loading time. --- build/Three.js | 254 ++++++++++----------- build/ThreeDebug.js | 256 ++++++++++----------- build/ThreeExtras.js | 398 ++++++++++++++++----------------- examples/scene_test.html | 48 +++- examples/scenes/test_scene.js | 40 ++-- src/renderers/WebGLRenderer.js | 33 +-- 6 files changed, 539 insertions(+), 490 deletions(-) diff --git a/build/Three.js b/build/Three.js index 634b1638..08c8d07f 100755 --- a/build/Three.js +++ b/build/Three.js @@ -12,50 +12,50 @@ THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1} THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,g=[];a=0;for(c=e.length;a0&&K>0&&j+K<1}var d,e,g,h,o,b,i,k,y,z, -u,x=a.geometry,H=x.vertices,J=[];d=0;for(e=x.faces.length;di?e:i;g=g>k? -g:k}a()};this.add3Points=function(i,k,y,z,u,x){if(b){b=false;c=iy?i>u?i:u:y>u?y:u;g=k>z?k>x?k:x:z>x?z:x}else{c=iy?i>u?i>e?i:e:u>e?u:e:y>u?y>e?y:e:u>e?u:e;g=k>z?k>x?k>g?k:g:x>g?x:g:z>x?z>g?z:g:x>g?x:g}a()};this.addRectangle=function(i){if(b){b=false;c=i.getLeft();d=i.getTop();e=i.getRight();g=i.getBottom()}else{c=ci.getRight()?e:i.getRight();g=g>i.getBottom()?g:i.getBottom()}a()};this.inflate=function(i){c-=i;d-=i;e+=i;g+=i;a()};this.minSelf=function(i){c=c>i.getLeft()?c:i.getLeft();d=d>i.getTop()?d:i.getTop();e=e=0&&Math.min(g,i.getBottom())-Math.max(d,i.getTop())>=0};this.empty=function(){b=true;g=e=d=c=0;a()};this.isEmpty=function(){return b};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+g+", width: "+h+", height: "+o+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; -THREE.Matrix4=function(a,c,d,e,g,h,o,b,i,k,y,z,u,x,H,J){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=h||1;this.n23=o||0;this.n24=b||0;this.n31=i||0;this.n32=k||0;this.n33=y||1;this.n34=z||0;this.n41=u||0;this.n42=x||0;this.n43=H||0;this.n44=J||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,g,h,o,b,i,k,y,z,u,x,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=g;this.n22=h;this.n23=o;this.n24=b;this.n31=i;this.n32=k;this.n33=y;this.n34=z;this.n41=u;this.n42=x;this.n43=H;this.n44=J;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,h=THREE.Matrix4.__tmpVec3;h.sub(a,c).normalize();e.cross(d,h).normalize();g.cross(h,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); -this.n31=h.x;this.n32=h.y;this.n33=h.z;this.n34=-h.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,g=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*c+this.n22*d+this.n23* -e+this.n24*g;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,g=a.n13,h=a.n14,o=a.n21,b=a.n22,i=a.n23,k=a.n24,y=a.n31, -z=a.n32,u=a.n33,x=a.n34,H=a.n41,J=a.n42,K=a.n43,p=a.n44,U=c.n11,F=c.n12,f=c.n13,j=c.n14,q=c.n21,l=c.n22,r=c.n23,C=c.n24,m=c.n31,t=c.n32,v=c.n33,s=c.n34,n=c.n41,E=c.n42,A=c.n43,O=c.n44;this.n11=d*U+e*q+g*m+h*n;this.n12=d*F+e*l+g*t+h*E;this.n13=d*f+e*r+g*v+h*A;this.n14=d*j+e*C+g*s+h*O;this.n21=o*U+b*q+i*m+k*n;this.n22=o*F+b*l+i*t+k*E;this.n23=o*f+b*r+i*v+k*A;this.n24=o*j+b*C+i*s+k*O;this.n31=y*U+z*q+u*m+x*n;this.n32=y*F+z*l+u*t+x*E;this.n33=y*f+z*r+u*v+x*A;this.n34=y*j+z*C+u*s+x*O;this.n41=H*U+J*q+ -K*m+p*n;this.n42=H*F+J*l+K*t+p*E;this.n43=H*f+J*r+K*v+p*A;this.n44=H*j+J*C+K*s+p*O;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,g=this.n14,h=this.n21,o=this.n22,b=this.n23,i=this.n24,k=this.n31,y=this.n32,z=this.n33,u=this.n34,x=this.n41,H=this.n42,J=this.n43,K=this.n44,p=a.n11,U=a.n21,F=a.n31,f=a.n41,j=a.n12,q=a.n22,l=a.n32,r=a.n42,C=a.n13,m=a.n23,t=a.n33,v=a.n43,s=a.n14,n=a.n24,E=a.n34;a=a.n44;this.n11=c*p+d*U+e*F+g*f;this.n12=c*j+d*q+e*l+g*r;this.n13=c*C+d*m+e*t+g* -v;this.n14=c*s+d*n+e*E+g*a;this.n21=h*p+o*U+b*F+i*f;this.n22=h*j+o*q+b*l+i*r;this.n23=h*C+o*m+b*t+i*v;this.n24=h*s+o*n+b*E+i*a;this.n31=k*p+y*U+z*F+u*f;this.n32=k*j+y*q+z*l+u*r;this.n33=k*C+y*m+z*t+u*v;this.n34=k*s+y*n+z*E+u*a;this.n41=x*p+H*U+J*F+K*f;this.n42=x*j+H*q+J*l+K*r;this.n43=x*C+H*m+J*t+K*v;this.n44=x*s+H*n+J*E+K*a;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,c=this.n12,d=this.n13,e=this.n14,g=this.n21,h=this.n22,o=this.n23,b=this.n24,i=this.n31,k=this.n32,y=this.n33,z=this.n34,u=this.n41,x=this.n42,H=this.n43,J=this.n44;return e*o*k*u-d*b*k*u-e*h*y*u+c*b*y*u+d*h*z*u-c*o*z*u-e*o*i*x+d*b*i*x+e*g*y*x-a*b*y*x-d*g*z*x+a*o*z*x+e*h*i*H-c*b*i*H-e*g*k*H+a*b*k*H+c*g*z*H-a*h*z*H-d*h*i*J+c*o*i*J+d*g*k*J-a*o*k*J-c*g*y*J+a*h*y*J},transpose:function(){function a(c,d, -e){var g=c[d];c[d]=c[e];c[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11; +THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,i=[];a=0;for(c=e.length;a0&&K>0&&j+K<1}var d,e,i,b,n,o,k,m,y,x, +s,w=a.geometry,H=w.vertices,J=[];d=0;for(e=w.faces.length;dk?e:k;i=i>m? +i:m}a()};this.add3Points=function(k,m,y,x,s,w){if(o){o=false;c=ky?k>s?k:s:y>s?y:s;i=m>x?m>w?m:w:x>w?x:w}else{c=ky?k>s?k>e?k:e:s>e?s:e:y>s?y>e?y:e:s>e?s:e;i=m>x?m>w?m>i?m:i:w>i?w:i:x>w?x>i?x:i:w>i?w:i}a()};this.addRectangle=function(k){if(o){o=false;c=k.getLeft();d=k.getTop();e=k.getRight();i=k.getBottom()}else{c=ck.getRight()?e:k.getRight();i=i>k.getBottom()?i:k.getBottom()}a()};this.inflate=function(k){c-=k;d-=k;e+=k;i+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e=0&&Math.min(i,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){o=true;i=e=d=c=0;a()};this.isEmpty=function(){return o};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+i+", width: "+b+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; +THREE.Matrix4=function(a,c,d,e,i,b,n,o,k,m,y,x,s,w,H,J){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=i||0;this.n22=b||1;this.n23=n||0;this.n24=o||0;this.n31=k||0;this.n32=m||0;this.n33=y||1;this.n34=x||0;this.n41=s||0;this.n42=w||0;this.n43=H||0;this.n44=J||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,i,b,n,o,k,m,y,x,s,w,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=i;this.n22=b;this.n23=n;this.n24=o;this.n31=k;this.n32=m;this.n33=y;this.n34=x;this.n41=s;this.n42=w;this.n43=H;this.n44=J;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();i.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a); +this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,i=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*i;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*i;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,i=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*i;a.y=this.n21*c+this.n22*d+this.n23* +e+this.n24*i;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*i;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*i;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,i=a.n13,b=a.n14,n=a.n21,o=a.n22,k=a.n23,m=a.n24,y=a.n31, +x=a.n32,s=a.n33,w=a.n34,H=a.n41,J=a.n42,K=a.n43,p=a.n44,h=c.n11,g=c.n12,f=c.n13,j=c.n14,t=c.n21,u=c.n22,l=c.n23,A=c.n24,q=c.n31,G=c.n32,r=c.n33,v=c.n34,D=c.n41,T=c.n42,E=c.n43,N=c.n44;this.n11=d*h+e*t+i*q+b*D;this.n12=d*g+e*u+i*G+b*T;this.n13=d*f+e*l+i*r+b*E;this.n14=d*j+e*A+i*v+b*N;this.n21=n*h+o*t+k*q+m*D;this.n22=n*g+o*u+k*G+m*T;this.n23=n*f+o*l+k*r+m*E;this.n24=n*j+o*A+k*v+m*N;this.n31=y*h+x*t+s*q+w*D;this.n32=y*g+x*u+s*G+w*T;this.n33=y*f+x*l+s*r+w*E;this.n34=y*j+x*A+s*v+w*N;this.n41=H*h+J*t+ +K*q+p*D;this.n42=H*g+J*u+K*G+p*T;this.n43=H*f+J*l+K*r+p*E;this.n44=H*j+J*A+K*v+p*N;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,i=this.n14,b=this.n21,n=this.n22,o=this.n23,k=this.n24,m=this.n31,y=this.n32,x=this.n33,s=this.n34,w=this.n41,H=this.n42,J=this.n43,K=this.n44,p=a.n11,h=a.n21,g=a.n31,f=a.n41,j=a.n12,t=a.n22,u=a.n32,l=a.n42,A=a.n13,q=a.n23,G=a.n33,r=a.n43,v=a.n14,D=a.n24,T=a.n34;a=a.n44;this.n11=c*p+d*h+e*g+i*f;this.n12=c*j+d*t+e*u+i*l;this.n13=c*A+d*q+e*G+i* +r;this.n14=c*v+d*D+e*T+i*a;this.n21=b*p+n*h+o*g+k*f;this.n22=b*j+n*t+o*u+k*l;this.n23=b*A+n*q+o*G+k*r;this.n24=b*v+n*D+o*T+k*a;this.n31=m*p+y*h+x*g+s*f;this.n32=m*j+y*t+x*u+s*l;this.n33=m*A+y*q+x*G+s*r;this.n34=m*v+y*D+x*T+s*a;this.n41=w*p+H*h+J*g+K*f;this.n42=w*j+H*t+J*u+K*l;this.n43=w*A+H*q+J*G+K*r;this.n44=w*v+H*D+J*T+K*a;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,c=this.n12,d=this.n13,e=this.n14,i=this.n21,b=this.n22,n=this.n23,o=this.n24,k=this.n31,m=this.n32,y=this.n33,x=this.n34,s=this.n41,w=this.n42,H=this.n43,J=this.n44;return e*n*m*s-d*o*m*s-e*b*y*s+c*o*y*s+d*b*x*s-c*n*x*s-e*n*k*w+d*o*k*w+e*i*y*w-a*o*y*w-d*i*x*w+a*n*x*w+e*b*k*H-c*o*k*H-e*i*m*H+a*o*m*H+c*i*x*H-a*b*x*H-d*b*k*J+c*n*k*J+d*i*m*J-a*n*m*J-c*i*y*J+a*b*y*J},transpose:function(){function a(c,d, +e){var i=c[d];c[d]=c[e];c[e]=i}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;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},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= -Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),g=1-d,h=a.x,o=a.y,b=a.z,i=g*h,k=g*o;this.set(i*h+d,i*o-e*b,i*b+e*o,0,i*o+e*b,k*o+d,k*b-e*h,0,i*b-e*o,k*b+e*h,g*b*b+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),i=1-d,b=a.x,n=a.y,o=a.z,k=i*b,m=i*n;this.set(k*b+d,k*n-e*o,k*o+e*n,0,k*n+e*o,m*n+d,m*o-e*b,0,k*o-e*n,m*o+e*b,i*o*o+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; -THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,o=a.n22,b=a.n23,i=a.n24,k=a.n31,y=a.n32,z=a.n33,u=a.n34,x=a.n41,H=a.n42,J=a.n43,K=a.n44,p=new THREE.Matrix4;p.n11=b*u*H-i*z*H+i*y*J-o*u*J-b*y*K+o*z*K;p.n12=g*z*H-e*u*H-g*y*J+d*u*J+e*y*K-d*z*K;p.n13=e*i*H-g*b*H+g*o*J-d*i*J-e*o*K+d*b*K;p.n14=g*b*y-e*i*y-g*o*z+d*i*z+e*o*u-d*b*u;p.n21=i*z*x-b*u*x-i*k*J+h*u*J+b*k*K-h*z*K;p.n22=e*u*x-g*z*x+g*k*J-c*u*J-e*k*K+c*z*K;p.n23=g*b*x-e*i*x-g*h*J+c*i*J+e*h*K-c*b*K;p.n24=e*i*k-g*b*k+ -g*h*z-c*i*z-e*h*u+c*b*u;p.n31=o*u*x-i*y*x+i*k*H-h*u*H-o*k*K+h*y*K;p.n32=g*y*x-d*u*x-g*k*H+c*u*H+d*k*K-c*y*K;p.n33=e*i*x-g*o*x+g*h*H-c*i*H-d*h*K+c*o*K;p.n34=g*o*k-d*i*k-g*h*y+c*i*y+d*h*u-c*o*u;p.n41=b*y*x-o*z*x-b*k*H+h*z*H+o*k*J-h*y*J;p.n42=d*z*x-e*y*x+e*k*H-c*z*H-d*k*J+c*y*J;p.n43=e*o*x-d*b*x-e*h*H+c*b*H+d*h*J-c*o*J;p.n44=d*b*k-e*o*k+e*h*y-c*b*y-d*h*z+c*o*z;p.multiplyScalar(1/a.determinant());return p}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],g=-c[10]*c[1]+c[2]*c[9],h=c[6]*c[1]-c[2]*c[5],o=-c[10]*c[4]+c[6]*c[8],b=c[10]*c[0]-c[2]*c[8],i=-c[6]*c[0]+c[2]*c[4],k=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],z=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*o+c[2]*k;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*g;d[2]=c*h;d[3]=c*o;d[4]=c*b;d[5]=c*i;d[6]=c*k;d[7]=c*y;d[8]=c*z;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,e,g,h){var o,b,i;o=new THREE.Matrix4;b=2*g/(c-a);i=2*g/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(h+g)/(h-g);g=-2*h*g/(h-g);o.n11=b;o.n12=0;o.n13=a;o.n14=0;o.n21=0;o.n22=i;o.n23=d;o.n24=0;o.n31=0;o.n32=0;o.n33=e;o.n34=g;o.n41=0;o.n42=0;o.n43=-1;o.n44=0;return o};THREE.Matrix4.makePerspective=function(a,c,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,d,e)}; -THREE.Matrix4.makeOrtho=function(a,c,d,e,g,h){var o,b,i,k;o=new THREE.Matrix4;b=c-a;i=d-e;k=h-g;a=(c+a)/b;d=(d+e)/i;g=(h+g)/k;o.n11=2/b;o.n12=0;o.n13=0;o.n14=-a;o.n21=0;o.n22=2/i;o.n23=0;o.n24=-d;o.n31=0;o.n32=0;o.n33=-2/k;o.n34=-g;o.n41=0;o.n42=0;o.n43=0;o.n44=1;return o};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,i=a.n14,b=a.n21,n=a.n22,o=a.n23,k=a.n24,m=a.n31,y=a.n32,x=a.n33,s=a.n34,w=a.n41,H=a.n42,J=a.n43,K=a.n44,p=new THREE.Matrix4;p.n11=o*s*H-k*x*H+k*y*J-n*s*J-o*y*K+n*x*K;p.n12=i*x*H-e*s*H-i*y*J+d*s*J+e*y*K-d*x*K;p.n13=e*k*H-i*o*H+i*n*J-d*k*J-e*n*K+d*o*K;p.n14=i*o*y-e*k*y-i*n*x+d*k*x+e*n*s-d*o*s;p.n21=k*x*w-o*s*w-k*m*J+b*s*J+o*m*K-b*x*K;p.n22=e*s*w-i*x*w+i*m*J-c*s*J-e*m*K+c*x*K;p.n23=i*o*w-e*k*w-i*b*J+c*k*J+e*b*K-c*o*K;p.n24=e*k*m-i*o*m+ +i*b*x-c*k*x-e*b*s+c*o*s;p.n31=n*s*w-k*y*w+k*m*H-b*s*H-n*m*K+b*y*K;p.n32=i*y*w-d*s*w-i*m*H+c*s*H+d*m*K-c*y*K;p.n33=e*k*w-i*n*w+i*b*H-c*k*H-d*b*K+c*n*K;p.n34=i*n*m-d*k*m-i*b*y+c*k*y+d*b*s-c*n*s;p.n41=o*y*w-n*x*w-o*m*H+b*x*H+n*m*J-b*y*J;p.n42=d*x*w-e*y*w+e*m*H-c*x*H-d*m*J+c*y*J;p.n43=e*n*w-d*o*w-e*b*H+c*o*H+d*b*J-c*n*J;p.n44=d*o*m-e*n*m+e*b*y-c*o*y-d*b*x+c*n*x;p.multiplyScalar(1/a.determinant());return p}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],n=-c[10]*c[4]+c[6]*c[8],o=c[10]*c[0]-c[2]*c[8],k=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*n+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*i;d[2]=c*b;d[3]=c*n;d[4]=c*o;d[5]=c*k;d[6]=c*m;d[7]=c*y;d[8]=c*x;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,e,i,b){var n,o,k;n=new THREE.Matrix4;o=2*i/(c-a);k=2*i/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+i)/(b-i);i=-2*b*i/(b-i);n.n11=o;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=k;n.n23=d;n.n24=0;n.n31=0;n.n32=0;n.n33=e;n.n34=i;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,d,e){var i;a=d*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,c,d,e,i,b){var n,o,k,m;n=new THREE.Matrix4;o=c-a;k=d-e;m=b-i;a=(c+a)/o;d=(d+e)/k;i=(b+i)/m;n.n11=2/o;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/k;n.n23=0;n.n24=-d;n.n31=0;n.n32=0;n.n33=-2/m;n.n34=-i;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,d,e,g){this.a=a;this.b=c;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=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,c,d,e,g,h){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=h instanceof Array?h:[h]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.Face3=function(a,c,d,e,i){this.a=a;this.b=c;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=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,d,e,i,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=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], +c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(v,D,T,E,N,U,C){b=v.vertices[D].position;n=v.vertices[T].position;o=v.vertices[E].position;k=i[N];m=i[U];y=i[C];x=n.x-b.x;s=o.x-b.x;w=n.y-b.y;H=o.y-b.y; +J=n.z-b.z;K=o.z-b.z;p=m.u-k.u;h=y.u-k.u;g=m.v-k.v;f=y.v-k.v;j=1/(p*f-h*g);l.set((f*x-g*s)*j,(f*w-g*H)*j,(f*J-g*K)*j);A.set((p*s-h*x)*j,(p*H-h*w)*j,(p*K-h*J)*j);t[D].addSelf(l);t[T].addSelf(l);t[E].addSelf(l);u[D].addSelf(A);u[T].addSelf(A);u[E].addSelf(A)}var c,d,e,i,b,n,o,k,m,y,x,s,w,H,J,K,p,h,g,f,j,t=[],u=[],l=new THREE.Vector3,A=new THREE.Vector3,q=new THREE.Vector3,G=new THREE.Vector3,r=new THREE.Vector3;c=0;for(d=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=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,c=0,d=this.vertices.length;c65535){k[b].counter+=1;i=k[b].hash+"_"+k[b].counter;if(this.geometryChunks[i]==undefined)this.geometryChunks[i]={faces:[],materials:o,vertices:0}}this.geometryChunks[i].faces.push(e);this.geometryChunks[i].vertices+=h}},toString:function(){return"THREE.Geometry ( vertices: "+ +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){m[o].counter+=1;k=m[o].hash+"_"+m[o].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:n,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; -this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; +THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; @@ -89,104 +89,104 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}}; -THREE.Texture=function(a,c,d,e,g,h){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=h!==undefined?h:THREE.LinearMipMapLinearFilter}; +THREE.Texture=function(a,c,d,e,i,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var c,d,e,g={};for(c in a){g[c]={};for(d in a[c]){e=a[c][d];g[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var c,d,e,g={};for(c=0;c=0&&v>=0&&s>=0&&n>=0)return true;else if(t<0&&v<0||s<0&&n<0)return false;else{if(t<0)C=Math.max(C,t/(t-v));else if(v<0)m=Math.min(m,t/(t-v));if(s<0)C=Math.max(C,s/(s-n));else if(n<0)m=Math.min(m,s/(s-n));if(mt&&A.z0&&K.z<1){u=H[x]=H[x]||new THREE.RenderableParticle;u.x=K.x/K.w;u.y=K.y/K.w;u.z=K.z;u.rotation=G.rotation.z;u.scale.x=G.scale.x*Math.abs(u.x-(K.x+r.projectionMatrix.n11)/(K.w+r.projectionMatrix.n14)); -u.scale.y=G.scale.y*Math.abs(u.y-(K.y+r.projectionMatrix.n22)/(K.w+r.projectionMatrix.n24));u.materials=G.materials;m.push(u);x++}}}}C&&m.sort(a);return m};this.unprojectVector=function(l,r){var C=THREE.Matrix4.makeInvert(r.matrix);C.multiplySelf(THREE.Matrix4.makeInvert(r.projectionMatrix));C.multiplyVector3(l);return l}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,g,h;this.domElement=document.createElement("div");this.setSize=function(o,b){d=o;e=b;g=d/2;h=e/2};this.render=function(o,b){var i,k,y,z,u,x,H,J;a=c.projectScene(o,b);i=0;for(k=a.length;i0){D.r+=ca.r*$;D.g+=ca.g*$;D.b+=ca.b*$}}else if($ instanceof THREE.PointLight){Y.sub($.position,X);Y.normalize();$=T.dot(Y)*ga;if($>0){D.r+=ca.r*$;D.g+=ca.g*$;D.b+=ca.b*$}}}}function Na(B,X,T){if(T.opacity!=0){a(T.opacity);c(T.blending);var D, -R,$,ca,ga,ia;if(T instanceof THREE.ParticleBasicMaterial){if(T.map){ca=T.map;ga=ca.width>>1;ia=ca.height>>1;R=X.scale.x*b;$=X.scale.y*i;T=R*ga;D=$*ia;w.set(B.x-T,B.y-D,B.x+T,B.y+D);if(V.instersects(w)){k.save();k.translate(B.x,B.y);k.rotate(-X.rotation);k.scale(R,-$);k.translate(-ga,-ia);k.drawImage(ca,0,0);k.restore()}}}else if(T instanceof THREE.ParticleCircleMaterial){if(M){Q.r=da.r+ba.r+Z.r;Q.g=da.g+ba.g+Z.g;Q.b=da.b+ba.b+Z.b;m.r=T.color.r*Q.r;m.g=T.color.g*Q.g;m.b=T.color.b*Q.b;m.updateStyleString()}else m.__styleString= -T.color.__styleString;T=X.scale.x*b;D=X.scale.y*i;w.set(B.x-T,B.y-D,B.x+T,B.y+D);if(V.instersects(w)){R=m.__styleString;if(J!=R)k.fillStyle=J=R;k.save();k.translate(B.x,B.y);k.rotate(-X.rotation);k.scale(T,D);k.beginPath();k.arc(0,0,1,0,ja,true);k.closePath();k.fill();k.restore()}}}}function Oa(B,X,T,D){if(D.opacity!=0){a(D.opacity);c(D.blending);k.beginPath();k.moveTo(B.positionScreen.x,B.positionScreen.y);k.lineTo(X.positionScreen.x,X.positionScreen.y);k.closePath();if(D instanceof THREE.LineBasicMaterial){m.__styleString= -D.color.__styleString;B=D.linewidth;if(K!=B)k.lineWidth=K=B;B=m.__styleString;if(H!=B)k.strokeStyle=H=B;k.stroke();w.inflate(D.linewidth*2)}}}function Ia(B,X,T,D,R,$){if(R.opacity!=0){a(R.opacity);c(R.blending);f=B.positionScreen.x;j=B.positionScreen.y;q=X.positionScreen.x;l=X.positionScreen.y;r=T.positionScreen.x;C=T.positionScreen.y;k.beginPath();k.moveTo(f,j);k.lineTo(q,l);k.lineTo(r,C);k.lineTo(f,j);k.closePath();if(R instanceof THREE.MeshBasicMaterial)if(R.map)R.map.image.loaded&&R.map.mapping instanceof -THREE.UVMapping&&xa(f,j,q,l,r,C,R.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);else if(R.env_map){if(R.env_map.image.loaded)if(R.env_map.mapping instanceof THREE.SphericalReflectionMapping){B=ra.matrix;Y.copy(D.vertexNormalsWorld[0]);N=(Y.x*B.n11+Y.y*B.n12+Y.z*B.n13)*0.5+0.5;G=-(Y.x*B.n21+Y.y*B.n22+Y.z*B.n23)*0.5+0.5;Y.copy(D.vertexNormalsWorld[1]);W=(Y.x*B.n11+Y.y*B.n12+Y.z*B.n13)*0.5+0.5;P=-(Y.x*B.n21+Y.y*B.n22+Y.z*B.n23)*0.5+0.5;Y.copy(D.vertexNormalsWorld[2]);I= -(Y.x*B.n11+Y.y*B.n12+Y.z*B.n13)*0.5+0.5;L=-(Y.x*B.n21+Y.y*B.n22+Y.z*B.n23)*0.5+0.5;xa(f,j,q,l,r,C,R.env_map.image,N,G,W,P,I,L)}}else R.wireframe?Ba(R.color.__styleString,R.wireframe_linewidth):Ca(R.color.__styleString);else if(R instanceof THREE.MeshLambertMaterial){if(R.map&&!R.wireframe){R.map.mapping instanceof THREE.UVMapping&&xa(f,j,q,l,r,C,R.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);c(THREE.SubtractiveBlending)}if(M)if(!R.wireframe&&R.shading==THREE.SmoothShading&& -D.vertexNormalsWorld.length==3){t.r=v.r=s.r=da.r;t.g=v.g=s.g=da.g;t.b=v.b=s.b=da.b;Aa($,D.v1.positionWorld,D.vertexNormalsWorld[0],t);Aa($,D.v2.positionWorld,D.vertexNormalsWorld[1],v);Aa($,D.v3.positionWorld,D.vertexNormalsWorld[2],s);n.r=(v.r+s.r)*0.5;n.g=(v.g+s.g)*0.5;n.b=(v.b+s.b)*0.5;O=Ja(t,v,s,n);xa(f,j,q,l,r,C,O,0,0,1,0,0,1)}else{Q.r=da.r;Q.g=da.g;Q.b=da.b;Aa($,D.centroidWorld,D.normalWorld,Q);m.r=R.color.r*Q.r;m.g=R.color.g*Q.g;m.b=R.color.b*Q.b;m.updateStyleString();R.wireframe?Ba(m.__styleString, -R.wireframe_linewidth):Ca(m.__styleString)}else R.wireframe?Ba(R.color.__styleString,R.wireframe_linewidth):Ca(R.color.__styleString)}else if(R instanceof THREE.MeshDepthMaterial){E=ra.near;A=ra.far;t.r=t.g=t.b=1-Ea(B.positionScreen.z,E,A);v.r=v.g=v.b=1-Ea(X.positionScreen.z,E,A);s.r=s.g=s.b=1-Ea(T.positionScreen.z,E,A);n.r=(v.r+s.r)*0.5;n.g=(v.g+s.g)*0.5;n.b=(v.b+s.b)*0.5;O=Ja(t,v,s,n);xa(f,j,q,l,r,C,O,0,0,1,0,0,1)}else if(R instanceof THREE.MeshNormalMaterial){m.r=Fa(D.normalWorld.x);m.g=Fa(D.normalWorld.y); -m.b=Fa(D.normalWorld.z);m.updateStyleString();R.wireframe?Ba(m.__styleString,R.wireframe_linewidth):Ca(m.__styleString)}}}function Ba(B,X){if(H!=B)k.strokeStyle=H=B;if(K!=X)k.lineWidth=K=X;k.stroke();w.inflate(X*2)}function Ca(B){if(J!=B)k.fillStyle=J=B;k.fill()}function xa(B,X,T,D,R,$,ca,ga,ia,na,la,oa,ya){var ta,pa;ta=ca.width-1;pa=ca.height-1;ga*=ta;ia*=pa;na*=ta;la*=pa;oa*=ta;ya*=pa;T-=B;D-=X;R-=B;$-=X;na-=ga;la-=ia;oa-=ga;ya-=ia;pa=1/(na*ya-oa*la);ta=(ya*T-la*R)*pa;la=(ya*D-la*$)*pa;T=(na*R- -oa*T)*pa;D=(na*$-oa*D)*pa;B=B-ta*ga-T*ia;X=X-la*ga-D*ia;k.save();k.transform(ta,la,T,D,B,X);k.clip();k.drawImage(ca,0,0);k.restore()}function Ja(B,X,T,D){var R=~~(B.r*255),$=~~(B.g*255);B=~~(B.b*255);var ca=~~(X.r*255),ga=~~(X.g*255);X=~~(X.b*255);var ia=~~(T.r*255),na=~~(T.g*255);T=~~(T.b*255);var la=~~(D.r*255),oa=~~(D.g*255);D=~~(D.b*255);ha[0]=R<0?0:R>255?255:R;ha[1]=$<0?0:$>255?255:$;ha[2]=B<0?0:B>255?255:B;ha[4]=ca<0?0:ca>255?255:ca;ha[5]=ga<0?0:ga>255?255:ga;ha[6]=X<0?0:X>255?255:X;ha[8]=ia< -0?0:ia>255?255:ia;ha[9]=na<0?0:na>255?255:na;ha[10]=T<0?0:T>255?255:T;ha[12]=la<0?0:la>255?255:la;ha[13]=oa<0?0:oa>255?255:oa;ha[14]=D<0?0:D>255?255:D;ka.putImageData(fa,0,0);ua.drawImage(qa,0,0);return sa}function Ea(B,X,T){B=(B-X)/(T-X);return B*B*(3-2*B)}function Fa(B){B=(B+1)*0.5;return B<0?0:B>1?1:B}function Ga(B,X){var T=X.x-B.x,D=X.y-B.y,R=1/Math.sqrt(T*T+D*D);T*=R;D*=R;X.x+=T;X.y+=D;B.x-=T;B.y-=D}var Da,Ka,aa,ma,wa,Ha,La,za;k.setTransform(1,0,0,-1,b,i);this.autoClear&&this.clear();d=e.projectScene(ea, -ra,this.sortElements);(M=ea.lights.length>0)&&Ma(ea);Da=0;for(Ka=d.length;Da0){W.r+=L.color.r*V;W.g+=L.color.g*V;W.b+=L.color.b*V}}else if(L instanceof THREE.PointLight){C.sub(L.position,G.centroidWorld);C.normalize();V=G.normalWorld.dot(C)*L.intensity;if(V>0){W.r+=L.color.r*V;W.g+=L.color.g*V;W.b+=L.color.b*V}}}}function c(N,G,W,P,I,L){s=e(n++);s.setAttribute("d","M "+N.positionScreen.x+ -" "+N.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)F.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(U){f.r=j.r;f.g=j.g;f.b=j.b;a(L,P,f);F.r=I.color.r*f.r;F.g=I.color.g*f.g;F.b=I.color.b*f.b;F.updateStyleString()}else F.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){r=1-I.__2near/(I.__farPlusNear-P.z*I.__farMinusNear); -F.setRGB(r,r,r)}else I instanceof THREE.MeshNormalMaterial&&F.setRGB(g(P.normalWorld.x),g(P.normalWorld.y),g(P.normalWorld.z));I.wireframe?s.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):s.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+I.opacity);b.appendChild(s)}function d(N,G,W,P,I,L,V){s=e(n++);s.setAttribute("d", -"M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(L instanceof THREE.MeshBasicMaterial)F.__styleString=L.color.__styleString;else if(L instanceof THREE.MeshLambertMaterial)if(U){f.r=j.r;f.g=j.g;f.b=j.b;a(V,I,f);F.r=L.color.r*f.r;F.g=L.color.g*f.g;F.b=L.color.b*f.b;F.updateStyleString()}else F.__styleString=L.color.__styleString;else if(L instanceof THREE.MeshDepthMaterial){r= -1-L.__2near/(L.__farPlusNear-I.z*L.__farMinusNear);F.setRGB(r,r,r)}else L instanceof THREE.MeshNormalMaterial&&F.setRGB(g(I.normalWorld.x),g(I.normalWorld.y),g(I.normalWorld.z));L.wireframe?s.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+L.wireframe_linewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.wireframe_linecap+"; stroke-linejoin: "+L.wireframe_linejoin):s.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+L.opacity);b.appendChild(s)} -function e(N){if(m[N]==null){m[N]=document.createElementNS("http://www.w3.org/2000/svg","path");O==0&&m[N].setAttribute("shape-rendering","crispEdges");return m[N]}return m[N]}function g(N){return N<0?Math.min((1+N)*0.5,0.5):0.5+Math.min(N*0.5,0.5)}var h=null,o=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,k,y,z,u,x,H,J,K=new THREE.Rectangle,p=new THREE.Rectangle,U=false,F=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),q=new THREE.Color(0), -l=new THREE.Color(0),r,C=new THREE.Vector3,m=[],t=[],v=[],s,n,E,A,O=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(N){switch(N){case "high":O=1;break;case "low":O=0}};this.setSize=function(N,G){i=N;k=G;y=i/2;z=k/2;b.setAttribute("viewBox",-y+" "+-z+" "+i+" "+k);b.setAttribute("width",i);b.setAttribute("height",k);K.set(-y,-z,y,z)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(N,G){var W,P, -I,L,V,S,w,M;this.autoClear&&this.clear();h=o.projectScene(N,G,this.sortElements);A=E=n=0;if(U=N.lights.length>0){w=N.lights;j.setRGB(0,0,0);q.setRGB(0,0,0);l.setRGB(0,0,0);W=0;for(P=w.length;W0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,da,q)}if(r){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, -f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ja,q);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Y,q)}};this.setLineBuffers=function(f,j,q,l){var r,C,m=f.vertices,t=m.length,v=f.__vertexArray,s=f.__lineArray;if(q)for(q=0;q0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights, -s.map?"#define USE_MAP":"",s.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");b.attachShader(E,g("fragment",A+t));b.attachShader(E,g("vertex",s+n));b.linkProgram(E);b.getProgramParameter(E,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+ -b.getProgramParameter(E,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");E.uniforms={};E.attributes={};l.program=E;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(m in l.uniforms)t.push(m);m=l.program;n=0;for(E=t.length;n=0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLNormalBuffer);b.vertexAttribPointer(v.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.normal)}if(v.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLTangentBuffer); -b.vertexAttribPointer(v.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.tangent)}if(v.uv>=0)if(r.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLUVBuffer);b.vertexAttribPointer(v.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.uv)}else b.disableVertexAttribArray(v.uv);if(l.wireframe||l instanceof THREE.LineBasicMaterial){v=l.wireframe_linewidth!==undefined?l.wireframe_linewidth:l.linewidth!==undefined?l.linewidth:1;l=l instanceof THREE.LineBasicMaterial&&C.type==THREE.LineStrip? -b.LINE_STRIP:b.LINES;b.lineWidth(v);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webGLLineBuffer);b.drawElements(l,r.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,r.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,j,q,l,r,C,m){var t,v,s,n,E;s=0;for(n=l.materials.length;s=0;q--){l=f.__webGLObjects[q].object;j==l&&f.__webGLObjects.splice(q,1)}};this.setupMatrices=function(f,j){f.autoUpdateMatrix&& -f.updateMatrix();y.multiply(j.matrix,f.matrix);x.set(y.flatten());z=THREE.Matrix4.makeInvert3x3(y).transpose();J.set(z.m);K.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,u);b.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,H);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,J);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,K)};this.loadCamera=function(f,j){b.uniform3f(f.uniforms.cameraPosition, -j.position.x,j.position.y,j.position.z)};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,j){if(f){!j||j=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK); -b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; -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, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", -envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\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\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", +THREE.Projector=function(){function a(u,l){return l.z-u.z}function c(u,l){var A=0,q=1,G=u.z+u.w,r=l.z+l.w,v=-u.z+u.w,D=-l.z+l.w;if(G>=0&&r>=0&&v>=0&&D>=0)return true;else if(G<0&&r<0||v<0&&D<0)return false;else{if(G<0)A=Math.max(A,G/(G-r));else if(r<0)q=Math.min(q,G/(G-r));if(v<0)A=Math.max(A,v/(v-D));else if(D<0)q=Math.min(q,v/(v-D));if(qG&&E.z0&&K.z<1){s=H[w]=H[w]||new THREE.RenderableParticle;s.x=K.x/K.w;s.y=K.y/K.w;s.z=K.z;s.rotation=C.rotation.z;s.scale.x=C.scale.x*Math.abs(s.x-(K.x+l.projectionMatrix.n11)/(K.w+l.projectionMatrix.n14)); +s.scale.y=C.scale.y*Math.abs(s.y-(K.y+l.projectionMatrix.n22)/(K.w+l.projectionMatrix.n24));s.materials=C.materials;q.push(s);w++}}}}A&&q.sort(a);return q};this.unprojectVector=function(u,l){var A=THREE.Matrix4.makeInvert(l.matrix);A.multiplySelf(THREE.Matrix4.makeInvert(l.projectionMatrix));A.multiplyVector3(u);return u}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,i,b;this.domElement=document.createElement("div");this.setSize=function(n,o){d=n;e=o;i=d/2;b=e/2};this.render=function(n,o){var k,m,y,x,s,w,H,J;a=c.projectScene(n,o);k=0;for(m=a.length;k0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}else if(Z instanceof THREE.PointLight){$.sub(Z.position,W);$.normalize();Z=R.dot($)*ga;if(Z>0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}}}function Na(B,W,R){if(R.opacity!=0){a(R.opacity);c(R.blending);var F, +O,Z,da,ga,ha;if(R instanceof THREE.ParticleBasicMaterial){if(R.map){da=R.map;ga=da.width>>1;ha=da.height>>1;O=W.scale.x*o;Z=W.scale.y*k;R=O*ga;F=Z*ha;z.set(B.x-R,B.y-F,B.x+R,B.y+F);if(L.instersects(z)){m.save();m.translate(B.x,B.y);m.rotate(-W.rotation);m.scale(O,-Z);m.translate(-ga,-ha);m.drawImage(da,0,0);m.restore()}}}else if(R instanceof THREE.ParticleCircleMaterial){if(Q){V.r=X.r+fa.r+aa.r;V.g=X.g+fa.g+aa.g;V.b=X.b+fa.b+aa.b;q.r=R.color.r*V.r;q.g=R.color.g*V.g;q.b=R.color.b*V.b;q.updateStyleString()}else q.__styleString= +R.color.__styleString;R=W.scale.x*o;F=W.scale.y*k;z.set(B.x-R,B.y-F,B.x+R,B.y+F);if(L.instersects(z)){O=q.__styleString;if(J!=O)m.fillStyle=J=O;m.save();m.translate(B.x,B.y);m.rotate(-W.rotation);m.scale(R,F);m.beginPath();m.arc(0,0,1,0,ya,true);m.closePath();m.fill();m.restore()}}}}function Oa(B,W,R,F){if(F.opacity!=0){a(F.opacity);c(F.blending);m.beginPath();m.moveTo(B.positionScreen.x,B.positionScreen.y);m.lineTo(W.positionScreen.x,W.positionScreen.y);m.closePath();if(F instanceof THREE.LineBasicMaterial){q.__styleString= +F.color.__styleString;B=F.linewidth;if(K!=B)m.lineWidth=K=B;B=q.__styleString;if(H!=B)m.strokeStyle=H=B;m.stroke();z.inflate(F.linewidth*2)}}}function Ia(B,W,R,F,O,Z){if(O.opacity!=0){a(O.opacity);c(O.blending);f=B.positionScreen.x;j=B.positionScreen.y;t=W.positionScreen.x;u=W.positionScreen.y;l=R.positionScreen.x;A=R.positionScreen.y;m.beginPath();m.moveTo(f,j);m.lineTo(t,u);m.lineTo(l,A);m.lineTo(f,j);m.closePath();if(O instanceof THREE.MeshBasicMaterial)if(O.map)O.map.image.loaded&&O.map.mapping instanceof +THREE.UVMapping&&va(f,j,t,u,l,A,O.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);else if(O.env_map){if(O.env_map.image.loaded)if(O.env_map.mapping instanceof THREE.SphericalReflectionMapping){B=pa.matrix;$.copy(F.vertexNormalsWorld[0]);U=($.x*B.n11+$.y*B.n12+$.z*B.n13)*0.5+0.5;C=-($.x*B.n21+$.y*B.n22+$.z*B.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[1]);S=($.x*B.n11+$.y*B.n12+$.z*B.n13)*0.5+0.5;Y=-($.x*B.n21+$.y*B.n22+$.z*B.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[2]);M= +($.x*B.n11+$.y*B.n12+$.z*B.n13)*0.5+0.5;I=-($.x*B.n21+$.y*B.n22+$.z*B.n23)*0.5+0.5;va(f,j,t,u,l,A,O.env_map.image,U,C,S,Y,M,I)}}else O.wireframe?Ba(O.color.__styleString,O.wireframe_linewidth):Ca(O.color.__styleString);else if(O instanceof THREE.MeshLambertMaterial){if(O.map&&!O.wireframe){O.map.mapping instanceof THREE.UVMapping&&va(f,j,t,u,l,A,O.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);c(THREE.SubtractiveBlending)}if(Q)if(!O.wireframe&&O.shading==THREE.SmoothShading&& +F.vertexNormalsWorld.length==3){G.r=r.r=v.r=X.r;G.g=r.g=v.g=X.g;G.b=r.b=v.b=X.b;Aa(Z,F.v1.positionWorld,F.vertexNormalsWorld[0],G);Aa(Z,F.v2.positionWorld,F.vertexNormalsWorld[1],r);Aa(Z,F.v3.positionWorld,F.vertexNormalsWorld[2],v);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,t,u,l,A,N,0,0,1,0,0,1)}else{V.r=X.r;V.g=X.g;V.b=X.b;Aa(Z,F.centroidWorld,F.normalWorld,V);q.r=O.color.r*V.r;q.g=O.color.g*V.g;q.b=O.color.b*V.b;q.updateStyleString();O.wireframe?Ba(q.__styleString, +O.wireframe_linewidth):Ca(q.__styleString)}else O.wireframe?Ba(O.color.__styleString,O.wireframe_linewidth):Ca(O.color.__styleString)}else if(O instanceof THREE.MeshDepthMaterial){T=pa.near;E=pa.far;G.r=G.g=G.b=1-Ea(B.positionScreen.z,T,E);r.r=r.g=r.b=1-Ea(W.positionScreen.z,T,E);v.r=v.g=v.b=1-Ea(R.positionScreen.z,T,E);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,t,u,l,A,N,0,0,1,0,0,1)}else if(O instanceof THREE.MeshNormalMaterial){q.r=Fa(F.normalWorld.x);q.g=Fa(F.normalWorld.y); +q.b=Fa(F.normalWorld.z);q.updateStyleString();O.wireframe?Ba(q.__styleString,O.wireframe_linewidth):Ca(q.__styleString)}}}function Ba(B,W){if(H!=B)m.strokeStyle=H=B;if(K!=W)m.lineWidth=K=W;m.stroke();z.inflate(W*2)}function Ca(B){if(J!=B)m.fillStyle=J=B;m.fill()}function va(B,W,R,F,O,Z,da,ga,ha,la,ja,ma,wa){var qa,na;qa=da.width-1;na=da.height-1;ga*=qa;ha*=na;la*=qa;ja*=na;ma*=qa;wa*=na;R-=B;F-=W;O-=B;Z-=W;la-=ga;ja-=ha;ma-=ga;wa-=ha;na=1/(la*wa-ma*ja);qa=(wa*R-ja*O)*na;ja=(wa*F-ja*Z)*na;R=(la*O- +ma*R)*na;F=(la*Z-ma*F)*na;B=B-qa*ga-R*ha;W=W-ja*ga-F*ha;m.save();m.transform(qa,ja,R,F,B,W);m.clip();m.drawImage(da,0,0);m.restore()}function Ja(B,W,R,F){var O=~~(B.r*255),Z=~~(B.g*255);B=~~(B.b*255);var da=~~(W.r*255),ga=~~(W.g*255);W=~~(W.b*255);var ha=~~(R.r*255),la=~~(R.g*255);R=~~(R.b*255);var ja=~~(F.r*255),ma=~~(F.g*255);F=~~(F.b*255);ia[0]=O<0?0:O>255?255:O;ia[1]=Z<0?0:Z>255?255:Z;ia[2]=B<0?0:B>255?255:B;ia[4]=da<0?0:da>255?255:da;ia[5]=ga<0?0:ga>255?255:ga;ia[6]=W<0?0:W>255?255:W;ia[8]=ha< +0?0:ha>255?255:ha;ia[9]=la<0?0:la>255?255:la;ia[10]=R<0?0:R>255?255:R;ia[12]=ja<0?0:ja>255?255:ja;ia[13]=ma<0?0:ma>255?255:ma;ia[14]=F<0?0:F>255?255:F;oa.putImageData(ta,0,0);za.drawImage(ca,0,0);return ua}function Ea(B,W,R){B=(B-W)/(R-W);return B*B*(3-2*B)}function Fa(B){B=(B+1)*0.5;return B<0?0:B>1?1:B}function Ga(B,W){var R=W.x-B.x,F=W.y-B.y,O=1/Math.sqrt(R*R+F*F);R*=O;F*=O;W.x+=R;W.y+=F;B.x-=R;B.y-=F}var Da,Ka,ba,ka,sa,Ha,La,xa;m.setTransform(1,0,0,-1,o,k);this.autoClear&&this.clear();d=e.projectScene(ea, +pa,this.sortElements);(Q=ea.lights.length>0)&&Ma(ea);Da=0;for(Ka=d.length;Da0){S.r+=I.color.r*L;S.g+=I.color.g*L;S.b+=I.color.b*L}}else if(I instanceof THREE.PointLight){A.sub(I.position,C.centroidWorld);A.normalize();L=C.normalWorld.dot(A)*I.intensity;if(L>0){S.r+=I.color.r*L;S.g+=I.color.g*L;S.b+=I.color.b*L}}}}function c(U,C,S,Y,M,I){v=e(D++);v.setAttribute("d","M "+U.positionScreen.x+ +" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(I,Y,f);g.r=M.color.r*f.r;g.g=M.color.g*f.g;g.b=M.color.b*f.b;g.updateStyleString()}else g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){l=1-M.__2near/(M.__farPlusNear-Y.z*M.__farMinusNear); +g.setRGB(l,l,l)}else M instanceof THREE.MeshNormalMaterial&&g.setRGB(i(Y.normalWorld.x),i(Y.normalWorld.y),i(Y.normalWorld.z));M.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+M.opacity);o.appendChild(v)}function d(U,C,S,Y,M,I,L){v=e(D++);v.setAttribute("d", +"M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(L,M,f);g.r=I.color.r*f.r;g.g=I.color.g*f.g;g.b=I.color.b*f.b;g.updateStyleString()}else g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){l= +1-I.__2near/(I.__farPlusNear-M.z*I.__farMinusNear);g.setRGB(l,l,l)}else I instanceof THREE.MeshNormalMaterial&&g.setRGB(i(M.normalWorld.x),i(M.normalWorld.y),i(M.normalWorld.z));I.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+I.opacity);o.appendChild(v)} +function e(U){if(q[U]==null){q[U]=document.createElementNS("http://www.w3.org/2000/svg","path");N==0&&q[U].setAttribute("shape-rendering","crispEdges");return q[U]}return q[U]}function i(U){return U<0?Math.min((1+U)*0.5,0.5):0.5+Math.min(U*0.5,0.5)}var b=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,y,x,s,w,H,J,K=new THREE.Rectangle,p=new THREE.Rectangle,h=false,g=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),t=new THREE.Color(0), +u=new THREE.Color(0),l,A=new THREE.Vector3,q=[],G=[],r=[],v,D,T,E,N=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(U){switch(U){case "high":N=1;break;case "low":N=0}};this.setSize=function(U,C){k=U;m=C;y=k/2;x=m/2;o.setAttribute("viewBox",-y+" "+-x+" "+k+" "+m);o.setAttribute("width",k);o.setAttribute("height",m);K.set(-y,-x,y,x)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(U,C){var S,Y, +M,I,L,P,z,Q;this.autoClear&&this.clear();b=n.projectScene(U,C,this.sortElements);E=T=D=0;if(h=U.lights.length>0){z=U.lights;j.setRGB(0,0,0);t.setRGB(0,0,0);u.setRGB(0,0,0);S=0;for(Y=z.length;S0){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Q,f)}if(t){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, +h.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,f);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,f)}};this.setLineBuffers=function(h,g,f,j){var t,u,l=h.vertices,A=l.length,q=h.__vertexArray,G=h.__lineArray;if(f)for(f=0;f0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n"); +b.attachShader(f,d("fragment",t+q));b.attachShader(f,d("vertex",u+g));b.linkProgram(f);b.getProgramParameter(f,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(f,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");f.uniforms={};f.attributes={};h.program=f;f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(j in h.uniforms)f.push(j);j=h.program;q=0;for(g=f.length;q=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLNormalBuffer);b.vertexAttribPointer(l.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.normal)}if(l.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLTangentBuffer);b.vertexAttribPointer(l.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.tangent)}if(l.uv>=0)if(t.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLUVBuffer); +b.vertexAttribPointer(l.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.uv)}else b.disableVertexAttribArray(l.uv);if(j.wireframe||j instanceof THREE.LineBasicMaterial){l=j.wireframe_linewidth!==undefined?j.wireframe_linewidth:j.linewidth!==undefined?j.linewidth:1;j=j instanceof THREE.LineBasicMaterial&&u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(l);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);b.drawElements(j,t.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, +t.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,t.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(h,g,f,j,t,u,l){var A,q,G,r,v;G=0;for(r=j.materials.length;G=0;f--){j=h.__webGLObjects[f].object;g==j&&h.__webGLObjects.splice(f,1)}};this.setupMatrices=function(h,g){h.autoUpdateMatrix&&h.updateMatrix();k.multiply(g.matrix,h.matrix);x.set(k.flatten());m=THREE.Matrix4.makeInvert3x3(k).transpose();w.set(m.m);H.set(h.matrix.flatten())};this.loadMatrices=function(h){b.uniformMatrix4fv(h.uniforms.viewMatrix, +false,y);b.uniformMatrix4fv(h.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(h.uniforms.projectionMatrix,false,s);b.uniformMatrix3fv(h.uniforms.normalMatrix,false,w);b.uniformMatrix4fv(h.uniforms.objectMatrix,false,H)};this.loadCamera=function(h,g){b.uniform3f(h.uniforms.cameraPosition,g.position.x,g.position.y,g.position.z)};this.setBlending=function(h){switch(h){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR, +b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(h,g){if(h){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(h=="back")b.cullFace(b.BACK);else h=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +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, 1.0 ), fogFactor );\n#endif", +envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\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\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 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, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"}; THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv", diff --git a/build/ThreeDebug.js b/build/ThreeDebug.js index 114a9107..89898068 100644 --- a/build/ThreeDebug.js +++ b/build/ThreeDebug.js @@ -12,50 +12,50 @@ THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1} THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,g=[];a=0;for(c=e.length;a0&&K>0&&k+K<1}var d,e,g,h,o,b,j,i,y,z, -u,x=a.geometry,H=x.vertices,J=[];d=0;for(e=x.faces.length;dj?e:j;g=g>i? -g:i}a()};this.add3Points=function(j,i,y,z,u,x){if(b){b=false;c=jy?j>u?j:u:y>u?y:u;g=i>z?i>x?i:x:z>x?z:x}else{c=jy?j>u?j>e?j:e:u>e?u:e:y>u?y>e?y:e:u>e?u:e;g=i>z?i>x?i>g?i:g:x>g?x:g:z>x?z>g?z:g:x>g?x:g}a()};this.addRectangle=function(j){if(b){b=false;c=j.getLeft();d=j.getTop();e=j.getRight();g=j.getBottom()}else{c=cj.getRight()?e:j.getRight();g=g>j.getBottom()?g:j.getBottom()}a()};this.inflate=function(j){c-=j;d-=j;e+=j;g+=j;a()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();d=d>j.getTop()?d:j.getTop();e=e=0&&Math.min(g,j.getBottom())-Math.max(d,j.getTop())>=0};this.empty=function(){b=true;g=e=d=c=0;a()};this.isEmpty=function(){return b};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+g+", width: "+h+", height: "+o+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; -THREE.Matrix4=function(a,c,d,e,g,h,o,b,j,i,y,z,u,x,H,J){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=h||1;this.n23=o||0;this.n24=b||0;this.n31=j||0;this.n32=i||0;this.n33=y||1;this.n34=z||0;this.n41=u||0;this.n42=x||0;this.n43=H||0;this.n44=J||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,g,h,o,b,j,i,y,z,u,x,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=g;this.n22=h;this.n23=o;this.n24=b;this.n31=j;this.n32=i;this.n33=y;this.n34=z;this.n41=u;this.n42=x;this.n43=H;this.n44=J;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,h=THREE.Matrix4.__tmpVec3;h.sub(a,c).normalize();e.cross(d,h).normalize();g.cross(h,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); -this.n31=h.x;this.n32=h.y;this.n33=h.z;this.n34=-h.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,g=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*c+this.n22*d+this.n23* -e+this.n24*g;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,g=a.n13,h=a.n14,o=a.n21,b=a.n22,j=a.n23,i=a.n24,y=a.n31, -z=a.n32,u=a.n33,x=a.n34,H=a.n41,J=a.n42,K=a.n43,p=a.n44,V=c.n11,F=c.n12,f=c.n13,k=c.n14,q=c.n21,l=c.n22,r=c.n23,C=c.n24,m=c.n31,t=c.n32,v=c.n33,s=c.n34,n=c.n41,E=c.n42,B=c.n43,O=c.n44;this.n11=d*V+e*q+g*m+h*n;this.n12=d*F+e*l+g*t+h*E;this.n13=d*f+e*r+g*v+h*B;this.n14=d*k+e*C+g*s+h*O;this.n21=o*V+b*q+j*m+i*n;this.n22=o*F+b*l+j*t+i*E;this.n23=o*f+b*r+j*v+i*B;this.n24=o*k+b*C+j*s+i*O;this.n31=y*V+z*q+u*m+x*n;this.n32=y*F+z*l+u*t+x*E;this.n33=y*f+z*r+u*v+x*B;this.n34=y*k+z*C+u*s+x*O;this.n41=H*V+J*q+ -K*m+p*n;this.n42=H*F+J*l+K*t+p*E;this.n43=H*f+J*r+K*v+p*B;this.n44=H*k+J*C+K*s+p*O;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,g=this.n14,h=this.n21,o=this.n22,b=this.n23,j=this.n24,i=this.n31,y=this.n32,z=this.n33,u=this.n34,x=this.n41,H=this.n42,J=this.n43,K=this.n44,p=a.n11,V=a.n21,F=a.n31,f=a.n41,k=a.n12,q=a.n22,l=a.n32,r=a.n42,C=a.n13,m=a.n23,t=a.n33,v=a.n43,s=a.n14,n=a.n24,E=a.n34;a=a.n44;this.n11=c*p+d*V+e*F+g*f;this.n12=c*k+d*q+e*l+g*r;this.n13=c*C+d*m+e*t+g* -v;this.n14=c*s+d*n+e*E+g*a;this.n21=h*p+o*V+b*F+j*f;this.n22=h*k+o*q+b*l+j*r;this.n23=h*C+o*m+b*t+j*v;this.n24=h*s+o*n+b*E+j*a;this.n31=i*p+y*V+z*F+u*f;this.n32=i*k+y*q+z*l+u*r;this.n33=i*C+y*m+z*t+u*v;this.n34=i*s+y*n+z*E+u*a;this.n41=x*p+H*V+J*F+K*f;this.n42=x*k+H*q+J*l+K*r;this.n43=x*C+H*m+J*t+K*v;this.n44=x*s+H*n+J*E+K*a;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,c=this.n12,d=this.n13,e=this.n14,g=this.n21,h=this.n22,o=this.n23,b=this.n24,j=this.n31,i=this.n32,y=this.n33,z=this.n34,u=this.n41,x=this.n42,H=this.n43,J=this.n44;return e*o*i*u-d*b*i*u-e*h*y*u+c*b*y*u+d*h*z*u-c*o*z*u-e*o*j*x+d*b*j*x+e*g*y*x-a*b*y*x-d*g*z*x+a*o*z*x+e*h*j*H-c*b*j*H-e*g*i*H+a*b*i*H+c*g*z*H-a*h*z*H-d*h*j*J+c*o*j*J+d*g*i*J-a*o*i*J-c*g*y*J+a*h*y*J},transpose:function(){function a(c,d, -e){var g=c[d];c[d]=c[e];c[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11; +THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,i=[];a=0;for(c=e.length;a0&&L>0&&j+L<1}var d,e,i,b,n,o,l,k,y,x, +s,w=a.geometry,H=w.vertices,K=[];d=0;for(e=w.faces.length;dl?e:l;i=i>k? +i:k}a()};this.add3Points=function(l,k,y,x,s,w){if(o){o=false;c=ly?l>s?l:s:y>s?y:s;i=k>x?k>w?k:w:x>w?x:w}else{c=ly?l>s?l>e?l:e:s>e?s:e:y>s?y>e?y:e:s>e?s:e;i=k>x?k>w?k>i?k:i:w>i?w:i:x>w?x>i?x:i:w>i?w:i}a()};this.addRectangle=function(l){if(o){o=false;c=l.getLeft();d=l.getTop();e=l.getRight();i=l.getBottom()}else{c=cl.getRight()?e:l.getRight();i=i>l.getBottom()?i:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;e+=l;i+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();e=e=0&&Math.min(i,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){o=true;i=e=d=c=0;a()};this.isEmpty=function(){return o};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+i+", width: "+b+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; +THREE.Matrix4=function(a,c,d,e,i,b,n,o,l,k,y,x,s,w,H,K){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=i||0;this.n22=b||1;this.n23=n||0;this.n24=o||0;this.n31=l||0;this.n32=k||0;this.n33=y||1;this.n34=x||0;this.n41=s||0;this.n42=w||0;this.n43=H||0;this.n44=K||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,i,b,n,o,l,k,y,x,s,w,H,K){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=i;this.n22=b;this.n23=n;this.n24=o;this.n31=l;this.n32=k;this.n33=y;this.n34=x;this.n41=s;this.n42=w;this.n43=H;this.n44=K;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();i.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a); +this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,i=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*i;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*i;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,i=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*i;a.y=this.n21*c+this.n22*d+this.n23* +e+this.n24*i;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*i;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*i;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,i=a.n13,b=a.n14,n=a.n21,o=a.n22,l=a.n23,k=a.n24,y=a.n31, +x=a.n32,s=a.n33,w=a.n34,H=a.n41,K=a.n42,L=a.n43,p=a.n44,h=c.n11,g=c.n12,f=c.n13,j=c.n14,t=c.n21,u=c.n22,m=c.n23,B=c.n24,q=c.n31,G=c.n32,r=c.n33,v=c.n34,D=c.n41,T=c.n42,E=c.n43,N=c.n44;this.n11=d*h+e*t+i*q+b*D;this.n12=d*g+e*u+i*G+b*T;this.n13=d*f+e*m+i*r+b*E;this.n14=d*j+e*B+i*v+b*N;this.n21=n*h+o*t+l*q+k*D;this.n22=n*g+o*u+l*G+k*T;this.n23=n*f+o*m+l*r+k*E;this.n24=n*j+o*B+l*v+k*N;this.n31=y*h+x*t+s*q+w*D;this.n32=y*g+x*u+s*G+w*T;this.n33=y*f+x*m+s*r+w*E;this.n34=y*j+x*B+s*v+w*N;this.n41=H*h+K*t+ +L*q+p*D;this.n42=H*g+K*u+L*G+p*T;this.n43=H*f+K*m+L*r+p*E;this.n44=H*j+K*B+L*v+p*N;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,i=this.n14,b=this.n21,n=this.n22,o=this.n23,l=this.n24,k=this.n31,y=this.n32,x=this.n33,s=this.n34,w=this.n41,H=this.n42,K=this.n43,L=this.n44,p=a.n11,h=a.n21,g=a.n31,f=a.n41,j=a.n12,t=a.n22,u=a.n32,m=a.n42,B=a.n13,q=a.n23,G=a.n33,r=a.n43,v=a.n14,D=a.n24,T=a.n34;a=a.n44;this.n11=c*p+d*h+e*g+i*f;this.n12=c*j+d*t+e*u+i*m;this.n13=c*B+d*q+e*G+i* +r;this.n14=c*v+d*D+e*T+i*a;this.n21=b*p+n*h+o*g+l*f;this.n22=b*j+n*t+o*u+l*m;this.n23=b*B+n*q+o*G+l*r;this.n24=b*v+n*D+o*T+l*a;this.n31=k*p+y*h+x*g+s*f;this.n32=k*j+y*t+x*u+s*m;this.n33=k*B+y*q+x*G+s*r;this.n34=k*v+y*D+x*T+s*a;this.n41=w*p+H*h+K*g+L*f;this.n42=w*j+H*t+K*u+L*m;this.n43=w*B+H*q+K*G+L*r;this.n44=w*v+H*D+K*T+L*a;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,c=this.n12,d=this.n13,e=this.n14,i=this.n21,b=this.n22,n=this.n23,o=this.n24,l=this.n31,k=this.n32,y=this.n33,x=this.n34,s=this.n41,w=this.n42,H=this.n43,K=this.n44;return e*n*k*s-d*o*k*s-e*b*y*s+c*o*y*s+d*b*x*s-c*n*x*s-e*n*l*w+d*o*l*w+e*i*y*w-a*o*y*w-d*i*x*w+a*n*x*w+e*b*l*H-c*o*l*H-e*i*k*H+a*o*k*H+c*i*x*H-a*b*x*H-d*b*l*K+c*n*l*K+d*i*k*K-a*n*k*K-c*i*y*K+a*b*y*K},transpose:function(){function a(c,d, +e){var i=c[d];c[d]=c[e];c[e]=i}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;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},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= -Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),g=1-d,h=a.x,o=a.y,b=a.z,j=g*h,i=g*o;this.set(j*h+d,j*o-e*b,j*b+e*o,0,j*o+e*b,i*o+d,i*b-e*h,0,j*b-e*o,i*b+e*h,g*b*b+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),i=1-d,b=a.x,n=a.y,o=a.z,l=i*b,k=i*n;this.set(l*b+d,l*n-e*o,l*o+e*n,0,l*n+e*o,k*n+d,k*o-e*b,0,l*o-e*n,k*o+e*b,i*o*o+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; -THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,o=a.n22,b=a.n23,j=a.n24,i=a.n31,y=a.n32,z=a.n33,u=a.n34,x=a.n41,H=a.n42,J=a.n43,K=a.n44,p=new THREE.Matrix4;p.n11=b*u*H-j*z*H+j*y*J-o*u*J-b*y*K+o*z*K;p.n12=g*z*H-e*u*H-g*y*J+d*u*J+e*y*K-d*z*K;p.n13=e*j*H-g*b*H+g*o*J-d*j*J-e*o*K+d*b*K;p.n14=g*b*y-e*j*y-g*o*z+d*j*z+e*o*u-d*b*u;p.n21=j*z*x-b*u*x-j*i*J+h*u*J+b*i*K-h*z*K;p.n22=e*u*x-g*z*x+g*i*J-c*u*J-e*i*K+c*z*K;p.n23=g*b*x-e*j*x-g*h*J+c*j*J+e*h*K-c*b*K;p.n24=e*j*i-g*b*i+ -g*h*z-c*j*z-e*h*u+c*b*u;p.n31=o*u*x-j*y*x+j*i*H-h*u*H-o*i*K+h*y*K;p.n32=g*y*x-d*u*x-g*i*H+c*u*H+d*i*K-c*y*K;p.n33=e*j*x-g*o*x+g*h*H-c*j*H-d*h*K+c*o*K;p.n34=g*o*i-d*j*i-g*h*y+c*j*y+d*h*u-c*o*u;p.n41=b*y*x-o*z*x-b*i*H+h*z*H+o*i*J-h*y*J;p.n42=d*z*x-e*y*x+e*i*H-c*z*H-d*i*J+c*y*J;p.n43=e*o*x-d*b*x-e*h*H+c*b*H+d*h*J-c*o*J;p.n44=d*b*i-e*o*i+e*h*y-c*b*y-d*h*z+c*o*z;p.multiplyScalar(1/a.determinant());return p}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],g=-c[10]*c[1]+c[2]*c[9],h=c[6]*c[1]-c[2]*c[5],o=-c[10]*c[4]+c[6]*c[8],b=c[10]*c[0]-c[2]*c[8],j=-c[6]*c[0]+c[2]*c[4],i=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],z=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*o+c[2]*i;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*g;d[2]=c*h;d[3]=c*o;d[4]=c*b;d[5]=c*j;d[6]=c*i;d[7]=c*y;d[8]=c*z;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,e,g,h){var o,b,j;o=new THREE.Matrix4;b=2*g/(c-a);j=2*g/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(h+g)/(h-g);g=-2*h*g/(h-g);o.n11=b;o.n12=0;o.n13=a;o.n14=0;o.n21=0;o.n22=j;o.n23=d;o.n24=0;o.n31=0;o.n32=0;o.n33=e;o.n34=g;o.n41=0;o.n42=0;o.n43=-1;o.n44=0;return o};THREE.Matrix4.makePerspective=function(a,c,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,d,e)}; -THREE.Matrix4.makeOrtho=function(a,c,d,e,g,h){var o,b,j,i;o=new THREE.Matrix4;b=c-a;j=d-e;i=h-g;a=(c+a)/b;d=(d+e)/j;g=(h+g)/i;o.n11=2/b;o.n12=0;o.n13=0;o.n14=-a;o.n21=0;o.n22=2/j;o.n23=0;o.n24=-d;o.n31=0;o.n32=0;o.n33=-2/i;o.n34=-g;o.n41=0;o.n42=0;o.n43=0;o.n44=1;return o};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,i=a.n14,b=a.n21,n=a.n22,o=a.n23,l=a.n24,k=a.n31,y=a.n32,x=a.n33,s=a.n34,w=a.n41,H=a.n42,K=a.n43,L=a.n44,p=new THREE.Matrix4;p.n11=o*s*H-l*x*H+l*y*K-n*s*K-o*y*L+n*x*L;p.n12=i*x*H-e*s*H-i*y*K+d*s*K+e*y*L-d*x*L;p.n13=e*l*H-i*o*H+i*n*K-d*l*K-e*n*L+d*o*L;p.n14=i*o*y-e*l*y-i*n*x+d*l*x+e*n*s-d*o*s;p.n21=l*x*w-o*s*w-l*k*K+b*s*K+o*k*L-b*x*L;p.n22=e*s*w-i*x*w+i*k*K-c*s*K-e*k*L+c*x*L;p.n23=i*o*w-e*l*w-i*b*K+c*l*K+e*b*L-c*o*L;p.n24=e*l*k-i*o*k+ +i*b*x-c*l*x-e*b*s+c*o*s;p.n31=n*s*w-l*y*w+l*k*H-b*s*H-n*k*L+b*y*L;p.n32=i*y*w-d*s*w-i*k*H+c*s*H+d*k*L-c*y*L;p.n33=e*l*w-i*n*w+i*b*H-c*l*H-d*b*L+c*n*L;p.n34=i*n*k-d*l*k-i*b*y+c*l*y+d*b*s-c*n*s;p.n41=o*y*w-n*x*w-o*k*H+b*x*H+n*k*K-b*y*K;p.n42=d*x*w-e*y*w+e*k*H-c*x*H-d*k*K+c*y*K;p.n43=e*n*w-d*o*w-e*b*H+c*o*H+d*b*K-c*n*K;p.n44=d*o*k-e*n*k+e*b*y-c*o*y-d*b*x+c*n*x;p.multiplyScalar(1/a.determinant());return p}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],n=-c[10]*c[4]+c[6]*c[8],o=c[10]*c[0]-c[2]*c[8],l=-c[6]*c[0]+c[2]*c[4],k=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*n+c[2]*k;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*i;d[2]=c*b;d[3]=c*n;d[4]=c*o;d[5]=c*l;d[6]=c*k;d[7]=c*y;d[8]=c*x;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,e,i,b){var n,o,l;n=new THREE.Matrix4;o=2*i/(c-a);l=2*i/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+i)/(b-i);i=-2*b*i/(b-i);n.n11=o;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=l;n.n23=d;n.n24=0;n.n31=0;n.n32=0;n.n33=e;n.n34=i;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,d,e){var i;a=d*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,c,d,e,i,b){var n,o,l,k;n=new THREE.Matrix4;o=c-a;l=d-e;k=b-i;a=(c+a)/o;d=(d+e)/l;i=(b+i)/k;n.n11=2/o;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/l;n.n23=0;n.n24=-d;n.n31=0;n.n32=0;n.n33=-2/k;n.n34=-i;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,d,e,g){this.a=a;this.b=c;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=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,c,d,e,g,h){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=h instanceof Array?h:[h]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.Face3=function(a,c,d,e,i){this.a=a;this.b=c;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=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,d,e,i,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=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], +c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(v,D,T,E,N,U,C){b=v.vertices[D].position;n=v.vertices[T].position;o=v.vertices[E].position;l=i[N];k=i[U];y=i[C];x=n.x-b.x;s=o.x-b.x;w=n.y-b.y;H=o.y-b.y; +K=n.z-b.z;L=o.z-b.z;p=k.u-l.u;h=y.u-l.u;g=k.v-l.v;f=y.v-l.v;j=1/(p*f-h*g);m.set((f*x-g*s)*j,(f*w-g*H)*j,(f*K-g*L)*j);B.set((p*s-h*x)*j,(p*H-h*w)*j,(p*L-h*K)*j);t[D].addSelf(m);t[T].addSelf(m);t[E].addSelf(m);u[D].addSelf(B);u[T].addSelf(B);u[E].addSelf(B)}var c,d,e,i,b,n,o,l,k,y,x,s,w,H,K,L,p,h,g,f,j,t=[],u=[],m=new THREE.Vector3,B=new THREE.Vector3,q=new THREE.Vector3,G=new THREE.Vector3,r=new THREE.Vector3;c=0;for(d=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=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,c=0,d=this.vertices.length;c65535){i[b].counter+=1;j=i[b].hash+"_"+i[b].counter;if(this.geometryChunks[j]==undefined)this.geometryChunks[j]={faces:[],materials:o,vertices:0}}this.geometryChunks[j].faces.push(e);this.geometryChunks[j].vertices+=h}},toString:function(){return"THREE.Geometry ( vertices: "+ +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){k[o].counter+=1;l=k[o].hash+"_"+k[o].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:n,vertices:0}}this.geometryChunks[l].faces.push(e);this.geometryChunks[l].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; -this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; +THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; @@ -89,105 +89,105 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}}; -THREE.Texture=function(a,c,d,e,g,h){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=h!==undefined?h:THREE.LinearMipMapLinearFilter}; +THREE.Texture=function(a,c,d,e,i,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var c,d,e,g={};for(c in a){g[c]={};for(d in a[c]){e=a[c][d];g[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var c,d,e,g={};for(c=0;c=0&&v>=0&&s>=0&&n>=0)return true;else if(t<0&&v<0||s<0&&n<0)return false;else{if(t<0)C=Math.max(C,t/(t-v));else if(v<0)m=Math.min(m,t/(t-v));if(s<0)C=Math.max(C,s/(s-n));else if(n<0)m=Math.min(m,s/(s-n));if(mt&&B.z0&&K.z<1){u=H[x]=H[x]||new THREE.RenderableParticle;u.x=K.x/K.w;u.y=K.y/K.w;u.z=K.z;u.rotation=G.rotation.z;u.scale.x=G.scale.x*Math.abs(u.x-(K.x+r.projectionMatrix.n11)/(K.w+r.projectionMatrix.n14)); -u.scale.y=G.scale.y*Math.abs(u.y-(K.y+r.projectionMatrix.n22)/(K.w+r.projectionMatrix.n24));u.materials=G.materials;m.push(u);x++}}}}C&&m.sort(a);return m};this.unprojectVector=function(l,r){var C=THREE.Matrix4.makeInvert(r.matrix);C.multiplySelf(THREE.Matrix4.makeInvert(r.projectionMatrix));C.multiplyVector3(l);return l}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,g,h;this.domElement=document.createElement("div");this.setSize=function(o,b){d=o;e=b;g=d/2;h=e/2};this.render=function(o,b){var j,i,y,z,u,x,H,J;a=c.projectScene(o,b);j=0;for(i=a.length;j0){D.r+=ca.r*$;D.g+=ca.g*$;D.b+=ca.b*$}}else if($ instanceof THREE.PointLight){Y.sub($.position,X);Y.normalize();$=U.dot(Y)*ga;if($>0){D.r+=ca.r*$;D.g+=ca.g*$;D.b+=ca.b*$}}}}function Na(A,X,U){if(U.opacity!=0){a(U.opacity);c(U.blending);var D, -S,$,ca,ga,ia;if(U instanceof THREE.ParticleBasicMaterial){if(U.map){ca=U.map;ga=ca.width>>1;ia=ca.height>>1;S=X.scale.x*b;$=X.scale.y*j;U=S*ga;D=$*ia;w.set(A.x-U,A.y-D,A.x+U,A.y+D);if(!T.instersects(w))return;i.save();i.translate(A.x,A.y);i.rotate(-X.rotation);i.scale(S,-$);i.translate(-ga,-ia);i.drawImage(ca,0,0);i.restore()}i.beginPath();i.moveTo(A.x-10,A.y);i.lineTo(A.x+10,A.y);i.moveTo(A.x,A.y-10);i.lineTo(A.x,A.y+10);i.closePath();i.strokeStyle="rgb(255,255,0)";i.stroke()}else if(U instanceof -THREE.ParticleCircleMaterial){if(M){R.r=da.r+ba.r+Z.r;R.g=da.g+ba.g+Z.g;R.b=da.b+ba.b+Z.b;m.r=U.color.r*R.r;m.g=U.color.g*R.g;m.b=U.color.b*R.b;m.updateStyleString()}else m.__styleString=U.color.__styleString;U=X.scale.x*b;D=X.scale.y*j;w.set(A.x-U,A.y-D,A.x+U,A.y+D);if(T.instersects(w)){S=m.__styleString;if(J!=S)i.fillStyle=J=S;i.save();i.translate(A.x,A.y);i.rotate(-X.rotation);i.scale(U,D);i.beginPath();i.arc(0,0,1,0,ja,true);i.closePath();i.fill();i.restore()}}}}function Oa(A,X,U,D){if(D.opacity!= -0){a(D.opacity);c(D.blending);i.beginPath();i.moveTo(A.positionScreen.x,A.positionScreen.y);i.lineTo(X.positionScreen.x,X.positionScreen.y);i.closePath();if(D instanceof THREE.LineBasicMaterial){m.__styleString=D.color.__styleString;A=D.linewidth;if(K!=A)i.lineWidth=K=A;A=m.__styleString;if(H!=A)i.strokeStyle=H=A;i.stroke();w.inflate(D.linewidth*2)}}}function Ia(A,X,U,D,S,$){if(S.opacity!=0){a(S.opacity);c(S.blending);f=A.positionScreen.x;k=A.positionScreen.y;q=X.positionScreen.x;l=X.positionScreen.y; -r=U.positionScreen.x;C=U.positionScreen.y;i.beginPath();i.moveTo(f,k);i.lineTo(q,l);i.lineTo(r,C);i.lineTo(f,k);i.closePath();if(S instanceof THREE.MeshBasicMaterial)if(S.map)S.map.image.loaded&&S.map.mapping instanceof THREE.UVMapping&&xa(f,k,q,l,r,C,S.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);else if(S.env_map){if(S.env_map.image.loaded)if(S.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=ra.matrix;Y.copy(D.vertexNormalsWorld[0]);N=(Y.x*A.n11+Y.y* -A.n12+Y.z*A.n13)*0.5+0.5;G=-(Y.x*A.n21+Y.y*A.n22+Y.z*A.n23)*0.5+0.5;Y.copy(D.vertexNormalsWorld[1]);W=(Y.x*A.n11+Y.y*A.n12+Y.z*A.n13)*0.5+0.5;P=-(Y.x*A.n21+Y.y*A.n22+Y.z*A.n23)*0.5+0.5;Y.copy(D.vertexNormalsWorld[2]);I=(Y.x*A.n11+Y.y*A.n12+Y.z*A.n13)*0.5+0.5;L=-(Y.x*A.n21+Y.y*A.n22+Y.z*A.n23)*0.5+0.5;xa(f,k,q,l,r,C,S.env_map.image,N,G,W,P,I,L)}}else S.wireframe?Ba(S.color.__styleString,S.wireframe_linewidth):Ca(S.color.__styleString);else if(S instanceof THREE.MeshLambertMaterial){if(S.map&&!S.wireframe){S.map.mapping instanceof -THREE.UVMapping&&xa(f,k,q,l,r,C,S.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);c(THREE.SubtractiveBlending)}if(M)if(!S.wireframe&&S.shading==THREE.SmoothShading&&D.vertexNormalsWorld.length==3){t.r=v.r=s.r=da.r;t.g=v.g=s.g=da.g;t.b=v.b=s.b=da.b;Aa($,D.v1.positionWorld,D.vertexNormalsWorld[0],t);Aa($,D.v2.positionWorld,D.vertexNormalsWorld[1],v);Aa($,D.v3.positionWorld,D.vertexNormalsWorld[2],s);n.r=(v.r+s.r)*0.5;n.g=(v.g+s.g)*0.5;n.b=(v.b+s.b)*0.5;O=Ja(t,v,s,n);xa(f, -k,q,l,r,C,O,0,0,1,0,0,1)}else{R.r=da.r;R.g=da.g;R.b=da.b;Aa($,D.centroidWorld,D.normalWorld,R);m.r=S.color.r*R.r;m.g=S.color.g*R.g;m.b=S.color.b*R.b;m.updateStyleString();S.wireframe?Ba(m.__styleString,S.wireframe_linewidth):Ca(m.__styleString)}else S.wireframe?Ba(S.color.__styleString,S.wireframe_linewidth):Ca(S.color.__styleString)}else if(S instanceof THREE.MeshDepthMaterial){E=ra.near;B=ra.far;t.r=t.g=t.b=1-Ea(A.positionScreen.z,E,B);v.r=v.g=v.b=1-Ea(X.positionScreen.z,E,B);s.r=s.g=s.b=1-Ea(U.positionScreen.z, -E,B);n.r=(v.r+s.r)*0.5;n.g=(v.g+s.g)*0.5;n.b=(v.b+s.b)*0.5;O=Ja(t,v,s,n);xa(f,k,q,l,r,C,O,0,0,1,0,0,1)}else if(S instanceof THREE.MeshNormalMaterial){m.r=Fa(D.normalWorld.x);m.g=Fa(D.normalWorld.y);m.b=Fa(D.normalWorld.z);m.updateStyleString();S.wireframe?Ba(m.__styleString,S.wireframe_linewidth):Ca(m.__styleString)}}}function Ba(A,X){if(H!=A)i.strokeStyle=H=A;if(K!=X)i.lineWidth=K=X;i.stroke();w.inflate(X*2)}function Ca(A){if(J!=A)i.fillStyle=J=A;i.fill()}function xa(A,X,U,D,S,$,ca,ga,ia,na,la,oa, -ya){var ta,pa;ta=ca.width-1;pa=ca.height-1;ga*=ta;ia*=pa;na*=ta;la*=pa;oa*=ta;ya*=pa;U-=A;D-=X;S-=A;$-=X;na-=ga;la-=ia;oa-=ga;ya-=ia;pa=1/(na*ya-oa*la);ta=(ya*U-la*S)*pa;la=(ya*D-la*$)*pa;U=(na*S-oa*U)*pa;D=(na*$-oa*D)*pa;A=A-ta*ga-U*ia;X=X-la*ga-D*ia;i.save();i.transform(ta,la,U,D,A,X);i.clip();i.drawImage(ca,0,0);i.restore()}function Ja(A,X,U,D){var S=~~(A.r*255),$=~~(A.g*255);A=~~(A.b*255);var ca=~~(X.r*255),ga=~~(X.g*255);X=~~(X.b*255);var ia=~~(U.r*255),na=~~(U.g*255);U=~~(U.b*255);var la=~~(D.r* -255),oa=~~(D.g*255);D=~~(D.b*255);ha[0]=S<0?0:S>255?255:S;ha[1]=$<0?0:$>255?255:$;ha[2]=A<0?0:A>255?255:A;ha[4]=ca<0?0:ca>255?255:ca;ha[5]=ga<0?0:ga>255?255:ga;ha[6]=X<0?0:X>255?255:X;ha[8]=ia<0?0:ia>255?255:ia;ha[9]=na<0?0:na>255?255:na;ha[10]=U<0?0:U>255?255:U;ha[12]=la<0?0:la>255?255:la;ha[13]=oa<0?0:oa>255?255:oa;ha[14]=D<0?0:D>255?255:D;ka.putImageData(fa,0,0);ua.drawImage(qa,0,0);return sa}function Ea(A,X,U){A=(A-X)/(U-X);return A*A*(3-2*A)}function Fa(A){A=(A+1)*0.5;return A<0?0:A>1?1:A}function Ga(A, -X){var U=X.x-A.x,D=X.y-A.y,S=1/Math.sqrt(U*U+D*D);U*=S;D*=S;X.x+=U;X.y+=D;A.x-=U;A.y-=D}var Da,Ka,aa,ma,wa,Ha,La,za;i.setTransform(1,0,0,-1,b,j);this.autoClear&&this.clear();d=e.projectScene(ea,ra,this.sortElements);i.fillStyle="rgba( 0, 255, 255, 0.5 )";i.fillRect(T.getX(),T.getY(),T.getWidth(),T.getHeight());(M=ea.lights.length>0)&&Ma(ea);Da=0;for(Ka=d.length;Da0){W.r+=L.color.r*T;W.g+=L.color.g*T;W.b+=L.color.b*T}}else if(L instanceof THREE.PointLight){C.sub(L.position,G.centroidWorld);C.normalize();T=G.normalWorld.dot(C)*L.intensity;if(T>0){W.r+=L.color.r*T;W.g+=L.color.g*T;W.b+=L.color.b*T}}}}function c(N,G,W,P,I,L){s=e(n++);s.setAttribute("d","M "+N.positionScreen.x+ -" "+N.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)F.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(V){f.r=k.r;f.g=k.g;f.b=k.b;a(L,P,f);F.r=I.color.r*f.r;F.g=I.color.g*f.g;F.b=I.color.b*f.b;F.updateStyleString()}else F.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){r=1-I.__2near/(I.__farPlusNear-P.z*I.__farMinusNear); -F.setRGB(r,r,r)}else I instanceof THREE.MeshNormalMaterial&&F.setRGB(g(P.normalWorld.x),g(P.normalWorld.y),g(P.normalWorld.z));I.wireframe?s.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):s.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+I.opacity);b.appendChild(s)}function d(N,G,W,P,I,L,T){s=e(n++);s.setAttribute("d", -"M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(L instanceof THREE.MeshBasicMaterial)F.__styleString=L.color.__styleString;else if(L instanceof THREE.MeshLambertMaterial)if(V){f.r=k.r;f.g=k.g;f.b=k.b;a(T,I,f);F.r=L.color.r*f.r;F.g=L.color.g*f.g;F.b=L.color.b*f.b;F.updateStyleString()}else F.__styleString=L.color.__styleString;else if(L instanceof THREE.MeshDepthMaterial){r= -1-L.__2near/(L.__farPlusNear-I.z*L.__farMinusNear);F.setRGB(r,r,r)}else L instanceof THREE.MeshNormalMaterial&&F.setRGB(g(I.normalWorld.x),g(I.normalWorld.y),g(I.normalWorld.z));L.wireframe?s.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+L.wireframe_linewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.wireframe_linecap+"; stroke-linejoin: "+L.wireframe_linejoin):s.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+L.opacity);b.appendChild(s)} -function e(N){if(m[N]==null){m[N]=document.createElementNS("http://www.w3.org/2000/svg","path");O==0&&m[N].setAttribute("shape-rendering","crispEdges");return m[N]}return m[N]}function g(N){return N<0?Math.min((1+N)*0.5,0.5):0.5+Math.min(N*0.5,0.5)}var h=null,o=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,i,y,z,u,x,H,J,K=new THREE.Rectangle,p=new THREE.Rectangle,V=false,F=new THREE.Color(16777215),f=new THREE.Color(16777215),k=new THREE.Color(0),q=new THREE.Color(0), -l=new THREE.Color(0),r,C=new THREE.Vector3,m=[],t=[],v=[],s,n,E,B,O=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(N){switch(N){case "high":O=1;break;case "low":O=0}};this.setSize=function(N,G){j=N;i=G;y=j/2;z=i/2;b.setAttribute("viewBox",-y+" "+-z+" "+j+" "+i);b.setAttribute("width",j);b.setAttribute("height",i);K.set(-y,-z,y,z)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(N,G){var W,P, -I,L,T,Q,w,M;this.autoClear&&this.clear();h=o.projectScene(N,G,this.sortElements);B=E=n=0;if(V=N.lights.length>0){w=N.lights;k.setRGB(0,0,0);q.setRGB(0,0,0);l.setRGB(0,0,0);W=0;for(P=w.length;W0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,da,q)}if(r){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, -f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ja,q);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Y,q)}};this.setLineBuffers=function(f,k,q,l){var r,C,m=f.vertices,t=m.length,v=f.__vertexArray,s=f.__lineArray;if(q)for(q=0;q0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights, -s.map?"#define USE_MAP":"",s.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");b.attachShader(E,g("fragment",B+t));b.attachShader(E,g("vertex",s+n));b.linkProgram(E);b.getProgramParameter(E,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+ -b.getProgramParameter(E,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");E.uniforms={};E.attributes={};l.program=E;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(m in l.uniforms)t.push(m);m=l.program;n=0;for(E=t.length;n=0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLNormalBuffer);b.vertexAttribPointer(v.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.normal)}if(v.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLTangentBuffer); -b.vertexAttribPointer(v.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.tangent)}if(v.uv>=0)if(r.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLUVBuffer);b.vertexAttribPointer(v.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.uv)}else b.disableVertexAttribArray(v.uv);if(l.wireframe||l instanceof THREE.LineBasicMaterial){v=l.wireframe_linewidth!==undefined?l.wireframe_linewidth:l.linewidth!==undefined?l.linewidth:1;l=l instanceof THREE.LineBasicMaterial&&C.type==THREE.LineStrip? -b.LINE_STRIP:b.LINES;b.lineWidth(v);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webGLLineBuffer);b.drawElements(l,r.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,r.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,k,q,l,r,C,m){var t,v,s,n,E;s=0;for(n=l.materials.length;s=0;q--){l=f.__webGLObjects[q].object;k==l&&f.__webGLObjects.splice(q,1)}};this.setupMatrices=function(f,k){f.autoUpdateMatrix&& -f.updateMatrix();y.multiply(k.matrix,f.matrix);x.set(y.flatten());z=THREE.Matrix4.makeInvert3x3(y).transpose();J.set(z.m);K.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,u);b.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,H);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,J);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,K)};this.loadCamera=function(f,k){b.uniform3f(f.uniforms.cameraPosition, -k.position.x,k.position.y,k.position.z)};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,k){if(f){!k||k=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK); -b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; -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, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", -envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\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\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", +THREE.Projector=function(){function a(u,m){return m.z-u.z}function c(u,m){var B=0,q=1,G=u.z+u.w,r=m.z+m.w,v=-u.z+u.w,D=-m.z+m.w;if(G>=0&&r>=0&&v>=0&&D>=0)return true;else if(G<0&&r<0||v<0&&D<0)return false;else{if(G<0)B=Math.max(B,G/(G-r));else if(r<0)q=Math.min(q,G/(G-r));if(v<0)B=Math.max(B,v/(v-D));else if(D<0)q=Math.min(q,v/(v-D));if(qG&&E.z0&&L.z<1){s=H[w]=H[w]||new THREE.RenderableParticle;s.x=L.x/L.w;s.y=L.y/L.w;s.z=L.z;s.rotation=C.rotation.z;s.scale.x=C.scale.x*Math.abs(s.x-(L.x+m.projectionMatrix.n11)/(L.w+m.projectionMatrix.n14)); +s.scale.y=C.scale.y*Math.abs(s.y-(L.y+m.projectionMatrix.n22)/(L.w+m.projectionMatrix.n24));s.materials=C.materials;q.push(s);w++}}}}B&&q.sort(a);return q};this.unprojectVector=function(u,m){var B=THREE.Matrix4.makeInvert(m.matrix);B.multiplySelf(THREE.Matrix4.makeInvert(m.projectionMatrix));B.multiplyVector3(u);return u}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,i,b;this.domElement=document.createElement("div");this.setSize=function(n,o){d=n;e=o;i=d/2;b=e/2};this.render=function(n,o){var l,k,y,x,s,w,H,K;a=c.projectScene(n,o);l=0;for(k=a.length;l0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}else if(Z instanceof THREE.PointLight){$.sub(Z.position,W);$.normalize();Z=R.dot($)*ga;if(Z>0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}}}function Na(A,W,R){if(R.opacity!=0){a(R.opacity);c(R.blending);var F, +P,Z,da,ga,ha;if(R instanceof THREE.ParticleBasicMaterial){if(R.map){da=R.map;ga=da.width>>1;ha=da.height>>1;P=W.scale.x*o;Z=W.scale.y*l;R=P*ga;F=Z*ha;z.set(A.x-R,A.y-F,A.x+R,A.y+F);if(!J.instersects(z))return;k.save();k.translate(A.x,A.y);k.rotate(-W.rotation);k.scale(P,-Z);k.translate(-ga,-ha);k.drawImage(da,0,0);k.restore()}k.beginPath();k.moveTo(A.x-10,A.y);k.lineTo(A.x+10,A.y);k.moveTo(A.x,A.y-10);k.lineTo(A.x,A.y+10);k.closePath();k.strokeStyle="rgb(255,255,0)";k.stroke()}else if(R instanceof +THREE.ParticleCircleMaterial){if(Q){V.r=X.r+fa.r+aa.r;V.g=X.g+fa.g+aa.g;V.b=X.b+fa.b+aa.b;q.r=R.color.r*V.r;q.g=R.color.g*V.g;q.b=R.color.b*V.b;q.updateStyleString()}else q.__styleString=R.color.__styleString;R=W.scale.x*o;F=W.scale.y*l;z.set(A.x-R,A.y-F,A.x+R,A.y+F);if(J.instersects(z)){P=q.__styleString;if(K!=P)k.fillStyle=K=P;k.save();k.translate(A.x,A.y);k.rotate(-W.rotation);k.scale(R,F);k.beginPath();k.arc(0,0,1,0,ya,true);k.closePath();k.fill();k.restore()}}}}function Oa(A,W,R,F){if(F.opacity!= +0){a(F.opacity);c(F.blending);k.beginPath();k.moveTo(A.positionScreen.x,A.positionScreen.y);k.lineTo(W.positionScreen.x,W.positionScreen.y);k.closePath();if(F instanceof THREE.LineBasicMaterial){q.__styleString=F.color.__styleString;A=F.linewidth;if(L!=A)k.lineWidth=L=A;A=q.__styleString;if(H!=A)k.strokeStyle=H=A;k.stroke();z.inflate(F.linewidth*2)}}}function Ia(A,W,R,F,P,Z){if(P.opacity!=0){a(P.opacity);c(P.blending);f=A.positionScreen.x;j=A.positionScreen.y;t=W.positionScreen.x;u=W.positionScreen.y; +m=R.positionScreen.x;B=R.positionScreen.y;k.beginPath();k.moveTo(f,j);k.lineTo(t,u);k.lineTo(m,B);k.lineTo(f,j);k.closePath();if(P instanceof THREE.MeshBasicMaterial)if(P.map)P.map.image.loaded&&P.map.mapping instanceof THREE.UVMapping&&va(f,j,t,u,m,B,P.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);else if(P.env_map){if(P.env_map.image.loaded)if(P.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=pa.matrix;$.copy(F.vertexNormalsWorld[0]);U=($.x*A.n11+$.y* +A.n12+$.z*A.n13)*0.5+0.5;C=-($.x*A.n21+$.y*A.n22+$.z*A.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[1]);S=($.x*A.n11+$.y*A.n12+$.z*A.n13)*0.5+0.5;Y=-($.x*A.n21+$.y*A.n22+$.z*A.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[2]);M=($.x*A.n11+$.y*A.n12+$.z*A.n13)*0.5+0.5;I=-($.x*A.n21+$.y*A.n22+$.z*A.n23)*0.5+0.5;va(f,j,t,u,m,B,P.env_map.image,U,C,S,Y,M,I)}}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString);else if(P instanceof THREE.MeshLambertMaterial){if(P.map&&!P.wireframe){P.map.mapping instanceof +THREE.UVMapping&&va(f,j,t,u,m,B,P.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);c(THREE.SubtractiveBlending)}if(Q)if(!P.wireframe&&P.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){G.r=r.r=v.r=X.r;G.g=r.g=v.g=X.g;G.b=r.b=v.b=X.b;Aa(Z,F.v1.positionWorld,F.vertexNormalsWorld[0],G);Aa(Z,F.v2.positionWorld,F.vertexNormalsWorld[1],r);Aa(Z,F.v3.positionWorld,F.vertexNormalsWorld[2],v);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j, +t,u,m,B,N,0,0,1,0,0,1)}else{V.r=X.r;V.g=X.g;V.b=X.b;Aa(Z,F.centroidWorld,F.normalWorld,V);q.r=P.color.r*V.r;q.g=P.color.g*V.g;q.b=P.color.b*V.b;q.updateStyleString();P.wireframe?Ba(q.__styleString,P.wireframe_linewidth):Ca(q.__styleString)}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString)}else if(P instanceof THREE.MeshDepthMaterial){T=pa.near;E=pa.far;G.r=G.g=G.b=1-Ea(A.positionScreen.z,T,E);r.r=r.g=r.b=1-Ea(W.positionScreen.z,T,E);v.r=v.g=v.b=1-Ea(R.positionScreen.z, +T,E);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,t,u,m,B,N,0,0,1,0,0,1)}else if(P instanceof THREE.MeshNormalMaterial){q.r=Fa(F.normalWorld.x);q.g=Fa(F.normalWorld.y);q.b=Fa(F.normalWorld.z);q.updateStyleString();P.wireframe?Ba(q.__styleString,P.wireframe_linewidth):Ca(q.__styleString)}}}function Ba(A,W){if(H!=A)k.strokeStyle=H=A;if(L!=W)k.lineWidth=L=W;k.stroke();z.inflate(W*2)}function Ca(A){if(K!=A)k.fillStyle=K=A;k.fill()}function va(A,W,R,F,P,Z,da,ga,ha,la,ja,ma, +wa){var qa,na;qa=da.width-1;na=da.height-1;ga*=qa;ha*=na;la*=qa;ja*=na;ma*=qa;wa*=na;R-=A;F-=W;P-=A;Z-=W;la-=ga;ja-=ha;ma-=ga;wa-=ha;na=1/(la*wa-ma*ja);qa=(wa*R-ja*P)*na;ja=(wa*F-ja*Z)*na;R=(la*P-ma*R)*na;F=(la*Z-ma*F)*na;A=A-qa*ga-R*ha;W=W-ja*ga-F*ha;k.save();k.transform(qa,ja,R,F,A,W);k.clip();k.drawImage(da,0,0);k.restore()}function Ja(A,W,R,F){var P=~~(A.r*255),Z=~~(A.g*255);A=~~(A.b*255);var da=~~(W.r*255),ga=~~(W.g*255);W=~~(W.b*255);var ha=~~(R.r*255),la=~~(R.g*255);R=~~(R.b*255);var ja=~~(F.r* +255),ma=~~(F.g*255);F=~~(F.b*255);ia[0]=P<0?0:P>255?255:P;ia[1]=Z<0?0:Z>255?255:Z;ia[2]=A<0?0:A>255?255:A;ia[4]=da<0?0:da>255?255:da;ia[5]=ga<0?0:ga>255?255:ga;ia[6]=W<0?0:W>255?255:W;ia[8]=ha<0?0:ha>255?255:ha;ia[9]=la<0?0:la>255?255:la;ia[10]=R<0?0:R>255?255:R;ia[12]=ja<0?0:ja>255?255:ja;ia[13]=ma<0?0:ma>255?255:ma;ia[14]=F<0?0:F>255?255:F;oa.putImageData(ta,0,0);za.drawImage(ca,0,0);return ua}function Ea(A,W,R){A=(A-W)/(R-W);return A*A*(3-2*A)}function Fa(A){A=(A+1)*0.5;return A<0?0:A>1?1:A}function Ga(A, +W){var R=W.x-A.x,F=W.y-A.y,P=1/Math.sqrt(R*R+F*F);R*=P;F*=P;W.x+=R;W.y+=F;A.x-=R;A.y-=F}var Da,Ka,ba,ka,sa,Ha,La,xa;k.setTransform(1,0,0,-1,o,l);this.autoClear&&this.clear();d=e.projectScene(ea,pa,this.sortElements);k.fillStyle="rgba( 0, 255, 255, 0.5 )";k.fillRect(J.getX(),J.getY(),J.getWidth(),J.getHeight());(Q=ea.lights.length>0)&&Ma(ea);Da=0;for(Ka=d.length;Da0){S.r+=I.color.r*J;S.g+=I.color.g*J;S.b+=I.color.b*J}}else if(I instanceof THREE.PointLight){B.sub(I.position,C.centroidWorld);B.normalize();J=C.normalWorld.dot(B)*I.intensity;if(J>0){S.r+=I.color.r*J;S.g+=I.color.g*J;S.b+=I.color.b*J}}}}function c(U,C,S,Y,M,I){v=e(D++);v.setAttribute("d","M "+U.positionScreen.x+ +" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(I,Y,f);g.r=M.color.r*f.r;g.g=M.color.g*f.g;g.b=M.color.b*f.b;g.updateStyleString()}else g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){m=1-M.__2near/(M.__farPlusNear-Y.z*M.__farMinusNear); +g.setRGB(m,m,m)}else M instanceof THREE.MeshNormalMaterial&&g.setRGB(i(Y.normalWorld.x),i(Y.normalWorld.y),i(Y.normalWorld.z));M.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+M.opacity);o.appendChild(v)}function d(U,C,S,Y,M,I,J){v=e(D++);v.setAttribute("d", +"M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(J,M,f);g.r=I.color.r*f.r;g.g=I.color.g*f.g;g.b=I.color.b*f.b;g.updateStyleString()}else g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){m= +1-I.__2near/(I.__farPlusNear-M.z*I.__farMinusNear);g.setRGB(m,m,m)}else I instanceof THREE.MeshNormalMaterial&&g.setRGB(i(M.normalWorld.x),i(M.normalWorld.y),i(M.normalWorld.z));I.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+I.opacity);o.appendChild(v)} +function e(U){if(q[U]==null){q[U]=document.createElementNS("http://www.w3.org/2000/svg","path");N==0&&q[U].setAttribute("shape-rendering","crispEdges");return q[U]}return q[U]}function i(U){return U<0?Math.min((1+U)*0.5,0.5):0.5+Math.min(U*0.5,0.5)}var b=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,y,x,s,w,H,K,L=new THREE.Rectangle,p=new THREE.Rectangle,h=false,g=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),t=new THREE.Color(0), +u=new THREE.Color(0),m,B=new THREE.Vector3,q=[],G=[],r=[],v,D,T,E,N=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(U){switch(U){case "high":N=1;break;case "low":N=0}};this.setSize=function(U,C){l=U;k=C;y=l/2;x=k/2;o.setAttribute("viewBox",-y+" "+-x+" "+l+" "+k);o.setAttribute("width",l);o.setAttribute("height",k);L.set(-y,-x,y,x)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(U,C){var S,Y, +M,I,J,O,z,Q;this.autoClear&&this.clear();b=n.projectScene(U,C,this.sortElements);E=T=D=0;if(h=U.lights.length>0){z=U.lights;j.setRGB(0,0,0);t.setRGB(0,0,0);u.setRGB(0,0,0);S=0;for(Y=z.length;S0){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Q,f)}if(t){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, +h.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,f);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,f)}};this.setLineBuffers=function(h,g,f,j){var t,u,m=h.vertices,B=m.length,q=h.__vertexArray,G=h.__lineArray;if(f)for(f=0;f0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n"); +b.attachShader(f,d("fragment",t+q));b.attachShader(f,d("vertex",u+g));b.linkProgram(f);b.getProgramParameter(f,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(f,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");f.uniforms={};f.attributes={};h.program=f;f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(j in h.uniforms)f.push(j);j=h.program;q=0;for(g=f.length;q=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLNormalBuffer);b.vertexAttribPointer(m.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.normal)}if(m.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLTangentBuffer);b.vertexAttribPointer(m.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.tangent)}if(m.uv>=0)if(t.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLUVBuffer); +b.vertexAttribPointer(m.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.uv)}else b.disableVertexAttribArray(m.uv);if(j.wireframe||j instanceof THREE.LineBasicMaterial){m=j.wireframe_linewidth!==undefined?j.wireframe_linewidth:j.linewidth!==undefined?j.linewidth:1;j=j instanceof THREE.LineBasicMaterial&&u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(m);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);b.drawElements(j,t.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, +t.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,t.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(h,g,f,j,t,u,m){var B,q,G,r,v;G=0;for(r=j.materials.length;G=0;f--){j=h.__webGLObjects[f].object;g==j&&h.__webGLObjects.splice(f,1)}};this.setupMatrices=function(h,g){h.autoUpdateMatrix&&h.updateMatrix();l.multiply(g.matrix,h.matrix);x.set(l.flatten());k=THREE.Matrix4.makeInvert3x3(l).transpose();w.set(k.m);H.set(h.matrix.flatten())};this.loadMatrices=function(h){b.uniformMatrix4fv(h.uniforms.viewMatrix, +false,y);b.uniformMatrix4fv(h.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(h.uniforms.projectionMatrix,false,s);b.uniformMatrix3fv(h.uniforms.normalMatrix,false,w);b.uniformMatrix4fv(h.uniforms.objectMatrix,false,H)};this.loadCamera=function(h,g){b.uniform3f(h.uniforms.cameraPosition,g.position.x,g.position.y,g.position.z)};this.setBlending=function(h){switch(h){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR, +b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(h,g){if(h){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(h=="back")b.cullFace(b.BACK);else h=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +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, 1.0 ), fogFactor );\n#endif", +envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\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\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 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, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"}; THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv", diff --git a/build/ThreeExtras.js b/build/ThreeExtras.js index acbb4c51..3a45d46f 100644 --- a/build/ThreeExtras.js +++ b/build/ThreeExtras.js @@ -1,67 +1,67 @@ // ThreeExtras.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; -THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* -this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0}; -THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, -cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-d*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= -a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+d*d+a*a)},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= +THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; +THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* +this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0}; +THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= +a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);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)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; -THREE.Vector4=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1}; -THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; -return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){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)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; -THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a0&&G>0&&t+G<1}var d,e,g,f,k,c,h,l,u,A, -p,n=a.geometry,v=n.vertices,D=[];d=0;for(e=n.faces.length;dh?e:h;g=g>l? -g:l}a()};this.add3Points=function(h,l,u,A,p,n){if(c){c=false;b=hu?h>p?h:p:u>p?u:p;g=l>A?l>n?l:n:A>n?A:n}else{b=hu?h>p?h>e?h:e:p>e?p:e:u>p?u>e?u:e:p>e?p:e;g=l>A?l>n?l>g?l:g:n>g?n:g:A>n?A>g?A:g:n>g?n:g}a()};this.addRectangle=function(h){if(c){c=false;b=h.getLeft();d=h.getTop();e=h.getRight();g=h.getBottom()}else{b=bh.getRight()?e:h.getRight();g=g>h.getBottom()?g:h.getBottom()}a()};this.inflate=function(h){b-=h;d-=h;e+=h;g+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e=0&&Math.min(g,h.getBottom())-Math.max(d,h.getTop())>=0};this.empty=function(){c=true;g=e=d=b=0;a()};this.isEmpty=function(){return c};this.toString= -function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+d+", bottom: "+g+", width: "+f+", height: "+k+" )"}};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}}; -THREE.Matrix4=function(a,b,d,e,g,f,k,c,h,l,u,A,p,n,v,D){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=f||1;this.n23=k||0;this.n24=c||0;this.n31=h||0;this.n32=l||0;this.n33=u||1;this.n34=A||0;this.n41=p||0;this.n42=n||0;this.n43=v||0;this.n44=D||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,g,f,k,c,h,l,u,A,p,n,v,D){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=f;this.n23=k;this.n24=c;this.n31=h;this.n32=l;this.n33=u;this.n34=A;this.n41=p;this.n42=n;this.n43=v;this.n44=D;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();e.cross(d,f).normalize();g.cross(f,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); -this.n31=f.x;this.n32=f.y;this.n33=f.z;this.n34=-f.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23* -e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;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 d=a.n11,e=a.n12,g=a.n13,f=a.n14,k=a.n21,c=a.n22,h=a.n23,l=a.n24,u=a.n31, -A=a.n32,p=a.n33,n=a.n34,v=a.n41,D=a.n42,G=a.n43,o=a.n44,I=b.n11,m=b.n12,j=b.n13,t=b.n14,C=b.n21,q=b.n22,B=b.n23,K=b.n24,w=b.n31,E=b.n32,F=b.n33,x=b.n34,z=b.n41,O=b.n42,L=b.n43,U=b.n44;this.n11=d*I+e*C+g*w+f*z;this.n12=d*m+e*q+g*E+f*O;this.n13=d*j+e*B+g*F+f*L;this.n14=d*t+e*K+g*x+f*U;this.n21=k*I+c*C+h*w+l*z;this.n22=k*m+c*q+h*E+l*O;this.n23=k*j+c*B+h*F+l*L;this.n24=k*t+c*K+h*x+l*U;this.n31=u*I+A*C+p*w+n*z;this.n32=u*m+A*q+p*E+n*O;this.n33=u*j+A*B+p*F+n*L;this.n34=u*t+A*K+p*x+n*U;this.n41=v*I+D*C+ -G*w+o*z;this.n42=v*m+D*q+G*E+o*O;this.n43=v*j+D*B+G*F+o*L;this.n44=v*t+D*K+G*x+o*U;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,f=this.n21,k=this.n22,c=this.n23,h=this.n24,l=this.n31,u=this.n32,A=this.n33,p=this.n34,n=this.n41,v=this.n42,D=this.n43,G=this.n44,o=a.n11,I=a.n21,m=a.n31,j=a.n41,t=a.n12,C=a.n22,q=a.n32,B=a.n42,K=a.n13,w=a.n23,E=a.n33,F=a.n43,x=a.n14,z=a.n24,O=a.n34;a=a.n44;this.n11=b*o+d*I+e*m+g*j;this.n12=b*t+d*C+e*q+g*B;this.n13=b*K+d*w+e*E+g* -F;this.n14=b*x+d*z+e*O+g*a;this.n21=f*o+k*I+c*m+h*j;this.n22=f*t+k*C+c*q+h*B;this.n23=f*K+k*w+c*E+h*F;this.n24=f*x+k*z+c*O+h*a;this.n31=l*o+u*I+A*m+p*j;this.n32=l*t+u*C+A*q+p*B;this.n33=l*K+u*w+A*E+p*F;this.n34=l*x+u*z+A*O+p*a;this.n41=n*o+v*I+D*m+G*j;this.n42=n*t+v*C+D*q+G*B;this.n43=n*K+v*w+D*E+G*F;this.n44=n*x+v*z+D*O+G*a;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,d=this.n13,e=this.n14,g=this.n21,f=this.n22,k=this.n23,c=this.n24,h=this.n31,l=this.n32,u=this.n33,A=this.n34,p=this.n41,n=this.n42,v=this.n43,D=this.n44;return e*k*l*p-d*c*l*p-e*f*u*p+b*c*u*p+d*f*A*p-b*k*A*p-e*k*h*n+d*c*h*n+e*g*u*n-a*c*u*n-d*g*A*n+a*k*A*n+e*f*h*v-b*c*h*v-e*g*l*v+a*c*l*v+b*g*A*v-a*f*A*v-d*f*h*D+b*k*h*D+d*g*l*D-a*k*l*D-b*g*u*D+a*f*u*D},transpose:function(){function a(b,d, -e){var g=b[d];b[d]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;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},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,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 d=Math.cos(b),e=Math.sin(b),g=1-d,f=a.x,k=a.y,c=a.z,h=g*f,l=g*k;this.set(h*f+d,h*k-e*c,h*c+e*k,0,h*k+e*c,l*k+d,l*c-e*f,0,h*c-e*k,l*c+e*f,g*c*c+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ -this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};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 d=new THREE.Matrix4;d.setRotAxis(a,b);return d}; -THREE.Matrix4.makeInvert=function(a){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,k=a.n22,c=a.n23,h=a.n24,l=a.n31,u=a.n32,A=a.n33,p=a.n34,n=a.n41,v=a.n42,D=a.n43,G=a.n44,o=new THREE.Matrix4;o.n11=c*p*v-h*A*v+h*u*D-k*p*D-c*u*G+k*A*G;o.n12=g*A*v-e*p*v-g*u*D+d*p*D+e*u*G-d*A*G;o.n13=e*h*v-g*c*v+g*k*D-d*h*D-e*k*G+d*c*G;o.n14=g*c*u-e*h*u-g*k*A+d*h*A+e*k*p-d*c*p;o.n21=h*A*n-c*p*n-h*l*D+f*p*D+c*l*G-f*A*G;o.n22=e*p*n-g*A*n+g*l*D-b*p*D-e*l*G+b*A*G;o.n23=g*c*n-e*h*n-g*f*D+b*h*D+e*f*G-b*c*G;o.n24=e*h*l-g*c*l+ -g*f*A-b*h*A-e*f*p+b*c*p;o.n31=k*p*n-h*u*n+h*l*v-f*p*v-k*l*G+f*u*G;o.n32=g*u*n-d*p*n-g*l*v+b*p*v+d*l*G-b*u*G;o.n33=e*h*n-g*k*n+g*f*v-b*h*v-d*f*G+b*k*G;o.n34=g*k*l-d*h*l-g*f*u+b*h*u+d*f*p-b*k*p;o.n41=c*u*n-k*A*n-c*l*v+f*A*v+k*l*D-f*u*D;o.n42=d*A*n-e*u*n+e*l*v-b*A*v-d*l*D+b*u*D;o.n43=e*k*n-d*c*n-e*f*v+b*c*v+d*f*D-b*k*D;o.n44=d*c*l-e*k*l+e*f*u-b*c*u-d*f*A+b*k*A;o.multiplyScalar(1/a.determinant());return o}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=a.m33;var d=a.m,e=b[10]*b[5]-b[6]*b[9],g=-b[10]*b[1]+b[2]*b[9],f=b[6]*b[1]-b[2]*b[5],k=-b[10]*b[4]+b[6]*b[8],c=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],l=b[9]*b[4]-b[5]*b[8],u=-b[9]*b[0]+b[1]*b[8],A=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*k+b[2]*l;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*e;d[1]=b*g;d[2]=b*f;d[3]=b*k;d[4]=b*c;d[5]=b*h;d[6]=b*l;d[7]=b*u;d[8]=b*A;return a}; -THREE.Matrix4.makeFrustum=function(a,b,d,e,g,f){var k,c,h;k=new THREE.Matrix4;c=2*g/(b-a);h=2*g/(e-d);a=(b+a)/(b-a);d=(e+d)/(e-d);e=-(f+g)/(f-g);g=-2*f*g/(f-g);k.n11=c;k.n12=0;k.n13=a;k.n14=0;k.n21=0;k.n22=h;k.n23=d;k.n24=0;k.n31=0;k.n32=0;k.n33=e;k.n34=g;k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)}; -THREE.Matrix4.makeOrtho=function(a,b,d,e,g,f){var k,c,h,l;k=new THREE.Matrix4;c=b-a;h=d-e;l=f-g;a=(b+a)/c;d=(d+e)/h;g=(f+g)/l;k.n11=2/c;k.n12=0;k.n13=0;k.n14=-a;k.n21=0;k.n22=2/h;k.n23=0;k.n24=-d;k.n31=0;k.n32=0;k.n33=-2/l;k.n34=-g;k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; -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=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,b,d,e,g){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=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,b,d,e,g,f){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=f instanceof Array?f:[f]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; +THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1}; +THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; +return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; +THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; +THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,g=[];a=0;for(c=e.length;a0&&F>0&&p+F<1}var d,e,g,b,k,j,h,n,v,x, +t,o=a.geometry,w=o.vertices,C=[];d=0;for(e=o.faces.length;dh?e:h;g=g>n? +g:n}a()};this.add3Points=function(h,n,v,x,t,o){if(j){j=false;c=hv?h>t?h:t:v>t?v:t;g=n>x?n>o?n:o:x>o?x:o}else{c=hv?h>t?h>e?h:e:t>e?t:e:v>t?v>e?v:e:t>e?t:e;g=n>x?n>o?n>g?n:g:o>g?o:g:x>o?x>g?x:g:o>g?o:g}a()};this.addRectangle=function(h){if(j){j=false;c=h.getLeft();d=h.getTop();e=h.getRight();g=h.getBottom()}else{c=ch.getRight()?e:h.getRight();g=g>h.getBottom()?g:h.getBottom()}a()};this.inflate=function(h){c-=h;d-=h;e+=h;g+=h;a()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e=0&&Math.min(g,h.getBottom())-Math.max(d,h.getTop())>=0};this.empty=function(){j=true;g=e=d=c=0;a()};this.isEmpty=function(){return j};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+g+", width: "+b+", height: "+k+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; +THREE.Matrix4=function(a,c,d,e,g,b,k,j,h,n,v,x,t,o,w,C){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=b||1;this.n23=k||0;this.n24=j||0;this.n31=h||0;this.n32=n||0;this.n33=v||1;this.n34=x||0;this.n41=t||0;this.n42=o||0;this.n43=w||0;this.n44=C||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,g,b,k,j,h,n,v,x,t,o,w,C){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=g;this.n22=b;this.n23=k;this.n24=j;this.n31=h;this.n32=n;this.n33=v;this.n34=x;this.n41=t;this.n42=o;this.n43=w;this.n44=C;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();g.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); +this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,g=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*c+this.n22*d+this.n23* +e+this.n24*g;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,g=a.n13,b=a.n14,k=a.n21,j=a.n22,h=a.n23,n=a.n24,v=a.n31, +x=a.n32,t=a.n33,o=a.n34,w=a.n41,C=a.n42,F=a.n43,q=a.n44,l=c.n11,f=c.n12,m=c.n13,p=c.n14,E=c.n21,y=c.n22,u=c.n23,G=c.n24,A=c.n31,J=c.n32,D=c.n33,z=c.n34,N=c.n41,X=c.n42,O=c.n43,T=c.n44;this.n11=d*l+e*E+g*A+b*N;this.n12=d*f+e*y+g*J+b*X;this.n13=d*m+e*u+g*D+b*O;this.n14=d*p+e*G+g*z+b*T;this.n21=k*l+j*E+h*A+n*N;this.n22=k*f+j*y+h*J+n*X;this.n23=k*m+j*u+h*D+n*O;this.n24=k*p+j*G+h*z+n*T;this.n31=v*l+x*E+t*A+o*N;this.n32=v*f+x*y+t*J+o*X;this.n33=v*m+x*u+t*D+o*O;this.n34=v*p+x*G+t*z+o*T;this.n41=w*l+C*E+ +F*A+q*N;this.n42=w*f+C*y+F*J+q*X;this.n43=w*m+C*u+F*D+q*O;this.n44=w*p+C*G+F*z+q*T;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,g=this.n14,b=this.n21,k=this.n22,j=this.n23,h=this.n24,n=this.n31,v=this.n32,x=this.n33,t=this.n34,o=this.n41,w=this.n42,C=this.n43,F=this.n44,q=a.n11,l=a.n21,f=a.n31,m=a.n41,p=a.n12,E=a.n22,y=a.n32,u=a.n42,G=a.n13,A=a.n23,J=a.n33,D=a.n43,z=a.n14,N=a.n24,X=a.n34;a=a.n44;this.n11=c*q+d*l+e*f+g*m;this.n12=c*p+d*E+e*y+g*u;this.n13=c*G+d*A+e*J+g* +D;this.n14=c*z+d*N+e*X+g*a;this.n21=b*q+k*l+j*f+h*m;this.n22=b*p+k*E+j*y+h*u;this.n23=b*G+k*A+j*J+h*D;this.n24=b*z+k*N+j*X+h*a;this.n31=n*q+v*l+x*f+t*m;this.n32=n*p+v*E+x*y+t*u;this.n33=n*G+v*A+x*J+t*D;this.n34=n*z+v*N+x*X+t*a;this.n41=o*q+w*l+C*f+F*m;this.n42=o*p+w*E+C*y+F*u;this.n43=o*G+w*A+C*J+F*D;this.n44=o*z+w*N+C*X+F*a;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,c=this.n12,d=this.n13,e=this.n14,g=this.n21,b=this.n22,k=this.n23,j=this.n24,h=this.n31,n=this.n32,v=this.n33,x=this.n34,t=this.n41,o=this.n42,w=this.n43,C=this.n44;return e*k*n*t-d*j*n*t-e*b*v*t+c*j*v*t+d*b*x*t-c*k*x*t-e*k*h*o+d*j*h*o+e*g*v*o-a*j*v*o-d*g*x*o+a*k*x*o+e*b*h*w-c*j*h*w-e*g*n*w+a*j*n*w+c*g*x*w-a*b*x*w-d*b*h*C+c*k*h*C+d*g*n*C-a*k*n*C-c*g*v*C+a*b*v*C},transpose:function(){function a(c,d, +e){var g=c[d];c[d]=c[e];c[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;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},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= +Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),g=1-d,b=a.x,k=a.y,j=a.z,h=g*b,n=g*k;this.set(h*b+d,h*k-e*j,h*j+e*k,0,h*k+e*j,n*k+d,n*j-e*b,0,h*j-e*k,n*j+e*b,g*j*j+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; +THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,b=a.n21,k=a.n22,j=a.n23,h=a.n24,n=a.n31,v=a.n32,x=a.n33,t=a.n34,o=a.n41,w=a.n42,C=a.n43,F=a.n44,q=new THREE.Matrix4;q.n11=j*t*w-h*x*w+h*v*C-k*t*C-j*v*F+k*x*F;q.n12=g*x*w-e*t*w-g*v*C+d*t*C+e*v*F-d*x*F;q.n13=e*h*w-g*j*w+g*k*C-d*h*C-e*k*F+d*j*F;q.n14=g*j*v-e*h*v-g*k*x+d*h*x+e*k*t-d*j*t;q.n21=h*x*o-j*t*o-h*n*C+b*t*C+j*n*F-b*x*F;q.n22=e*t*o-g*x*o+g*n*C-c*t*C-e*n*F+c*x*F;q.n23=g*j*o-e*h*o-g*b*C+c*h*C+e*b*F-c*j*F;q.n24=e*h*n-g*j*n+ +g*b*x-c*h*x-e*b*t+c*j*t;q.n31=k*t*o-h*v*o+h*n*w-b*t*w-k*n*F+b*v*F;q.n32=g*v*o-d*t*o-g*n*w+c*t*w+d*n*F-c*v*F;q.n33=e*h*o-g*k*o+g*b*w-c*h*w-d*b*F+c*k*F;q.n34=g*k*n-d*h*n-g*b*v+c*h*v+d*b*t-c*k*t;q.n41=j*v*o-k*x*o-j*n*w+b*x*w+k*n*C-b*v*C;q.n42=d*x*o-e*v*o+e*n*w-c*x*w-d*n*C+c*v*C;q.n43=e*k*o-d*j*o-e*b*w+c*j*w+d*b*C-c*k*C;q.n44=d*j*n-e*k*n+e*b*v-c*j*v-d*b*x+c*k*x;q.multiplyScalar(1/a.determinant());return q}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],g=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],k=-c[10]*c[4]+c[6]*c[8],j=c[10]*c[0]-c[2]*c[8],h=-c[6]*c[0]+c[2]*c[4],n=c[9]*c[4]-c[5]*c[8],v=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*k+c[2]*n;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*g;d[2]=c*b;d[3]=c*k;d[4]=c*j;d[5]=c*h;d[6]=c*n;d[7]=c*v;d[8]=c*x;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,e,g,b){var k,j,h;k=new THREE.Matrix4;j=2*g/(c-a);h=2*g/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+g)/(b-g);g=-2*b*g/(b-g);k.n11=j;k.n12=0;k.n13=a;k.n14=0;k.n21=0;k.n22=h;k.n23=d;k.n24=0;k.n31=0;k.n32=0;k.n33=e;k.n34=g;k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,c,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,c,d,e,g,b){var k,j,h,n;k=new THREE.Matrix4;j=c-a;h=d-e;n=b-g;a=(c+a)/j;d=(d+e)/h;g=(b+g)/n;k.n11=2/j;k.n12=0;k.n13=0;k.n14=-a;k.n21=0;k.n22=2/h;k.n23=0;k.n24=-d;k.n31=0;k.n32=0;k.n33=-2/n;k.n34=-g;k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; +THREE.Face3=function(a,c,d,e,g){this.a=a;this.b=c;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=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,d,e,g,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; -THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;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], -z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=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,d=this.vertices.length;b65535){l[c].counter+=1;h=l[c].hash+"_"+l[c].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:k,vertices:0}}this.geometryChunks[h].faces.push(e);this.geometryChunks[h].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+ +THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=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], +z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=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,c=0,d=this.vertices.length;c65535){n[j].counter+=1;h=n[j].hash+"_"+n[j].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:k,vertices:0}}this.geometryChunks[h].faces.push(e);this.geometryChunks[h].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,b,d,e){this.fov=a;this.aspect=b;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; -THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light; -THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; +THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; +THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; -THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,b=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(b.x);if(b.y!=0){e.setRotY(b.y);this.rotationMatrix.multiplySelf(e)}if(b.z!=0){e.setRotZ(b.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};THREE.Object3DCounter={value:0}; -THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.autoUpdateMatrix=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; -THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; +THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};THREE.Object3DCounter={value:0}; +THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.autoUpdateMatrix=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; +THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2; THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}}; THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
linewidth: "+this.linewidth+"
linecap: "+this.linecap+"
linejoin: "+this.linejoin+"
)"}}; @@ -89,102 +89,102 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}}; -THREE.Texture=function(a,b,d,e,g,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter}; +THREE.Texture=function(a,c,d,e,g,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; -THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var b,d,e,g={};for(b in a){g[b]={};for(d in a[b]){e=a[b][d];g[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,d,e,g={};for(b=0;b=0&&F>=0&&x>=0&&z>=0)return true;else if(E<0&&F<0||x<0&&z<0)return false;else{if(E<0)K=Math.max(K,E/(E-F));else if(F<0)w=Math.min(w,E/(E-F));if(x<0)K=Math.max(K,x/(x-z));else if(z<0)w=Math.min(w,x/(x-z));if(wE&&L.z0&&G.z<1){p=v[n]=v[n]||new THREE.RenderableParticle;p.x=G.x/G.w;p.y=G.y/G.w;p.z=G.z;p.rotation=P.rotation.z;p.scale.x=P.scale.x*Math.abs(p.x-(G.x+B.projectionMatrix.n11)/(G.w+B.projectionMatrix.n14)); -p.scale.y=P.scale.y*Math.abs(p.y-(G.y+B.projectionMatrix.n22)/(G.w+B.projectionMatrix.n24));p.materials=P.materials;w.push(p);n++}}}}K&&w.sort(a);return w};this.unprojectVector=function(q,B){var K=THREE.Matrix4.makeInvert(B.matrix);K.multiplySelf(THREE.Matrix4.makeInvert(B.projectionMatrix));K.multiplyVector3(q);return q}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,g,f;this.domElement=document.createElement("div");this.setSize=function(k,c){d=k;e=c;g=d/2;f=e/2};this.render=function(k,c){var h,l,u,A,p,n,v,D;a=b.projectScene(k,c);h=0;for(l=a.length;h0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}else if(fa instanceof THREE.PointLight){J.sub(fa.position,ea);J.normalize();fa=aa.dot(J)*na;if(fa>0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}}}function Qa(N,ea,aa){if(aa.opacity!=0){a(aa.opacity); -b(aa.blending);var Q,$,fa,la,na,oa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map){la=aa.map;na=la.width>>1;oa=la.height>>1;$=ea.scale.x*c;fa=ea.scale.y*h;aa=$*na;Q=fa*oa;H.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(H)){l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale($,-fa);l.translate(-na,-oa);l.drawImage(la,0,0);l.restore()}}}else if(aa instanceof THREE.ParticleCircleMaterial){if(S){V.r=ia.r+ha.r+y.r;V.g=ia.g+ha.g+y.g;V.b=ia.b+ha.b+y.b;w.r=aa.color.r*V.r;w.g=aa.color.g* -V.g;w.b=aa.color.b*V.b;w.updateStyleString()}else w.__styleString=aa.color.__styleString;aa=ea.scale.x*c;Q=ea.scale.y*h;H.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(H)){$=w.__styleString;if(D!=$)l.fillStyle=D=$;l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale(aa,Q);l.beginPath();l.arc(0,0,1,0,M,true);l.closePath();l.fill();l.restore()}}}}function Ra(N,ea,aa,Q){if(Q.opacity!=0){a(Q.opacity);b(Q.blending);l.beginPath();l.moveTo(N.positionScreen.x,N.positionScreen.y);l.lineTo(ea.positionScreen.x, -ea.positionScreen.y);l.closePath();if(Q instanceof THREE.LineBasicMaterial){w.__styleString=Q.color.__styleString;N=Q.linewidth;if(G!=N)l.lineWidth=G=N;N=w.__styleString;if(v!=N)l.strokeStyle=v=N;l.stroke();H.inflate(Q.linewidth*2)}}}function La(N,ea,aa,Q,$,fa){if($.opacity!=0){a($.opacity);b($.blending);j=N.positionScreen.x;t=N.positionScreen.y;C=ea.positionScreen.x;q=ea.positionScreen.y;B=aa.positionScreen.x;K=aa.positionScreen.y;l.beginPath();l.moveTo(j,t);l.lineTo(C,q);l.lineTo(B,K);l.lineTo(j, -t);l.closePath();if($ instanceof THREE.MeshBasicMaterial)if($.map)$.map.image.loaded&&$.map.mapping instanceof THREE.UVMapping&&Aa(j,t,C,q,B,K,$.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);else if($.env_map){if($.env_map.image.loaded)if($.env_map.mapping instanceof THREE.SphericalReflectionMapping){N=wa.matrix;J.copy(Q.vertexNormalsWorld[0]);W=(J.x*N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;P=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;J.copy(Q.vertexNormalsWorld[1]);da=(J.x* -N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;X=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;J.copy(Q.vertexNormalsWorld[2]);R=(J.x*N.n11+J.y*N.n12+J.z*N.n13)*0.5+0.5;T=-(J.x*N.n21+J.y*N.n22+J.z*N.n23)*0.5+0.5;Aa(j,t,C,q,B,K,$.env_map.image,W,P,da,X,R,T)}}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){$.map.mapping instanceof THREE.UVMapping&&Aa(j,t,C,q,B,K,$.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u, -Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);b(THREE.SubtractiveBlending)}if(S)if(!$.wireframe&&$.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){E.r=F.r=x.r=ia.r;E.g=F.g=x.g=ia.g;E.b=F.b=x.b=ia.b;Da(fa,Q.v1.positionWorld,Q.vertexNormalsWorld[0],E);Da(fa,Q.v2.positionWorld,Q.vertexNormalsWorld[1],F);Da(fa,Q.v3.positionWorld,Q.vertexNormalsWorld[2],x);z.r=(F.r+x.r)*0.5;z.g=(F.g+x.g)*0.5;z.b=(F.b+x.b)*0.5;U=Ma(E,F,x,z);Aa(j,t,C,q,B,K,U,0,0,1,0,0,1)}else{V.r=ia.r;V.g=ia.g;V.b=ia.b;Da(fa,Q.centroidWorld, -Q.normalWorld,V);w.r=$.color.r*V.r;w.g=$.color.g*V.g;w.b=$.color.b*V.b;w.updateStyleString();$.wireframe?Ea(w.__styleString,$.wireframe_linewidth):Fa(w.__styleString)}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){O=wa.near;L=wa.far;E.r=E.g=E.b=1-Ha(N.positionScreen.z,O,L);F.r=F.g=F.b=1-Ha(ea.positionScreen.z,O,L);x.r=x.g=x.b=1-Ha(aa.positionScreen.z,O,L);z.r=(F.r+x.r)*0.5;z.g=(F.g+x.g)*0.5;z.b=(F.b+x.b)*0.5; -U=Ma(E,F,x,z);Aa(j,t,C,q,B,K,U,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){w.r=Ia(Q.normalWorld.x);w.g=Ia(Q.normalWorld.y);w.b=Ia(Q.normalWorld.z);w.updateStyleString();$.wireframe?Ea(w.__styleString,$.wireframe_linewidth):Fa(w.__styleString)}}}function Ea(N,ea){if(v!=N)l.strokeStyle=v=N;if(G!=ea)l.lineWidth=G=ea;l.stroke();H.inflate(ea*2)}function Fa(N){if(D!=N)l.fillStyle=D=N;l.fill()}function Aa(N,ea,aa,Q,$,fa,la,na,oa,ta,pa,ua,Ba){var xa,va;xa=la.width-1;va=la.height-1;na*=xa; -oa*=va;ta*=xa;pa*=va;ua*=xa;Ba*=va;aa-=N;Q-=ea;$-=N;fa-=ea;ta-=na;pa-=oa;ua-=na;Ba-=oa;va=1/(ta*Ba-ua*pa);xa=(Ba*aa-pa*$)*va;pa=(Ba*Q-pa*fa)*va;aa=(ta*$-ua*aa)*va;Q=(ta*fa-ua*Q)*va;N=N-xa*na-aa*oa;ea=ea-pa*na-Q*oa;l.save();l.transform(xa,pa,aa,Q,N,ea);l.clip();l.drawImage(la,0,0);l.restore()}function Ma(N,ea,aa,Q){var $=~~(N.r*255),fa=~~(N.g*255);N=~~(N.b*255);var la=~~(ea.r*255),na=~~(ea.g*255);ea=~~(ea.b*255);var oa=~~(aa.r*255),ta=~~(aa.g*255);aa=~~(aa.b*255);var pa=~~(Q.r*255),ua=~~(Q.g*255); -Q=~~(Q.b*255);ja[0]=$<0?0:$>255?255:$;ja[1]=fa<0?0:fa>255?255:fa;ja[2]=N<0?0:N>255?255:N;ja[4]=la<0?0:la>255?255:la;ja[5]=na<0?0:na>255?255:na;ja[6]=ea<0?0:ea>255?255:ea;ja[8]=oa<0?0:oa>255?255:oa;ja[9]=ta<0?0:ta>255?255:ta;ja[10]=aa<0?0:aa>255?255:aa;ja[12]=pa<0?0:pa>255?255:pa;ja[13]=ua<0?0:ua>255?255:ua;ja[14]=Q<0?0:Q>255?255:Q;ca.putImageData(ga,0,0);sa.drawImage(Z,0,0);return qa}function Ha(N,ea,aa){N=(N-ea)/(aa-ea);return N*N*(3-2*N)}function Ia(N){N=(N+1)*0.5;return N<0?0:N>1?1:N}function Ja(N, -ea){var aa=ea.x-N.x,Q=ea.y-N.y,$=1/Math.sqrt(aa*aa+Q*Q);aa*=$;Q*=$;ea.x+=aa;ea.y+=Q;N.x-=aa;N.y-=Q}var Ga,Na,ka,ra,za,Ka,Oa,Ca;l.setTransform(1,0,0,-1,c,h);this.autoClear&&this.clear();d=e.projectScene(ma,wa,this.sortElements);(S=ma.lights.length>0)&&Pa(ma);Ga=0;for(Na=d.length;Ga=0&&D>=0&&z>=0&&N>=0)return true;else if(J<0&&D<0||z<0&&N<0)return false;else{if(J<0)G=Math.max(G,J/(J-D));else if(D<0)A=Math.min(A,J/(J-D));if(z<0)G=Math.max(G,z/(z-N));else if(N<0)A=Math.min(A,z/(z-N));if(AJ&&O.z0&&F.z<1){t=w[o]=w[o]||new THREE.RenderableParticle;t.x=F.x/F.w;t.y=F.y/F.w;t.z=F.z;t.rotation=K.rotation.z;t.scale.x=K.scale.x*Math.abs(t.x-(F.x+u.projectionMatrix.n11)/(F.w+u.projectionMatrix.n14)); +t.scale.y=K.scale.y*Math.abs(t.y-(F.y+u.projectionMatrix.n22)/(F.w+u.projectionMatrix.n24));t.materials=K.materials;A.push(t);o++}}}}G&&A.sort(a);return A};this.unprojectVector=function(y,u){var G=THREE.Matrix4.makeInvert(u.matrix);G.multiplySelf(THREE.Matrix4.makeInvert(u.projectionMatrix));G.multiplyVector3(y);return y}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,g,b;this.domElement=document.createElement("div");this.setSize=function(k,j){d=k;e=j;g=d/2;b=e/2};this.render=function(k,j){var h,n,v,x,t,o,w,C;a=c.projectScene(k,j);h=0;for(n=a.length;h0){P.r+=ka.r*ga;P.g+=ka.g*ga;P.b+=ka.b*ga}}else if(ga instanceof THREE.PointLight){I.sub(ga.position,ea);I.normalize();ga=ba.dot(I)*na;if(ga>0){P.r+=ka.r*ga;P.g+=ka.g*ga;P.b+=ka.b*ga}}}}function Qa(M,ea,ba){if(ba.opacity!=0){a(ba.opacity); +c(ba.blending);var P,Y,ga,ka,na,oa;if(ba instanceof THREE.ParticleBasicMaterial){if(ba.map){ka=ba.map;na=ka.width>>1;oa=ka.height>>1;Y=ea.scale.x*j;ga=ea.scale.y*h;ba=Y*na;P=ga*oa;H.set(M.x-ba,M.y-P,M.x+ba,M.y+P);if(S.instersects(H)){n.save();n.translate(M.x,M.y);n.rotate(-ea.rotation);n.scale(Y,-ga);n.translate(-na,-oa);n.drawImage(ka,0,0);n.restore()}}}else if(ba instanceof THREE.ParticleCircleMaterial){if(W){$.r=ca.r+ha.r+B.r;$.g=ca.g+ha.g+B.g;$.b=ca.b+ha.b+B.b;A.r=ba.color.r*$.r;A.g=ba.color.g* +$.g;A.b=ba.color.b*$.b;A.updateStyleString()}else A.__styleString=ba.color.__styleString;ba=ea.scale.x*j;P=ea.scale.y*h;H.set(M.x-ba,M.y-P,M.x+ba,M.y+P);if(S.instersects(H)){Y=A.__styleString;if(C!=Y)n.fillStyle=C=Y;n.save();n.translate(M.x,M.y);n.rotate(-ea.rotation);n.scale(ba,P);n.beginPath();n.arc(0,0,1,0,L,true);n.closePath();n.fill();n.restore()}}}}function Ra(M,ea,ba,P){if(P.opacity!=0){a(P.opacity);c(P.blending);n.beginPath();n.moveTo(M.positionScreen.x,M.positionScreen.y);n.lineTo(ea.positionScreen.x, +ea.positionScreen.y);n.closePath();if(P instanceof THREE.LineBasicMaterial){A.__styleString=P.color.__styleString;M=P.linewidth;if(F!=M)n.lineWidth=F=M;M=A.__styleString;if(w!=M)n.strokeStyle=w=M;n.stroke();H.inflate(P.linewidth*2)}}}function La(M,ea,ba,P,Y,ga){if(Y.opacity!=0){a(Y.opacity);c(Y.blending);m=M.positionScreen.x;p=M.positionScreen.y;E=ea.positionScreen.x;y=ea.positionScreen.y;u=ba.positionScreen.x;G=ba.positionScreen.y;n.beginPath();n.moveTo(m,p);n.lineTo(E,y);n.lineTo(u,G);n.lineTo(m, +p);n.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Aa(m,p,E,y,u,G,Y.map.image,P.uvs[0].u,P.uvs[0].v,P.uvs[1].u,P.uvs[1].v,P.uvs[2].u,P.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){M=va.matrix;I.copy(P.vertexNormalsWorld[0]);aa=(I.x*M.n11+I.y*M.n12+I.z*M.n13)*0.5+0.5;K=-(I.x*M.n21+I.y*M.n22+I.z*M.n23)*0.5+0.5;I.copy(P.vertexNormalsWorld[1]);Z=(I.x* +M.n11+I.y*M.n12+I.z*M.n13)*0.5+0.5;fa=-(I.x*M.n21+I.y*M.n22+I.z*M.n23)*0.5+0.5;I.copy(P.vertexNormalsWorld[2]);U=(I.x*M.n11+I.y*M.n12+I.z*M.n13)*0.5+0.5;Q=-(I.x*M.n21+I.y*M.n22+I.z*M.n23)*0.5+0.5;Aa(m,p,E,y,u,G,Y.env_map.image,aa,K,Z,fa,U,Q)}}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&!Y.wireframe){Y.map.mapping instanceof THREE.UVMapping&&Aa(m,p,E,y,u,G,Y.map.image,P.uvs[0].u,P.uvs[0].v,P.uvs[1].u, +P.uvs[1].v,P.uvs[2].u,P.uvs[2].v);c(THREE.SubtractiveBlending)}if(W)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&P.vertexNormalsWorld.length==3){J.r=D.r=z.r=ca.r;J.g=D.g=z.g=ca.g;J.b=D.b=z.b=ca.b;Da(ga,P.v1.positionWorld,P.vertexNormalsWorld[0],J);Da(ga,P.v2.positionWorld,P.vertexNormalsWorld[1],D);Da(ga,P.v3.positionWorld,P.vertexNormalsWorld[2],z);N.r=(D.r+z.r)*0.5;N.g=(D.g+z.g)*0.5;N.b=(D.b+z.b)*0.5;T=Ma(J,D,z,N);Aa(m,p,E,y,u,G,T,0,0,1,0,0,1)}else{$.r=ca.r;$.g=ca.g;$.b=ca.b;Da(ga,P.centroidWorld, +P.normalWorld,$);A.r=Y.color.r*$.r;A.g=Y.color.g*$.g;A.b=Y.color.b*$.b;A.updateStyleString();Y.wireframe?Ea(A.__styleString,Y.wireframe_linewidth):Fa(A.__styleString)}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){X=va.near;O=va.far;J.r=J.g=J.b=1-Ha(M.positionScreen.z,X,O);D.r=D.g=D.b=1-Ha(ea.positionScreen.z,X,O);z.r=z.g=z.b=1-Ha(ba.positionScreen.z,X,O);N.r=(D.r+z.r)*0.5;N.g=(D.g+z.g)*0.5;N.b=(D.b+z.b)*0.5; +T=Ma(J,D,z,N);Aa(m,p,E,y,u,G,T,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){A.r=Ia(P.normalWorld.x);A.g=Ia(P.normalWorld.y);A.b=Ia(P.normalWorld.z);A.updateStyleString();Y.wireframe?Ea(A.__styleString,Y.wireframe_linewidth):Fa(A.__styleString)}}}function Ea(M,ea){if(w!=M)n.strokeStyle=w=M;if(F!=ea)n.lineWidth=F=ea;n.stroke();H.inflate(ea*2)}function Fa(M){if(C!=M)n.fillStyle=C=M;n.fill()}function Aa(M,ea,ba,P,Y,ga,ka,na,oa,ra,pa,sa,Ba){var xa,ta;xa=ka.width-1;ta=ka.height-1;na*=xa; +oa*=ta;ra*=xa;pa*=ta;sa*=xa;Ba*=ta;ba-=M;P-=ea;Y-=M;ga-=ea;ra-=na;pa-=oa;sa-=na;Ba-=oa;ta=1/(ra*Ba-sa*pa);xa=(Ba*ba-pa*Y)*ta;pa=(Ba*P-pa*ga)*ta;ba=(ra*Y-sa*ba)*ta;P=(ra*ga-sa*P)*ta;M=M-xa*na-ba*oa;ea=ea-pa*na-P*oa;n.save();n.transform(xa,pa,ba,P,M,ea);n.clip();n.drawImage(ka,0,0);n.restore()}function Ma(M,ea,ba,P){var Y=~~(M.r*255),ga=~~(M.g*255);M=~~(M.b*255);var ka=~~(ea.r*255),na=~~(ea.g*255);ea=~~(ea.b*255);var oa=~~(ba.r*255),ra=~~(ba.g*255);ba=~~(ba.b*255);var pa=~~(P.r*255),sa=~~(P.g*255); +P=~~(P.b*255);ia[0]=Y<0?0:Y>255?255:Y;ia[1]=ga<0?0:ga>255?255:ga;ia[2]=M<0?0:M>255?255:M;ia[4]=ka<0?0:ka>255?255:ka;ia[5]=na<0?0:na>255?255:na;ia[6]=ea<0?0:ea>255?255:ea;ia[8]=oa<0?0:oa>255?255:oa;ia[9]=ra<0?0:ra>255?255:ra;ia[10]=ba<0?0:ba>255?255:ba;ia[12]=pa<0?0:pa>255?255:pa;ia[13]=sa<0?0:sa>255?255:sa;ia[14]=P<0?0:P>255?255:P;da.putImageData(ma,0,0);wa.drawImage(R,0,0);return ua}function Ha(M,ea,ba){M=(M-ea)/(ba-ea);return M*M*(3-2*M)}function Ia(M){M=(M+1)*0.5;return M<0?0:M>1?1:M}function Ja(M, +ea){var ba=ea.x-M.x,P=ea.y-M.y,Y=1/Math.sqrt(ba*ba+P*P);ba*=Y;P*=Y;ea.x+=ba;ea.y+=P;M.x-=ba;M.y-=P}var Ga,Na,ja,qa,za,Ka,Oa,Ca;n.setTransform(1,0,0,-1,j,h);this.autoClear&&this.clear();d=e.projectScene(la,va,this.sortElements);(W=la.lights.length>0)&&Pa(la);Ga=0;for(Na=d.length;Ga0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}else if(T instanceof THREE.PointLight){K.sub(T.position,P.centroidWorld);K.normalize();ba=P.normalWorld.dot(K)*T.intensity;if(ba>0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}}}function b(W,P,da,X,R,T){x=e(z++);x.setAttribute("d", -"M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)m.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(I){j.r=t.r;j.g=t.g;j.b=t.b;a(T,X,j);m.r=R.color.r*j.r;m.g=R.color.g*j.g;m.b=R.color.b*j.b;m.updateStyleString()}else m.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshDepthMaterial){B=1-R.__2near/(R.__farPlusNear- -X.z*R.__farMinusNear);m.setRGB(B,B,B)}else R instanceof THREE.MeshNormalMaterial&&m.setRGB(g(X.normalWorld.x),g(X.normalWorld.y),g(X.normalWorld.z));R.wireframe?x.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):x.setAttribute("style","fill: "+m.__styleString+"; fill-opacity: "+R.opacity);c.appendChild(x)}function d(W,P,da,X,R,T,ba){x= -e(z++);x.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(T instanceof THREE.MeshBasicMaterial)m.__styleString=T.color.__styleString;else if(T instanceof THREE.MeshLambertMaterial)if(I){j.r=t.r;j.g=t.g;j.b=t.b;a(ba,R,j);m.r=T.color.r*j.r;m.g=T.color.g*j.g;m.b=T.color.b*j.b;m.updateStyleString()}else m.__styleString=T.color.__styleString; -else if(T instanceof THREE.MeshDepthMaterial){B=1-T.__2near/(T.__farPlusNear-R.z*T.__farMinusNear);m.setRGB(B,B,B)}else T instanceof THREE.MeshNormalMaterial&&m.setRGB(g(R.normalWorld.x),g(R.normalWorld.y),g(R.normalWorld.z));T.wireframe?x.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+T.wireframe_linewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.wireframe_linecap+"; stroke-linejoin: "+T.wireframe_linejoin):x.setAttribute("style","fill: "+m.__styleString+ -"; fill-opacity: "+T.opacity);c.appendChild(x)}function e(W){if(w[W]==null){w[W]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&w[W].setAttribute("shape-rendering","crispEdges");return w[W]}return w[W]}function g(W){return W<0?Math.min((1+W)*0.5,0.5):0.5+Math.min(W*0.5,0.5)}var f=null,k=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,l,u,A,p,n,v,D,G=new THREE.Rectangle,o=new THREE.Rectangle,I=false,m=new THREE.Color(16777215),j=new THREE.Color(16777215), -t=new THREE.Color(0),C=new THREE.Color(0),q=new THREE.Color(0),B,K=new THREE.Vector3,w=[],E=[],F=[],x,z,O,L,U=1;this.domElement=c;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(W){switch(W){case "high":U=1;break;case "low":U=0}};this.setSize=function(W,P){h=W;l=P;u=h/2;A=l/2;c.setAttribute("viewBox",-u+" "+-A+" "+h+" "+l);c.setAttribute("width",h);c.setAttribute("height",l);G.set(-u,-A,u,A)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])}; -this.render=function(W,P){var da,X,R,T,ba,Y,H,S;this.autoClear&&this.clear();f=k.projectScene(W,P,this.sortElements);L=O=z=0;if(I=W.lights.length>0){H=W.lights;t.setRGB(0,0,0);C.setRGB(0,0,0);q.setRGB(0,0,0);da=0;for(X=H.length;da0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,ia,C)}if(B){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, -j.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,M,C);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,J,C)}};this.setLineBuffers=function(j,t,C,q){var B,K,w=j.vertices,E=w.length,F=j.__vertexArray,x=j.__lineArray;if(C)for(C=0;C0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights, -x.map?"#define USE_MAP":"",x.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");c.attachShader(O,g("fragment",L+E));c.attachShader(O,g("vertex",x+z));c.linkProgram(O);c.getProgramParameter(O,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+ -c.getProgramParameter(O,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");O.uniforms={};O.attributes={};q.program=O;E=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(w in q.uniforms)E.push(w);w=q.program;z=0;for(O=E.length;z=0){c.bindBuffer(c.ARRAY_BUFFER,B.__webGLNormalBuffer);c.vertexAttribPointer(F.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.normal)}if(F.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,B.__webGLTangentBuffer); -c.vertexAttribPointer(F.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.tangent)}if(F.uv>=0)if(B.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,B.__webGLUVBuffer);c.vertexAttribPointer(F.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.uv)}else c.disableVertexAttribArray(F.uv);if(q.wireframe||q instanceof THREE.LineBasicMaterial){F=q.wireframe_linewidth!==undefined?q.wireframe_linewidth:q.linewidth!==undefined?q.linewidth:1;q=q instanceof THREE.LineBasicMaterial&&K.type==THREE.LineStrip? -c.LINE_STRIP:c.LINES;c.lineWidth(F);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);c.drawElements(q,B.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,B.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(j,t,C,q,B,K,w){var E,F,x,z,O;x=0;for(z=q.materials.length;x=0;C--){q=j.__webGLObjects[C].object;t==q&&j.__webGLObjects.splice(C,1)}};this.setupMatrices=function(j,t){j.autoUpdateMatrix&& -j.updateMatrix();u.multiply(t.matrix,j.matrix);n.set(u.flatten());A=THREE.Matrix4.makeInvert3x3(u).transpose();D.set(A.m);G.set(j.matrix.flatten())};this.loadMatrices=function(j){c.uniformMatrix4fv(j.uniforms.viewMatrix,false,p);c.uniformMatrix4fv(j.uniforms.modelViewMatrix,false,n);c.uniformMatrix4fv(j.uniforms.projectionMatrix,false,v);c.uniformMatrix3fv(j.uniforms.normalMatrix,false,D);c.uniformMatrix4fv(j.uniforms.objectMatrix,false,G)};this.loadCamera=function(j,t){c.uniform3f(j.uniforms.cameraPosition, -t.position.x,t.position.y,t.position.z)};this.setBlending=function(j){switch(j){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(j,t){if(j){!t||t=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(j=="back")c.cullFace(c.BACK);else j=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK); -c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +THREE.SVGRenderer=function(){function a(aa,K,Z){var fa,U,Q,S;fa=0;for(U=aa.lights.length;fa0){Z.r+=Q.color.r*S;Z.g+=Q.color.g*S;Z.b+=Q.color.b*S}}else if(Q instanceof THREE.PointLight){G.sub(Q.position,K.centroidWorld);G.normalize();S=K.normalWorld.dot(G)*Q.intensity;if(S>0){Z.r+=Q.color.r*S;Z.g+=Q.color.g*S;Z.b+=Q.color.b*S}}}}function c(aa,K,Z,fa,U,Q){z=e(N++);z.setAttribute("d","M "+ +aa.positionScreen.x+" "+aa.positionScreen.y+" L "+K.positionScreen.x+" "+K.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");if(U instanceof THREE.MeshBasicMaterial)f.__styleString=U.color.__styleString;else if(U instanceof THREE.MeshLambertMaterial)if(l){m.r=p.r;m.g=p.g;m.b=p.b;a(Q,fa,m);f.r=U.color.r*m.r;f.g=U.color.g*m.g;f.b=U.color.b*m.b;f.updateStyleString()}else f.__styleString=U.color.__styleString;else if(U instanceof THREE.MeshDepthMaterial){u=1-U.__2near/(U.__farPlusNear- +fa.z*U.__farMinusNear);f.setRGB(u,u,u)}else U instanceof THREE.MeshNormalMaterial&&f.setRGB(g(fa.normalWorld.x),g(fa.normalWorld.y),g(fa.normalWorld.z));U.wireframe?z.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+U.wireframe_linewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.wireframe_linecap+"; stroke-linejoin: "+U.wireframe_linejoin):z.setAttribute("style","fill: "+f.__styleString+"; fill-opacity: "+U.opacity);j.appendChild(z)}function d(aa,K,Z,fa,U, +Q,S){z=e(N++);z.setAttribute("d","M "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+K.positionScreen.x+" "+K.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");if(Q instanceof THREE.MeshBasicMaterial)f.__styleString=Q.color.__styleString;else if(Q instanceof THREE.MeshLambertMaterial)if(l){m.r=p.r;m.g=p.g;m.b=p.b;a(S,U,m);f.r=Q.color.r*m.r;f.g=Q.color.g*m.g;f.b=Q.color.b*m.b;f.updateStyleString()}else f.__styleString=Q.color.__styleString; +else if(Q instanceof THREE.MeshDepthMaterial){u=1-Q.__2near/(Q.__farPlusNear-U.z*Q.__farMinusNear);f.setRGB(u,u,u)}else Q instanceof THREE.MeshNormalMaterial&&f.setRGB(g(U.normalWorld.x),g(U.normalWorld.y),g(U.normalWorld.z));Q.wireframe?z.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+Q.wireframe_linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.wireframe_linecap+"; stroke-linejoin: "+Q.wireframe_linejoin):z.setAttribute("style","fill: "+f.__styleString+ +"; fill-opacity: "+Q.opacity);j.appendChild(z)}function e(aa){if(A[aa]==null){A[aa]=document.createElementNS("http://www.w3.org/2000/svg","path");T==0&&A[aa].setAttribute("shape-rendering","crispEdges");return A[aa]}return A[aa]}function g(aa){return aa<0?Math.min((1+aa)*0.5,0.5):0.5+Math.min(aa*0.5,0.5)}var b=null,k=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,n,v,x,t,o,w,C,F=new THREE.Rectangle,q=new THREE.Rectangle,l=false,f=new THREE.Color(16777215),m=new THREE.Color(16777215), +p=new THREE.Color(0),E=new THREE.Color(0),y=new THREE.Color(0),u,G=new THREE.Vector3,A=[],J=[],D=[],z,N,X,O,T=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(aa){switch(aa){case "high":T=1;break;case "low":T=0}};this.setSize=function(aa,K){h=aa;n=K;v=h/2;x=n/2;j.setAttribute("viewBox",-v+" "+-x+" "+h+" "+n);j.setAttribute("width",h);j.setAttribute("height",n);F.set(-v,-x,v,x)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])}; +this.render=function(aa,K){var Z,fa,U,Q,S,V,H,W;this.autoClear&&this.clear();b=k.projectScene(aa,K,this.sortElements);O=X=N=0;if(l=aa.lights.length>0){H=aa.lights;p.setRGB(0,0,0);E.setRGB(0,0,0);y.setRGB(0,0,0);Z=0;for(fa=H.length;Z0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER, +W,m)}if(E){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ha,m);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,B,m)}};this.setLineBuffers=function(l,f,m,p){var E,y,u=l.vertices,G=u.length,A=l.__vertexArray,J=l.__lineArray;if(m)for(m=0;m0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+y.maxDirLights,"#define MAX_POINT_LIGHTS "+y.maxPointLights,y.map?"#define USE_MAP":"",y.env_map? +"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");b.attachShader(m,d("fragment",E+A));b.attachShader(m,d("vertex",y+f));b.linkProgram(m);b.getProgramParameter(m,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(m,b.VALIDATE_STATUS)+ +", gl error ["+b.getError()+"]");m.uniforms={};m.attributes={};l.program=m;m=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(p in l.uniforms)m.push(p);p=l.program;A=0;for(f=m.length;A=0){b.bindBuffer(b.ARRAY_BUFFER,E.__webGLNormalBuffer);b.vertexAttribPointer(u.normal, +3,b.FLOAT,false,0,0);b.enableVertexAttribArray(u.normal)}if(u.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,E.__webGLTangentBuffer);b.vertexAttribPointer(u.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(u.tangent)}if(u.uv>=0)if(E.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,E.__webGLUVBuffer);b.vertexAttribPointer(u.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(u.uv)}else b.disableVertexAttribArray(u.uv);if(p.wireframe||p instanceof THREE.LineBasicMaterial){u=p.wireframe_linewidth!==undefined? +p.wireframe_linewidth:p.linewidth!==undefined?p.linewidth:1;p=p instanceof THREE.LineBasicMaterial&&y.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(u);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,E.__webGLLineBuffer);b.drawElements(p,E.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,E.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,E.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(l,f,m,p,E,y,u){var G,A,J,D,z;J=0;for(D=p.materials.length;J=0;m--){p= +l.__webGLObjects[m].object;f==p&&l.__webGLObjects.splice(m,1)}};this.setupMatrices=function(l,f){l.autoUpdateMatrix&&l.updateMatrix();h.multiply(f.matrix,l.matrix);x.set(h.flatten());n=THREE.Matrix4.makeInvert3x3(h).transpose();o.set(n.m);w.set(l.matrix.flatten())};this.loadMatrices=function(l){b.uniformMatrix4fv(l.uniforms.viewMatrix,false,v);b.uniformMatrix4fv(l.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(l.uniforms.projectionMatrix,false,t);b.uniformMatrix3fv(l.uniforms.normalMatrix,false, +o);b.uniformMatrix4fv(l.uniforms.objectMatrix,false,w)};this.loadCamera=function(l,f){b.uniform3f(l.uniforms.cameraPosition,f.position.x,f.position.y,f.position.z)};this.setBlending=function(l){switch(l){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(l,f){if(l){!f||f=="ccw"?b.frontFace(b.CCW): +b.frontFace(b.CW);if(l=="back")b.cullFace(b.BACK);else l=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; 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, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\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\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", @@ -201,63 +201,63 @@ shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform "gl_FragColor = mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;", THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]}; THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null}; -var GeometryUtils={merge:function(a,b){var d=b instanceof THREE.Mesh,e=a.vertices.length,g=d?b.geometry:b,f=a.vertices,k=g.vertices,c=a.faces,h=g.faces,l=a.uvs;g=g.uvs;d&&b.autoUpdateMatrix&&b.updateMatrix();for(var u=0,A=k.length;u= 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}", vertex_shader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"}, cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},basic:{uniforms:{}, -vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"void main() {\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\n}"}}},Cube=function(a,b,d,e,g,f,k,c){function h(D,G,o,I,m,j,t,C){var q,B,K=e||1,w=g||1,E=K+1,F=w+1,x=m/2,z=j/2;m=m/K;var O=j/w,L=l.vertices.length;if(D=="x"&&G=="y"||D=="y"&&G=="x")q="z";else if(D=="x"&&G=="z"||D=="z"&&G=="x")q="y";else if(D=="z"&&G=="y"||D=="y"&&G=="z")q="x";for(B=0;B0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(A,c,p)))-1);l.push(u)}b.push(l)}var n,v,D;g=b.length;for(d=0;d0)for(e=0;e1){n=this.vertices[k].position.clone(); -v=this.vertices[h].position.clone();D=this.vertices[l].position.clone();n.normalize();v.normalize();D.normalize();this.faces.push(new THREE.Face3(k,h,l,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(D.x,D.y,D.z)]));this.uvs.push([u,A,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; -var Torus=function(a,b,d,e){this.radius=a||100;this.tube=b||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(d=0;d<=this.segmentsT;++d){e=d/this.segmentsT*2*Math.PI;var g=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));a.push([d/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(d= -1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*b+d;g=(this.segmentsT+1)*b+d-1;var f=(this.segmentsT+1)*(b-1)+d-1,k=(this.segmentsT+1)*(b-1)+d;this.faces.push(new THREE.Face4(e,g,f,k));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[k][0],a[k][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var Icosahedron=function(a){function b(A,p,n){var v=Math.sqrt(A*A+p*p+n*n);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(A/v,p/v,n/v)))-1}function d(A,p,n,v){v.faces.push(new THREE.Face3(A,p,n))}function e(A,p){var n=g.vertices[A].position,v=g.vertices[p].position;return b((n.x+v.x)/2,(n.y+v.y)/2,(n.z+v.z)/2)}var g=this,f=new THREE.Geometry,k;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);d(0,11,5,f);d(0,5,1,f);d(0,1,7,f);d(0,7,10,f);d(0,10,11,f);d(1,5,9,f);d(5,11,4,f);d(11,10,2,f);d(10,7,6,f);d(7,1,8,f);d(3,9,4,f);d(3,4,2,f);d(3,2,6,f);d(3,6,8,f);d(3,8,9,f);d(4,9,5,f);d(2,4,11,f);d(6,2,10,f);d(8,6,7,f);d(9,8,1,f);for(a=0;a>7)-127;J=(ca&127)<<16|Z<<8|J;if(J==0&&ja==-127)return 0;return(1-2*(ga>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,ja)}function c(y,M){var J=u(y,M),Z=u(y,M+1),ca=u(y,M+2);return(u(y,M+3)<<24)+(ca<<16)+(Z<<8)+J}function h(y,M){var J=u(y,M);return(u(y,M+1)<<8)+J}function l(y,M){var J=u(y,M);return J>127?J-256:J}function u(y,M){return y.charCodeAt(M)&255}function A(y){var M, -J,Z;M=c(a,y);J=c(a,y+C);Z=c(a,y+q);y=h(a,y+B);THREE.Loader.prototype.f3(o,M,J,Z,y)}function p(y){var M,J,Z,ca,ga,ja;M=c(a,y);J=c(a,y+C);Z=c(a,y+q);ca=h(a,y+B);ga=c(a,y+K);ja=c(a,y+w);y=c(a,y+E);THREE.Loader.prototype.f3n(o,j,M,J,Z,ca,ga,ja,y)}function n(y){var M,J,Z,ca;M=c(a,y);J=c(a,y+F);Z=c(a,y+x);ca=c(a,y+z);y=h(a,y+O);THREE.Loader.prototype.f4(o,M,J,Z,ca,y)}function v(y){var M,J,Z,ca,ga,ja,qa,sa;M=c(a,y);J=c(a,y+F);Z=c(a,y+x);ca=c(a,y+z);ga=h(a,y+O);ja=c(a,y+L);qa=c(a,y+U);sa=c(a,y+W);y=c(a,y+ -P);THREE.Loader.prototype.f4n(o,j,M,J,Z,ca,ga,ja,qa,sa,y)}function D(y){var M,J;M=c(a,y);J=c(a,y+da);y=c(a,y+X);THREE.Loader.prototype.uv3(o,t[M*2],t[M*2+1],t[J*2],t[J*2+1],t[y*2],t[y*2+1])}function G(y){var M,J,Z;M=c(a,y);J=c(a,y+R);Z=c(a,y+T);y=c(a,y+ba);THREE.Loader.prototype.uv4(o,t[M*2],t[M*2+1],t[J*2],t[J*2+1],t[Z*2],t[Z*2+1],t[y*2],t[y*2+1])}var o=this,I=0,m,j=[],t=[],C,q,B,K,w,E,F,x,z,O,L,U,W,P,da,X,R,T,ba,Y,H,S,V,ia,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(o,e,f); -m={signature:a.substr(I,8),header_bytes:u(a,I+8),vertex_coordinate_bytes:u(a,I+9),normal_coordinate_bytes:u(a,I+10),uv_coordinate_bytes:u(a,I+11),vertex_index_bytes:u(a,I+12),normal_index_bytes:u(a,I+13),uv_index_bytes:u(a,I+14),material_index_bytes:u(a,I+15),nvertices:c(a,I+16),nnormals:c(a,I+16+4),nuvs:c(a,I+16+8),ntri_flat:c(a,I+16+12),ntri_smooth:c(a,I+16+16),ntri_flat_uv:c(a,I+16+20),ntri_smooth_uv:c(a,I+16+24),nquad_flat:c(a,I+16+28),nquad_smooth:c(a,I+16+32),nquad_flat_uv:c(a,I+16+36),nquad_smooth_uv:c(a, -I+16+40)};I+=m.header_bytes;C=m.vertex_index_bytes;q=m.vertex_index_bytes*2;B=m.vertex_index_bytes*3;K=m.vertex_index_bytes*3+m.material_index_bytes;w=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;E=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;F=m.vertex_index_bytes;x=m.vertex_index_bytes*2;z=m.vertex_index_bytes*3;O=m.vertex_index_bytes*4;L=m.vertex_index_bytes*4+m.material_index_bytes;U=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes; -W=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;P=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;da=m.uv_index_bytes;X=m.uv_index_bytes*2;R=m.uv_index_bytes;T=m.uv_index_bytes*2;ba=m.uv_index_bytes*3;f=m.vertex_index_bytes*3+m.material_index_bytes;ha=m.vertex_index_bytes*4+m.material_index_bytes;Y=m.ntri_flat*f;H=m.ntri_smooth*(f+m.normal_index_bytes*3);S=m.ntri_flat_uv*(f+m.uv_index_bytes*3);V=m.ntri_smooth_uv*(f+m.normal_index_bytes*3+m.uv_index_bytes* -3);ia=m.nquad_flat*ha;f=m.nquad_smooth*(ha+m.normal_index_bytes*4);ha=m.nquad_flat_uv*(ha+m.uv_index_bytes*4);I+=function(y){var M,J,Z,ca=m.vertex_coordinate_bytes*3,ga=y+m.nvertices*ca;for(y=y;y0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,j,t)))-1);n.push(v)}c.push(n)}var o,w,C;g=c.length;for(d=0;d0)for(e=0;e1){o=this.vertices[k].position.clone(); +w=this.vertices[h].position.clone();C=this.vertices[n].position.clone();o.normalize();w.normalize();C.normalize();this.faces.push(new THREE.Face3(k,h,n,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([v,x,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Torus=function(a,c,d,e){this.radius=a||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){e=d/this.segmentsT*2*Math.PI;var g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));a.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d= +1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*c+d;g=(this.segmentsT+1)*c+d-1;var b=(this.segmentsT+1)*(c-1)+d-1,k=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,g,b,k));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[b][0],a[b][1]),new THREE.UV(a[k][0],a[k][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; +var Icosahedron=function(a){function c(x,t,o){var w=Math.sqrt(x*x+t*t+o*o);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(x/w,t/w,o/w)))-1}function d(x,t,o,w){w.faces.push(new THREE.Face3(x,t,o))}function e(x,t){var o=g.vertices[x].position,w=g.vertices[t].position;return c((o.x+w.x)/2,(o.y+w.y)/2,(o.z+w.z)/2)}var g=this,b=new THREE.Geometry,k;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0, +1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);d(0,11,5,b);d(0,5,1,b);d(0,1,7,b);d(0,7,10,b);d(0,10,11,b);d(1,5,9,b);d(5,11,4,b);d(11,10,2,b);d(10,7,6,b);d(7,1,8,b);d(3,9,4,b);d(3,4,2,b);d(3,2,6,b);d(3,6,8,b);d(3,8,9,b);d(4,9,5,b);d(2,4,11,b);d(6,2,10,b);d(8,6,7,b);d(9,8,1,b);for(a=0;a>7)-127;I=(da&127)<<16|R<<8|I;if(I==0&&ia==-127)return 0;return(1-2*(ma>>7))*(1+I*Math.pow(2,-23))*Math.pow(2,ia)}function j(B,L){var I=v(B,L),R=v(B,L+1),da=v(B,L+2);return(v(B,L+3)<<24)+(da<<16)+(R<<8)+I}function h(B,L){var I=v(B,L);return(v(B,L+1)<<8)+I}function n(B,L){var I=v(B,L);return I>127?I-256:I}function v(B,L){return B.charCodeAt(L)&255}function x(B){var L, +I,R;L=j(a,B);I=j(a,B+E);R=j(a,B+y);B=h(a,B+u);THREE.Loader.prototype.f3(q,L,I,R,B)}function t(B){var L,I,R,da,ma,ia;L=j(a,B);I=j(a,B+E);R=j(a,B+y);da=h(a,B+u);ma=j(a,B+G);ia=j(a,B+A);B=j(a,B+J);THREE.Loader.prototype.f3n(q,m,L,I,R,da,ma,ia,B)}function o(B){var L,I,R,da;L=j(a,B);I=j(a,B+D);R=j(a,B+z);da=j(a,B+N);B=h(a,B+X);THREE.Loader.prototype.f4(q,L,I,R,da,B)}function w(B){var L,I,R,da,ma,ia,ua,wa;L=j(a,B);I=j(a,B+D);R=j(a,B+z);da=j(a,B+N);ma=h(a,B+X);ia=j(a,B+O);ua=j(a,B+T);wa=j(a,B+aa);B=j(a, +B+K);THREE.Loader.prototype.f4n(q,m,L,I,R,da,ma,ia,ua,wa,B)}function C(B){var L,I;L=j(a,B);I=j(a,B+Z);B=j(a,B+fa);THREE.Loader.prototype.uv3(q,p[L*2],p[L*2+1],p[I*2],p[I*2+1],p[B*2],p[B*2+1])}function F(B){var L,I,R;L=j(a,B);I=j(a,B+U);R=j(a,B+Q);B=j(a,B+S);THREE.Loader.prototype.uv4(q,p[L*2],p[L*2+1],p[I*2],p[I*2+1],p[R*2],p[R*2+1],p[B*2],p[B*2+1])}var q=this,l=0,f,m=[],p=[],E,y,u,G,A,J,D,z,N,X,O,T,aa,K,Z,fa,U,Q,S,V,H,W,$,ca,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(q,e, +b);f={signature:a.substr(l,8),header_bytes:v(a,l+8),vertex_coordinate_bytes:v(a,l+9),normal_coordinate_bytes:v(a,l+10),uv_coordinate_bytes:v(a,l+11),vertex_index_bytes:v(a,l+12),normal_index_bytes:v(a,l+13),uv_index_bytes:v(a,l+14),material_index_bytes:v(a,l+15),nvertices:j(a,l+16),nnormals:j(a,l+16+4),nuvs:j(a,l+16+8),ntri_flat:j(a,l+16+12),ntri_smooth:j(a,l+16+16),ntri_flat_uv:j(a,l+16+20),ntri_smooth_uv:j(a,l+16+24),nquad_flat:j(a,l+16+28),nquad_smooth:j(a,l+16+32),nquad_flat_uv:j(a,l+16+36),nquad_smooth_uv:j(a, +l+16+40)};l+=f.header_bytes;E=f.vertex_index_bytes;y=f.vertex_index_bytes*2;u=f.vertex_index_bytes*3;G=f.vertex_index_bytes*3+f.material_index_bytes;A=f.vertex_index_bytes*3+f.material_index_bytes+f.normal_index_bytes;J=f.vertex_index_bytes*3+f.material_index_bytes+f.normal_index_bytes*2;D=f.vertex_index_bytes;z=f.vertex_index_bytes*2;N=f.vertex_index_bytes*3;X=f.vertex_index_bytes*4;O=f.vertex_index_bytes*4+f.material_index_bytes;T=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes; +aa=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes*2;K=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes*3;Z=f.uv_index_bytes;fa=f.uv_index_bytes*2;U=f.uv_index_bytes;Q=f.uv_index_bytes*2;S=f.uv_index_bytes*3;b=f.vertex_index_bytes*3+f.material_index_bytes;ha=f.vertex_index_bytes*4+f.material_index_bytes;V=f.ntri_flat*b;H=f.ntri_smooth*(b+f.normal_index_bytes*3);W=f.ntri_flat_uv*(b+f.uv_index_bytes*3);$=f.ntri_smooth_uv*(b+f.normal_index_bytes*3+f.uv_index_bytes* +3);ca=f.nquad_flat*ha;b=f.nquad_smooth*(ha+f.normal_index_bytes*4);ha=f.nquad_flat_uv*(ha+f.uv_index_bytes*4);l+=function(B){var L,I,R,da=f.vertex_coordinate_bytes*3,ma=B+f.nvertices*da;for(B=B;B pieces ) { + + //console.log("xxxxxxxxx"); + break; + + } + + } + + } + + } + } function init() { @@ -206,13 +232,19 @@ var callback_progress = function( progress, result ) { - var bar = 250; - if ( progress.total_models + progress.total_textures ) - bar = Math.floor( 250 * ( progress.loaded_models + progress.loaded_textures ) / ( progress.total_models + progress.total_textures ) ); + var bar = 250, + total = progress.total_models + progress.total_textures, + loaded = progress.loaded_models + progress.loaded_textures; + + if ( total ) + bar = Math.floor( bar * loaded / total ); $( "bar" ).style.width = bar + "px"; - handle_update( result ); + count = 0; + for ( var m in result.materials ) count++; + + handle_update( result, Math.floor( count/total ) ); } @@ -232,7 +264,7 @@ */ - handle_update( result ); + //handle_update( result, 1 ); } @@ -248,13 +280,15 @@ mat_veyron[ 3 ][ 0 ] = result.materials[ "glass" ]; mat_veyron[ 4 ][ 0 ] = result.materials[ "chrome" ]; mat_veyron[ 5 ][ 0 ] = result.materials[ "chrome" ]; + mat_veyron[ 6 ][ 0 ] = result.materials[ "backlights" ]; + mat_veyron[ 7 ][ 0 ] = result.materials[ "backsignals" ]; $( "message" ).style.display = "none"; $( "progressbar" ).style.display = "none"; $( "start" ).style.display = "block"; $( "start" ).className = "enabled"; - handle_update( result ); + handle_update( result, 1 ); } diff --git a/examples/scenes/test_scene.js b/examples/scenes/test_scene.js index 0a63075e..e0907f11 100644 --- a/examples/scenes/test_scene.js +++ b/examples/scenes/test_scene.js @@ -206,6 +206,7 @@ var scene = { "materials": { + /* "basic_red": { "type": "MeshBasicMaterial", "parameters": { color: 0xff0000, wireframe: true } @@ -215,16 +216,27 @@ var scene = { "type": "MeshBasicMaterial", "parameters": { color: 0x007711, wireframe: true } }, - - "basic_gray": { + + "basic_blue": { "type": "MeshBasicMaterial", - "parameters": { color: 0x666666, wireframe: true } + "parameters": { color: 0x0000ff, wireframe: true } }, - + "basic_black": { "type": "MeshBasicMaterial", "parameters": { color: 0x000000, wireframe: true } }, + + "phong_white": { + "type": "MeshPhongMaterial", + "parameters": { color: 0xaaaaaa } + }, + */ + + "basic_gray": { + "type": "MeshBasicMaterial", + "parameters": { color: 0x666666, wireframe: true } + }, "basic_white": { "type": "MeshBasicMaterial", @@ -236,11 +248,6 @@ var scene = { "parameters": { color: 0xffffff, shading: "flat" } }, - "basic_blue": { - "type": "MeshBasicMaterial", - "parameters": { color: 0x0000ff, wireframe: true } - }, - "lambert_red": { "type": "MeshLambertMaterial", "parameters": { color: 0xff0000 } @@ -256,11 +263,6 @@ var scene = { "parameters": { color: 0x0055aa } }, - "phong_white": { - "type": "MeshPhongMaterial", - "parameters": { color: 0xaaaaaa } - }, - "phong_orange": { "type": "MeshPhongMaterial", "parameters": { color:0x000000, specular: 0xaa5500 } @@ -296,6 +298,16 @@ var scene = { "parameters": { color: 0x050505 } }, + "backlights": { + "type": "MeshLambertMaterial", + "parameters": { color: 0xff0000, opacity: 0.5 } + }, + + "backsignals": { + "type": "MeshLambertMaterial", + "parameters": { color: 0xffbb00, opacity: 0.5 } + }, + "textured_bg": { "type": "MeshBasicMaterial", "parameters": { color: 0xffffff, map: "texture_bg" } diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index bee6bf4d..5a67fe44 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -711,19 +711,16 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.renderBuffer = function ( camera, lights, fog, material, geometryChunk, object ) { - - var program, u, identifiers, attributes, parameters, maxLightCount, linewidth, primitives; - + this.initMaterial = function( material, lights, fog ) { + if ( !material.program ) { + var u, identifiers, parameters, maxLightCount; + if ( material instanceof THREE.MeshDepthMaterial ) { setMaterialShaders( material, THREE.ShaderLib[ 'depth' ] ); - material.uniforms.mNear.value = camera.near; - material.uniforms.mFar.value = camera.far; - } else if ( material instanceof THREE.MeshNormalMaterial ) { setMaterialShaders( material, THREE.ShaderLib[ 'normal' ] ); @@ -732,26 +729,18 @@ THREE.WebGLRenderer = function ( parameters ) { setMaterialShaders( material, THREE.ShaderLib[ 'basic' ] ); - refreshUniformsCommon( material, fog ); - } else if ( material instanceof THREE.MeshLambertMaterial ) { setMaterialShaders( material, THREE.ShaderLib[ 'lambert' ] ); - refreshUniformsCommon( material, fog ); - } else if ( material instanceof THREE.MeshPhongMaterial ) { setMaterialShaders( material, THREE.ShaderLib[ 'phong' ] ); - refreshUniformsCommon( material, fog ); - } else if ( material instanceof THREE.LineBasicMaterial ) { setMaterialShaders( material, THREE.ShaderLib[ 'basic' ] ); - refreshUniformsLine( material, fog ); - } // heuristics to create shader parameters according to lights in the scene @@ -773,6 +762,14 @@ THREE.WebGLRenderer = function ( parameters ) { cacheAttributeLocations( material.program, [ "position", "normal", "uv", "tangent" ] ); } + + }; + + this.renderBuffer = function ( camera, lights, fog, material, geometryChunk, object ) { + + var program, u, identifiers, attributes, parameters, maxLightCount, linewidth, primitives; + + this.initMaterial( material, lights, fog ); program = material.program; @@ -813,6 +810,12 @@ THREE.WebGLRenderer = function ( parameters ) { } + if ( material instanceof THREE.MeshDepthMaterial ) { + + material.uniforms.mNear.value = camera.near; + material.uniforms.mFar.value = camera.far; + } + setUniforms( program, material.uniforms ); attributes = program.attributes;