|
@@ -13,29 +13,29 @@ 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;
|
|
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+")"}};
|
|
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=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,f=[];a=0;for(c=e.length;a<c;a++){d=e[a];if(d instanceof THREE.Mesh)f=f.concat(this.intersectObject(d))}f.sort(function(b,h){return b.distance-h.distance});return f},intersectObject:function(a){function c(G,w,H,p){p=p.clone().subSelf(w);H=H.clone().subSelf(w);var l=G.clone().subSelf(w);G=p.dot(p);w=p.dot(H);p=p.dot(l);var v=H.dot(H);H=H.dot(l);l=1/(G*v-w*w);v=(v*p-w*H)*l;G=(G*H-w*p)*l;return v>0&&G>0&&v+G<1}var d,e,f,b,h,j,g,m,n,z,
|
|
|
|
-u,o=a.geometry,A=o.vertices,C=[];d=0;for(e=o.faces.length;d<e;d++){f=o.faces[d];z=this.origin.clone();u=this.direction.clone();b=a.matrix.multiplyVector3(A[f.a].position.clone());h=a.matrix.multiplyVector3(A[f.b].position.clone());j=a.matrix.multiplyVector3(A[f.c].position.clone());g=f instanceof THREE.Face4?a.matrix.multiplyVector3(A[f.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(f.normal.clone());n=u.dot(m);if(n<0){m=m.dot((new THREE.Vector3).sub(b,z))/n;z=z.addSelf(u.multiplyScalar(m));
|
|
|
|
-if(f instanceof THREE.Face3){if(c(z,b,h,j)){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};C.push(f)}}else if(f instanceof THREE.Face4)if(c(z,b,h,g)||c(z,h,j,g)){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};C.push(f)}}}return C}};
|
|
|
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,f=[];a=0;for(c=e.length;a<c;a++){d=e[a];if(d instanceof THREE.Mesh)f=f.concat(this.intersectObject(d))}f.sort(function(b,h){return b.distance-h.distance});return f},intersectObject:function(a){function c(H,x,I,q){q=q.clone().subSelf(x);I=I.clone().subSelf(x);var k=H.clone().subSelf(x);H=q.dot(q);x=q.dot(I);q=q.dot(k);var v=I.dot(I);I=I.dot(k);k=1/(H*v-x*x);v=(v*q-x*I)*k;H=(H*I-x*q)*k;return v>0&&H>0&&v+H<1}var d,e,f,b,h,j,g,m,n,z,
|
|
|
|
+u,p=a.geometry,A=p.vertices,D=[];d=0;for(e=p.faces.length;d<e;d++){f=p.faces[d];z=this.origin.clone();u=this.direction.clone();b=a.matrix.multiplyVector3(A[f.a].position.clone());h=a.matrix.multiplyVector3(A[f.b].position.clone());j=a.matrix.multiplyVector3(A[f.c].position.clone());g=f instanceof THREE.Face4?a.matrix.multiplyVector3(A[f.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(f.normal.clone());n=u.dot(m);if(n<0){m=m.dot((new THREE.Vector3).sub(b,z))/n;z=z.addSelf(u.multiplyScalar(m));
|
|
|
|
+if(f instanceof THREE.Face3){if(c(z,b,h,j)){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};D.push(f)}}else if(f instanceof THREE.Face4)if(c(z,b,h,g)||c(z,h,j,g)){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};D.push(f)}}}return D}};
|
|
THREE.Rectangle=function(){function a(){b=e-c;h=f-d}var c,d,e,f,b,h,j=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return b};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,m,n,z){j=false;c=g;d=m;e=n;f=z;a()};this.addPoint=function(g,m){if(j){j=false;c=g;d=m;e=g;f=m}else{c=c<g?c:g;d=d<m?d:m;e=e>g?e:g;f=f>m?
|
|
THREE.Rectangle=function(){function a(){b=e-c;h=f-d}var c,d,e,f,b,h,j=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return b};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,m,n,z){j=false;c=g;d=m;e=n;f=z;a()};this.addPoint=function(g,m){if(j){j=false;c=g;d=m;e=g;f=m}else{c=c<g?c:g;d=d<m?d:m;e=e>g?e:g;f=f>m?
|
|
-f:m}a()};this.add3Points=function(g,m,n,z,u,o){if(j){j=false;c=g<n?g<u?g:u:n<u?n:u;d=m<z?m<o?m:o:z<o?z:o;e=g>n?g>u?g:u:n>u?n:u;f=m>z?m>o?m:o:z>o?z:o}else{c=g<n?g<u?g<c?g:c:u<c?u:c:n<u?n<c?n:c:u<c?u:c;d=m<z?m<o?m<d?m:d:o<d?o:d:z<o?z<d?z:d:o<d?o:d;e=g>n?g>u?g>e?g:e:u>e?u:e:n>u?n>e?n:e:u>e?u:e;f=m>z?m>o?m>f?m:f:o>f?o:f:z>o?z>f?z:f:o>f?o:f}a()};this.addRectangle=function(g){if(j){j=false;c=g.getLeft();d=g.getTop();e=g.getRight();f=g.getBottom()}else{c=c<g.getLeft()?c:g.getLeft();d=d<g.getTop()?d:g.getTop();
|
|
|
|
|
|
+f:m}a()};this.add3Points=function(g,m,n,z,u,p){if(j){j=false;c=g<n?g<u?g:u:n<u?n:u;d=m<z?m<p?m:p:z<p?z:p;e=g>n?g>u?g:u:n>u?n:u;f=m>z?m>p?m:p:z>p?z:p}else{c=g<n?g<u?g<c?g:c:u<c?u:c:n<u?n<c?n:c:u<c?u:c;d=m<z?m<p?m<d?m:d:p<d?p:d:z<p?z<d?z:d:p<d?p:d;e=g>n?g>u?g>e?g:e:u>e?u:e:n>u?n>e?n:e:u>e?u:e;f=m>z?m>p?m>f?m:f:p>f?p:f:z>p?z>f?z:f:p>f?p:f}a()};this.addRectangle=function(g){if(j){j=false;c=g.getLeft();d=g.getTop();e=g.getRight();f=g.getBottom()}else{c=c<g.getLeft()?c:g.getLeft();d=d<g.getTop()?d:g.getTop();
|
|
e=e>g.getRight()?e:g.getRight();f=f>g.getBottom()?f:g.getBottom()}a()};this.inflate=function(g){c-=g;d-=g;e+=g;f+=g;a()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();d=d>g.getTop()?d:g.getTop();e=e<g.getRight()?e:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.instersects=function(g){return Math.min(e,g.getRight())-Math.max(c,g.getLeft())>=0&&Math.min(f,g.getBottom())-Math.max(d,g.getTop())>=0};this.empty=function(){j=true;f=e=d=c=0;a()};this.isEmpty=function(){return j};this.toString=
|
|
e=e>g.getRight()?e:g.getRight();f=f>g.getBottom()?f:g.getBottom()}a()};this.inflate=function(g){c-=g;d-=g;e+=g;f+=g;a()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();d=d>g.getTop()?d:g.getTop();e=e<g.getRight()?e:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.instersects=function(g){return Math.min(e,g.getRight())-Math.max(c,g.getLeft())>=0&&Math.min(f,g.getBottom())-Math.max(d,g.getTop())>=0};this.empty=function(){j=true;f=e=d=c=0;a()};this.isEmpty=function(){return j};this.toString=
|
|
function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+f+", width: "+b+", height: "+h+" )"}};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}};
|
|
function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+f+", width: "+b+", height: "+h+" )"}};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,f,b,h,j,g,m,n,z,u,o,A,C){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=f||0;this.n22=b||1;this.n23=h||0;this.n24=j||0;this.n31=g||0;this.n32=m||0;this.n33=n||1;this.n34=z||0;this.n41=u||0;this.n42=o||0;this.n43=A||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,f,b,h,j,g,m,n,z,u,o,A,C){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=b;this.n23=h;this.n24=j;this.n31=g;this.n32=m;this.n33=n;this.n34=z;this.n41=u;this.n42=o;this.n43=A;this.n44=C;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
|
|
|
|
+THREE.Matrix4=function(a,c,d,e,f,b,h,j,g,m,n,z,u,p,A,D){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=f||0;this.n22=b||1;this.n23=h||0;this.n24=j||0;this.n31=g||0;this.n32=m||0;this.n33=n||1;this.n34=z||0;this.n41=u||0;this.n42=p||0;this.n43=A||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,c,d,e,f,b,h,j,g,m,n,z,u,p,A,D){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=b;this.n23=h;this.n24=j;this.n31=g;this.n32=m;this.n33=n;this.n34=z;this.n41=u;this.n42=p;this.n43=A;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,c,d){var e=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();f.cross(b,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);
|
|
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,f=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();f.cross(b,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=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,f=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)*f;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*f;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*d+this.n23*
|
|
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,f=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)*f;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*f;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*d+this.n23*
|
|
e+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;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,f=a.n13,b=a.n14,h=a.n21,j=a.n22,g=a.n23,m=a.n24,n=a.n31,
|
|
e+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;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,f=a.n13,b=a.n14,h=a.n21,j=a.n22,g=a.n23,m=a.n24,n=a.n31,
|
|
-z=a.n32,u=a.n33,o=a.n34,A=a.n41,C=a.n42,G=a.n43,w=a.n44,H=c.n11,p=c.n12,l=c.n13,v=c.n14,t=c.n21,k=c.n22,q=c.n23,x=c.n24,y=c.n31,F=c.n32,B=c.n33,D=c.n34,I=c.n41,N=c.n42,O=c.n43,Q=c.n44;this.n11=d*H+e*t+f*y+b*I;this.n12=d*p+e*k+f*F+b*N;this.n13=d*l+e*q+f*B+b*O;this.n14=d*v+e*x+f*D+b*Q;this.n21=h*H+j*t+g*y+m*I;this.n22=h*p+j*k+g*F+m*N;this.n23=h*l+j*q+g*B+m*O;this.n24=h*v+j*x+g*D+m*Q;this.n31=n*H+z*t+u*y+o*I;this.n32=n*p+z*k+u*F+o*N;this.n33=n*l+z*q+u*B+o*O;this.n34=n*v+z*x+u*D+o*Q;this.n41=A*H+C*t+
|
|
|
|
-G*y+w*I;this.n42=A*p+C*k+G*F+w*N;this.n43=A*l+C*q+G*B+w*O;this.n44=A*v+C*x+G*D+w*Q;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,f=this.n14,b=this.n21,h=this.n22,j=this.n23,g=this.n24,m=this.n31,n=this.n32,z=this.n33,u=this.n34,o=this.n41,A=this.n42,C=this.n43,G=this.n44,w=a.n11,H=a.n21,p=a.n31,l=a.n41,v=a.n12,t=a.n22,k=a.n32,q=a.n42,x=a.n13,y=a.n23,F=a.n33,B=a.n43,D=a.n14,I=a.n24,N=a.n34;a=a.n44;this.n11=c*w+d*H+e*p+f*l;this.n12=c*v+d*t+e*k+f*q;this.n13=c*x+d*y+e*F+f*
|
|
|
|
-B;this.n14=c*D+d*I+e*N+f*a;this.n21=b*w+h*H+j*p+g*l;this.n22=b*v+h*t+j*k+g*q;this.n23=b*x+h*y+j*F+g*B;this.n24=b*D+h*I+j*N+g*a;this.n31=m*w+n*H+z*p+u*l;this.n32=m*v+n*t+z*k+u*q;this.n33=m*x+n*y+z*F+u*B;this.n34=m*D+n*I+z*N+u*a;this.n41=o*w+A*H+C*p+G*l;this.n42=o*v+A*t+C*k+G*q;this.n43=o*x+A*y+C*F+G*B;this.n44=o*D+A*I+C*N+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,c=this.n12,d=this.n13,e=this.n14,f=this.n21,b=this.n22,h=this.n23,j=this.n24,g=this.n31,m=this.n32,n=this.n33,z=this.n34,u=this.n41,o=this.n42,A=this.n43,C=this.n44;return e*h*m*u-d*j*m*u-e*b*n*u+c*j*n*u+d*b*z*u-c*h*z*u-e*h*g*o+d*j*g*o+e*f*n*o-a*j*n*o-d*f*z*o+a*h*z*o+e*b*g*A-c*j*g*A-e*f*m*A+a*j*m*A+c*f*z*A-a*b*z*A-d*b*g*C+c*h*g*C+d*f*m*C-a*h*m*C-c*f*n*C+a*b*n*C},transpose:function(){function a(c,d,
|
|
|
|
|
|
+z=a.n32,u=a.n33,p=a.n34,A=a.n41,D=a.n42,H=a.n43,x=a.n44,I=c.n11,q=c.n12,k=c.n13,v=c.n14,t=c.n21,l=c.n22,o=c.n23,w=c.n24,y=c.n31,G=c.n32,B=c.n33,C=c.n34,F=c.n41,L=c.n42,O=c.n43,Q=c.n44;this.n11=d*I+e*t+f*y+b*F;this.n12=d*q+e*l+f*G+b*L;this.n13=d*k+e*o+f*B+b*O;this.n14=d*v+e*w+f*C+b*Q;this.n21=h*I+j*t+g*y+m*F;this.n22=h*q+j*l+g*G+m*L;this.n23=h*k+j*o+g*B+m*O;this.n24=h*v+j*w+g*C+m*Q;this.n31=n*I+z*t+u*y+p*F;this.n32=n*q+z*l+u*G+p*L;this.n33=n*k+z*o+u*B+p*O;this.n34=n*v+z*w+u*C+p*Q;this.n41=A*I+D*t+
|
|
|
|
+H*y+x*F;this.n42=A*q+D*l+H*G+x*L;this.n43=A*k+D*o+H*B+x*O;this.n44=A*v+D*w+H*C+x*Q;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,f=this.n14,b=this.n21,h=this.n22,j=this.n23,g=this.n24,m=this.n31,n=this.n32,z=this.n33,u=this.n34,p=this.n41,A=this.n42,D=this.n43,H=this.n44,x=a.n11,I=a.n21,q=a.n31,k=a.n41,v=a.n12,t=a.n22,l=a.n32,o=a.n42,w=a.n13,y=a.n23,G=a.n33,B=a.n43,C=a.n14,F=a.n24,L=a.n34;a=a.n44;this.n11=c*x+d*I+e*q+f*k;this.n12=c*v+d*t+e*l+f*o;this.n13=c*w+d*y+e*G+f*
|
|
|
|
+B;this.n14=c*C+d*F+e*L+f*a;this.n21=b*x+h*I+j*q+g*k;this.n22=b*v+h*t+j*l+g*o;this.n23=b*w+h*y+j*G+g*B;this.n24=b*C+h*F+j*L+g*a;this.n31=m*x+n*I+z*q+u*k;this.n32=m*v+n*t+z*l+u*o;this.n33=m*w+n*y+z*G+u*B;this.n34=m*C+n*F+z*L+u*a;this.n41=p*x+A*I+D*q+H*k;this.n42=p*v+A*t+D*l+H*o;this.n43=p*w+A*y+D*G+H*B;this.n44=p*C+A*F+D*L+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,c=this.n12,d=this.n13,e=this.n14,f=this.n21,b=this.n22,h=this.n23,j=this.n24,g=this.n31,m=this.n32,n=this.n33,z=this.n34,u=this.n41,p=this.n42,A=this.n43,D=this.n44;return e*h*m*u-d*j*m*u-e*b*n*u+c*j*n*u+d*b*z*u-c*h*z*u-e*h*g*p+d*j*g*p+e*f*n*p-a*j*n*p-d*f*z*p+a*h*z*p+e*b*g*A-c*j*g*A-e*f*m*A+a*j*m*A+c*f*z*A-a*b*z*A-d*b*g*D+c*h*g*D+d*f*m*D-a*h*m*D-c*f*n*D+a*b*n*D},transpose:function(){function a(c,d,
|
|
e){var f=c[d];c[d]=c[e];c[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;
|
|
e){var f=c[d];c[d]=c[e];c[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,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=
|
|
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),f=1-d,b=a.x,h=a.y,j=a.z,g=f*b,m=f*h;this.set(g*b+d,g*h-e*j,g*j+e*h,0,g*h+e*j,m*h+d,m*j-e*b,0,g*j-e*h,m*j+e*b,f*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+" "+
|
|
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),f=1-d,b=a.x,h=a.y,j=a.z,g=f*b,m=f*h;this.set(g*b+d,g*h-e*j,g*j+e*h,0,g*h+e*j,m*h+d,m*j-e*b,0,g*j-e*h,m*j+e*b,f*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};
|
|
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.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,f=a.n14,b=a.n21,h=a.n22,j=a.n23,g=a.n24,m=a.n31,n=a.n32,z=a.n33,u=a.n34,o=a.n41,A=a.n42,C=a.n43,G=a.n44,w=new THREE.Matrix4;w.n11=j*u*A-g*z*A+g*n*C-h*u*C-j*n*G+h*z*G;w.n12=f*z*A-e*u*A-f*n*C+d*u*C+e*n*G-d*z*G;w.n13=e*g*A-f*j*A+f*h*C-d*g*C-e*h*G+d*j*G;w.n14=f*j*n-e*g*n-f*h*z+d*g*z+e*h*u-d*j*u;w.n21=g*z*o-j*u*o-g*m*C+b*u*C+j*m*G-b*z*G;w.n22=e*u*o-f*z*o+f*m*C-c*u*C-e*m*G+c*z*G;w.n23=f*j*o-e*g*o-f*b*C+c*g*C+e*b*G-c*j*G;w.n24=e*g*m-f*j*m+
|
|
|
|
-f*b*z-c*g*z-e*b*u+c*j*u;w.n31=h*u*o-g*n*o+g*m*A-b*u*A-h*m*G+b*n*G;w.n32=f*n*o-d*u*o-f*m*A+c*u*A+d*m*G-c*n*G;w.n33=e*g*o-f*h*o+f*b*A-c*g*A-d*b*G+c*h*G;w.n34=f*h*m-d*g*m-f*b*n+c*g*n+d*b*u-c*h*u;w.n41=j*n*o-h*z*o-j*m*A+b*z*A+h*m*C-b*n*C;w.n42=d*z*o-e*n*o+e*m*A-c*z*A-d*m*C+c*n*C;w.n43=e*h*o-d*j*o-e*b*A+c*j*A+d*b*C-c*h*C;w.n44=d*j*m-e*h*m+e*b*n-c*j*n-d*b*z+c*h*z;w.multiplyScalar(1/a.determinant());return w};
|
|
|
|
|
|
+THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,b=a.n21,h=a.n22,j=a.n23,g=a.n24,m=a.n31,n=a.n32,z=a.n33,u=a.n34,p=a.n41,A=a.n42,D=a.n43,H=a.n44,x=new THREE.Matrix4;x.n11=j*u*A-g*z*A+g*n*D-h*u*D-j*n*H+h*z*H;x.n12=f*z*A-e*u*A-f*n*D+d*u*D+e*n*H-d*z*H;x.n13=e*g*A-f*j*A+f*h*D-d*g*D-e*h*H+d*j*H;x.n14=f*j*n-e*g*n-f*h*z+d*g*z+e*h*u-d*j*u;x.n21=g*z*p-j*u*p-g*m*D+b*u*D+j*m*H-b*z*H;x.n22=e*u*p-f*z*p+f*m*D-c*u*D-e*m*H+c*z*H;x.n23=f*j*p-e*g*p-f*b*D+c*g*D+e*b*H-c*j*H;x.n24=e*g*m-f*j*m+
|
|
|
|
+f*b*z-c*g*z-e*b*u+c*j*u;x.n31=h*u*p-g*n*p+g*m*A-b*u*A-h*m*H+b*n*H;x.n32=f*n*p-d*u*p-f*m*A+c*u*A+d*m*H-c*n*H;x.n33=e*g*p-f*h*p+f*b*A-c*g*A-d*b*H+c*h*H;x.n34=f*h*m-d*g*m-f*b*n+c*g*n+d*b*u-c*h*u;x.n41=j*n*p-h*z*p-j*m*A+b*z*A+h*m*D-b*n*D;x.n42=d*z*p-e*n*p+e*m*A-c*z*A-d*m*D+c*n*D;x.n43=e*h*p-d*j*p-e*b*A+c*j*A+d*b*D-c*h*D;x.n44=d*j*m-e*h*m+e*b*n-c*j*n-d*b*z+c*h*z;x.multiplyScalar(1/a.determinant());return x};
|
|
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],f=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],h=-c[10]*c[4]+c[6]*c[8],j=c[10]*c[0]-c[2]*c[8],g=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],n=-c[9]*c[0]+c[1]*c[8],z=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*h+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*f;d[2]=c*b;d[3]=c*h;d[4]=c*j;d[5]=c*g;d[6]=c*m;d[7]=c*n;d[8]=c*z;return a};
|
|
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],f=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],h=-c[10]*c[4]+c[6]*c[8],j=c[10]*c[0]-c[2]*c[8],g=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],n=-c[9]*c[0]+c[1]*c[8],z=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*h+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*f;d[2]=c*b;d[3]=c*h;d[4]=c*j;d[5]=c*g;d[6]=c*m;d[7]=c*n;d[8]=c*z;return a};
|
|
THREE.Matrix4.makeFrustum=function(a,c,d,e,f,b){var h,j,g;h=new THREE.Matrix4;j=2*f/(c-a);g=2*f/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+f)/(b-f);f=-2*b*f/(b-f);h.n11=j;h.n12=0;h.n13=a;h.n14=0;h.n21=0;h.n22=g;h.n23=d;h.n24=0;h.n31=0;h.n32=0;h.n33=e;h.n34=f;h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,e)};
|
|
THREE.Matrix4.makeFrustum=function(a,c,d,e,f,b){var h,j,g;h=new THREE.Matrix4;j=2*f/(c-a);g=2*f/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+f)/(b-f);f=-2*b*f/(b-f);h.n11=j;h.n12=0;h.n13=a;h.n14=0;h.n21=0;h.n22=g;h.n23=d;h.n24=0;h.n31=0;h.n32=0;h.n33=e;h.n34=f;h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,e)};
|
|
THREE.Matrix4.makeOrtho=function(a,c,d,e,f,b){var h,j,g,m;h=new THREE.Matrix4;j=c-a;g=d-e;m=b-f;a=(c+a)/j;d=(d+e)/g;f=(b+f)/m;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-a;h.n21=0;h.n22=2/g;h.n23=0;h.n24=-d;h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-f;h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
THREE.Matrix4.makeOrtho=function(a,c,d,e,f,b){var h,j,g,m;h=new THREE.Matrix4;j=c-a;g=d-e;m=b-f;a=(c+a)/j;d=(d+e)/g;f=(b+f)/m;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-a;h.n21=0;h.n22=2/g;h.n23=0;h.n24=-d;h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-f;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;
|
|
@@ -47,10 +47,10 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.f
|
|
d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,e,f,b,h,j=new THREE.Vector3,g=new THREE.Vector3;e=0;for(f=this.vertices.length;e<f;e++){b=this.vertices[e];b.normal.set(0,0,0)}e=0;for(f=this.faces.length;e<f;e++){b=this.faces[e];if(a&&b.vertexNormals.length){j.set(0,0,0);c=0;for(d=b.normal.length;c<d;c++)j.addSelf(b.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[b.a];d=this.vertices[b.b];h=this.vertices[b.c];j.sub(h.position,
|
|
d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,e,f,b,h,j=new THREE.Vector3,g=new THREE.Vector3;e=0;for(f=this.vertices.length;e<f;e++){b=this.vertices[e];b.normal.set(0,0,0)}e=0;for(f=this.faces.length;e<f;e++){b=this.faces[e];if(a&&b.vertexNormals.length){j.set(0,0,0);c=0;for(d=b.normal.length;c<d;c++)j.addSelf(b.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[b.a];d=this.vertices[b.b];h=this.vertices[b.c];j.sub(h.position,
|
|
d.position);g.sub(c.position,d.position);j.crossSelf(g)}j.isZero()||j.normalize();b.normal.copy(j)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
|
|
d.position);g.sub(c.position,d.position);j.crossSelf(g)}j.isZero()||j.normalize();b.normal.copy(j)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<
|
|
-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(D,I,N,O,Q,T,U){b=D.vertices[I].position;h=D.vertices[N].position;j=D.vertices[O].position;g=f[Q];m=f[T];n=f[U];z=h.x-b.x;u=j.x-b.x;o=h.y-b.y;A=j.y-b.y;
|
|
|
|
-C=h.z-b.z;G=j.z-b.z;w=m.u-g.u;H=n.u-g.u;p=m.v-g.v;l=n.v-g.v;v=1/(w*l-H*p);q.set((l*z-p*u)*v,(l*o-p*A)*v,(l*C-p*G)*v);x.set((w*u-H*z)*v,(w*A-H*o)*v,(w*G-H*C)*v);t[I].addSelf(q);t[N].addSelf(q);t[O].addSelf(q);k[I].addSelf(x);k[N].addSelf(x);k[O].addSelf(x)}var c,d,e,f,b,h,j,g,m,n,z,u,o,A,C,G,w,H,p,l,v,t=[],k=[],q=new THREE.Vector3,x=new THREE.Vector3,y=new THREE.Vector3,F=new THREE.Vector3,B=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){t[c]=new THREE.Vector3;k[c]=new THREE.Vector3}c=0;
|
|
|
|
|
|
+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(C,F,L,O,Q,T,U){b=C.vertices[F].position;h=C.vertices[L].position;j=C.vertices[O].position;g=f[Q];m=f[T];n=f[U];z=h.x-b.x;u=j.x-b.x;p=h.y-b.y;A=j.y-b.y;
|
|
|
|
+D=h.z-b.z;H=j.z-b.z;x=m.u-g.u;I=n.u-g.u;q=m.v-g.v;k=n.v-g.v;v=1/(x*k-I*q);o.set((k*z-q*u)*v,(k*p-q*A)*v,(k*D-q*H)*v);w.set((x*u-I*z)*v,(x*A-I*p)*v,(x*H-I*D)*v);t[F].addSelf(o);t[L].addSelf(o);t[O].addSelf(o);l[F].addSelf(w);l[L].addSelf(w);l[O].addSelf(w)}var c,d,e,f,b,h,j,g,m,n,z,u,p,A,D,H,x,I,q,k,v,t=[],l=[],o=new THREE.Vector3,w=new THREE.Vector3,y=new THREE.Vector3,G=new THREE.Vector3,B=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){t[c]=new THREE.Vector3;l[c]=new THREE.Vector3}c=0;
|
|
for(d=this.faces.length;c<d;c++){e=this.faces[c];f=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
|
|
for(d=this.faces.length;c<d;c++){e=this.faces[c];f=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
|
|
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){B.copy(this.vertices[c].normal);e=t[c];y.copy(e);y.subSelf(B.multiplyScalar(B.dot(e))).normalize();F.cross(this.vertices[c].normal,e);e=F.dot(k[c]);e=e<0?-1:1;this.vertices[c].tangent.set(y.x,y.y,y.z,e)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
|
|
|
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){B.copy(this.vertices[c].normal);e=t[c];y.copy(e);y.subSelf(B.multiplyScalar(B.dot(e))).normalize();G.cross(this.vertices[c].normal,e);e=G.dot(l[c]);e=e<0?-1:1;this.vertices[c].tangent.set(y.x,y.y,y.z,e)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){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;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else 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;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(n){var z=[];c=0;for(d=n.length;c<d;c++)n[c]==undefined?z.push("undefined"):z.push(n[c].toString());return z.join("_")}var c,d,e,f,b,h,j,g,m={};e=0;for(f=this.faces.length;e<f;e++){b=this.faces[e];
|
|
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;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(n){var z=[];c=0;for(d=n.length;c<d;c++)n[c]==undefined?z.push("undefined"):z.push(n[c].toString());return z.join("_")}var c,d,e,f,b,h,j,g,m={};e=0;for(f=this.faces.length;e<f;e++){b=this.faces[e];
|
|
h=b.materials;j=a(h);if(m[j]==undefined)m[j]={hash:j,counter:0};g=m[j].hash+"_"+m[j].counter;if(this.geometryChunks[g]==undefined)this.geometryChunks[g]={faces:[],materials:h,vertices:0};b=b instanceof THREE.Face3?3:4;if(this.geometryChunks[g].vertices+b>65535){m[j].counter+=1;g=m[j].hash+"_"+m[j].counter;if(this.geometryChunks[g]==undefined)this.geometryChunks[g]={faces:[],materials:h,vertices:0}}this.geometryChunks[g].faces.push(e);this.geometryChunks[g].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
h=b.materials;j=a(h);if(m[j]==undefined)m[j]={hash:j,counter:0};g=m[j].hash+"_"+m[j].counter;if(this.geometryChunks[g]==undefined)this.geometryChunks[g]={faces:[],materials:h,vertices:0};b=b instanceof THREE.Face3?3:4;if(this.geometryChunks[g].vertices+b>65535){m[j].counter+=1;g=m[j].hash+"_"+m[j].counter;if(this.geometryChunks[g]==undefined)this.geometryChunks[g]={faces:[],materials:h,vertices:0}}this.geometryChunks[g].faces.push(e);this.geometryChunks[g].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
@@ -64,8 +64,8 @@ THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rot
|
|
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.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
|
|
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.sortParticles=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.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.BillboardBlending=3;
|
|
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.BillboardBlending=3;
|
|
-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 (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
|
|
|
|
|
|
+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";this.vertex_colors=false;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;
|
|
|
|
+if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
|
|
THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==
|
|
THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==
|
|
undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==
|
|
undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==
|
|
undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
@@ -98,136 +98,139 @@ var Uniforms={clone:function(a){var c,d,e,f={};for(c in a){f[c]={};for(d in a[c]
|
|
THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
|
THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
|
THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
|
|
THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
|
|
THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
|
|
THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
|
|
-THREE.Projector=function(){function a(k,q){return q.z-k.z}function c(k,q){var x=0,y=1,F=k.z+k.w,B=q.z+q.w,D=-k.z+k.w,I=-q.z+q.w;if(F>=0&&B>=0&&D>=0&&I>=0)return true;else if(F<0&&B<0||D<0&&I<0)return false;else{if(F<0)x=Math.max(x,F/(F-B));else if(B<0)y=Math.min(y,F/(F-B));if(D<0)x=Math.max(x,D/(D-I));else if(I<0)y=Math.min(y,D/(D-I));if(y<x)return false;else{k.lerpSelf(q,x);q.lerpSelf(k,1-y);return true}}}var d,e,f=[],b,h,j,g=[],m,n,z=[],u,o,A=[],C=new THREE.Vector4,G=new THREE.Vector4,w=new THREE.Matrix4,
|
|
|
|
-H=new THREE.Matrix4,p=[],l=new THREE.Vector4,v=new THREE.Vector4,t;this.projectObjects=function(k,q,x){var y=[],F,B;e=0;w.multiply(q.projectionMatrix,q.matrix);p[0]=new THREE.Vector4(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);p[1]=new THREE.Vector4(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);p[2]=new THREE.Vector4(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);p[3]=new THREE.Vector4(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);p[4]=new THREE.Vector4(w.n41-w.n31,w.n42-w.n32,w.n43-
|
|
|
|
-w.n33,w.n44-w.n34);p[5]=new THREE.Vector4(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);q=0;for(F=p.length;q<F;q++){B=p[q];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}F=k.objects;k=0;for(q=F.length;k<q;k++){B=F[k];var D;if(!(D=!B.visible)){if(D=B instanceof THREE.Mesh){a:{D=void 0;for(var I=B.position,N=-B.geometry.boundingSphere.radius*Math.max(B.scale.x,Math.max(B.scale.y,B.scale.z)),O=0;O<6;O++){D=p[O].x*I.x+p[O].y*I.y+p[O].z*I.z+p[O].w;if(D<=N){D=false;break a}}D=true}D=!D}D=D}if(!D){d=
|
|
|
|
-f[e]=f[e]||new THREE.RenderableObject;C.copy(B.position);w.multiplyVector3(C);d.object=B;d.z=C.z;y.push(d);e++}}x&&y.sort(a);return y};this.projectScene=function(k,q,x){var y=[],F=q.near,B=q.far,D,I,N,O,Q,T,U,ba,ca,S,K,Z,V,P,W,$;j=n=o=0;q.autoUpdateMatrix&&q.updateMatrix();w.multiply(q.projectionMatrix,q.matrix);T=this.projectObjects(k,q,true);k=0;for(D=T.length;k<D;k++){U=T[k].object;if(U.visible){U.autoUpdateMatrix&&U.updateMatrix();ba=U.matrix;ca=U.rotationMatrix;S=U.materials;K=U.overdraw;if(U instanceof
|
|
|
|
-THREE.Mesh){Z=U.geometry;V=Z.vertices;I=0;for(N=V.length;I<N;I++){P=V[I];P.positionWorld.copy(P.position);ba.multiplyVector3(P.positionWorld);O=P.positionScreen;O.copy(P.positionWorld);w.multiplyVector4(O);O.x/=O.w;O.y/=O.w;P.__visible=O.z>F&&O.z<B}Z=Z.faces;I=0;for(N=Z.length;I<N;I++){P=Z[I];if(P instanceof THREE.Face3){O=V[P.a];Q=V[P.b];W=V[P.c];if(O.__visible&&Q.__visible&&W.__visible)if(U.doubleSided||U.flipSided!=(W.positionScreen.x-O.positionScreen.x)*(Q.positionScreen.y-O.positionScreen.y)-
|
|
|
|
-(W.positionScreen.y-O.positionScreen.y)*(Q.positionScreen.x-O.positionScreen.x)<0){b=g[j]=g[j]||new THREE.RenderableFace3;b.v1.positionWorld.copy(O.positionWorld);b.v2.positionWorld.copy(Q.positionWorld);b.v3.positionWorld.copy(W.positionWorld);b.v1.positionScreen.copy(O.positionScreen);b.v2.positionScreen.copy(Q.positionScreen);b.v3.positionScreen.copy(W.positionScreen);b.normalWorld.copy(P.normal);ca.multiplyVector3(b.normalWorld);b.centroidWorld.copy(P.centroid);ba.multiplyVector3(b.centroidWorld);
|
|
|
|
-b.centroidScreen.copy(b.centroidWorld);w.multiplyVector3(b.centroidScreen);W=P.vertexNormals;t=b.vertexNormalsWorld;O=0;for(Q=W.length;O<Q;O++){$=t[O]=t[O]||new THREE.Vector3;$.copy(W[O]);ca.multiplyVector3($)}b.z=b.centroidScreen.z;b.meshMaterials=S;b.faceMaterials=P.materials;b.overdraw=K;if(U.geometry.uvs[I]){b.uvs[0]=U.geometry.uvs[I][0];b.uvs[1]=U.geometry.uvs[I][1];b.uvs[2]=U.geometry.uvs[I][2]}y.push(b);j++}}else if(P instanceof THREE.Face4){O=V[P.a];Q=V[P.b];W=V[P.c];$=V[P.d];if(O.__visible&&
|
|
|
|
-Q.__visible&&W.__visible&&$.__visible)if(U.doubleSided||U.flipSided!=(($.positionScreen.x-O.positionScreen.x)*(Q.positionScreen.y-O.positionScreen.y)-($.positionScreen.y-O.positionScreen.y)*(Q.positionScreen.x-O.positionScreen.x)<0||(Q.positionScreen.x-W.positionScreen.x)*($.positionScreen.y-W.positionScreen.y)-(Q.positionScreen.y-W.positionScreen.y)*($.positionScreen.x-W.positionScreen.x)<0)){b=g[j]=g[j]||new THREE.RenderableFace3;b.v1.positionWorld.copy(O.positionWorld);b.v2.positionWorld.copy(Q.positionWorld);
|
|
|
|
-b.v3.positionWorld.copy($.positionWorld);b.v1.positionScreen.copy(O.positionScreen);b.v2.positionScreen.copy(Q.positionScreen);b.v3.positionScreen.copy($.positionScreen);b.normalWorld.copy(P.normal);ca.multiplyVector3(b.normalWorld);b.centroidWorld.copy(P.centroid);ba.multiplyVector3(b.centroidWorld);b.centroidScreen.copy(b.centroidWorld);w.multiplyVector3(b.centroidScreen);b.z=b.centroidScreen.z;b.meshMaterials=S;b.faceMaterials=P.materials;b.overdraw=K;if(U.geometry.uvs[I]){b.uvs[0]=U.geometry.uvs[I][0];
|
|
|
|
-b.uvs[1]=U.geometry.uvs[I][1];b.uvs[2]=U.geometry.uvs[I][3]}y.push(b);j++;h=g[j]=g[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(Q.positionWorld);h.v2.positionWorld.copy(W.positionWorld);h.v3.positionWorld.copy($.positionWorld);h.v1.positionScreen.copy(Q.positionScreen);h.v2.positionScreen.copy(W.positionScreen);h.v3.positionScreen.copy($.positionScreen);h.normalWorld.copy(b.normalWorld);h.centroidWorld.copy(b.centroidWorld);h.centroidScreen.copy(b.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
|
|
|
|
-S;h.faceMaterials=P.materials;h.overdraw=K;if(U.geometry.uvs[I]){h.uvs[0]=U.geometry.uvs[I][1];h.uvs[1]=U.geometry.uvs[I][2];h.uvs[2]=U.geometry.uvs[I][3]}y.push(h);j++}}}}else if(U instanceof THREE.Line){H.multiply(w,ba);V=U.geometry.vertices;P=V[0];P.positionScreen.copy(P.position);H.multiplyVector4(P.positionScreen);I=1;for(N=V.length;I<N;I++){O=V[I];O.positionScreen.copy(O.position);H.multiplyVector4(O.positionScreen);Q=V[I-1];l.copy(O.positionScreen);v.copy(Q.positionScreen);if(c(l,v)){l.multiplyScalar(1/
|
|
|
|
-l.w);v.multiplyScalar(1/v.w);m=z[n]=z[n]||new THREE.RenderableLine;m.v1.positionScreen.copy(l);m.v2.positionScreen.copy(v);m.z=Math.max(l.z,v.z);m.materials=U.materials;y.push(m);n++}}}else if(U instanceof THREE.Particle){G.set(U.position.x,U.position.y,U.position.z,1);w.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){u=A[o]=A[o]||new THREE.RenderableParticle;u.x=G.x/G.w;u.y=G.y/G.w;u.z=G.z;u.rotation=U.rotation.z;u.scale.x=U.scale.x*Math.abs(u.x-(G.x+q.projectionMatrix.n11)/(G.w+q.projectionMatrix.n14));
|
|
|
|
-u.scale.y=U.scale.y*Math.abs(u.y-(G.y+q.projectionMatrix.n22)/(G.w+q.projectionMatrix.n24));u.materials=U.materials;y.push(u);o++}}}}x&&y.sort(a);return y};this.unprojectVector=function(k,q){var x=THREE.Matrix4.makeInvert(q.matrix);x.multiplySelf(THREE.Matrix4.makeInvert(q.projectionMatrix));x.multiplyVector3(k);return k}};
|
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,f,b;this.domElement=document.createElement("div");this.setSize=function(h,j){d=h;e=j;f=d/2;b=e/2};this.render=function(h,j){var g,m,n,z,u,o,A,C;a=c.projectScene(h,j);g=0;for(m=a.length;g<m;g++){u=a[g];if(u instanceof THREE.RenderableParticle){A=u.x*f+f;C=u.y*b+b;n=0;for(z=u.material.length;n<z;n++){o=u.material[n];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=A+"px";o.style.top=C+"px"}}}}}};
|
|
|
|
-THREE.CanvasRenderer=function(){function a(la){if(u!=la)m.globalAlpha=u=la}function c(la){if(o!=la){switch(la){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}o=la}}var d=null,e=new THREE.Projector,f=document.createElement("canvas"),b,h,j,g,m=f.getContext("2d"),n=new THREE.Color(0),z=0,u=1,o=0,A=null,C=null,G=1,w,H,p,l,v,t,k,q,x,y=new THREE.Color,
|
|
|
|
-F=new THREE.Color,B=new THREE.Color,D=new THREE.Color,I=new THREE.Color,N,O,Q,T,U,ba,ca,S,K,Z=new THREE.Rectangle,V=new THREE.Rectangle,P=new THREE.Rectangle,W=false,$=new THREE.Color,da=new THREE.Color,ha=new THREE.Color,E=new THREE.Color,L=Math.PI*2,J=new THREE.Vector3,X,ea,ja,ia,qa,ma,ua=16;X=document.createElement("canvas");X.width=X.height=2;ea=X.getContext("2d");ea.fillStyle="rgba(0,0,0,1)";ea.fillRect(0,0,2,2);ja=ea.getImageData(0,0,2,2);ia=ja.data;qa=document.createElement("canvas");qa.width=
|
|
|
|
-qa.height=ua;ma=qa.getContext("2d");ma.translate(-ua/2,-ua/2);ma.scale(ua,ua);ua--;this.domElement=f;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(la,ra){b=la;h=ra;j=b/2;g=h/2;f.width=b;f.height=h;Z.set(-j,-g,j,g);u=1;o=0;C=A=null;G=1};this.setClearColor=function(la,ra){n=la;z=ra;V.set(-j,-g,j,g);m.setTransform(1,0,0,-1,j,g);this.clear()};this.setClearColorHex=function(la,ra){n.setHex(la);z=ra;V.set(-j,-g,j,g);m.setTransform(1,0,0,-1,j,g);this.clear()};this.clear=function(){m.setTransform(1,
|
|
|
|
-0,0,-1,j,g);if(!V.isEmpty()){V.inflate(1);V.minSelf(Z);if(n.hex==0&&z==0)m.clearRect(V.getX(),V.getY(),V.getWidth(),V.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+z+")";m.fillRect(V.getX(),V.getY(),V.getWidth(),V.getHeight())}V.empty()}};this.render=function(la,ra){function Ha(M){var fa,aa,R,Y=M.lights;da.setRGB(0,0,0);ha.setRGB(0,0,0);E.setRGB(0,0,0);M=0;for(fa=Y.length;M<fa;M++){aa=Y[M];R=aa.color;if(aa instanceof
|
|
|
|
-THREE.AmbientLight){da.r+=R.r;da.g+=R.g;da.b+=R.b}else if(aa instanceof THREE.DirectionalLight){ha.r+=R.r;ha.g+=R.g;ha.b+=R.b}else if(aa instanceof THREE.PointLight){E.r+=R.r;E.g+=R.g;E.b+=R.b}}}function Da(M,fa,aa,R){var Y,ga,na,oa,pa=M.lights;M=0;for(Y=pa.length;M<Y;M++){ga=pa[M];na=ga.color;oa=ga.intensity;if(ga instanceof THREE.DirectionalLight){ga=aa.dot(ga.position)*oa;if(ga>0){R.r+=na.r*ga;R.g+=na.g*ga;R.b+=na.b*ga}}else if(ga instanceof THREE.PointLight){J.sub(ga.position,fa);J.normalize();
|
|
|
|
-ga=aa.dot(J)*oa;if(ga>0){R.r+=na.r*ga;R.g+=na.g*ga;R.b+=na.b*ga}}}}function Qa(M,fa,aa){if(aa.opacity!=0){a(aa.opacity);c(aa.blending);var R,Y,ga,na,oa,pa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map&&aa.map.image.loaded){na=aa.map.image;oa=na.width>>1;pa=na.height>>1;Y=fa.scale.x*j;ga=fa.scale.y*g;aa=Y*oa;R=ga*pa;P.set(M.x-aa,M.y-R,M.x+aa,M.y+R);if(Z.instersects(P)){m.save();m.translate(M.x,M.y);m.rotate(-fa.rotation);m.scale(Y,-ga);m.translate(-oa,-pa);m.drawImage(na,0,0);m.restore()}}}else if(aa instanceof
|
|
|
|
-THREE.ParticleCircleMaterial){if(W){$.r=da.r+ha.r+E.r;$.g=da.g+ha.g+E.g;$.b=da.b+ha.b+E.b;y.r=aa.color.r*$.r;y.g=aa.color.g*$.g;y.b=aa.color.b*$.b;y.updateStyleString()}else y.__styleString=aa.color.__styleString;aa=fa.scale.x*j;R=fa.scale.y*g;P.set(M.x-aa,M.y-R,M.x+aa,M.y+R);if(Z.instersects(P)){Y=y.__styleString;if(C!=Y)m.fillStyle=C=Y;m.save();m.translate(M.x,M.y);m.rotate(-fa.rotation);m.scale(aa,R);m.beginPath();m.arc(0,0,1,0,L,true);m.closePath();m.fill();m.restore()}}}}function Ra(M,fa,aa,
|
|
|
|
-R){if(R.opacity!=0){a(R.opacity);c(R.blending);m.beginPath();m.moveTo(M.positionScreen.x,M.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(R instanceof THREE.LineBasicMaterial){y.__styleString=R.color.__styleString;M=R.linewidth;if(G!=M)m.lineWidth=G=M;M=y.__styleString;if(A!=M)m.strokeStyle=A=M;m.stroke();P.inflate(R.linewidth*2)}}}function Ma(M,fa,aa,R,Y,ga){if(Y.opacity!=0){a(Y.opacity);c(Y.blending);l=M.positionScreen.x;v=M.positionScreen.y;t=fa.positionScreen.x;
|
|
|
|
-k=fa.positionScreen.y;q=aa.positionScreen.x;x=aa.positionScreen.y;m.beginPath();m.moveTo(l,v);m.lineTo(t,k);m.lineTo(q,x);m.lineTo(l,v);m.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Aa(l,v,t,k,q,x,Y.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){M=ra.matrix;J.copy(R.vertexNormalsWorld[0]);
|
|
|
|
-T=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;U=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;J.copy(R.vertexNormalsWorld[1]);ba=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;ca=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;J.copy(R.vertexNormalsWorld[2]);S=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;K=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;Aa(l,v,t,k,q,x,Y.env_map.image,T,U,ba,ca,S,K)}}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(l,v,t,k,q,x,Y.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);c(THREE.SubtractiveBlending)}if(W)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==3){F.r=B.r=D.r=da.r;F.g=B.g=D.g=da.g;F.b=B.b=D.b=da.b;Da(ga,R.v1.positionWorld,R.vertexNormalsWorld[0],F);Da(ga,R.v2.positionWorld,R.vertexNormalsWorld[1],B);Da(ga,R.v3.positionWorld,R.vertexNormalsWorld[2],D);I.r=(B.r+D.r)*0.5;I.g=(B.g+D.g)*
|
|
|
|
-0.5;I.b=(B.b+D.b)*0.5;Q=Na(F,B,D,I);Aa(l,v,t,k,q,x,Q,0,0,1,0,0,1)}else{$.r=da.r;$.g=da.g;$.b=da.b;Da(ga,R.centroidWorld,R.normalWorld,$);y.r=Y.color.r*$.r;y.g=Y.color.g*$.g;y.b=Y.color.b*$.b;y.updateStyleString();Y.wireframe?Ea(y.__styleString,Y.wireframe_linewidth):Fa(y.__styleString)}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){N=ra.near;O=ra.far;F.r=F.g=F.b=1-Ia(M.positionScreen.z,N,O);B.r=B.g=B.b=1-Ia(fa.positionScreen.z,
|
|
|
|
-N,O);D.r=D.g=D.b=1-Ia(aa.positionScreen.z,N,O);I.r=(B.r+D.r)*0.5;I.g=(B.g+D.g)*0.5;I.b=(B.b+D.b)*0.5;Q=Na(F,B,D,I);Aa(l,v,t,k,q,x,Q,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){y.r=Ja(R.normalWorld.x);y.g=Ja(R.normalWorld.y);y.b=Ja(R.normalWorld.z);y.updateStyleString();Y.wireframe?Ea(y.__styleString,Y.wireframe_linewidth):Fa(y.__styleString)}}}function Ea(M,fa){if(A!=M)m.strokeStyle=A=M;if(G!=fa)m.lineWidth=G=fa;m.stroke();P.inflate(fa*2)}function Fa(M){if(C!=M)m.fillStyle=C=M;m.fill()}
|
|
|
|
-function Aa(M,fa,aa,R,Y,ga,na,oa,pa,va,sa,wa,Ba){var ya,xa;ya=na.width-1;xa=na.height-1;oa*=ya;pa*=xa;va*=ya;sa*=xa;wa*=ya;Ba*=xa;aa-=M;R-=fa;Y-=M;ga-=fa;va-=oa;sa-=pa;wa-=oa;Ba-=pa;xa=1/(va*Ba-wa*sa);ya=(Ba*aa-sa*Y)*xa;sa=(Ba*R-sa*ga)*xa;aa=(va*Y-wa*aa)*xa;R=(va*ga-wa*R)*xa;M=M-ya*oa-aa*pa;fa=fa-sa*oa-R*pa;m.save();m.transform(ya,sa,aa,R,M,fa);m.clip();m.drawImage(na,0,0);m.restore()}function Na(M,fa,aa,R){var Y=~~(M.r*255),ga=~~(M.g*255);M=~~(M.b*255);var na=~~(fa.r*255),oa=~~(fa.g*255);fa=~~(fa.b*
|
|
|
|
-255);var pa=~~(aa.r*255),va=~~(aa.g*255);aa=~~(aa.b*255);var sa=~~(R.r*255),wa=~~(R.g*255);R=~~(R.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]=na<0?0:na>255?255:na;ia[5]=oa<0?0:oa>255?255:oa;ia[6]=fa<0?0:fa>255?255:fa;ia[8]=pa<0?0:pa>255?255:pa;ia[9]=va<0?0:va>255?255:va;ia[10]=aa<0?0:aa>255?255:aa;ia[12]=sa<0?0:sa>255?255:sa;ia[13]=wa<0?0:wa>255?255:wa;ia[14]=R<0?0:R>255?255:R;ea.putImageData(ja,0,0);ma.drawImage(X,0,0);return qa}function Ia(M,fa,aa){M=
|
|
|
|
-(M-fa)/(aa-fa);return M*M*(3-2*M)}function Ja(M){M=(M+1)*0.5;return M<0?0:M>1?1:M}function Ka(M,fa){var aa=fa.x-M.x,R=fa.y-M.y,Y=1/Math.sqrt(aa*aa+R*R);aa*=Y;R*=Y;fa.x+=aa;fa.y+=R;M.x-=aa;M.y-=R}var Ga,Oa,ka,ta,za,La,Pa,Ca;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,g);d=e.projectScene(la,ra,this.sortElements);(W=la.lights.length>0)&&Ha(la);Ga=0;for(Oa=d.length;Ga<Oa;Ga++){ka=d[Ga];P.empty();if(ka instanceof THREE.RenderableParticle){w=ka;w.x*=j;w.y*=g;ta=0;for(za=ka.materials.length;ta<
|
|
|
|
-za;ta++)Qa(w,ka,ka.materials[ta],la)}else if(ka instanceof THREE.RenderableLine){w=ka.v1;H=ka.v2;w.positionScreen.x*=j;w.positionScreen.y*=g;H.positionScreen.x*=j;H.positionScreen.y*=g;P.addPoint(w.positionScreen.x,w.positionScreen.y);P.addPoint(H.positionScreen.x,H.positionScreen.y);if(Z.instersects(P)){ta=0;for(za=ka.materials.length;ta<za;)Ra(w,H,ka,ka.materials[ta++],la)}}else if(ka instanceof THREE.RenderableFace3){w=ka.v1;H=ka.v2;p=ka.v3;w.positionScreen.x*=j;w.positionScreen.y*=g;H.positionScreen.x*=
|
|
|
|
-j;H.positionScreen.y*=g;p.positionScreen.x*=j;p.positionScreen.y*=g;if(ka.overdraw){Ka(w.positionScreen,H.positionScreen);Ka(H.positionScreen,p.positionScreen);Ka(p.positionScreen,w.positionScreen)}P.add3Points(w.positionScreen.x,w.positionScreen.y,H.positionScreen.x,H.positionScreen.y,p.positionScreen.x,p.positionScreen.y);if(Z.instersects(P)){ta=0;for(za=ka.meshMaterials.length;ta<za;){Ca=ka.meshMaterials[ta++];if(Ca instanceof THREE.MeshFaceMaterial){La=0;for(Pa=ka.faceMaterials.length;La<Pa;)(Ca=
|
|
|
|
-ka.faceMaterials[La++])&&Ma(w,H,p,ka,Ca,la)}else Ma(w,H,p,ka,Ca,la)}}}V.addRectangle(P)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function a(T,U,ba){var ca,S,K,Z;ca=0;for(S=T.lights.length;ca<S;ca++){K=T.lights[ca];if(K instanceof THREE.DirectionalLight){Z=U.normalWorld.dot(K.position)*K.intensity;if(Z>0){ba.r+=K.color.r*Z;ba.g+=K.color.g*Z;ba.b+=K.color.b*Z}}else if(K instanceof THREE.PointLight){x.sub(K.position,U.centroidWorld);x.normalize();Z=U.normalWorld.dot(x)*K.intensity;if(Z>0){ba.r+=K.color.r*Z;ba.g+=K.color.g*Z;ba.b+=K.color.b*Z}}}}function c(T,U,ba,ca,S,K){D=e(I++);D.setAttribute("d",
|
|
|
|
-"M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+U.positionScreen.x+" "+U.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)p.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(H){l.r=v.r;l.g=v.g;l.b=v.b;a(K,ca,l);p.r=S.color.r*l.r;p.g=S.color.g*l.g;p.b=S.color.b*l.b;p.updateStyleString()}else p.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){q=1-S.__2near/(S.__farPlusNear-
|
|
|
|
-ca.z*S.__farMinusNear);p.setRGB(q,q,q)}else S instanceof THREE.MeshNormalMaterial&&p.setRGB(f(ca.normalWorld.x),f(ca.normalWorld.y),f(ca.normalWorld.z));S.wireframe?D.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+S.wireframe_linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframe_linecap+"; stroke-linejoin: "+S.wireframe_linejoin):D.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+S.opacity);j.appendChild(D)}function d(T,U,ba,ca,S,
|
|
|
|
-K,Z){D=e(I++);D.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+U.positionScreen.x+" "+U.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(K instanceof THREE.MeshBasicMaterial)p.__styleString=K.color.__styleString;else if(K instanceof THREE.MeshLambertMaterial)if(H){l.r=v.r;l.g=v.g;l.b=v.b;a(Z,S,l);p.r=K.color.r*l.r;p.g=K.color.g*l.g;p.b=K.color.b*l.b;p.updateStyleString()}else p.__styleString=K.color.__styleString;
|
|
|
|
-else if(K instanceof THREE.MeshDepthMaterial){q=1-K.__2near/(K.__farPlusNear-S.z*K.__farMinusNear);p.setRGB(q,q,q)}else K instanceof THREE.MeshNormalMaterial&&p.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));K.wireframe?D.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+K.wireframe_linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.wireframe_linecap+"; stroke-linejoin: "+K.wireframe_linejoin):D.setAttribute("style","fill: "+p.__styleString+
|
|
|
|
-"; fill-opacity: "+K.opacity);j.appendChild(D)}function e(T){if(y[T]==null){y[T]=document.createElementNS("http://www.w3.org/2000/svg","path");Q==0&&y[T].setAttribute("shape-rendering","crispEdges");return y[T]}return y[T]}function f(T){return T<0?Math.min((1+T)*0.5,0.5):0.5+Math.min(T*0.5,0.5)}var b=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),g,m,n,z,u,o,A,C,G=new THREE.Rectangle,w=new THREE.Rectangle,H=false,p=new THREE.Color(16777215),l=new THREE.Color(16777215),
|
|
|
|
-v=new THREE.Color(0),t=new THREE.Color(0),k=new THREE.Color(0),q,x=new THREE.Vector3,y=[],F=[],B=[],D,I,N,O,Q=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(T){switch(T){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(T,U){g=T;m=U;n=g/2;z=m/2;j.setAttribute("viewBox",-n+" "+-z+" "+g+" "+m);j.setAttribute("width",g);j.setAttribute("height",m);G.set(-n,-z,n,z)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};
|
|
|
|
-this.render=function(T,U){var ba,ca,S,K,Z,V,P,W;this.autoClear&&this.clear();b=h.projectScene(T,U,this.sortElements);O=N=I=0;if(H=T.lights.length>0){P=T.lights;v.setRGB(0,0,0);t.setRGB(0,0,0);k.setRGB(0,0,0);ba=0;for(ca=P.length;ba<ca;ba++){S=P[ba];K=S.color;if(S instanceof THREE.AmbientLight){v.r+=K.r;v.g+=K.g;v.b+=K.b}else if(S instanceof THREE.DirectionalLight){t.r+=K.r;t.g+=K.g;t.b+=K.b}else if(S instanceof THREE.PointLight){k.r+=K.r;k.g+=K.g;k.b+=K.b}}}ba=0;for(ca=b.length;ba<ca;ba++){P=b[ba];
|
|
|
|
-w.empty();if(P instanceof THREE.RenderableParticle){u=P;u.x*=n;u.y*=-z;S=0;for(K=P.materials.length;S<K;S++)if(W=P.materials[S]){Z=u;V=P;W=W;var $=N++;if(F[$]==null){F[$]=document.createElementNS("http://www.w3.org/2000/svg","circle");Q==0&&F[$].setAttribute("shape-rendering","crispEdges")}D=F[$];D.setAttribute("cx",Z.x);D.setAttribute("cy",Z.y);D.setAttribute("r",V.scale.x*n);if(W instanceof THREE.ParticleCircleMaterial){if(H){l.r=v.r+t.r+k.r;l.g=v.g+t.g+k.g;l.b=v.b+t.b+k.b;p.r=W.color.r*l.r;p.g=
|
|
|
|
-W.color.g*l.g;p.b=W.color.b*l.b;p.updateStyleString()}else p=W.color;D.setAttribute("style","fill: "+p.__styleString)}j.appendChild(D)}}else if(P instanceof THREE.RenderableLine){u=P.v1;o=P.v2;u.positionScreen.x*=n;u.positionScreen.y*=-z;o.positionScreen.x*=n;o.positionScreen.y*=-z;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,o.positionScreen.y);if(G.instersects(w)){S=0;for(K=P.materials.length;S<K;)if(W=P.materials[S++]){Z=u;V=o;W=W;$=O++;if(B[$]==null){B[$]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
-"line");Q==0&&B[$].setAttribute("shape-rendering","crispEdges")}D=B[$];D.setAttribute("x1",Z.positionScreen.x);D.setAttribute("y1",Z.positionScreen.y);D.setAttribute("x2",V.positionScreen.x);D.setAttribute("y2",V.positionScreen.y);if(W instanceof THREE.LineBasicMaterial){p.__styleString=W.color.__styleString;D.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin);j.appendChild(D)}}}}else if(P instanceof
|
|
|
|
-THREE.RenderableFace3){u=P.v1;o=P.v2;A=P.v3;u.positionScreen.x*=n;u.positionScreen.y*=-z;o.positionScreen.x*=n;o.positionScreen.y*=-z;A.positionScreen.x*=n;A.positionScreen.y*=-z;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,o.positionScreen.y);w.addPoint(A.positionScreen.x,A.positionScreen.y);if(G.instersects(w)){S=0;for(K=P.meshMaterials.length;S<K;){W=P.meshMaterials[S++];if(W instanceof THREE.MeshFaceMaterial){Z=0;for(V=P.faceMaterials.length;Z<V;)(W=P.faceMaterials[Z++])&&
|
|
|
|
-c(u,o,A,P,W,T)}else W&&c(u,o,A,P,W,T)}}}else if(P instanceof THREE.RenderableFace4){u=P.v1;o=P.v2;A=P.v3;C=P.v4;u.positionScreen.x*=n;u.positionScreen.y*=-z;o.positionScreen.x*=n;o.positionScreen.y*=-z;A.positionScreen.x*=n;A.positionScreen.y*=-z;C.positionScreen.x*=n;C.positionScreen.y*=-z;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(o.positionScreen.x,o.positionScreen.y);w.addPoint(A.positionScreen.x,A.positionScreen.y);w.addPoint(C.positionScreen.x,C.positionScreen.y);if(G.instersects(w)){S=
|
|
|
|
-0;for(K=P.meshMaterials.length;S<K;){W=P.meshMaterials[S++];if(W instanceof THREE.MeshFaceMaterial){Z=0;for(V=P.faceMaterials.length;Z<V;)(W=P.faceMaterials[Z++])&&d(u,o,A,C,P,W,T)}else W&&d(u,o,A,C,P,W,T)}}}}}};
|
|
|
|
-THREE.WebGLRenderer=function(a){function c(l,v){l.fragment_shader=v.fragment_shader;l.vertex_shader=v.vertex_shader;l.uniforms=Uniforms.clone(v.uniforms)}function d(l,v){var t;if(l=="fragment")t=b.createShader(b.FRAGMENT_SHADER);else if(l=="vertex")t=b.createShader(b.VERTEX_SHADER);b.shaderSource(t,v);b.compileShader(t);if(!b.getShaderParameter(t,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(t));return null}return t}function e(l){switch(l){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;
|
|
|
|
|
|
+THREE.Projector=function(){function a(l,o){return o.z-l.z}function c(l,o){var w=0,y=1,G=l.z+l.w,B=o.z+o.w,C=-l.z+l.w,F=-o.z+o.w;if(G>=0&&B>=0&&C>=0&&F>=0)return true;else if(G<0&&B<0||C<0&&F<0)return false;else{if(G<0)w=Math.max(w,G/(G-B));else if(B<0)y=Math.min(y,G/(G-B));if(C<0)w=Math.max(w,C/(C-F));else if(F<0)y=Math.min(y,C/(C-F));if(y<w)return false;else{l.lerpSelf(o,w);o.lerpSelf(l,1-y);return true}}}var d,e,f=[],b,h,j,g=[],m,n,z=[],u,p,A=[],D=new THREE.Vector4,H=new THREE.Vector4,x=new THREE.Matrix4,
|
|
|
|
+I=new THREE.Matrix4,q=[],k=new THREE.Vector4,v=new THREE.Vector4,t;this.projectObjects=function(l,o,w){var y=[],G,B;e=0;x.multiply(o.projectionMatrix,o.matrix);q[0]=new THREE.Vector4(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);q[1]=new THREE.Vector4(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);q[2]=new THREE.Vector4(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);q[3]=new THREE.Vector4(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);q[4]=new THREE.Vector4(x.n41-x.n31,x.n42-x.n32,x.n43-
|
|
|
|
+x.n33,x.n44-x.n34);q[5]=new THREE.Vector4(x.n41+x.n31,x.n42+x.n32,x.n43+x.n33,x.n44+x.n34);o=0;for(G=q.length;o<G;o++){B=q[o];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}G=l.objects;l=0;for(o=G.length;l<o;l++){B=G[l];var C;if(!(C=!B.visible)){if(C=B instanceof THREE.Mesh){a:{C=void 0;for(var F=B.position,L=-B.geometry.boundingSphere.radius*Math.max(B.scale.x,Math.max(B.scale.y,B.scale.z)),O=0;O<6;O++){C=q[O].x*F.x+q[O].y*F.y+q[O].z*F.z+q[O].w;if(C<=L){C=false;break a}}C=true}C=!C}C=C}if(!C){d=
|
|
|
|
+f[e]=f[e]||new THREE.RenderableObject;D.copy(B.position);x.multiplyVector3(D);d.object=B;d.z=D.z;y.push(d);e++}}w&&y.sort(a);return y};this.projectScene=function(l,o,w){var y=[],G=o.near,B=o.far,C,F,L,O,Q,T,U,ba,ca,S,N,Z,V,J,W,da;j=n=p=0;o.autoUpdateMatrix&&o.updateMatrix();x.multiply(o.projectionMatrix,o.matrix);T=this.projectObjects(l,o,true);l=0;for(C=T.length;l<C;l++){U=T[l].object;if(U.visible){U.autoUpdateMatrix&&U.updateMatrix();ba=U.matrix;ca=U.rotationMatrix;S=U.materials;N=U.overdraw;if(U instanceof
|
|
|
|
+THREE.Mesh){Z=U.geometry;V=Z.vertices;F=0;for(L=V.length;F<L;F++){J=V[F];J.positionWorld.copy(J.position);ba.multiplyVector3(J.positionWorld);O=J.positionScreen;O.copy(J.positionWorld);x.multiplyVector4(O);O.x/=O.w;O.y/=O.w;J.__visible=O.z>G&&O.z<B}Z=Z.faces;F=0;for(L=Z.length;F<L;F++){J=Z[F];if(J instanceof THREE.Face3){O=V[J.a];Q=V[J.b];W=V[J.c];if(O.__visible&&Q.__visible&&W.__visible)if(U.doubleSided||U.flipSided!=(W.positionScreen.x-O.positionScreen.x)*(Q.positionScreen.y-O.positionScreen.y)-
|
|
|
|
+(W.positionScreen.y-O.positionScreen.y)*(Q.positionScreen.x-O.positionScreen.x)<0){b=g[j]=g[j]||new THREE.RenderableFace3;b.v1.positionWorld.copy(O.positionWorld);b.v2.positionWorld.copy(Q.positionWorld);b.v3.positionWorld.copy(W.positionWorld);b.v1.positionScreen.copy(O.positionScreen);b.v2.positionScreen.copy(Q.positionScreen);b.v3.positionScreen.copy(W.positionScreen);b.normalWorld.copy(J.normal);ca.multiplyVector3(b.normalWorld);b.centroidWorld.copy(J.centroid);ba.multiplyVector3(b.centroidWorld);
|
|
|
|
+b.centroidScreen.copy(b.centroidWorld);x.multiplyVector3(b.centroidScreen);W=J.vertexNormals;t=b.vertexNormalsWorld;O=0;for(Q=W.length;O<Q;O++){da=t[O]=t[O]||new THREE.Vector3;da.copy(W[O]);ca.multiplyVector3(da)}b.z=b.centroidScreen.z;b.meshMaterials=S;b.faceMaterials=J.materials;b.overdraw=N;if(U.geometry.uvs[F]){b.uvs[0]=U.geometry.uvs[F][0];b.uvs[1]=U.geometry.uvs[F][1];b.uvs[2]=U.geometry.uvs[F][2]}y.push(b);j++}}else if(J instanceof THREE.Face4){O=V[J.a];Q=V[J.b];W=V[J.c];da=V[J.d];if(O.__visible&&
|
|
|
|
+Q.__visible&&W.__visible&&da.__visible)if(U.doubleSided||U.flipSided!=((da.positionScreen.x-O.positionScreen.x)*(Q.positionScreen.y-O.positionScreen.y)-(da.positionScreen.y-O.positionScreen.y)*(Q.positionScreen.x-O.positionScreen.x)<0||(Q.positionScreen.x-W.positionScreen.x)*(da.positionScreen.y-W.positionScreen.y)-(Q.positionScreen.y-W.positionScreen.y)*(da.positionScreen.x-W.positionScreen.x)<0)){b=g[j]=g[j]||new THREE.RenderableFace3;b.v1.positionWorld.copy(O.positionWorld);b.v2.positionWorld.copy(Q.positionWorld);
|
|
|
|
+b.v3.positionWorld.copy(da.positionWorld);b.v1.positionScreen.copy(O.positionScreen);b.v2.positionScreen.copy(Q.positionScreen);b.v3.positionScreen.copy(da.positionScreen);b.normalWorld.copy(J.normal);ca.multiplyVector3(b.normalWorld);b.centroidWorld.copy(J.centroid);ba.multiplyVector3(b.centroidWorld);b.centroidScreen.copy(b.centroidWorld);x.multiplyVector3(b.centroidScreen);b.z=b.centroidScreen.z;b.meshMaterials=S;b.faceMaterials=J.materials;b.overdraw=N;if(U.geometry.uvs[F]){b.uvs[0]=U.geometry.uvs[F][0];
|
|
|
|
+b.uvs[1]=U.geometry.uvs[F][1];b.uvs[2]=U.geometry.uvs[F][3]}y.push(b);j++;h=g[j]=g[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(Q.positionWorld);h.v2.positionWorld.copy(W.positionWorld);h.v3.positionWorld.copy(da.positionWorld);h.v1.positionScreen.copy(Q.positionScreen);h.v2.positionScreen.copy(W.positionScreen);h.v3.positionScreen.copy(da.positionScreen);h.normalWorld.copy(b.normalWorld);h.centroidWorld.copy(b.centroidWorld);h.centroidScreen.copy(b.centroidScreen);h.z=h.centroidScreen.z;
|
|
|
|
+h.meshMaterials=S;h.faceMaterials=J.materials;h.overdraw=N;if(U.geometry.uvs[F]){h.uvs[0]=U.geometry.uvs[F][1];h.uvs[1]=U.geometry.uvs[F][2];h.uvs[2]=U.geometry.uvs[F][3]}y.push(h);j++}}}}else if(U instanceof THREE.Line){I.multiply(x,ba);V=U.geometry.vertices;J=V[0];J.positionScreen.copy(J.position);I.multiplyVector4(J.positionScreen);F=1;for(L=V.length;F<L;F++){O=V[F];O.positionScreen.copy(O.position);I.multiplyVector4(O.positionScreen);Q=V[F-1];k.copy(O.positionScreen);v.copy(Q.positionScreen);
|
|
|
|
+if(c(k,v)){k.multiplyScalar(1/k.w);v.multiplyScalar(1/v.w);m=z[n]=z[n]||new THREE.RenderableLine;m.v1.positionScreen.copy(k);m.v2.positionScreen.copy(v);m.z=Math.max(k.z,v.z);m.materials=U.materials;y.push(m);n++}}}else if(U instanceof THREE.Particle){H.set(U.position.x,U.position.y,U.position.z,1);x.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){u=A[p]=A[p]||new THREE.RenderableParticle;u.x=H.x/H.w;u.y=H.y/H.w;u.z=H.z;u.rotation=U.rotation.z;u.scale.x=U.scale.x*Math.abs(u.x-(H.x+o.projectionMatrix.n11)/
|
|
|
|
+(H.w+o.projectionMatrix.n14));u.scale.y=U.scale.y*Math.abs(u.y-(H.y+o.projectionMatrix.n22)/(H.w+o.projectionMatrix.n24));u.materials=U.materials;y.push(u);p++}}}}w&&y.sort(a);return y};this.unprojectVector=function(l,o){var w=THREE.Matrix4.makeInvert(o.matrix);w.multiplySelf(THREE.Matrix4.makeInvert(o.projectionMatrix));w.multiplyVector3(l);return l}};
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,f,b;this.domElement=document.createElement("div");this.setSize=function(h,j){d=h;e=j;f=d/2;b=e/2};this.render=function(h,j){var g,m,n,z,u,p,A,D;a=c.projectScene(h,j);g=0;for(m=a.length;g<m;g++){u=a[g];if(u instanceof THREE.RenderableParticle){A=u.x*f+f;D=u.y*b+b;n=0;for(z=u.material.length;n<z;n++){p=u.material[n];if(p instanceof THREE.ParticleDOMMaterial){p=p.domElement;p.style.left=A+"px";p.style.top=D+"px"}}}}}};
|
|
|
|
+THREE.CanvasRenderer=function(){function a(ka){if(u!=ka)m.globalAlpha=u=ka}function c(ka){if(p!=ka){switch(ka){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}p=ka}}var d=null,e=new THREE.Projector,f=document.createElement("canvas"),b,h,j,g,m=f.getContext("2d"),n=new THREE.Color(0),z=0,u=1,p=0,A=null,D=null,H=1,x,I,q,k,v,t,l,o,w,y=new THREE.Color,
|
|
|
|
+G=new THREE.Color,B=new THREE.Color,C=new THREE.Color,F=new THREE.Color,L,O,Q,T,U,ba,ca,S,N,Z=new THREE.Rectangle,V=new THREE.Rectangle,J=new THREE.Rectangle,W=false,da=new THREE.Color,ha=new THREE.Color,ea=new THREE.Color,E=new THREE.Color,M=Math.PI*2,K=new THREE.Vector3,X,$,ma,ia,qa,ta,ua=16;X=document.createElement("canvas");X.width=X.height=2;$=X.getContext("2d");$.fillStyle="rgba(0,0,0,1)";$.fillRect(0,0,2,2);ma=$.getImageData(0,0,2,2);ia=ma.data;qa=document.createElement("canvas");qa.width=
|
|
|
|
+qa.height=ua;ta=qa.getContext("2d");ta.translate(-ua/2,-ua/2);ta.scale(ua,ua);ua--;this.domElement=f;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ka,ja){b=ka;h=ja;j=b/2;g=h/2;f.width=b;f.height=h;Z.set(-j,-g,j,g);u=1;p=0;D=A=null;H=1};this.setClearColor=function(ka,ja){n=ka;z=ja;V.set(-j,-g,j,g);m.setTransform(1,0,0,-1,j,g);this.clear()};this.setClearColorHex=function(ka,ja){n.setHex(ka);z=ja;V.set(-j,-g,j,g);m.setTransform(1,0,0,-1,j,g);this.clear()};this.clear=function(){m.setTransform(1,
|
|
|
|
+0,0,-1,j,g);if(!V.isEmpty()){V.inflate(1);V.minSelf(Z);if(n.hex==0&&z==0)m.clearRect(V.getX(),V.getY(),V.getWidth(),V.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+z+")";m.fillRect(V.getX(),V.getY(),V.getWidth(),V.getHeight())}V.empty()}};this.render=function(ka,ja){function Fa(P){var fa,aa,R,Y=P.lights;ha.setRGB(0,0,0);ea.setRGB(0,0,0);E.setRGB(0,0,0);P=0;for(fa=Y.length;P<fa;P++){aa=Y[P];R=aa.color;if(aa instanceof
|
|
|
|
+THREE.AmbientLight){ha.r+=R.r;ha.g+=R.g;ha.b+=R.b}else if(aa instanceof THREE.DirectionalLight){ea.r+=R.r;ea.g+=R.g;ea.b+=R.b}else if(aa instanceof THREE.PointLight){E.r+=R.r;E.g+=R.g;E.b+=R.b}}}function Aa(P,fa,aa,R){var Y,ga,na,oa,pa=P.lights;P=0;for(Y=pa.length;P<Y;P++){ga=pa[P];na=ga.color;oa=ga.intensity;if(ga instanceof THREE.DirectionalLight){ga=aa.dot(ga.position)*oa;if(ga>0){R.r+=na.r*ga;R.g+=na.g*ga;R.b+=na.b*ga}}else if(ga instanceof THREE.PointLight){K.sub(ga.position,fa);K.normalize();
|
|
|
|
+ga=aa.dot(K)*oa;if(ga>0){R.r+=na.r*ga;R.g+=na.g*ga;R.b+=na.b*ga}}}}function Ja(P,fa,aa){if(aa.opacity!=0){a(aa.opacity);c(aa.blending);var R,Y,ga,na,oa,pa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map&&aa.map.image.loaded){na=aa.map.image;oa=na.width>>1;pa=na.height>>1;Y=fa.scale.x*j;ga=fa.scale.y*g;aa=Y*oa;R=ga*pa;J.set(P.x-aa,P.y-R,P.x+aa,P.y+R);if(Z.instersects(J)){m.save();m.translate(P.x,P.y);m.rotate(-fa.rotation);m.scale(Y,-ga);m.translate(-oa,-pa);m.drawImage(na,0,0);m.restore()}}}else if(aa instanceof
|
|
|
|
+THREE.ParticleCircleMaterial){if(W){da.r=ha.r+ea.r+E.r;da.g=ha.g+ea.g+E.g;da.b=ha.b+ea.b+E.b;y.r=aa.color.r*da.r;y.g=aa.color.g*da.g;y.b=aa.color.b*da.b;y.updateStyleString()}else y.__styleString=aa.color.__styleString;aa=fa.scale.x*j;R=fa.scale.y*g;J.set(P.x-aa,P.y-R,P.x+aa,P.y+R);if(Z.instersects(J)){Y=y.__styleString;if(D!=Y)m.fillStyle=D=Y;m.save();m.translate(P.x,P.y);m.rotate(-fa.rotation);m.scale(aa,R);m.beginPath();m.arc(0,0,1,0,M,true);m.closePath();m.fill();m.restore()}}}}function Ka(P,
|
|
|
|
+fa,aa,R){if(R.opacity!=0){a(R.opacity);c(R.blending);m.beginPath();m.moveTo(P.positionScreen.x,P.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(R instanceof THREE.LineBasicMaterial){y.__styleString=R.color.__styleString;P=R.linewidth;if(H!=P)m.lineWidth=H=P;P=y.__styleString;if(A!=P)m.strokeStyle=A=P;m.stroke();J.inflate(R.linewidth*2)}}}function ra(P,fa,aa,R,Y,ga){if(Y.opacity!=0){a(Y.opacity);c(Y.blending);k=P.positionScreen.x;v=P.positionScreen.y;t=fa.positionScreen.x;
|
|
|
|
+l=fa.positionScreen.y;o=aa.positionScreen.x;w=aa.positionScreen.y;m.beginPath();m.moveTo(k,v);m.lineTo(t,l);m.lineTo(o,w);m.lineTo(k,v);m.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Ca(k,v,t,l,o,w,Y.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){P=ja.matrix;K.copy(R.vertexNormalsWorld[0]);
|
|
|
|
+T=(K.x*P.n11+K.y*P.n12+K.z*P.n13)*0.5+0.5;U=-(K.x*P.n21+K.y*P.n22+K.z*P.n23)*0.5+0.5;K.copy(R.vertexNormalsWorld[1]);ba=(K.x*P.n11+K.y*P.n12+K.z*P.n13)*0.5+0.5;ca=-(K.x*P.n21+K.y*P.n22+K.z*P.n23)*0.5+0.5;K.copy(R.vertexNormalsWorld[2]);S=(K.x*P.n11+K.y*P.n12+K.z*P.n13)*0.5+0.5;N=-(K.x*P.n21+K.y*P.n22+K.z*P.n23)*0.5+0.5;Ca(k,v,t,l,o,w,Y.env_map.image,T,U,ba,ca,S,N)}}else Y.wireframe?Ga(Y.color.__styleString,Y.wireframe_linewidth):Ha(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&
|
|
|
|
+!Y.wireframe){Y.map.mapping instanceof THREE.UVMapping&&Ca(k,v,t,l,o,w,Y.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);c(THREE.SubtractiveBlending)}if(W)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==3){G.r=B.r=C.r=ha.r;G.g=B.g=C.g=ha.g;G.b=B.b=C.b=ha.b;Aa(ga,R.v1.positionWorld,R.vertexNormalsWorld[0],G);Aa(ga,R.v2.positionWorld,R.vertexNormalsWorld[1],B);Aa(ga,R.v3.positionWorld,R.vertexNormalsWorld[2],C);F.r=(B.r+C.r)*0.5;F.g=(B.g+C.g)*
|
|
|
|
+0.5;F.b=(B.b+C.b)*0.5;Q=Pa(G,B,C,F);Ca(k,v,t,l,o,w,Q,0,0,1,0,0,1)}else{da.r=ha.r;da.g=ha.g;da.b=ha.b;Aa(ga,R.centroidWorld,R.normalWorld,da);y.r=Y.color.r*da.r;y.g=Y.color.g*da.g;y.b=Y.color.b*da.b;y.updateStyleString();Y.wireframe?Ga(y.__styleString,Y.wireframe_linewidth):Ha(y.__styleString)}else Y.wireframe?Ga(Y.color.__styleString,Y.wireframe_linewidth):Ha(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){L=ja.near;O=ja.far;G.r=G.g=G.b=1-La(P.positionScreen.z,L,O);B.r=B.g=B.b=
|
|
|
|
+1-La(fa.positionScreen.z,L,O);C.r=C.g=C.b=1-La(aa.positionScreen.z,L,O);F.r=(B.r+C.r)*0.5;F.g=(B.g+C.g)*0.5;F.b=(B.b+C.b)*0.5;Q=Pa(G,B,C,F);Ca(k,v,t,l,o,w,Q,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){y.r=Ma(R.normalWorld.x);y.g=Ma(R.normalWorld.y);y.b=Ma(R.normalWorld.z);y.updateStyleString();Y.wireframe?Ga(y.__styleString,Y.wireframe_linewidth):Ha(y.__styleString)}}}function Ga(P,fa){if(A!=P)m.strokeStyle=A=P;if(H!=fa)m.lineWidth=H=fa;m.stroke();J.inflate(fa*2)}function Ha(P){if(D!=
|
|
|
|
+P)m.fillStyle=D=P;m.fill()}function Ca(P,fa,aa,R,Y,ga,na,oa,pa,wa,sa,xa,Da){var za,ya;za=na.width-1;ya=na.height-1;oa*=za;pa*=ya;wa*=za;sa*=ya;xa*=za;Da*=ya;aa-=P;R-=fa;Y-=P;ga-=fa;wa-=oa;sa-=pa;xa-=oa;Da-=pa;ya=1/(wa*Da-xa*sa);za=(Da*aa-sa*Y)*ya;sa=(Da*R-sa*ga)*ya;aa=(wa*Y-xa*aa)*ya;R=(wa*ga-xa*R)*ya;P=P-za*oa-aa*pa;fa=fa-sa*oa-R*pa;m.save();m.transform(za,sa,aa,R,P,fa);m.clip();m.drawImage(na,0,0);m.restore()}function Pa(P,fa,aa,R){var Y=~~(P.r*255),ga=~~(P.g*255);P=~~(P.b*255);var na=~~(fa.r*255),
|
|
|
|
+oa=~~(fa.g*255);fa=~~(fa.b*255);var pa=~~(aa.r*255),wa=~~(aa.g*255);aa=~~(aa.b*255);var sa=~~(R.r*255),xa=~~(R.g*255);R=~~(R.b*255);ia[0]=Y<0?0:Y>255?255:Y;ia[1]=ga<0?0:ga>255?255:ga;ia[2]=P<0?0:P>255?255:P;ia[4]=na<0?0:na>255?255:na;ia[5]=oa<0?0:oa>255?255:oa;ia[6]=fa<0?0:fa>255?255:fa;ia[8]=pa<0?0:pa>255?255:pa;ia[9]=wa<0?0:wa>255?255:wa;ia[10]=aa<0?0:aa>255?255:aa;ia[12]=sa<0?0:sa>255?255:sa;ia[13]=xa<0?0:xa>255?255:xa;ia[14]=R<0?0:R>255?255:R;$.putImageData(ma,0,0);ta.drawImage(X,0,0);return qa}
|
|
|
|
+function La(P,fa,aa){P=(P-fa)/(aa-fa);return P*P*(3-2*P)}function Ma(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function Na(P,fa){var aa=fa.x-P.x,R=fa.y-P.y,Y=1/Math.sqrt(aa*aa+R*R);aa*=Y;R*=Y;fa.x+=aa;fa.y+=R;P.x-=aa;P.y-=R}var Ia,Qa,la,va,Ba,Oa,Ra,Ea;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,g);d=e.projectScene(ka,ja,this.sortElements);(W=ka.lights.length>0)&&Fa(ka);Ia=0;for(Qa=d.length;Ia<Qa;Ia++){la=d[Ia];J.empty();if(la instanceof THREE.RenderableParticle){x=la;x.x*=j;x.y*=g;va=0;for(Ba=
|
|
|
|
+la.materials.length;va<Ba;va++)Ja(x,la,la.materials[va],ka)}else if(la instanceof THREE.RenderableLine){x=la.v1;I=la.v2;x.positionScreen.x*=j;x.positionScreen.y*=g;I.positionScreen.x*=j;I.positionScreen.y*=g;J.addPoint(x.positionScreen.x,x.positionScreen.y);J.addPoint(I.positionScreen.x,I.positionScreen.y);if(Z.instersects(J)){va=0;for(Ba=la.materials.length;va<Ba;)Ka(x,I,la,la.materials[va++],ka)}}else if(la instanceof THREE.RenderableFace3){x=la.v1;I=la.v2;q=la.v3;x.positionScreen.x*=j;x.positionScreen.y*=
|
|
|
|
+g;I.positionScreen.x*=j;I.positionScreen.y*=g;q.positionScreen.x*=j;q.positionScreen.y*=g;if(la.overdraw){Na(x.positionScreen,I.positionScreen);Na(I.positionScreen,q.positionScreen);Na(q.positionScreen,x.positionScreen)}J.add3Points(x.positionScreen.x,x.positionScreen.y,I.positionScreen.x,I.positionScreen.y,q.positionScreen.x,q.positionScreen.y);if(Z.instersects(J)){va=0;for(Ba=la.meshMaterials.length;va<Ba;){Ea=la.meshMaterials[va++];if(Ea instanceof THREE.MeshFaceMaterial){Oa=0;for(Ra=la.faceMaterials.length;Oa<
|
|
|
|
+Ra;)(Ea=la.faceMaterials[Oa++])&&ra(x,I,q,la,Ea,ka)}else ra(x,I,q,la,Ea,ka)}}}V.addRectangle(J)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function a(T,U,ba){var ca,S,N,Z;ca=0;for(S=T.lights.length;ca<S;ca++){N=T.lights[ca];if(N instanceof THREE.DirectionalLight){Z=U.normalWorld.dot(N.position)*N.intensity;if(Z>0){ba.r+=N.color.r*Z;ba.g+=N.color.g*Z;ba.b+=N.color.b*Z}}else if(N instanceof THREE.PointLight){w.sub(N.position,U.centroidWorld);w.normalize();Z=U.normalWorld.dot(w)*N.intensity;if(Z>0){ba.r+=N.color.r*Z;ba.g+=N.color.g*Z;ba.b+=N.color.b*Z}}}}function c(T,U,ba,ca,S,N){C=e(F++);C.setAttribute("d",
|
|
|
|
+"M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+U.positionScreen.x+" "+U.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)q.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(I){k.r=v.r;k.g=v.g;k.b=v.b;a(N,ca,k);q.r=S.color.r*k.r;q.g=S.color.g*k.g;q.b=S.color.b*k.b;q.updateStyleString()}else q.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){o=1-S.__2near/(S.__farPlusNear-
|
|
|
|
+ca.z*S.__farMinusNear);q.setRGB(o,o,o)}else S instanceof THREE.MeshNormalMaterial&&q.setRGB(f(ca.normalWorld.x),f(ca.normalWorld.y),f(ca.normalWorld.z));S.wireframe?C.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+S.wireframe_linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframe_linecap+"; stroke-linejoin: "+S.wireframe_linejoin):C.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+S.opacity);j.appendChild(C)}function d(T,U,ba,ca,S,
|
|
|
|
+N,Z){C=e(F++);C.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+U.positionScreen.x+" "+U.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(N instanceof THREE.MeshBasicMaterial)q.__styleString=N.color.__styleString;else if(N instanceof THREE.MeshLambertMaterial)if(I){k.r=v.r;k.g=v.g;k.b=v.b;a(Z,S,k);q.r=N.color.r*k.r;q.g=N.color.g*k.g;q.b=N.color.b*k.b;q.updateStyleString()}else q.__styleString=N.color.__styleString;
|
|
|
|
+else if(N instanceof THREE.MeshDepthMaterial){o=1-N.__2near/(N.__farPlusNear-S.z*N.__farMinusNear);q.setRGB(o,o,o)}else N instanceof THREE.MeshNormalMaterial&&q.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));N.wireframe?C.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+N.wireframe_linewidth+"; stroke-opacity: "+N.opacity+"; stroke-linecap: "+N.wireframe_linecap+"; stroke-linejoin: "+N.wireframe_linejoin):C.setAttribute("style","fill: "+q.__styleString+
|
|
|
|
+"; fill-opacity: "+N.opacity);j.appendChild(C)}function e(T){if(y[T]==null){y[T]=document.createElementNS("http://www.w3.org/2000/svg","path");Q==0&&y[T].setAttribute("shape-rendering","crispEdges");return y[T]}return y[T]}function f(T){return T<0?Math.min((1+T)*0.5,0.5):0.5+Math.min(T*0.5,0.5)}var b=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),g,m,n,z,u,p,A,D,H=new THREE.Rectangle,x=new THREE.Rectangle,I=false,q=new THREE.Color(16777215),k=new THREE.Color(16777215),
|
|
|
|
+v=new THREE.Color(0),t=new THREE.Color(0),l=new THREE.Color(0),o,w=new THREE.Vector3,y=[],G=[],B=[],C,F,L,O,Q=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(T){switch(T){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(T,U){g=T;m=U;n=g/2;z=m/2;j.setAttribute("viewBox",-n+" "+-z+" "+g+" "+m);j.setAttribute("width",g);j.setAttribute("height",m);H.set(-n,-z,n,z)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};
|
|
|
|
+this.render=function(T,U){var ba,ca,S,N,Z,V,J,W;this.autoClear&&this.clear();b=h.projectScene(T,U,this.sortElements);O=L=F=0;if(I=T.lights.length>0){J=T.lights;v.setRGB(0,0,0);t.setRGB(0,0,0);l.setRGB(0,0,0);ba=0;for(ca=J.length;ba<ca;ba++){S=J[ba];N=S.color;if(S instanceof THREE.AmbientLight){v.r+=N.r;v.g+=N.g;v.b+=N.b}else if(S instanceof THREE.DirectionalLight){t.r+=N.r;t.g+=N.g;t.b+=N.b}else if(S instanceof THREE.PointLight){l.r+=N.r;l.g+=N.g;l.b+=N.b}}}ba=0;for(ca=b.length;ba<ca;ba++){J=b[ba];
|
|
|
|
+x.empty();if(J instanceof THREE.RenderableParticle){u=J;u.x*=n;u.y*=-z;S=0;for(N=J.materials.length;S<N;S++)if(W=J.materials[S]){Z=u;V=J;W=W;var da=L++;if(G[da]==null){G[da]=document.createElementNS("http://www.w3.org/2000/svg","circle");Q==0&&G[da].setAttribute("shape-rendering","crispEdges")}C=G[da];C.setAttribute("cx",Z.x);C.setAttribute("cy",Z.y);C.setAttribute("r",V.scale.x*n);if(W instanceof THREE.ParticleCircleMaterial){if(I){k.r=v.r+t.r+l.r;k.g=v.g+t.g+l.g;k.b=v.b+t.b+l.b;q.r=W.color.r*k.r;
|
|
|
|
+q.g=W.color.g*k.g;q.b=W.color.b*k.b;q.updateStyleString()}else q=W.color;C.setAttribute("style","fill: "+q.__styleString)}j.appendChild(C)}}else if(J instanceof THREE.RenderableLine){u=J.v1;p=J.v2;u.positionScreen.x*=n;u.positionScreen.y*=-z;p.positionScreen.x*=n;p.positionScreen.y*=-z;x.addPoint(u.positionScreen.x,u.positionScreen.y);x.addPoint(p.positionScreen.x,p.positionScreen.y);if(H.instersects(x)){S=0;for(N=J.materials.length;S<N;)if(W=J.materials[S++]){Z=u;V=p;W=W;da=O++;if(B[da]==null){B[da]=
|
|
|
|
+document.createElementNS("http://www.w3.org/2000/svg","line");Q==0&&B[da].setAttribute("shape-rendering","crispEdges")}C=B[da];C.setAttribute("x1",Z.positionScreen.x);C.setAttribute("y1",Z.positionScreen.y);C.setAttribute("x2",V.positionScreen.x);C.setAttribute("y2",V.positionScreen.y);if(W instanceof THREE.LineBasicMaterial){q.__styleString=W.color.__styleString;C.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+
|
|
|
|
+W.linecap+"; stroke-linejoin: "+W.linejoin);j.appendChild(C)}}}}else if(J instanceof THREE.RenderableFace3){u=J.v1;p=J.v2;A=J.v3;u.positionScreen.x*=n;u.positionScreen.y*=-z;p.positionScreen.x*=n;p.positionScreen.y*=-z;A.positionScreen.x*=n;A.positionScreen.y*=-z;x.addPoint(u.positionScreen.x,u.positionScreen.y);x.addPoint(p.positionScreen.x,p.positionScreen.y);x.addPoint(A.positionScreen.x,A.positionScreen.y);if(H.instersects(x)){S=0;for(N=J.meshMaterials.length;S<N;){W=J.meshMaterials[S++];if(W instanceof
|
|
|
|
+THREE.MeshFaceMaterial){Z=0;for(V=J.faceMaterials.length;Z<V;)(W=J.faceMaterials[Z++])&&c(u,p,A,J,W,T)}else W&&c(u,p,A,J,W,T)}}}else if(J instanceof THREE.RenderableFace4){u=J.v1;p=J.v2;A=J.v3;D=J.v4;u.positionScreen.x*=n;u.positionScreen.y*=-z;p.positionScreen.x*=n;p.positionScreen.y*=-z;A.positionScreen.x*=n;A.positionScreen.y*=-z;D.positionScreen.x*=n;D.positionScreen.y*=-z;x.addPoint(u.positionScreen.x,u.positionScreen.y);x.addPoint(p.positionScreen.x,p.positionScreen.y);x.addPoint(A.positionScreen.x,
|
|
|
|
+A.positionScreen.y);x.addPoint(D.positionScreen.x,D.positionScreen.y);if(H.instersects(x)){S=0;for(N=J.meshMaterials.length;S<N;){W=J.meshMaterials[S++];if(W instanceof THREE.MeshFaceMaterial){Z=0;for(V=J.faceMaterials.length;Z<V;)(W=J.faceMaterials[Z++])&&d(u,p,A,D,J,W,T)}else W&&d(u,p,A,D,J,W,T)}}}}}};
|
|
|
|
+THREE.WebGLRenderer=function(a){function c(k,v){k.fragment_shader=v.fragment_shader;k.vertex_shader=v.vertex_shader;k.uniforms=Uniforms.clone(v.uniforms)}function d(k,v){var t;if(k=="fragment")t=b.createShader(b.FRAGMENT_SHADER);else if(k=="vertex")t=b.createShader(b.VERTEX_SHADER);b.shaderSource(t,v);b.compileShader(t);if(!b.getShaderParameter(t,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(t));return null}return t}function e(k){switch(k){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;
|
|
case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;
|
|
case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;
|
|
case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var f=document.createElement("canvas"),b,h=null,j=null,g=new THREE.Matrix4,m,n=new Float32Array(16),z=new Float32Array(16),
|
|
case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var f=document.createElement("canvas"),b,h=null,j=null,g=new THREE.Matrix4,m,n=new Float32Array(16),z=new Float32Array(16),
|
|
-u=new Float32Array(16),o=new Float32Array(9),A=new Float32Array(16),C=new THREE.Matrix4,G=new THREE.Vector4,w=true,H=new THREE.Color(0),p=0;if(a){if(a.antialias!==undefined)w=a.antialias;a.clearColor!==undefined&&H.setHex(a.clearColor);if(a.clearAlpha!==undefined)p=a.clearAlpha}this.domElement=f;this.autoClear=true;(function(l,v,t){try{b=f.getContext("experimental-webgl",{antialias:l})}catch(k){console.log(k)}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,
|
|
|
|
-0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(v.r,v.g,v.b,t)})(w,H,p);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,v){f.width=l;f.height=v;b.viewport(0,0,f.width,f.height)};this.setClearColorHex=function(l,v){var t=new THREE.Color(l);b.clearColor(t.r,
|
|
|
|
-t.g,t.b,v)};this.setClearColor=function(l,v){b.clearColor(l.r,l.g,l.b,v)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(l,v){var t,k,q,x=0,y=0,F=0,B,D,I,N=this.lights,O=N.directional.colors,Q=N.directional.positions,T=N.point.colors,U=N.point.positions,ba=0,ca=0;t=0;for(k=v.length;t<k;t++){q=v[t];B=q.color;D=q.position;I=q.intensity;if(q instanceof THREE.AmbientLight){x+=B.r;y+=B.g;F+=B.b}else if(q instanceof THREE.DirectionalLight){O[ba*3]=B.r*I;
|
|
|
|
-O[ba*3+1]=B.g*I;O[ba*3+2]=B.b*I;Q[ba*3]=D.x;Q[ba*3+1]=D.y;Q[ba*3+2]=D.z;ba+=1}else if(q instanceof THREE.PointLight){T[ca*3]=B.r*I;T[ca*3+1]=B.g*I;T[ca*3+2]=B.b*I;U[ca*3]=D.x;U[ca*3+1]=D.y;U[ca*3+2]=D.z;ca+=1}}N.point.length=ca;N.directional.length=ba;N.ambient[0]=x;N.ambient[1]=y;N.ambient[2]=F};this.createParticleBuffers=function(l){l.__webGLVertexBuffer=b.createBuffer();l.__webGLParticleBuffer=b.createBuffer();l.__webGLColorBuffer=b.createBuffer()};this.createLineBuffers=function(l){l.__webGLVertexBuffer=
|
|
|
|
-b.createBuffer();l.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(l){l.__webGLVertexBuffer=b.createBuffer();l.__webGLNormalBuffer=b.createBuffer();l.__webGLTangentBuffer=b.createBuffer();l.__webGLUVBuffer=b.createBuffer();l.__webGLUV2Buffer=b.createBuffer();l.__webGLFaceBuffer=b.createBuffer();l.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(l){var v=l.vertices.length;l.__vertexArray=new Float32Array(v*3);l.__lineArray=new Uint16Array(v);l.__webGLLineCount=
|
|
|
|
-v};this.initParticleBuffers=function(l){var v=l.vertices.length;l.__vertexArray=new Float32Array(v*3);l.__colorArray=new Float32Array(v*3);l.__particleArray=new Uint16Array(v);l.__sortArray=[];l.__webGLParticleCount=v};this.initMeshBuffers=function(l,v){var t,k,q=0,x=0,y=0,F=v.geometry.faces,B=l.faces;t=0;for(k=B.length;t<k;t++){fi=B[t];face=F[fi];if(face instanceof THREE.Face3){q+=3;x+=1;y+=3}else if(face instanceof THREE.Face4){q+=4;x+=2;y+=4}}l.__vertexArray=new Float32Array(q*3);l.__normalArray=
|
|
|
|
-new Float32Array(q*3);l.__tangentArray=new Float32Array(q*4);l.__uvArray=new Float32Array(q*2);l.__uv2Array=new Float32Array(q*2);l.__faceArray=new Uint16Array(x*3);l.__lineArray=new Uint16Array(y*2);q=false;t=0;for(k=v.materials.length;t<k;t++){F=v.materials[t];if(F instanceof THREE.MeshFaceMaterial){F=0;for(B=l.materials.length;F<B;F++)if(l.materials[F]&&l.materials[F].shading!=undefined&&l.materials[F].shading==THREE.SmoothShading){q=true;break}}else if(F&&F.shading!=undefined&&F.shading==THREE.SmoothShading){q=
|
|
|
|
-true;break}if(q)break}l.__needsSmoothNormals=q;l.__webGLFaceCount=x*3;l.__webGLLineCount=y*2};this.setMeshBuffers=function(l,v,t){var k,q,x,y,F,B,D,I,N,O,Q=0,T=0,U=0,ba=0,ca=0,S=0,K=0,Z=0,V=l.__vertexArray,P=l.__uvArray,W=l.__uv2Array,$=l.__normalArray,da=l.__tangentArray,ha=l.__faceArray,E=l.__lineArray,L=l.__needsSmoothNormals,J=v.geometry,X=J.__dirtyVertices,ea=J.__dirtyElements,ja=J.__dirtyUvs,ia=J.__dirtyNormals,qa=J.__dirtyTangents,ma=J.vertices,ua=l.faces,la=J.faces,ra=J.uvs,Ha=J.uvs2;v=0;
|
|
|
|
-for(k=ua.length;v<k;v++){q=ua[v];x=la[q];B=ra[q];q=Ha[q];y=x.vertexNormals;F=x.normal;if(x instanceof THREE.Face3){if(X){D=ma[x.a].position;I=ma[x.b].position;N=ma[x.c].position;V[T]=D.x;V[T+1]=D.y;V[T+2]=D.z;V[T+3]=I.x;V[T+4]=I.y;V[T+5]=I.z;V[T+6]=N.x;V[T+7]=N.y;V[T+8]=N.z;T+=9}if(qa&&J.hasTangents){D=ma[x.a].tangent;I=ma[x.b].tangent;N=ma[x.c].tangent;da[K]=D.x;da[K+1]=D.y;da[K+2]=D.z;da[K+3]=D.w;da[K+4]=I.x;da[K+5]=I.y;da[K+6]=I.z;da[K+7]=I.w;da[K+8]=N.x;da[K+9]=N.y;da[K+10]=N.z;da[K+11]=N.w;K+=
|
|
|
|
-12}if(ia)if(y.length==3&&L)for(x=0;x<3;x++){F=y[x];$[S]=F.x;$[S+1]=F.y;$[S+2]=F.z;S+=3}else for(x=0;x<3;x++){$[S]=F.x;$[S+1]=F.y;$[S+2]=F.z;S+=3}if(ja&&B)for(x=0;x<3;x++){y=B[x];P[U]=y.u;P[U+1]=y.v;U+=2}if(ja&&q)for(x=0;x<3;x++){B=q[x];W[ba]=B.u;W[ba+1]=B.v;ba+=2}if(ea){ha[ca]=Q;ha[ca+1]=Q+1;ha[ca+2]=Q+2;ca+=3;E[Z]=Q;E[Z+1]=Q+1;E[Z+2]=Q;E[Z+3]=Q+2;E[Z+4]=Q+1;E[Z+5]=Q+2;Z+=6;Q+=3}}else if(x instanceof THREE.Face4){if(X){D=ma[x.a].position;I=ma[x.b].position;N=ma[x.c].position;O=ma[x.d].position;V[T]=
|
|
|
|
-D.x;V[T+1]=D.y;V[T+2]=D.z;V[T+3]=I.x;V[T+4]=I.y;V[T+5]=I.z;V[T+6]=N.x;V[T+7]=N.y;V[T+8]=N.z;V[T+9]=O.x;V[T+10]=O.y;V[T+11]=O.z;T+=12}if(qa&&J.hasTangents){D=ma[x.a].tangent;I=ma[x.b].tangent;N=ma[x.c].tangent;x=ma[x.d].tangent;da[K]=D.x;da[K+1]=D.y;da[K+2]=D.z;da[K+3]=D.w;da[K+4]=I.x;da[K+5]=I.y;da[K+6]=I.z;da[K+7]=I.w;da[K+8]=N.x;da[K+9]=N.y;da[K+10]=N.z;da[K+11]=N.w;da[K+12]=x.x;da[K+13]=x.y;da[K+14]=x.z;da[K+15]=x.w;K+=16}if(ia)if(y.length==4&&L)for(x=0;x<4;x++){F=y[x];$[S]=F.x;$[S+1]=F.y;$[S+
|
|
|
|
-2]=F.z;S+=3}else for(x=0;x<4;x++){$[S]=F.x;$[S+1]=F.y;$[S+2]=F.z;S+=3}if(ja&&B)for(x=0;x<4;x++){y=B[x];P[U]=y.u;P[U+1]=y.v;U+=2}if(ja&&q)for(x=0;x<4;x++){B=q[x];W[ba]=B.u;W[ba+1]=B.v;ba+=2}if(ea){ha[ca]=Q;ha[ca+1]=Q+1;ha[ca+2]=Q+2;ha[ca+3]=Q;ha[ca+4]=Q+2;ha[ca+5]=Q+3;ca+=6;E[Z]=Q;E[Z+1]=Q+1;E[Z+2]=Q;E[Z+3]=Q+3;E[Z+4]=Q+1;E[Z+5]=Q+2;E[Z+6]=Q+2;E[Z+7]=Q+3;Z+=8;Q+=4}}}if(X){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,V,t)}if(ia){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLNormalBuffer);
|
|
|
|
-b.bufferData(b.ARRAY_BUFFER,$,t)}if(qa&&J.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,da,t)}if(ja&&U>0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,P,t)}if(ja&&ba>0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,W,t)}if(ea){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ha,t);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-E,t)}};this.setLineBuffers=function(l,v){var t,k,q,x=l.vertices,y=x.length,F=l.__vertexArray,B=l.__lineArray,D=l.__dirtyElements;if(l.__dirtyVertices){for(t=0;t<y;t++){k=x[t].position;q=t*3;F[q]=k.x;F[q+1]=k.y;F[q+2]=k.z}b.bindBuffer(b.ARRAY_BUFFER,l.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,F,v)}if(D){for(t=0;t<y;t++)B[t]=t;b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,B,v)}};this.setParticleBuffers=function(l,v,t,k){var q,x,y;x=l.vertices;var F=
|
|
|
|
-x.length,B=l.colors,D=B.length,I=l.__vertexArray,N=l.__particleArray,O=l.__colorArray,Q=l.__sortArray,T=l.__dirtyVertices,U=l.__dirtyElements,ba=l.__dirtyColors;if(t.sortParticles){C.multiply(k.projectionMatrix,k.matrix);C.multiplySelf(t.matrix);for(q=0;q<F;q++){y=x[q].position;G.copy(y);C.multiplyVector3(G);Q[q]=[G.z,q]}Q.sort(function(ca,S){return S[0]-ca[0]});for(q=0;q<F;q++){y=x[Q[q][1]].position;k=q*3;I[k]=y.x;I[k+1]=y.y;I[k+2]=y.z}for(x=0;x<D;x++){k=x*3;color=B[Q[x][1]];O[k]=color.r;O[k+1]=
|
|
|
|
-color.g;O[k+2]=color.b}}else{if(T)for(q=0;q<F;q++){y=x[q].position;k=q*3;I[k]=y.x;I[k+1]=y.y;I[k+2]=y.z}if(ba)for(x=0;x<D;x++){color=B[x];k=x*3;O[k]=color.r;O[k+1]=color.g;O[k+2]=color.b}}if(U){for(q=0;q<F;q++)N[q]=q;b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLParticleBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,N,v)}if(T||t.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,I,v)}if(ba||t.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,
|
|
|
|
-O,v)}};this.initMaterial=function(l,v,t){if(!l.program){var k,q;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof
|
|
|
|
-THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var x,y,F,B;q=F=B=0;for(x=v.length;q<x;q++){y=v[q];y instanceof THREE.DirectionalLight&&F++;y instanceof THREE.PointLight&&B++}if(B+F<=4){v=F;B=B}else{v=Math.ceil(4*F/(B+F));B=4-v}q={directional:v,point:B};B=l.fragment_shader;v=l.vertex_shader;x={fog:t,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,maxDirLights:q.directional,maxPointLights:q.point};t=b.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif",
|
|
|
|
-"#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",x.map?"#define USE_MAP":"",x.env_map?"#define USE_ENVMAP":"",x.light_map?"#define USE_LIGHTMAP":"",x.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");x=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#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":"",x.light_map?"#define USE_LIGHTMAP":"",x.vertex_colors?"#define USE_COLOR":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(t,d("fragment",q+B));b.attachShader(t,
|
|
|
|
-d("vertex",x+v));b.linkProgram(t);b.getProgramParameter(t,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(t,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");t.uniforms={};t.attributes={};l.program=t;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(k in l.uniforms)t.push(k);k=l.program;B=0;for(v=t.length;B<v;B++){q=t[B];k.uniforms[q]=b.getUniformLocation(k,q)}l=l.program;k=["position","normal",
|
|
|
|
-"uv","uv2","tangent","color"];t=0;for(B=k.length;t<B;t++){v=k[t];l.attributes[v]=b.getAttribLocation(l,v)}}};this.setProgram=function(l,v,t,k){this.initMaterial(k,v,t);var q=k.program;if(q!=h){b.useProgram(q);h=q}this.loadCamera(q,l);this.loadMatrices(q);if(k instanceof THREE.MeshPhongMaterial||k instanceof THREE.MeshLambertMaterial){this.setupLights(q,v);v=this.lights;k.uniforms.enableLighting.value=v.directional.length+v.point.length;k.uniforms.ambientLightColor.value=v.ambient;k.uniforms.directionalLightColor.value=
|
|
|
|
-v.directional.colors;k.uniforms.directionalLightDirection.value=v.directional.positions;k.uniforms.pointLightColor.value=v.point.colors;k.uniforms.pointLightPosition.value=v.point.positions}if(k instanceof THREE.MeshBasicMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial){k.uniforms.diffuse.value.setRGB(k.color.r*k.opacity,k.color.g*k.opacity,k.color.b*k.opacity);k.uniforms.opacity.value=k.opacity;k.uniforms.map.texture=k.map;k.uniforms.light_map.texture=k.light_map;
|
|
|
|
-k.uniforms.env_map.texture=k.env_map;k.uniforms.reflectivity.value=k.reflectivity;k.uniforms.refraction_ratio.value=k.refraction_ratio;k.uniforms.combine.value=k.combine;k.uniforms.useRefract.value=k.env_map&&k.env_map.mapping instanceof THREE.CubeRefractionMapping;if(t){k.uniforms.fogColor.value.setHex(t.color.hex);if(t instanceof THREE.Fog){k.uniforms.fogNear.value=t.near;k.uniforms.fogFar.value=t.far}else if(t instanceof THREE.FogExp2)k.uniforms.fogDensity.value=t.density}}if(k instanceof THREE.LineBasicMaterial){k.uniforms.diffuse.value.setRGB(k.color.r*
|
|
|
|
-k.opacity,k.color.g*k.opacity,k.color.b*k.opacity);k.uniforms.opacity.value=k.opacity;if(t){k.uniforms.fogColor.value.setHex(t.color.hex);if(t instanceof THREE.Fog){k.uniforms.fogNear.value=t.near;k.uniforms.fogFar.value=t.far}else if(t instanceof THREE.FogExp2)k.uniforms.fogDensity.value=t.density}}if(k instanceof THREE.ParticleBasicMaterial){k.uniforms.psColor.value.setRGB(k.color.r*k.opacity,k.color.g*k.opacity,k.color.b*k.opacity);k.uniforms.opacity.value=k.opacity;k.uniforms.size.value=k.size;
|
|
|
|
-k.uniforms.map.texture=k.map;if(t){k.uniforms.fogColor.value.setHex(t.color.hex);if(t instanceof THREE.Fog){k.uniforms.fogNear.value=t.near;k.uniforms.fogFar.value=t.far}else if(t instanceof THREE.FogExp2)k.uniforms.fogDensity.value=t.density}}if(k instanceof THREE.MeshPhongMaterial){k.uniforms.ambient.value.setRGB(k.ambient.r,k.ambient.g,k.ambient.b);k.uniforms.specular.value.setRGB(k.specular.r,k.specular.g,k.specular.b);k.uniforms.shininess.value=k.shininess}if(k instanceof THREE.MeshDepthMaterial){k.uniforms.mNear.value=
|
|
|
|
-l.near;k.uniforms.mFar.value=l.far}l=k.uniforms;var x,y;for(x in l)if(y=q.uniforms[x]){k=l[x];v=k.type;t=k.value;if(v=="i")b.uniform1i(y,t);else if(v=="f")b.uniform1f(y,t);else if(v=="fv1")b.uniform1fv(y,t);else if(v=="fv")b.uniform3fv(y,t);else if(v=="v2")b.uniform2f(y,t.x,t.y);else if(v=="v3")b.uniform3f(y,t.x,t.y,t.z);else if(v=="c")b.uniform3f(y,t.r,t.g,t.b);else if(v=="t"){b.uniform1i(y,t);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){k=k;t=t;if(k.image.length==6){if(!k.image.__webGLTextureCube&&
|
|
|
|
-!k.image.__cubeMapInitialized&&k.image.loadCount==6){k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(v=0;v<6;++v)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
|
-v,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[v]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+t);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{k=k;t=t;if(!k.__webGLTexture&&k.image.loaded){k.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(k.wrap_s));
|
|
|
|
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(k.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(k.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(k.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+t);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}return q};this.renderBuffer=function(l,v,t,k,q,x){l=this.setProgram(l,v,t,k,x).attributes;b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(l.position,
|
|
|
|
-3,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.position);if(l.color>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);b.vertexAttribPointer(l.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.color)}if(l.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(l.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.normal)}if(l.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLTangentBuffer);b.vertexAttribPointer(l.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.tangent)}if(l.uv>=
|
|
|
|
-0)if(q.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLUVBuffer);b.vertexAttribPointer(l.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.uv)}else b.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(q.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLUV2Buffer);b.vertexAttribPointer(l.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.uv2)}else b.disableVertexAttribArray(l.uv2);if(k.wireframe||k instanceof THREE.LineBasicMaterial){l=k.wireframe_linewidth!==undefined?k.wireframe_linewidth:
|
|
|
|
-k.linewidth!==undefined?k.linewidth:1;k=k instanceof THREE.LineBasicMaterial&&x.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(l);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);b.drawElements(k,q.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(k instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLParticleBuffer);b.drawElements(b.POINTS,q.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,
|
|
|
|
-q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(l,v,t,k,q,x,y){var F,B,D,I,N;D=0;for(I=k.materials.length;D<I;D++){F=k.materials[D];if(F instanceof THREE.MeshFaceMaterial){F=0;for(B=q.materials.length;F<B;F++)if((N=q.materials[F])&&N.blending==x&&N.opacity<1==y){this.setBlending(N.blending);this.renderBuffer(l,v,t,N,q,k)}}else if((N=F)&&N.blending==x&&N.opacity<1==y){this.setBlending(N.blending);this.renderBuffer(l,v,t,N,q,k)}}};this.renderPassImmediate=function(l,v,t,k,q,x){var y,
|
|
|
|
-F,B,D;y=0;for(F=k.materials.length;y<F;y++)if((B=k.materials[y])&&B.blending==q&&B.opacity<1==x){this.setBlending(B.blending);D=this.setProgram(l,v,t,B,k);k.render(function(I){var N=D;if(!I.__webGLVertexBuffer)I.__webGLVertexBuffer=b.createBuffer();if(!I.__webGLNormalBuffer)I.__webGLNormalBuffer=b.createBuffer();if(I.hasPos){b.bindBuffer(b.ARRAY_BUFFER,I.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,I.positionArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(N.attributes.position);b.vertexAttribPointer(N.attributes.position,
|
|
|
|
-3,b.FLOAT,false,0,0)}if(I.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,I.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,I.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(N.attributes.normal);b.vertexAttribPointer(N.attributes.normal,3,b.FLOAT,false,0,0)}b.drawArrays(b.TRIANGLES,0,I.count);I.count=0})}};this.render=function(l,v,t,k){var q,x,y,F=l.lights,B=l.fog;v.autoUpdateMatrix&&v.updateMatrix();n.set(v.matrix.flatten());u.set(v.projectionMatrix.flatten());this.initWebGLObjects(l,v);k=k!==undefined?
|
|
|
|
-k:true;if(t&&!t.__webGLFramebuffer){t.__webGLFramebuffer=b.createFramebuffer();t.__webGLRenderbuffer=b.createRenderbuffer();t.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,t.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,t.width,t.height);b.bindTexture(b.TEXTURE_2D,t.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(t.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(t.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,
|
|
|
|
-e(t.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(t.min_filter));b.texImage2D(b.TEXTURE_2D,0,e(t.format),t.width,t.height,0,e(t.format),e(t.type),null);b.bindFramebuffer(b.FRAMEBUFFER,t.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,t.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,t.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,
|
|
|
|
-null)}if(t){q=t.__webGLFramebuffer;y=t.width;x=t.height}else{q=null;y=f.width;x=f.height}if(q!=j){b.bindFramebuffer(b.FRAMEBUFFER,q);b.viewport(0,0,y,x);k&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);j=q}this.autoClear&&this.clear();q=l.__webGLObjects.length;for(k=0;k<q;k++){x=l.__webGLObjects[k];y=x.object;if(y.visible){y.autoUpdateMatrix&&y.updateMatrix();if(y.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);y.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}}}for(k=0;k<q;k++){x=l.__webGLObjects[k];
|
|
|
|
-y=x.object;x=x.buffer;if(y.visible){y.autoUpdateMatrix&&y.updateMatrix();this.setupMatrices(y,v);this.renderPass(v,F,B,y,x,THREE.NormalBlending,false)}}for(k=0;k<l.__webGLObjectsImmediate.length;k++){x=l.__webGLObjectsImmediate[k];y=x.object;if(y.visible){y.autoUpdateMatrix&&y.updateMatrix();this.setupMatrices(y,v);this.renderPassImmediate(v,F,B,y,THREE.NormalBlending,false)}}for(k=0;k<q;k++){x=l.__webGLObjects[k];y=x.object;x=x.buffer;if(y.visible){this.setupMatrices(y,v);this.renderPass(v,F,B,y,
|
|
|
|
-x,THREE.AdditiveBlending,false);this.renderPass(v,F,B,y,x,THREE.SubtractiveBlending,false);this.renderPass(v,F,B,y,x,THREE.AdditiveBlending,true);this.renderPass(v,F,B,y,x,THREE.SubtractiveBlending,true);this.renderPass(v,F,B,y,x,THREE.NormalBlending,true);this.renderPass(v,F,B,y,x,THREE.BillboardBlending,false)}}for(k=0;k<l.__webGLObjectsImmediate.length;k++){x=l.__webGLObjectsImmediate[k];y=x.object;if(y.visible){y.autoUpdateMatrix&&y.updateMatrix();this.setupMatrices(y,v);this.renderPassImmediate(v,
|
|
|
|
-F,B,y,THREE.NormalBlending,true)}}if(t&&t.min_filter!==THREE.NearestFilter&&t.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,t.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(l,v){function t(N,O,Q,T){if(N[O]==undefined){l.__webGLObjects.push({buffer:Q,object:T});N[O]=1}}function k(N,O,Q){if(N[O]==undefined){l.__webGLObjectsImmediate.push({object:Q});N[O]=1}}var q,x,y,F,B,D,I;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap=
|
|
|
|
-{};l.__webGLObjectsImmediate=[]}q=0;for(x=l.objects.length;q<x;q++){y=l.objects[q];B=y.geometry;if(l.__webGLObjectsMap[y.id]==undefined)l.__webGLObjectsMap[y.id]={};I=l.__webGLObjectsMap[y.id];if(y instanceof THREE.Mesh){for(F in B.geometryChunks){D=B.geometryChunks[F];if(!D.__webGLVertexBuffer){this.createMeshBuffers(D);this.initMeshBuffers(D,y);B.__dirtyVertices=true;B.__dirtyElements=true;B.__dirtyUvs=true;B.__dirtyNormals=true;B.__dirtyTangents=true}if(B.__dirtyVertices||B.__dirtyElements||B.__dirtyUvs)this.setMeshBuffers(D,
|
|
|
|
-y,b.DYNAMIC_DRAW);t(I,F,D,y)}B.__dirtyVertices=false;B.__dirtyElements=false;B.__dirtyUvs=false;B.__dirtyNormals=false;B.__dirtyTangents=false}else if(y instanceof THREE.Line){if(!B.__webGLVertexBuffer){this.createLineBuffers(B);this.initLineBuffers(B);B.__dirtyVertices=true;B.__dirtyElements=true}B.__dirtyVertices&&this.setLineBuffers(B,b.DYNAMIC_DRAW);t(I,0,B,y);B.__dirtyVertices=false;B.__dirtyElements=false}else if(y instanceof THREE.ParticleSystem){if(!B.__webGLVertexBuffer){this.createParticleBuffers(B);
|
|
|
|
-this.initParticleBuffers(B);B.__dirtyVertices=true;B.__dirtyColors=true;B.__dirtyElements=true}if(B.__dirtyVertices||B.__dirtyColors||y.sortParticles)this.setParticleBuffers(B,b.DYNAMIC_DRAW,y,v);t(I,0,B,y);B.__dirtyVertices=false;B.__dirtyColors=false;B.__dirtyElements=false}else y instanceof THREE.MarchingCubes&&k(I,0,y)}};this.removeObject=function(l,v){var t,k;for(t=l.__webGLObjects.length-1;t>=0;t--){k=l.__webGLObjects[t].object;v==k&&l.__webGLObjects.splice(t,1)}};this.setupMatrices=function(l,
|
|
|
|
-v){g.multiply(v.matrix,l.matrix);z.set(g.flatten());m=THREE.Matrix4.makeInvert3x3(g).transpose();o.set(m.m);A.set(l.matrix.flatten())};this.loadMatrices=function(l){b.uniformMatrix4fv(l.uniforms.viewMatrix,false,n);b.uniformMatrix4fv(l.uniforms.modelViewMatrix,false,z);b.uniformMatrix4fv(l.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(l.uniforms.normalMatrix,false,o);b.uniformMatrix4fv(l.uniforms.objectMatrix,false,A)};this.loadCamera=function(l,v){b.uniform3f(l.uniforms.cameraPosition,v.position.x,
|
|
|
|
-v.position.y,v.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;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(l,v){if(l){!v||v=="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, gl_FragColor.w ), 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 = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float 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_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",
|
|
|
|
-lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\nlightmapColor = texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\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",
|
|
|
|
|
|
+u=new Float32Array(16),p=new Float32Array(9),A=new Float32Array(16),D=new THREE.Matrix4,H=new THREE.Vector4,x=true,I=new THREE.Color(0),q=0;if(a){if(a.antialias!==undefined)x=a.antialias;a.clearColor!==undefined&&I.setHex(a.clearColor);if(a.clearAlpha!==undefined)q=a.clearAlpha}this.domElement=f;this.autoClear=true;(function(k,v,t){try{b=f.getContext("experimental-webgl",{antialias:k})}catch(l){console.log(l)}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,
|
|
|
|
+0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(v.r,v.g,v.b,t)})(x,I,q);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(k,v){f.width=k;f.height=v;b.viewport(0,0,f.width,f.height)};this.setClearColorHex=function(k,v){var t=new THREE.Color(k);b.clearColor(t.r,
|
|
|
|
+t.g,t.b,v)};this.setClearColor=function(k,v){b.clearColor(k.r,k.g,k.b,v)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(k,v){var t,l,o,w=0,y=0,G=0,B,C,F,L=this.lights,O=L.directional.colors,Q=L.directional.positions,T=L.point.colors,U=L.point.positions,ba=0,ca=0;t=0;for(l=v.length;t<l;t++){o=v[t];B=o.color;C=o.position;F=o.intensity;if(o instanceof THREE.AmbientLight){w+=B.r;y+=B.g;G+=B.b}else if(o instanceof THREE.DirectionalLight){O[ba*3]=B.r*F;
|
|
|
|
+O[ba*3+1]=B.g*F;O[ba*3+2]=B.b*F;Q[ba*3]=C.x;Q[ba*3+1]=C.y;Q[ba*3+2]=C.z;ba+=1}else if(o instanceof THREE.PointLight){T[ca*3]=B.r*F;T[ca*3+1]=B.g*F;T[ca*3+2]=B.b*F;U[ca*3]=C.x;U[ca*3+1]=C.y;U[ca*3+2]=C.z;ca+=1}}L.point.length=ca;L.directional.length=ba;L.ambient[0]=w;L.ambient[1]=y;L.ambient[2]=G};this.createParticleBuffers=function(k){k.__webGLVertexBuffer=b.createBuffer();k.__webGLColorBuffer=b.createBuffer();k.__webGLParticleBuffer=b.createBuffer()};this.createLineBuffers=function(k){k.__webGLVertexBuffer=
|
|
|
|
+b.createBuffer();k.__webGLColorBuffer=b.createBuffer();k.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(k){k.__webGLVertexBuffer=b.createBuffer();k.__webGLNormalBuffer=b.createBuffer();k.__webGLTangentBuffer=b.createBuffer();k.__webGLColorBuffer=b.createBuffer();k.__webGLUVBuffer=b.createBuffer();k.__webGLUV2Buffer=b.createBuffer();k.__webGLFaceBuffer=b.createBuffer();k.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(k){var v=k.vertices.length;k.__vertexArray=
|
|
|
|
+new Float32Array(v*3);k.__colorArray=new Float32Array(v*3);k.__lineArray=new Uint16Array(v);k.__webGLLineCount=v};this.initParticleBuffers=function(k){var v=k.vertices.length;k.__vertexArray=new Float32Array(v*3);k.__colorArray=new Float32Array(v*3);k.__particleArray=new Uint16Array(v);k.__sortArray=[];k.__webGLParticleCount=v};this.initMeshBuffers=function(k,v){var t,l,o=0,w=0,y=0,G=v.geometry.faces,B=k.faces;t=0;for(l=B.length;t<l;t++){fi=B[t];face=G[fi];if(face instanceof THREE.Face3){o+=3;w+=
|
|
|
|
+1;y+=3}else if(face instanceof THREE.Face4){o+=4;w+=2;y+=4}}k.__vertexArray=new Float32Array(o*3);k.__normalArray=new Float32Array(o*3);k.__tangentArray=new Float32Array(o*4);k.__colorArray=new Float32Array(o*3);k.__uvArray=new Float32Array(o*2);k.__uv2Array=new Float32Array(o*2);k.__faceArray=new Uint16Array(w*3);k.__lineArray=new Uint16Array(y*2);o=false;t=0;for(l=v.materials.length;t<l;t++){G=v.materials[t];if(G instanceof THREE.MeshFaceMaterial){G=0;for(B=k.materials.length;G<B;G++)if(k.materials[G]&&
|
|
|
|
+k.materials[G].shading!=undefined&&k.materials[G].shading==THREE.SmoothShading){o=true;break}}else if(G&&G.shading!=undefined&&G.shading==THREE.SmoothShading){o=true;break}if(o)break}k.__needsSmoothNormals=o;k.__webGLFaceCount=w*3;k.__webGLLineCount=y*2};this.setMeshBuffers=function(k,v,t){var l,o,w,y,G,B,C,F,L,O,Q=0,T=0,U=0,ba=0,ca=0,S=0,N=0,Z=0,V=0,J=k.__vertexArray,W=k.__uvArray,da=k.__uv2Array,ha=k.__normalArray,ea=k.__tangentArray,E=k.__colorArray,M=k.__faceArray,K=k.__lineArray,X=k.__needsSmoothNormals,
|
|
|
|
+$=v.geometry,ma=$.__dirtyVertices,ia=$.__dirtyElements,qa=$.__dirtyUvs,ta=$.__dirtyNormals,ua=$.__dirtyTangents,ka=$.__dirtyColors,ja=$.vertices,Fa=k.faces,Aa=$.faces,Ja=$.uvs,Ka=$.uvs2,ra=$.colors;v=0;for(l=Fa.length;v<l;v++){o=Fa[v];w=Aa[o];B=Ja[o];o=Ka[o];y=w.vertexNormals;G=w.normal;if(w instanceof THREE.Face3){if(ma){C=ja[w.a].position;F=ja[w.b].position;L=ja[w.c].position;J[T]=C.x;J[T+1]=C.y;J[T+2]=C.z;J[T+3]=F.x;J[T+4]=F.y;J[T+5]=F.z;J[T+6]=L.x;J[T+7]=L.y;J[T+8]=L.z;T+=9}if(ka&&ra.length){C=
|
|
|
|
+ra[w.a];F=ra[w.b];L=ra[w.c];E[V]=C.r;E[V+1]=C.g;E[V+2]=C.b;E[V+3]=F.r;E[V+4]=F.g;E[V+5]=F.b;E[V+6]=L.r;E[V+7]=L.g;E[V+8]=L.b;V+=9}if(ua&&$.hasTangents){C=ja[w.a].tangent;F=ja[w.b].tangent;L=ja[w.c].tangent;ea[N]=C.x;ea[N+1]=C.y;ea[N+2]=C.z;ea[N+3]=C.w;ea[N+4]=F.x;ea[N+5]=F.y;ea[N+6]=F.z;ea[N+7]=F.w;ea[N+8]=L.x;ea[N+9]=L.y;ea[N+10]=L.z;ea[N+11]=L.w;N+=12}if(ta)if(y.length==3&&X)for(w=0;w<3;w++){G=y[w];ha[S]=G.x;ha[S+1]=G.y;ha[S+2]=G.z;S+=3}else for(w=0;w<3;w++){ha[S]=G.x;ha[S+1]=G.y;ha[S+2]=G.z;S+=
|
|
|
|
+3}if(qa&&B)for(w=0;w<3;w++){y=B[w];W[U]=y.u;W[U+1]=y.v;U+=2}if(qa&&o)for(w=0;w<3;w++){B=o[w];da[ba]=B.u;da[ba+1]=B.v;ba+=2}if(ia){M[ca]=Q;M[ca+1]=Q+1;M[ca+2]=Q+2;ca+=3;K[Z]=Q;K[Z+1]=Q+1;K[Z+2]=Q;K[Z+3]=Q+2;K[Z+4]=Q+1;K[Z+5]=Q+2;Z+=6;Q+=3}}else if(w instanceof THREE.Face4){if(ma){C=ja[w.a].position;F=ja[w.b].position;L=ja[w.c].position;O=ja[w.d].position;J[T]=C.x;J[T+1]=C.y;J[T+2]=C.z;J[T+3]=F.x;J[T+4]=F.y;J[T+5]=F.z;J[T+6]=L.x;J[T+7]=L.y;J[T+8]=L.z;J[T+9]=O.x;J[T+10]=O.y;J[T+11]=O.z;T+=12}if(ka&&
|
|
|
|
+ra.length){C=ra[w.a];F=ra[w.b];L=ra[w.d];E[V]=C.r;E[V+1]=C.g;E[V+2]=C.b;E[V+3]=F.r;E[V+4]=F.g;E[V+5]=F.b;E[V+6]=L.r;E[V+7]=L.g;E[V+8]=L.b;E[V+9]=(void 0).r;E[V+10]=(void 0).g;E[V+11]=(void 0).b;V+=12}if(ua&&$.hasTangents){C=ja[w.a].tangent;F=ja[w.b].tangent;L=ja[w.c].tangent;w=ja[w.d].tangent;ea[N]=C.x;ea[N+1]=C.y;ea[N+2]=C.z;ea[N+3]=C.w;ea[N+4]=F.x;ea[N+5]=F.y;ea[N+6]=F.z;ea[N+7]=F.w;ea[N+8]=L.x;ea[N+9]=L.y;ea[N+10]=L.z;ea[N+11]=L.w;ea[N+12]=w.x;ea[N+13]=w.y;ea[N+14]=w.z;ea[N+15]=w.w;N+=16}if(ta)if(y.length==
|
|
|
|
+4&&X)for(w=0;w<4;w++){G=y[w];ha[S]=G.x;ha[S+1]=G.y;ha[S+2]=G.z;S+=3}else for(w=0;w<4;w++){ha[S]=G.x;ha[S+1]=G.y;ha[S+2]=G.z;S+=3}if(qa&&B)for(w=0;w<4;w++){y=B[w];W[U]=y.u;W[U+1]=y.v;U+=2}if(qa&&o)for(w=0;w<4;w++){B=o[w];da[ba]=B.u;da[ba+1]=B.v;ba+=2}if(ia){M[ca]=Q;M[ca+1]=Q+1;M[ca+2]=Q+2;M[ca+3]=Q;M[ca+4]=Q+2;M[ca+5]=Q+3;ca+=6;K[Z]=Q;K[Z+1]=Q+1;K[Z+2]=Q;K[Z+3]=Q+3;K[Z+4]=Q+1;K[Z+5]=Q+2;K[Z+6]=Q+2;K[Z+7]=Q+3;Z+=8;Q+=4}}}if(ma){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,
|
|
|
|
+J,t)}if(ka&&ra.length){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,E,t)}if(ta){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,ha,t)}if(ua&&$.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,ea,t)}if(qa&&U>0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,W,t)}if(qa&&ba>0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,da,t)}if(ia){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+k.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,M,t);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,K,t)}};this.setLineBuffers=function(k,v){var t,l,o,w=k.vertices,y=k.colors,G=w.length,B=y.length,C=k.__vertexArray,F=k.__colorArray,L=k.__lineArray,O=k.__dirtyColors,Q=k.__dirtyElements;if(k.__dirtyVertices){for(t=0;t<G;t++){l=w[t].position;o=t*3;C[o]=l.x;C[o+1]=l.y;C[o+2]=l.z}b.bindBuffer(b.ARRAY_BUFFER,k.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,
|
|
|
|
+C,v)}if(O){for(t=0;t<B;t++){color=y[t];o=t*3;F[o]=color.r;F[o+1]=color.g;F[o+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,k.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,F,v)}if(Q){for(t=0;t<G;t++)L[t]=t;b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,L,v)}};this.setParticleBuffers=function(k,v,t,l){var o,w,y;w=k.vertices;var G=w.length,B=k.colors,C=B.length,F=k.__vertexArray,L=k.__particleArray,O=k.__colorArray,Q=k.__sortArray,T=k.__dirtyVertices,U=k.__dirtyElements,
|
|
|
|
+ba=k.__dirtyColors;if(t.sortParticles){D.multiply(l.projectionMatrix,l.matrix);D.multiplySelf(t.matrix);for(o=0;o<G;o++){y=w[o].position;H.copy(y);D.multiplyVector3(H);Q[o]=[H.z,o]}Q.sort(function(ca,S){return S[0]-ca[0]});for(o=0;o<G;o++){y=w[Q[o][1]].position;l=o*3;F[l]=y.x;F[l+1]=y.y;F[l+2]=y.z}for(w=0;w<C;w++){l=w*3;color=B[Q[w][1]];O[l]=color.r;O[l+1]=color.g;O[l+2]=color.b}}else{if(T)for(o=0;o<G;o++){y=w[o].position;l=o*3;F[l]=y.x;F[l+1]=y.y;F[l+2]=y.z}if(ba)for(w=0;w<C;w++){color=B[w];l=w*
|
|
|
|
+3;O[l]=color.r;O[l+1]=color.g;O[l+2]=color.b}}if(U){for(o=0;o<G;o++)L[o]=o;b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLParticleBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,L,v)}if(T||t.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,F,v)}if(ba||t.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,O,v)}};this.initMaterial=function(k,v,t){if(!k.program){var l,o;if(k instanceof THREE.MeshDepthMaterial)c(k,THREE.ShaderLib.depth);
|
|
|
|
+else if(k instanceof THREE.MeshNormalMaterial)c(k,THREE.ShaderLib.normal);else if(k instanceof THREE.MeshBasicMaterial)c(k,THREE.ShaderLib.basic);else if(k instanceof THREE.MeshLambertMaterial)c(k,THREE.ShaderLib.lambert);else if(k instanceof THREE.MeshPhongMaterial)c(k,THREE.ShaderLib.phong);else if(k instanceof THREE.LineBasicMaterial)c(k,THREE.ShaderLib.basic);else k instanceof THREE.ParticleBasicMaterial&&c(k,THREE.ShaderLib.particle_basic);var w,y,G,B;o=G=B=0;for(w=v.length;o<w;o++){y=v[o];y instanceof
|
|
|
|
+THREE.DirectionalLight&&G++;y instanceof THREE.PointLight&&B++}if(B+G<=4){v=G;B=B}else{v=Math.ceil(4*G/(B+G));B=4-v}o={directional:v,point:B};B=k.fragment_shader;v=k.vertex_shader;w={fog:t,map:k.map,env_map:k.env_map,light_map:k.light_map,vertex_colors:k.vertex_colors,maxDirLights:o.directional,maxPointLights:o.point};t=b.createProgram();o=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,w.fog?"#define USE_FOG":"",
|
|
|
|
+w.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",w.map?"#define USE_MAP":"",w.env_map?"#define USE_ENVMAP":"",w.light_map?"#define USE_LIGHTMAP":"",w.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");w=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,w.map?"#define USE_MAP":"",w.env_map?"#define USE_ENVMAP":"",w.light_map?
|
|
|
|
+"#define USE_LIGHTMAP":"",w.vertex_colors?"#define USE_COLOR":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(t,d("fragment",o+B));b.attachShader(t,d("vertex",w+v));b.linkProgram(t);b.getProgramParameter(t,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+
|
|
|
|
+b.getProgramParameter(t,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");t.uniforms={};t.attributes={};k.program=t;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(l in k.uniforms)t.push(l);l=k.program;B=0;for(v=t.length;B<v;B++){o=t[B];l.uniforms[o]=b.getUniformLocation(l,o)}k=k.program;l=["position","normal","uv","uv2","tangent","color"];t=0;for(B=l.length;t<B;t++){v=l[t];k.attributes[v]=b.getAttribLocation(k,v)}}};this.setProgram=function(k,
|
|
|
|
+v,t,l){this.initMaterial(l,v,t);var o=l.program;if(o!=h){b.useProgram(o);h=o}this.loadCamera(o,k);this.loadMatrices(o);if(l instanceof THREE.MeshPhongMaterial||l instanceof THREE.MeshLambertMaterial){this.setupLights(o,v);v=this.lights;l.uniforms.enableLighting.value=v.directional.length+v.point.length;l.uniforms.ambientLightColor.value=v.ambient;l.uniforms.directionalLightColor.value=v.directional.colors;l.uniforms.directionalLightDirection.value=v.directional.positions;l.uniforms.pointLightColor.value=
|
|
|
|
+v.point.colors;l.uniforms.pointLightPosition.value=v.point.positions}if(l instanceof THREE.MeshBasicMaterial||l instanceof THREE.MeshLambertMaterial||l instanceof THREE.MeshPhongMaterial){l.uniforms.diffuse.value.setRGB(l.color.r*l.opacity,l.color.g*l.opacity,l.color.b*l.opacity);l.uniforms.opacity.value=l.opacity;l.uniforms.map.texture=l.map;l.uniforms.light_map.texture=l.light_map;l.uniforms.env_map.texture=l.env_map;l.uniforms.reflectivity.value=l.reflectivity;l.uniforms.refraction_ratio.value=
|
|
|
|
+l.refraction_ratio;l.uniforms.combine.value=l.combine;l.uniforms.useRefract.value=l.env_map&&l.env_map.mapping instanceof THREE.CubeRefractionMapping;if(t){l.uniforms.fogColor.value.setHex(t.color.hex);if(t instanceof THREE.Fog){l.uniforms.fogNear.value=t.near;l.uniforms.fogFar.value=t.far}else if(t instanceof THREE.FogExp2)l.uniforms.fogDensity.value=t.density}}if(l instanceof THREE.LineBasicMaterial){l.uniforms.diffuse.value.setRGB(l.color.r*l.opacity,l.color.g*l.opacity,l.color.b*l.opacity);l.uniforms.opacity.value=
|
|
|
|
+l.opacity;if(t){l.uniforms.fogColor.value.setHex(t.color.hex);if(t instanceof THREE.Fog){l.uniforms.fogNear.value=t.near;l.uniforms.fogFar.value=t.far}else if(t instanceof THREE.FogExp2)l.uniforms.fogDensity.value=t.density}}if(l instanceof THREE.ParticleBasicMaterial){l.uniforms.psColor.value.setRGB(l.color.r*l.opacity,l.color.g*l.opacity,l.color.b*l.opacity);l.uniforms.opacity.value=l.opacity;l.uniforms.size.value=l.size;l.uniforms.map.texture=l.map;if(t){l.uniforms.fogColor.value.setHex(t.color.hex);
|
|
|
|
+if(t instanceof THREE.Fog){l.uniforms.fogNear.value=t.near;l.uniforms.fogFar.value=t.far}else if(t instanceof THREE.FogExp2)l.uniforms.fogDensity.value=t.density}}if(l instanceof THREE.MeshPhongMaterial){l.uniforms.ambient.value.setRGB(l.ambient.r,l.ambient.g,l.ambient.b);l.uniforms.specular.value.setRGB(l.specular.r,l.specular.g,l.specular.b);l.uniforms.shininess.value=l.shininess}if(l instanceof THREE.MeshDepthMaterial){l.uniforms.mNear.value=k.near;l.uniforms.mFar.value=k.far}k=l.uniforms;var w,
|
|
|
|
+y;for(w in k)if(y=o.uniforms[w]){l=k[w];v=l.type;t=l.value;if(v=="i")b.uniform1i(y,t);else if(v=="f")b.uniform1f(y,t);else if(v=="fv1")b.uniform1fv(y,t);else if(v=="fv")b.uniform3fv(y,t);else if(v=="v2")b.uniform2f(y,t.x,t.y);else if(v=="v3")b.uniform3f(y,t.x,t.y,t.z);else if(v=="c")b.uniform3f(y,t.r,t.g,t.b);else if(v=="t"){b.uniform1i(y,t);if(l=l.texture)if(l.image instanceof Array&&l.image.length==6){l=l;t=t;if(l.image.length==6){if(!l.image.__webGLTextureCube&&!l.image.__cubeMapInitialized&&l.image.loadCount==
|
|
|
|
+6){l.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,l.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(v=0;v<6;++v)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,l.image[v]);b.generateMipmap(b.TEXTURE_CUBE_MAP);
|
|
|
|
+b.bindTexture(b.TEXTURE_CUBE_MAP,null);l.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+t);b.bindTexture(b.TEXTURE_CUBE_MAP,l.image.__webGLTextureCube)}}else{l=l;t=t;if(!l.__webGLTexture&&l.image.loaded){l.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,l.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,l.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(l.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(l.wrap_t));b.texParameteri(b.TEXTURE_2D,
|
|
|
|
+b.TEXTURE_MAG_FILTER,e(l.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(l.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+t);b.bindTexture(b.TEXTURE_2D,l.__webGLTexture)}}}return o};this.renderBuffer=function(k,v,t,l,o,w){k=this.setProgram(k,v,t,l,w).attributes;b.bindBuffer(b.ARRAY_BUFFER,o.__webGLVertexBuffer);b.vertexAttribPointer(k.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(k.position);if(k.color>=0){b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
|
+o.__webGLColorBuffer);b.vertexAttribPointer(k.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(k.color)}if(k.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLNormalBuffer);b.vertexAttribPointer(k.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(k.normal)}if(k.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLTangentBuffer);b.vertexAttribPointer(k.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(k.tangent)}if(k.uv>=0)if(o.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUVBuffer);
|
|
|
|
+b.vertexAttribPointer(k.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(k.uv)}else b.disableVertexAttribArray(k.uv);if(k.uv2>=0)if(o.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUV2Buffer);b.vertexAttribPointer(k.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(k.uv2)}else b.disableVertexAttribArray(k.uv2);if(l.wireframe||l instanceof THREE.LineBasicMaterial){k=l.wireframe_linewidth!==undefined?l.wireframe_linewidth:l.linewidth!==undefined?l.linewidth:1;l=l instanceof THREE.LineBasicMaterial&&
|
|
|
|
+w.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(k);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);b.drawElements(l,o.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(l instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLParticleBuffer);b.drawElements(b.POINTS,o.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,o.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(k,
|
|
|
|
+v,t,l,o,w,y){var G,B,C,F,L;C=0;for(F=l.materials.length;C<F;C++){G=l.materials[C];if(G instanceof THREE.MeshFaceMaterial){G=0;for(B=o.materials.length;G<B;G++)if((L=o.materials[G])&&L.blending==w&&L.opacity<1==y){this.setBlending(L.blending);this.renderBuffer(k,v,t,L,o,l)}}else if((L=G)&&L.blending==w&&L.opacity<1==y){this.setBlending(L.blending);this.renderBuffer(k,v,t,L,o,l)}}};this.renderPassImmediate=function(k,v,t,l,o,w){var y,G,B,C;y=0;for(G=l.materials.length;y<G;y++)if((B=l.materials[y])&&
|
|
|
|
+B.blending==o&&B.opacity<1==w){this.setBlending(B.blending);C=this.setProgram(k,v,t,B,l);l.render(function(F){var L=C;if(!F.__webGLVertexBuffer)F.__webGLVertexBuffer=b.createBuffer();if(!F.__webGLNormalBuffer)F.__webGLNormalBuffer=b.createBuffer();if(F.hasPos){b.bindBuffer(b.ARRAY_BUFFER,F.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,F.positionArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(L.attributes.position);b.vertexAttribPointer(L.attributes.position,3,b.FLOAT,false,0,0)}if(F.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
|
+F.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,F.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(L.attributes.normal);b.vertexAttribPointer(L.attributes.normal,3,b.FLOAT,false,0,0)}b.drawArrays(b.TRIANGLES,0,F.count);F.count=0})}};this.render=function(k,v,t,l){var o,w,y,G=k.lights,B=k.fog;v.autoUpdateMatrix&&v.updateMatrix();n.set(v.matrix.flatten());u.set(v.projectionMatrix.flatten());this.initWebGLObjects(k,v);l=l!==undefined?l:true;if(t&&!t.__webGLFramebuffer){t.__webGLFramebuffer=b.createFramebuffer();
|
|
|
|
+t.__webGLRenderbuffer=b.createRenderbuffer();t.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,t.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,t.width,t.height);b.bindTexture(b.TEXTURE_2D,t.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(t.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(t.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(t.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(t.min_filter));
|
|
|
|
+b.texImage2D(b.TEXTURE_2D,0,e(t.format),t.width,t.height,0,e(t.format),e(t.type),null);b.bindFramebuffer(b.FRAMEBUFFER,t.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,t.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,t.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(t){o=t.__webGLFramebuffer;y=t.width;w=t.height}else{o=null;
|
|
|
|
+y=f.width;w=f.height}if(o!=j){b.bindFramebuffer(b.FRAMEBUFFER,o);b.viewport(0,0,y,w);l&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);j=o}this.autoClear&&this.clear();o=k.__webGLObjects.length;for(l=0;l<o;l++){w=k.__webGLObjects[l];y=w.object;if(y.visible){y.autoUpdateMatrix&&y.updateMatrix();if(y.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);y.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}}}for(l=0;l<o;l++){w=k.__webGLObjects[l];y=w.object;w=w.buffer;if(y.visible){y.autoUpdateMatrix&&
|
|
|
|
+y.updateMatrix();this.setupMatrices(y,v);this.renderPass(v,G,B,y,w,THREE.NormalBlending,false)}}for(l=0;l<k.__webGLObjectsImmediate.length;l++){w=k.__webGLObjectsImmediate[l];y=w.object;if(y.visible){y.autoUpdateMatrix&&y.updateMatrix();this.setupMatrices(y,v);this.renderPassImmediate(v,G,B,y,THREE.NormalBlending,false)}}for(l=0;l<o;l++){w=k.__webGLObjects[l];y=w.object;w=w.buffer;if(y.visible){this.setupMatrices(y,v);this.renderPass(v,G,B,y,w,THREE.AdditiveBlending,false);this.renderPass(v,G,B,y,
|
|
|
|
+w,THREE.SubtractiveBlending,false);this.renderPass(v,G,B,y,w,THREE.AdditiveBlending,true);this.renderPass(v,G,B,y,w,THREE.SubtractiveBlending,true);this.renderPass(v,G,B,y,w,THREE.NormalBlending,true);this.renderPass(v,G,B,y,w,THREE.BillboardBlending,false)}}for(l=0;l<k.__webGLObjectsImmediate.length;l++){w=k.__webGLObjectsImmediate[l];y=w.object;if(y.visible){y.autoUpdateMatrix&&y.updateMatrix();this.setupMatrices(y,v);this.renderPassImmediate(v,G,B,y,THREE.NormalBlending,true)}}if(t&&t.min_filter!==
|
|
|
|
+THREE.NearestFilter&&t.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,t.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(k,v){function t(L,O,Q,T){if(L[O]==undefined){k.__webGLObjects.push({buffer:Q,object:T});L[O]=1}}function l(L,O,Q){if(L[O]==undefined){k.__webGLObjectsImmediate.push({object:Q});L[O]=1}}var o,w,y,G,B,C,F;if(!k.__webGLObjects){k.__webGLObjects=[];k.__webGLObjectsMap={};k.__webGLObjectsImmediate=[]}o=0;for(w=
|
|
|
|
+k.objects.length;o<w;o++){y=k.objects[o];B=y.geometry;if(k.__webGLObjectsMap[y.id]==undefined)k.__webGLObjectsMap[y.id]={};F=k.__webGLObjectsMap[y.id];if(y instanceof THREE.Mesh){for(G in B.geometryChunks){C=B.geometryChunks[G];if(!C.__webGLVertexBuffer){this.createMeshBuffers(C);this.initMeshBuffers(C,y);B.__dirtyVertices=true;B.__dirtyElements=true;B.__dirtyUvs=true;B.__dirtyNormals=true;B.__dirtyTangents=true;B.__dirtyColors=true}if(B.__dirtyVertices||B.__dirtyElements||B.__dirtyUvs||B.__dirtyNormals||
|
|
|
|
+B.__dirtyColors||B.__dirtyTangents)this.setMeshBuffers(C,y,b.DYNAMIC_DRAW);t(F,G,C,y)}B.__dirtyVertices=false;B.__dirtyElements=false;B.__dirtyUvs=false;B.__dirtyNormals=false;B.__dirtyTangents=false;B.__dirtyColors=false}else if(y instanceof THREE.Line){if(!B.__webGLVertexBuffer){this.createLineBuffers(B);this.initLineBuffers(B);B.__dirtyVertices=true;B.__dirtyElements=true;B.__dirtyColors=true}if(B.__dirtyVertices||B.__dirtyColors)this.setLineBuffers(B,b.DYNAMIC_DRAW);t(F,0,B,y);B.__dirtyVertices=
|
|
|
|
+false;B.__dirtyElements=false}else if(y instanceof THREE.ParticleSystem){if(!B.__webGLVertexBuffer){this.createParticleBuffers(B);this.initParticleBuffers(B);B.__dirtyVertices=true;B.__dirtyColors=true;B.__dirtyElements=true}if(B.__dirtyVertices||B.__dirtyColors||y.sortParticles)this.setParticleBuffers(B,b.DYNAMIC_DRAW,y,v);t(F,0,B,y);B.__dirtyVertices=false;B.__dirtyColors=false;B.__dirtyElements=false}else y instanceof THREE.MarchingCubes&&l(F,0,y)}};this.removeObject=function(k,v){var t,l;for(t=
|
|
|
|
+k.__webGLObjects.length-1;t>=0;t--){l=k.__webGLObjects[t].object;v==l&&k.__webGLObjects.splice(t,1)}};this.setupMatrices=function(k,v){g.multiply(v.matrix,k.matrix);z.set(g.flatten());m=THREE.Matrix4.makeInvert3x3(g).transpose();p.set(m.m);A.set(k.matrix.flatten())};this.loadMatrices=function(k){b.uniformMatrix4fv(k.uniforms.viewMatrix,false,n);b.uniformMatrix4fv(k.uniforms.modelViewMatrix,false,z);b.uniformMatrix4fv(k.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(k.uniforms.normalMatrix,
|
|
|
|
+false,p);b.uniformMatrix4fv(k.uniforms.objectMatrix,false,A)};this.loadCamera=function(k,v){b.uniform3f(k.uniforms.cameraPosition,v.position.x,v.position.y,v.position.z)};this.setBlending=function(k){switch(k){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;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);
|
|
|
|
+b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(k,v){if(k){!v||v=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(k=="back")b.cullFace(b.BACK);else k=="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, gl_FragColor.w ), 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 = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float 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_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
|
|
+map_particle_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
|
|
|
|
+lightmap_fragment:"#ifdef USE_LIGHTMAP\nlightmapColor = texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\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_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",
|
|
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",
|
|
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\nvertexColor = vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif"};
|
|
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\nvertexColor = vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif"};
|
|
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,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",
|
|
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,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",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},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)}}};
|
|
value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},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)}}};
|
|
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",
|
|
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",
|
|
-vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
|
|
|
|
-THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},
|
|
|
|
-lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,
|
|
|
|
-THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_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.lightmap_vertex,
|
|
|
|
-THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
|
|
|
|
|
|
+vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );\nvec4 vertexColor = vec4( 1.0 );",
|
|
|
|
+THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,"gl_FragColor = mColor * mapColor * lightmapColor * vertexColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,
|
|
|
|
+THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
|
|
|
|
+THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_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.lightmap_vertex,THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
|
|
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * totalLight * vec4( vLightWeighting, 1.0 );",
|
|
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * 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.lightmap_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.lightmap_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.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.lightmap_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.lightmap_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")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( psColor, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 vertexColor = vec4( 1.0 );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,
|
|
THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( psColor, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 vertexColor = vec4( 1.0 );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,
|
|
"gl_FragColor = mColor * mapColor * vertexColor;",THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};
|
|
"gl_FragColor = mColor * mapColor * vertexColor;",THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\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.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};
|
|
THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
-var GeometryUtils={merge:function(a,c){var d=c instanceof THREE.Mesh,e=a.vertices.length,f=d?c.geometry:c,b=a.vertices,h=f.vertices,j=a.faces,g=f.faces,m=a.uvs;f=f.uvs;d&&c.autoUpdateMatrix&&c.updateMatrix();for(var n=0,z=h.length;n<z;n++){var u=new THREE.Vertex(h[n].position.clone());d&&c.matrix.multiplyVector3(u.position);b.push(u)}n=0;for(z=g.length;n<z;n++){h=g[n];var o,A=h.vertexNormals;if(h instanceof THREE.Face3)o=new THREE.Face3(h.a+e,h.b+e,h.c+e);else if(h instanceof THREE.Face4)o=new THREE.Face4(h.a+
|
|
|
|
-e,h.b+e,h.c+e,h.d+e);o.centroid.copy(h.centroid);o.normal.copy(h.normal);d=0;for(b=A.length;d<b;d++){u=A[d];o.vertexNormals.push(u.clone())}o.materials=h.materials.slice();j.push(o)}n=0;for(z=f.length;n<z;n++){e=f[n];j=[];d=0;for(b=e.length;d<b;d++)j.push(new THREE.UV(e[d].u,e[d].v));m.push(j)}}},ImageUtils={loadTexture:function(a,c,d){var e=new Image;e.onload=function(){this.loaded=true;d&&d(this)};e.src=a;return new THREE.Texture(e,c)},loadArray:function(a,c){var d,e,f=[];d=f.loadCount=0;for(e=
|
|
|
|
-a.length;d<e;++d){f[d]=new Image;f[d].loaded=0;f[d].onload=function(){f.loadCount+=1;this.loaded=true;c&&c(this)};f[d].src=a[d]}return f}},SceneUtils={loadScene:function(a,c,d,e){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function b(){for(n in k.objects)if(!D.objects[n]){C=k.objects[n];if(p=D.geometries[C.geometry]){t=[];for(i=0;i<C.materials.length;i++)t[i]=D.materials[C.materials[i]];G=C.position;r=C.rotation;s=C.scale;object=new THREE.Mesh(p,t);object.position.set(G[0],G[1],G[2]);
|
|
|
|
-object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=C.visible;D.scene.addObject(object);D.objects[n]=object}}}function h(I){return function(N){D.geometries[I]=N;b();x-=1;j()}}function j(){e({total_models:F,total_textures:B,loaded_models:F-x,loaded_textures:B-y},D);x==0&&y==0&&d(D)}var g,m,n,z,u,o,A,C,G,w,H,p,l,v,t,k,q,x,y,F,B,D;k=f.data;q=new THREE.Loader;y=x=0;D={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};
|
|
|
|
-f=function(){y-=1;j()};for(u in k.cameras){w=k.cameras[u];if(w.type=="perspective")l=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){l=new THREE.Camera;l.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}G=w.position;w=w.target;l.position.set(G[0],G[1],G[2]);l.target.position.set(w[0],w[1],w[2]);D.cameras[u]=l}for(z in k.lights){u=k.lights[z];if(u.type=="directional"){G=u.direction;light=new THREE.DirectionalLight;light.position.set(G[0],G[1],
|
|
|
|
-G[2]);light.position.normalize()}else if(u.type=="point"){G=u.position;light=new THREE.PointLight;light.position.set(G[0],G[1],G[2])}w=u.color;i=u.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);D.scene.addLight(light);D.lights[z]=light}for(o in k.fogs){z=k.fogs[o];if(z.type=="linear")v=new THREE.Fog(0,z.near,z.far);else if(z.type=="exp2")v=new THREE.FogExp2(0,z.density);w=z.color;v.color.setRGB(w[0],w[1],w[2]);D.fogs[o]=v}if(D.cameras&&k.defaults.camera)D.currentCamera=D.cameras[k.defaults.camera];
|
|
|
|
-if(D.fogs&&k.defaults.fog)D.scene.fog=D.fogs[k.defaults.fog];w=k.defaults.bgcolor;D.bgColor=new THREE.Color;D.bgColor.setRGB(w[0],w[1],w[2]);D.bgColorAlpha=k.defaults.bgalpha;for(g in k.geometries){o=k.geometries[g];if(o.type=="bin_mesh"||o.type=="ascii_mesh")x+=1}F=x;for(g in k.geometries){o=k.geometries[g];if(o.type=="cube"){p=new Cube(o.width,o.height,o.depth,o.segments_width,o.segments_height,null,o.flipped,o.sides);D.geometries[g]=p}else if(o.type=="plane"){p=new Plane(o.width,o.height,o.segments_width,
|
|
|
|
-o.segments_height);D.geometries[g]=p}else if(o.type=="sphere"){p=new Sphere(o.radius,o.segments_width,o.segments_height);D.geometries[g]=p}else if(o.type=="cylinder"){p=new Cylinder(o.numSegs,o.topRad,o.botRad,o.height,o.topOffset,o.botOffset);D.geometries[g]=p}else if(o.type=="torus"){p=new Torus(o.radius,o.tube,o.segmentsR,o.segmentsT);D.geometries[g]=p}else if(o.type=="icosahedron"){p=new Icosahedron(o.subdivisions);D.geometries[g]=p}else if(o.type=="bin_mesh")q.loadBinary({model:o.url,callback:h(g)});
|
|
|
|
-else o.type=="ascii_mesh"&&q.loadAscii({model:o.url,callback:h(g)})}for(A in k.textures){g=k.textures[A];y+=g.url instanceof Array?g.url.length:1}B=y;for(A in k.textures){g=k.textures[A];if(g.mapping!=undefined&&THREE[g.mapping]!=undefined)g.mapping=new THREE[g.mapping];if(g.url instanceof Array){o=ImageUtils.loadArray(g.url,f);o=new THREE.Texture(o,g.mapping)}else{o=ImageUtils.loadTexture(g.url,g.mapping,f);if(THREE[g.min_filter]!=undefined)o.min_filter=THREE[g.min_filter];if(THREE[g.mag_filter]!=
|
|
|
|
-undefined)o.mag_filter=THREE[g.mag_filter]}D.textures[A]=o}for(m in k.materials){A=k.materials[m];for(H in A.parameters)if(H=="env_map"||H=="map"||H=="light_map")A.parameters[H]=D.textures[A.parameters[H]];else if(H=="shading")A.parameters[H]=A.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")A.parameters[H]=THREE[A.parameters[H]]?THREE[A.parameters[H]]:THREE.NormalBlending;else if(H=="combine")A.parameters[H]=A.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;
|
|
|
|
-A=new THREE[A.type](A.parameters);D.materials[m]=A}b();c(D)}},addMesh:function(a,c,d,e,f,b,h,j,g,m){c=new THREE.Mesh(c,m);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=e;c.position.y=f;c.position.z=b;c.rotation.x=h;c.rotation.y=j;c.rotation.z=g;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,d){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragment_shader:e.fragment_shader,vertex_shader:e.vertex_shader,uniforms:e.uniforms});c=new THREE.Mesh(new Cube(c,
|
|
|
|
|
|
+var GeometryUtils={merge:function(a,c){var d=c instanceof THREE.Mesh,e=a.vertices.length,f=d?c.geometry:c,b=a.vertices,h=f.vertices,j=a.faces,g=f.faces,m=a.uvs;f=f.uvs;d&&c.autoUpdateMatrix&&c.updateMatrix();for(var n=0,z=h.length;n<z;n++){var u=new THREE.Vertex(h[n].position.clone());d&&c.matrix.multiplyVector3(u.position);b.push(u)}n=0;for(z=g.length;n<z;n++){h=g[n];var p,A=h.vertexNormals;if(h instanceof THREE.Face3)p=new THREE.Face3(h.a+e,h.b+e,h.c+e);else if(h instanceof THREE.Face4)p=new THREE.Face4(h.a+
|
|
|
|
+e,h.b+e,h.c+e,h.d+e);p.centroid.copy(h.centroid);p.normal.copy(h.normal);d=0;for(b=A.length;d<b;d++){u=A[d];p.vertexNormals.push(u.clone())}p.materials=h.materials.slice();j.push(p)}n=0;for(z=f.length;n<z;n++){e=f[n];j=[];d=0;for(b=e.length;d<b;d++)j.push(new THREE.UV(e[d].u,e[d].v));m.push(j)}}},ImageUtils={loadTexture:function(a,c,d){var e=new Image;e.onload=function(){this.loaded=true;d&&d(this)};e.src=a;return new THREE.Texture(e,c)},loadArray:function(a,c){var d,e,f=[];d=f.loadCount=0;for(e=
|
|
|
|
+a.length;d<e;++d){f[d]=new Image;f[d].loaded=0;f[d].onload=function(){f.loadCount+=1;this.loaded=true;c&&c(this)};f[d].src=a[d]}return f}},SceneUtils={loadScene:function(a,c,d,e){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function b(){for(n in l.objects)if(!C.objects[n]){D=l.objects[n];if(q=C.geometries[D.geometry]){t=[];for(i=0;i<D.materials.length;i++)t[i]=C.materials[D.materials[i]];H=D.position;r=D.rotation;s=D.scale;object=new THREE.Mesh(q,t);object.position.set(H[0],H[1],H[2]);
|
|
|
|
+object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;C.scene.addObject(object);C.objects[n]=object}}}function h(F){return function(L){C.geometries[F]=L;b();w-=1;j()}}function j(){e({total_models:G,total_textures:B,loaded_models:G-w,loaded_textures:B-y},C);w==0&&y==0&&d(C)}var g,m,n,z,u,p,A,D,H,x,I,q,k,v,t,l,o,w,y,G,B,C;l=f.data;o=new THREE.Loader;y=w=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};
|
|
|
|
+f=function(){y-=1;j()};for(u in l.cameras){x=l.cameras[u];if(x.type=="perspective")k=new THREE.Camera(x.fov,x.aspect,x.near,x.far);else if(x.type=="ortho"){k=new THREE.Camera;k.projectionMatrix=THREE.Matrix4.makeOrtho(x.left,x.right,x.top,x.bottom,x.near,x.far)}H=x.position;x=x.target;k.position.set(H[0],H[1],H[2]);k.target.position.set(x[0],x[1],x[2]);C.cameras[u]=k}for(z in l.lights){u=l.lights[z];if(u.type=="directional"){H=u.direction;light=new THREE.DirectionalLight;light.position.set(H[0],H[1],
|
|
|
|
+H[2]);light.position.normalize()}else if(u.type=="point"){H=u.position;light=new THREE.PointLight;light.position.set(H[0],H[1],H[2])}x=u.color;i=u.intensity||1;light.color.setRGB(x[0]*i,x[1]*i,x[2]*i);C.scene.addLight(light);C.lights[z]=light}for(p in l.fogs){z=l.fogs[p];if(z.type=="linear")v=new THREE.Fog(0,z.near,z.far);else if(z.type=="exp2")v=new THREE.FogExp2(0,z.density);x=z.color;v.color.setRGB(x[0],x[1],x[2]);C.fogs[p]=v}if(C.cameras&&l.defaults.camera)C.currentCamera=C.cameras[l.defaults.camera];
|
|
|
|
+if(C.fogs&&l.defaults.fog)C.scene.fog=C.fogs[l.defaults.fog];x=l.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(x[0],x[1],x[2]);C.bgColorAlpha=l.defaults.bgalpha;for(g in l.geometries){p=l.geometries[g];if(p.type=="bin_mesh"||p.type=="ascii_mesh")w+=1}G=w;for(g in l.geometries){p=l.geometries[g];if(p.type=="cube"){q=new Cube(p.width,p.height,p.depth,p.segments_width,p.segments_height,null,p.flipped,p.sides);C.geometries[g]=q}else if(p.type=="plane"){q=new Plane(p.width,p.height,p.segments_width,
|
|
|
|
+p.segments_height);C.geometries[g]=q}else if(p.type=="sphere"){q=new Sphere(p.radius,p.segments_width,p.segments_height);C.geometries[g]=q}else if(p.type=="cylinder"){q=new Cylinder(p.numSegs,p.topRad,p.botRad,p.height,p.topOffset,p.botOffset);C.geometries[g]=q}else if(p.type=="torus"){q=new Torus(p.radius,p.tube,p.segmentsR,p.segmentsT);C.geometries[g]=q}else if(p.type=="icosahedron"){q=new Icosahedron(p.subdivisions);C.geometries[g]=q}else if(p.type=="bin_mesh")o.loadBinary({model:p.url,callback:h(g)});
|
|
|
|
+else p.type=="ascii_mesh"&&o.loadAscii({model:p.url,callback:h(g)})}for(A in l.textures){g=l.textures[A];y+=g.url instanceof Array?g.url.length:1}B=y;for(A in l.textures){g=l.textures[A];if(g.mapping!=undefined&&THREE[g.mapping]!=undefined)g.mapping=new THREE[g.mapping];if(g.url instanceof Array){p=ImageUtils.loadArray(g.url,f);p=new THREE.Texture(p,g.mapping)}else{p=ImageUtils.loadTexture(g.url,g.mapping,f);if(THREE[g.min_filter]!=undefined)p.min_filter=THREE[g.min_filter];if(THREE[g.mag_filter]!=
|
|
|
|
+undefined)p.mag_filter=THREE[g.mag_filter]}C.textures[A]=p}for(m in l.materials){A=l.materials[m];for(I in A.parameters)if(I=="env_map"||I=="map"||I=="light_map")A.parameters[I]=C.textures[A.parameters[I]];else if(I=="shading")A.parameters[I]=A.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")A.parameters[I]=THREE[A.parameters[I]]?THREE[A.parameters[I]]:THREE.NormalBlending;else if(I=="combine")A.parameters[I]=A.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;
|
|
|
|
+A=new THREE[A.type](A.parameters);C.materials[m]=A}b();c(C)}},addMesh:function(a,c,d,e,f,b,h,j,g,m){c=new THREE.Mesh(c,m);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=e;c.position.y=f;c.position.z=b;c.rotation.x=h;c.rotation.y=j;c.rotation.z=g;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,d){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragment_shader:e.fragment_shader,vertex_shader:e.vertex_shader,uniforms:e.uniforms});c=new THREE.Mesh(new Cube(c,
|
|
c,c,1,1,null,true),d);a.addObject(c);return c},addPanoramaCube:function(a,c,d){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));c=new THREE.Mesh(new Cube(c,
|
|
c,c,1,1,null,true),d);a.addObject(c);return c},addPanoramaCube:function(a,c,d){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));c=new THREE.Mesh(new Cube(c,
|
|
c,c,1,1,e,true),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,d){var e=c/2;c=new Plane(c,c);var f=Math.PI/2,b=Math.PI;SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));SceneUtils.addMesh(a,c,1,-e,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));SceneUtils.addMesh(a,c,1,e,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));SceneUtils.addMesh(a,c,1,0,e,0,f,0,b,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));
|
|
c,c,1,1,e,true),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,d){var e=c/2;c=new Plane(c,c);var f=Math.PI/2,b=Math.PI;SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));SceneUtils.addMesh(a,c,1,-e,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));SceneUtils.addMesh(a,c,1,e,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));SceneUtils.addMesh(a,c,1,0,e,0,f,0,b,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));
|
|
SceneUtils.addMesh(a,c,1,0,-e,0,-f,0,b,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
SceneUtils.addMesh(a,c,1,0,-e,0,-f,0,b,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
@@ -239,21 +242,21 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying ve
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nconst float fNintensity = 0.35;\nconst float fSintensity = 0.35;\nconst float fScount = 4096.0;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin(vUv.y * fScount), cos(vUv.y * fScount) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * fSintensity;\ncResult = cTextureScreen.rgb + clamp( fNintensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nconst float fNintensity = 0.35;\nconst float fSintensity = 0.35;\nconst float fScount = 4096.0;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin(vUv.y * fScount), cos(vUv.y * fScount) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * fSintensity;\ncResult = cTextureScreen.rgb + clamp( fNintensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\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}"}},buildKernel:function(a){var c,d,e,f,b=2*Math.ceil(a*3)+1;if(b>25)b=25;f=(b-1)*0.5;d=Array(b);for(c=e=0;c<b;++c){d[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));e+=d[c]}for(c=0;c<b;++c)d[c]/=e;return d}},Cube=function(a,c,d,e,f,b,h,j){function g(C,G,w,H,p,l,v,t){var k,q,x=e||1,y=f||1,F=x+1,B=y+1,D=p/2,I=l/2;p=p/x;var N=l/y,O=m.vertices.length;if(C=="x"&&G=="y"||C=="y"&&G=="x")k="z";else if(C=="x"&&G=="z"||C=="z"&&G=="x")k="y";else if(C==
|
|
|
|
-"z"&&G=="y"||C=="y"&&G=="z")k="x";for(q=0;q<B;q++)for(l=0;l<F;l++){var Q=new THREE.Vector3;Q[C]=(l*p-D)*w;Q[G]=(q*N-I)*H;Q[k]=v;m.vertices.push(new THREE.Vertex(Q))}for(q=0;q<y;q++)for(l=0;l<x;l++){m.faces.push(new THREE.Face4(l+F*q+O,l+F*(q+1)+O,l+1+F*(q+1)+O,l+1+F*q+O,null,t));m.uvs.push([new THREE.UV(l/x,q/y),new THREE.UV(l/x,(q+1)/y),new THREE.UV((l+1)/x,(q+1)/y),new THREE.UV((l+1)/x,q/y)])}}THREE.Geometry.call(this);var m=this,n=a/2,z=c/2,u=d/2;h=h?-1:1;if(b!==undefined)if(b instanceof Array)this.materials=
|
|
|
|
-b;else{this.materials=[];for(var o=0;o<6;o++)this.materials.push([b])}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(j!=undefined)for(var A in j)if(this.sides[A]!=undefined)this.sides[A]=j[A];this.sides.px&&g("z","y",1*h,-1,d,c,-n,this.materials[0]);this.sides.nx&&g("z","y",-1*h,-1,d,c,n,this.materials[1]);this.sides.py&&g("x","z",1*h,1,a,d,z,this.materials[2]);this.sides.ny&&g("x","z",1*h,-1,a,d,-z,this.materials[3]);this.sides.pz&&g("x","y",1*h,-1,a,c,u,this.materials[4]);
|
|
|
|
-this.sides.nz&&g("x","y",-1*h,-1,a,c,-u,this.materials[5]);(function(){for(var C=[],G=[],w=0,H=m.vertices.length;w<H;w++){for(var p=m.vertices[w],l=false,v=0,t=C.length;v<t;v++){var k=C[v];if(p.position.x==k.position.x&&p.position.y==k.position.y&&p.position.z==k.position.z){G[w]=v;l=true;break}}if(!l){G[w]=C.length;C.push(new THREE.Vertex(p.position.clone()))}}w=0;for(H=m.faces.length;w<H;w++){p=m.faces[w];p.a=G[p.a];p.b=G[p.b];p.c=G[p.c];p.d=G[p.d]}m.vertices=C})();this.computeCentroids();this.computeFaceNormals();
|
|
|
|
|
|
+fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,d,e,f,b=2*Math.ceil(a*3)+1;if(b>25)b=25;f=(b-1)*0.5;d=Array(b);for(c=e=0;c<b;++c){d[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));e+=d[c]}for(c=0;c<b;++c)d[c]/=e;return d}},Cube=function(a,c,d,e,f,b,h,j){function g(D,H,x,I,q,k,v,t){var l,o,w=e||1,y=f||1,G=w+1,B=y+1,C=q/2,F=k/2;q=q/w;var L=k/y,O=m.vertices.length;if(D=="x"&&H=="y"||D=="y"&&H=="x")l="z";else if(D=="x"&&H=="z"||D=="z"&&H=="x")l="y";else if(D==
|
|
|
|
+"z"&&H=="y"||D=="y"&&H=="z")l="x";for(o=0;o<B;o++)for(k=0;k<G;k++){var Q=new THREE.Vector3;Q[D]=(k*q-C)*x;Q[H]=(o*L-F)*I;Q[l]=v;m.vertices.push(new THREE.Vertex(Q))}for(o=0;o<y;o++)for(k=0;k<w;k++){m.faces.push(new THREE.Face4(k+G*o+O,k+G*(o+1)+O,k+1+G*(o+1)+O,k+1+G*o+O,null,t));m.uvs.push([new THREE.UV(k/w,o/y),new THREE.UV(k/w,(o+1)/y),new THREE.UV((k+1)/w,(o+1)/y),new THREE.UV((k+1)/w,o/y)])}}THREE.Geometry.call(this);var m=this,n=a/2,z=c/2,u=d/2;h=h?-1:1;if(b!==undefined)if(b instanceof Array)this.materials=
|
|
|
|
+b;else{this.materials=[];for(var p=0;p<6;p++)this.materials.push([b])}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(j!=undefined)for(var A in j)if(this.sides[A]!=undefined)this.sides[A]=j[A];this.sides.px&&g("z","y",1*h,-1,d,c,-n,this.materials[0]);this.sides.nx&&g("z","y",-1*h,-1,d,c,n,this.materials[1]);this.sides.py&&g("x","z",1*h,1,a,d,z,this.materials[2]);this.sides.ny&&g("x","z",1*h,-1,a,d,-z,this.materials[3]);this.sides.pz&&g("x","y",1*h,-1,a,c,u,this.materials[4]);
|
|
|
|
+this.sides.nz&&g("x","y",-1*h,-1,a,c,-u,this.materials[5]);(function(){for(var D=[],H=[],x=0,I=m.vertices.length;x<I;x++){for(var q=m.vertices[x],k=false,v=0,t=D.length;v<t;v++){var l=D[v];if(q.position.x==l.position.x&&q.position.y==l.position.y&&q.position.z==l.position.z){H[x]=v;k=true;break}}if(!k){H[x]=D.length;D.push(new THREE.Vertex(q.position.clone()))}}x=0;for(I=m.faces.length;x<I;x++){q=m.faces[x];q.a=H[q.a];q.b=H[q.b];q.c=H[q.c];q.d=H[q.d]}m.vertices=D})();this.computeCentroids();this.computeFaceNormals();
|
|
this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
var Cylinder=function(a,c,d,e,f){function b(m,n,z){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,z)))}THREE.Geometry.call(this);var h=this,j=Math.PI,g;for(g=0;g<a;g++)b(Math.sin(2*j*g/a)*c,Math.cos(2*j*g/a)*c,0);for(g=0;g<a;g++)b(Math.sin(2*j*g/a)*d,Math.cos(2*j*g/a)*d,e);for(g=0;g<a;g++)h.faces.push(new THREE.Face4(g,g+a,a+(g+1)%a,(g+1)%a));if(d!=0){b(0,0,-f);for(g=a;g<a+a/2;g++)h.faces.push(new THREE.Face4(2*a,(2*g-2*a)%a,(2*g-2*a+1)%a,(2*g-2*a+2)%a))}if(c!=0){b(0,0,e+f);for(g=a+a/2;g<
|
|
var Cylinder=function(a,c,d,e,f){function b(m,n,z){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,z)))}THREE.Geometry.call(this);var h=this,j=Math.PI,g;for(g=0;g<a;g++)b(Math.sin(2*j*g/a)*c,Math.cos(2*j*g/a)*c,0);for(g=0;g<a;g++)b(Math.sin(2*j*g/a)*d,Math.cos(2*j*g/a)*d,e);for(g=0;g<a;g++)h.faces.push(new THREE.Face4(g,g+a,a+(g+1)%a,(g+1)%a));if(d!=0){b(0,0,-f);for(g=a;g<a+a/2;g++)h.faces.push(new THREE.Face4(2*a,(2*g-2*a)%a,(2*g-2*a+1)%a,(2*g-2*a+2)%a))}if(c!=0){b(0,0,e+f);for(g=a+a/2;g<
|
|
2*a;g++)h.faces.push(new THREE.Face4((2*g-2*a+2)%a+a,(2*g-2*a+1)%a+a,(2*g-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
2*a;g++)h.faces.push(new THREE.Face4((2*g-2*a+2)%a+a,(2*g-2*a+1)%a+a,(2*g-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
var Plane=function(a,c,d,e){THREE.Geometry.call(this);var f,b=a/2,h=c/2;d=d||1;e=e||1;var j=d+1,g=e+1;a=a/d;var m=c/e;for(f=0;f<g;f++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-b,-(f*m-h),0)));for(f=0;f<e;f++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+j*f,c+j*(f+1),c+1+j*(f+1),c+1+j*f));this.uvs.push([new THREE.UV(c/d,f/e),new THREE.UV(c/d,(f+1)/e),new THREE.UV((c+1)/d,(f+1)/e),new THREE.UV((c+1)/d,f/e)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
|
|
var Plane=function(a,c,d,e){THREE.Geometry.call(this);var f,b=a/2,h=c/2;d=d||1;e=e||1;var j=d+1,g=e+1;a=a/d;var m=c/e;for(f=0;f<g;f++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-b,-(f*m-h),0)));for(f=0;f<e;f++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+j*f,c+j*(f+1),c+1+j*(f+1),c+1+j*f));this.uvs.push([new THREE.UV(c/d,f/e),new THREE.UV(c/d,(f+1)/e),new THREE.UV((c+1)/d,(f+1)/e),new THREE.UV((c+1)/d,f/e)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
-var Sphere=function(a,c,d){THREE.Geometry.call(this);var e,f=Math.PI,b=Math.max(3,c||8),h=Math.max(2,d||6);c=[];for(d=0;d<h+1;d++){e=d/h;var j=a*Math.cos(e*f),g=a*Math.sin(e*f),m=[],n=0;for(e=0;e<b;e++){var z=2*e/b,u=g*Math.sin(z*f);z=g*Math.cos(z*f);(d==0||d==h)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(z,j,u)))-1);m.push(n)}c.push(m)}var o,A,C;f=c.length;for(d=0;d<f;d++){b=c[d].length;if(d>0)for(e=0;e<b;e++){m=e==b-1;h=c[d][m?0:e+1];j=c[d][m?b-1:e];g=c[d-1][m?b-1:e];m=c[d-1][m?
|
|
|
|
-0:e+1];u=d/(f-1);o=(d-1)/(f-1);A=(e+1)/b;z=e/b;n=new THREE.UV(1-A,u);u=new THREE.UV(1-z,u);z=new THREE.UV(1-z,o);var G=new THREE.UV(1-A,o);if(d<c.length-1){o=this.vertices[h].position.clone();A=this.vertices[j].position.clone();C=this.vertices[g].position.clone();o.normalize();A.normalize();C.normalize();this.faces.push(new THREE.Face3(h,j,g,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([n,u,z])}if(d>1){o=this.vertices[h].position.clone();
|
|
|
|
-A=this.vertices[g].position.clone();C=this.vertices[m].position.clone();o.normalize();A.normalize();C.normalize();this.faces.push(new THREE.Face3(h,g,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([n,z,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
|
|
|
+var Sphere=function(a,c,d){THREE.Geometry.call(this);var e,f=Math.PI,b=Math.max(3,c||8),h=Math.max(2,d||6);c=[];for(d=0;d<h+1;d++){e=d/h;var j=a*Math.cos(e*f),g=a*Math.sin(e*f),m=[],n=0;for(e=0;e<b;e++){var z=2*e/b,u=g*Math.sin(z*f);z=g*Math.cos(z*f);(d==0||d==h)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(z,j,u)))-1);m.push(n)}c.push(m)}var p,A,D;f=c.length;for(d=0;d<f;d++){b=c[d].length;if(d>0)for(e=0;e<b;e++){m=e==b-1;h=c[d][m?0:e+1];j=c[d][m?b-1:e];g=c[d-1][m?b-1:e];m=c[d-1][m?
|
|
|
|
+0:e+1];u=d/(f-1);p=(d-1)/(f-1);A=(e+1)/b;z=e/b;n=new THREE.UV(1-A,u);u=new THREE.UV(1-z,u);z=new THREE.UV(1-z,p);var H=new THREE.UV(1-A,p);if(d<c.length-1){p=this.vertices[h].position.clone();A=this.vertices[j].position.clone();D=this.vertices[g].position.clone();p.normalize();A.normalize();D.normalize();this.faces.push(new THREE.Face3(h,j,g,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(D.x,D.y,D.z)]));this.uvs.push([n,u,z])}if(d>1){p=this.vertices[h].position.clone();
|
|
|
|
+A=this.vertices[g].position.clone();D=this.vertices[m].position.clone();p.normalize();A.normalize();D.normalize();this.faces.push(new THREE.Face3(h,g,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(D.x,D.y,D.z)]));this.uvs.push([n,z,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,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 f=c/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-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
|
|
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 f=c/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-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
|
|
1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*c+d;f=(this.segmentsT+1)*c+d-1;var b=(this.segmentsT+1)*(c-1)+d-1,h=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,f,b,h));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[b][0],a[b][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;
|
|
1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*c+d;f=(this.segmentsT+1)*c+d-1;var b=(this.segmentsT+1)*(c-1)+d-1,h=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,f,b,h));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[b][0],a[b][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 c(z,u,o){var A=Math.sqrt(z*z+u*u+o*o);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(z/A,u/A,o/A)))-1}function d(z,u,o,A){A.faces.push(new THREE.Face3(z,u,o))}function e(z,u){var o=f.vertices[z].position,A=f.vertices[u].position;return c((o.x+A.x)/2,(o.y+A.y)/2,(o.z+A.z)/2)}var f=this,b=new THREE.Geometry,h;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,
|
|
|
|
|
|
+var Icosahedron=function(a){function c(z,u,p){var A=Math.sqrt(z*z+u*u+p*p);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(z/A,u/A,p/A)))-1}function d(z,u,p,A){A.faces.push(new THREE.Face3(z,u,p))}function e(z,u){var p=f.vertices[z].position,A=f.vertices[u].position;return c((p.x+A.x)/2,(p.y+A.y)/2,(p.z+A.z)/2)}var f=this,b=new THREE.Geometry,h;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<this.subdivisions;a++){h=new THREE.Geometry;for(var j in b.faces){var g=e(b.faces[j].a,b.faces[j].b),m=e(b.faces[j].b,b.faces[j].c),n=e(b.faces[j].c,b.faces[j].a);d(b.faces[j].a,g,n,h);d(b.faces[j].b,m,g,h);d(b.faces[j].c,
|
|
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<this.subdivisions;a++){h=new THREE.Geometry;for(var j in b.faces){var g=e(b.faces[j].a,b.faces[j].b),m=e(b.faces[j].b,b.faces[j].c),n=e(b.faces[j].c,b.faces[j].a);d(b.faces[j].a,g,n,h);d(b.faces[j].b,m,g,h);d(b.faces[j].c,
|
|
n,m,h);d(g,m,n,h)}b.faces=h.faces}f.faces=b.faces;delete b;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
n,m,h);d(g,m,n,h)}b.faces=h.faces}f.faces=b.faces;delete b;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
function LathedObject(a,c,d){THREE.Geometry.call(this);c=c||12;d=d||2*Math.PI;c=d/c;for(var e=[],f=[],b=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));f[j]=this.vertices.length-1;e[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var g=THREE.Matrix4.rotationZMatrix(c),m=0;m<=d+0.0010;m+=c){for(j=0;j<e.length;j++)if(m<d){e[j]=g.multiplyVector3(e[j].clone());this.vertices.push(new THREE.Vertex(e[j]));b[j]=this.vertices.length-1}else b=h;if(m==0)h=f;for(j=0;j<f.length-1;j++){this.faces.push(new THREE.Face4(b[j],
|
|
function LathedObject(a,c,d){THREE.Geometry.call(this);c=c||12;d=d||2*Math.PI;c=d/c;for(var e=[],f=[],b=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));f[j]=this.vertices.length-1;e[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var g=THREE.Matrix4.rotationZMatrix(c),m=0;m<=d+0.0010;m+=c){for(j=0;j<e.length;j++)if(m<d){e[j]=g.multiplyVector3(e[j].clone());this.vertices.push(new THREE.Vertex(e[j]));b[j]=this.vertices.length-1}else b=h;if(m==0)h=f;for(j=0;j<f.length-1;j++){this.faces.push(new THREE.Face4(b[j],
|
|
@@ -261,14 +264,14 @@ b[j+1],f[j+1],f[j]));this.uvs.push([new THREE.UV(m/d,j/a.length),new THREE.UV(m/
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(d){this.isolation=80;this.size=d;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=true;this.maxCount=4096;this.count=
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(d){this.isolation=80;this.size=d;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=true;this.maxCount=4096;this.count=
|
|
0;this.hasNormal=this.hasPos=false;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(d,e,f){return d+(e-d)*f};this.VIntX=function(d,e,f,b,h,j,g,m,n,z){h=(h-n)/(z-n);n=this.normal_cache;e[b]=j+h*this.delta;e[b+1]=g;e[b+2]=m;f[b]=this.lerp(n[d],n[d+3],h);f[b+1]=this.lerp(n[d+1],n[d+4],h);f[b+2]=this.lerp(n[d+2],n[d+5],h)};this.VIntY=function(d,e,f,b,h,j,g,m,n,z){h=(h-n)/(z-n);n=this.normal_cache;e[b]=j;e[b+1]=g+h*this.delta;e[b+
|
|
0;this.hasNormal=this.hasPos=false;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(d,e,f){return d+(e-d)*f};this.VIntX=function(d,e,f,b,h,j,g,m,n,z){h=(h-n)/(z-n);n=this.normal_cache;e[b]=j+h*this.delta;e[b+1]=g;e[b+2]=m;f[b]=this.lerp(n[d],n[d+3],h);f[b+1]=this.lerp(n[d+1],n[d+4],h);f[b+2]=this.lerp(n[d+2],n[d+5],h)};this.VIntY=function(d,e,f,b,h,j,g,m,n,z){h=(h-n)/(z-n);n=this.normal_cache;e[b]=j;e[b+1]=g+h*this.delta;e[b+
|
|
2]=m;e=d+this.yd*3;f[b]=this.lerp(n[d],n[e],h);f[b+1]=this.lerp(n[d+1],n[e+1],h);f[b+2]=this.lerp(n[d+2],n[e+2],h)};this.VIntZ=function(d,e,f,b,h,j,g,m,n,z){h=(h-n)/(z-n);n=this.normal_cache;e[b]=j;e[b+1]=g;e[b+2]=m+h*this.delta;e=d+this.zd*3;f[b]=this.lerp(n[d],n[e],h);f[b+1]=this.lerp(n[d+1],n[e+1],h);f[b+2]=this.lerp(n[d+2],n[e+2],h)};this.compNorm=function(d){var e=d*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[d-1]-this.field[d+1];this.normal_cache[e+1]=this.field[d-this.yd]-
|
|
2]=m;e=d+this.yd*3;f[b]=this.lerp(n[d],n[e],h);f[b+1]=this.lerp(n[d+1],n[e+1],h);f[b+2]=this.lerp(n[d+2],n[e+2],h)};this.VIntZ=function(d,e,f,b,h,j,g,m,n,z){h=(h-n)/(z-n);n=this.normal_cache;e[b]=j;e[b+1]=g;e[b+2]=m+h*this.delta;e=d+this.zd*3;f[b]=this.lerp(n[d],n[e],h);f[b+1]=this.lerp(n[d+1],n[e+1],h);f[b+2]=this.lerp(n[d+2],n[e+2],h)};this.compNorm=function(d){var e=d*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[d-1]-this.field[d+1];this.normal_cache[e+1]=this.field[d-this.yd]-
|
|
-this.field[d+this.yd];this.normal_cache[e+2]=this.field[d-this.zd]-this.field[d+this.zd]}};this.polygonize=function(d,e,f,b,h,j){var g=b+1,m=b+this.yd,n=b+this.zd,z=g+this.yd,u=g+this.zd,o=b+this.yd+this.zd,A=g+this.yd+this.zd,C=0,G=this.field[b],w=this.field[g],H=this.field[m],p=this.field[z],l=this.field[n],v=this.field[u],t=this.field[o],k=this.field[A];if(G<h)C|=1;if(w<h)C|=2;if(H<h)C|=8;if(p<h)C|=4;if(l<h)C|=16;if(v<h)C|=32;if(t<h)C|=128;if(k<h)C|=64;var q=THREE.edgeTable[C];if(q==0)return 0;
|
|
|
|
-var x=this.delta,y=d+x,F=e+x;x=f+x;if(q&1){this.compNorm(b);this.compNorm(g);this.VIntX(b*3,this.vlist,this.nlist,0,h,d,e,f,G,w)}if(q&2){this.compNorm(g);this.compNorm(z);this.VIntY(g*3,this.vlist,this.nlist,3,h,y,e,f,w,p)}if(q&4){this.compNorm(m);this.compNorm(z);this.VIntX(m*3,this.vlist,this.nlist,6,h,d,F,f,H,p)}if(q&8){this.compNorm(b);this.compNorm(m);this.VIntY(b*3,this.vlist,this.nlist,9,h,d,e,f,G,H)}if(q&16){this.compNorm(n);this.compNorm(u);this.VIntX(n*3,this.vlist,this.nlist,12,h,d,e,x,
|
|
|
|
-l,v)}if(q&32){this.compNorm(u);this.compNorm(A);this.VIntY(u*3,this.vlist,this.nlist,15,h,y,e,x,v,k)}if(q&64){this.compNorm(o);this.compNorm(A);this.VIntX(o*3,this.vlist,this.nlist,18,h,d,F,x,t,k)}if(q&128){this.compNorm(n);this.compNorm(o);this.VIntY(n*3,this.vlist,this.nlist,21,h,d,e,x,l,t)}if(q&256){this.compNorm(b);this.compNorm(n);this.VIntZ(b*3,this.vlist,this.nlist,24,h,d,e,f,G,l)}if(q&512){this.compNorm(g);this.compNorm(u);this.VIntZ(g*3,this.vlist,this.nlist,27,h,y,e,f,w,v)}if(q&1024){this.compNorm(z);
|
|
|
|
-this.compNorm(A);this.VIntZ(z*3,this.vlist,this.nlist,30,h,y,F,f,p,k)}if(q&2048){this.compNorm(m);this.compNorm(o);this.VIntZ(m*3,this.vlist,this.nlist,33,h,d,F,f,H,t)}C<<=4;for(h=b=0;THREE.triTable[C+h]!=-1;){d=C+h;e=d+1;f=d+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[d],3*THREE.triTable[e],3*THREE.triTable[f],j);h+=3;b++}return b};this.posnormtriv=function(d,e,f,b,h,j){var g=this.count*3;this.positionArray[g]=d[f];this.positionArray[g+1]=d[f+1];this.positionArray[g+2]=d[f+2];this.positionArray[g+
|
|
|
|
|
|
+this.field[d+this.yd];this.normal_cache[e+2]=this.field[d-this.zd]-this.field[d+this.zd]}};this.polygonize=function(d,e,f,b,h,j){var g=b+1,m=b+this.yd,n=b+this.zd,z=g+this.yd,u=g+this.zd,p=b+this.yd+this.zd,A=g+this.yd+this.zd,D=0,H=this.field[b],x=this.field[g],I=this.field[m],q=this.field[z],k=this.field[n],v=this.field[u],t=this.field[p],l=this.field[A];if(H<h)D|=1;if(x<h)D|=2;if(I<h)D|=8;if(q<h)D|=4;if(k<h)D|=16;if(v<h)D|=32;if(t<h)D|=128;if(l<h)D|=64;var o=THREE.edgeTable[D];if(o==0)return 0;
|
|
|
|
+var w=this.delta,y=d+w,G=e+w;w=f+w;if(o&1){this.compNorm(b);this.compNorm(g);this.VIntX(b*3,this.vlist,this.nlist,0,h,d,e,f,H,x)}if(o&2){this.compNorm(g);this.compNorm(z);this.VIntY(g*3,this.vlist,this.nlist,3,h,y,e,f,x,q)}if(o&4){this.compNorm(m);this.compNorm(z);this.VIntX(m*3,this.vlist,this.nlist,6,h,d,G,f,I,q)}if(o&8){this.compNorm(b);this.compNorm(m);this.VIntY(b*3,this.vlist,this.nlist,9,h,d,e,f,H,I)}if(o&16){this.compNorm(n);this.compNorm(u);this.VIntX(n*3,this.vlist,this.nlist,12,h,d,e,w,
|
|
|
|
+k,v)}if(o&32){this.compNorm(u);this.compNorm(A);this.VIntY(u*3,this.vlist,this.nlist,15,h,y,e,w,v,l)}if(o&64){this.compNorm(p);this.compNorm(A);this.VIntX(p*3,this.vlist,this.nlist,18,h,d,G,w,t,l)}if(o&128){this.compNorm(n);this.compNorm(p);this.VIntY(n*3,this.vlist,this.nlist,21,h,d,e,w,k,t)}if(o&256){this.compNorm(b);this.compNorm(n);this.VIntZ(b*3,this.vlist,this.nlist,24,h,d,e,f,H,k)}if(o&512){this.compNorm(g);this.compNorm(u);this.VIntZ(g*3,this.vlist,this.nlist,27,h,y,e,f,x,v)}if(o&1024){this.compNorm(z);
|
|
|
|
+this.compNorm(A);this.VIntZ(z*3,this.vlist,this.nlist,30,h,y,G,f,q,l)}if(o&2048){this.compNorm(m);this.compNorm(p);this.VIntZ(m*3,this.vlist,this.nlist,33,h,d,G,f,I,t)}D<<=4;for(h=b=0;THREE.triTable[D+h]!=-1;){d=D+h;e=d+1;f=d+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[d],3*THREE.triTable[e],3*THREE.triTable[f],j);h+=3;b++}return b};this.posnormtriv=function(d,e,f,b,h,j){var g=this.count*3;this.positionArray[g]=d[f];this.positionArray[g+1]=d[f+1];this.positionArray[g+2]=d[f+2];this.positionArray[g+
|
|
3]=d[b];this.positionArray[g+4]=d[b+1];this.positionArray[g+5]=d[b+2];this.positionArray[g+6]=d[h];this.positionArray[g+7]=d[h+1];this.positionArray[g+8]=d[h+2];this.normalArray[g]=e[f];this.normalArray[g+1]=e[f+1];this.normalArray[g+2]=e[f+2];this.normalArray[g+3]=e[b];this.normalArray[g+4]=e[b+1];this.normalArray[g+5]=e[b+2];this.normalArray[g+6]=e[h];this.normalArray[g+7]=e[h+1];this.normalArray[g+8]=e[h+2];this.hasNormal=this.hasPos=true;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=
|
|
3]=d[b];this.positionArray[g+4]=d[b+1];this.positionArray[g+5]=d[b+2];this.positionArray[g+6]=d[h];this.positionArray[g+7]=d[h+1];this.positionArray[g+8]=d[h+2];this.normalArray[g]=e[f];this.normalArray[g+1]=e[f+1];this.normalArray[g+2]=e[f+2];this.normalArray[g+3]=e[b];this.normalArray[g+4]=e[b+1];this.normalArray[g+5]=e[b+2];this.normalArray[g+6]=e[h];this.normalArray[g+7]=e[h+1];this.normalArray[g+8]=e[h+2];this.hasNormal=this.hasPos=true;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=
|
|
-function(){this.count=0;this.hasNormal=this.hasPos=false};this.end=function(d){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;d(this)}};this.addBall=function(d,e,f,b,h){var j=this.size*Math.sqrt(b/h),g=f*this.size,m=e*this.size,n=d*this.size,z=Math.floor(g-j);if(z<1)z=1;g=Math.floor(g+j);if(g>this.size-1)g=this.size-1;var u=Math.floor(m-j);if(u<1)u=1;m=Math.floor(m+j);if(m>this.size-1)m=this.size-1;var o=Math.floor(n-j);if(o<1)o=1;j=Math.floor(n+j);
|
|
|
|
-if(j>this.size-1)j=this.size-1;var A,C,G,w,H,p;for(z=z;z<g;z++){n=this.size2*z;C=z/this.size-f;H=C*C;for(C=u;C<m;C++){G=n+this.size*C;A=C/this.size-e;p=A*A;for(A=o;A<j;A++){w=A/this.size-d;w=b/(1.0E-6+w*w+p+H)-h;if(w>0)this.field[G+A]+=w}}}};this.addPlaneX=function(d,e){var f,b,h,j,g,m=this.size,n=this.yd,z=this.zd,u=this.field,o=m*Math.sqrt(d/e);if(o>m)o=m;for(f=0;f<o;f++){b=f/m;b=b*b;j=d/(1.0E-4+b)-e;if(j>0)for(b=0;b<m;b++){g=f+b*n;for(h=0;h<m;h++)u[z*h+g]+=j}}};this.addPlaneY=function(d,e){var f,
|
|
|
|
-b,h,j,g,m,n=this.size,z=this.yd,u=this.zd,o=this.field,A=n*Math.sqrt(d/e);if(A>n)A=n;for(b=0;b<A;b++){f=b/n;f=f*f;j=d/(1.0E-4+f)-e;if(j>0){g=b*z;for(f=0;f<n;f++){m=g+f;for(h=0;h<n;h++)o[u*h+m]+=j}}}};this.addPlaneZ=function(d,e){var f,b,h,j,g,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(d/e);if(dist>size)dist=size;for(h=0;h<dist;h++){f=h/size;f=f*f;j=d/(1.0E-4+f)-e;if(j>0){g=zd*h;for(b=0;b<size;b++){m=g+b*yd;for(f=0;f<size;f++)field[m+f]+=j}}}};this.reset=function(){var d;
|
|
|
|
|
|
+function(){this.count=0;this.hasNormal=this.hasPos=false};this.end=function(d){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;d(this)}};this.addBall=function(d,e,f,b,h){var j=this.size*Math.sqrt(b/h),g=f*this.size,m=e*this.size,n=d*this.size,z=Math.floor(g-j);if(z<1)z=1;g=Math.floor(g+j);if(g>this.size-1)g=this.size-1;var u=Math.floor(m-j);if(u<1)u=1;m=Math.floor(m+j);if(m>this.size-1)m=this.size-1;var p=Math.floor(n-j);if(p<1)p=1;j=Math.floor(n+j);
|
|
|
|
+if(j>this.size-1)j=this.size-1;var A,D,H,x,I,q;for(z=z;z<g;z++){n=this.size2*z;D=z/this.size-f;I=D*D;for(D=u;D<m;D++){H=n+this.size*D;A=D/this.size-e;q=A*A;for(A=p;A<j;A++){x=A/this.size-d;x=b/(1.0E-6+x*x+q+I)-h;if(x>0)this.field[H+A]+=x}}}};this.addPlaneX=function(d,e){var f,b,h,j,g,m=this.size,n=this.yd,z=this.zd,u=this.field,p=m*Math.sqrt(d/e);if(p>m)p=m;for(f=0;f<p;f++){b=f/m;b=b*b;j=d/(1.0E-4+b)-e;if(j>0)for(b=0;b<m;b++){g=f+b*n;for(h=0;h<m;h++)u[z*h+g]+=j}}};this.addPlaneY=function(d,e){var f,
|
|
|
|
+b,h,j,g,m,n=this.size,z=this.yd,u=this.zd,p=this.field,A=n*Math.sqrt(d/e);if(A>n)A=n;for(b=0;b<A;b++){f=b/n;f=f*f;j=d/(1.0E-4+f)-e;if(j>0){g=b*z;for(f=0;f<n;f++){m=g+f;for(h=0;h<n;h++)p[u*h+m]+=j}}}};this.addPlaneZ=function(d,e){var f,b,h,j,g,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(d/e);if(dist>size)dist=size;for(h=0;h<dist;h++){f=h/size;f=f*f;j=d/(1.0E-4+f)-e;if(j>0){g=zd*h;for(b=0;b<size;b++){m=g+b*yd;for(f=0;f<size;f++)field[m+f]+=j}}}};this.reset=function(){var d;
|
|
for(d=0;d<this.size3;d++){this.normal_cache[d*3]=0;this.field[d]=0}};this.render=function(d){this.begin();var e,f,b,h,j,g,m,n,z,u=this.size-2;for(h=1;h<u;h++){z=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(b=1;b<u;b++){n=z+this.size*b;g=(b-this.halfsize)/this.halfsize;for(f=1;f<u;f++){j=(f-this.halfsize)/this.halfsize;e=n+f;this.polygonize(j,g,m,e,this.isolation,d)}}}this.end(d)};this.generateGeometry=function(){var d=0,e=new THREE.Geometry;this.render(function(f){var b,h,j,g,m,n,z,u;for(b=
|
|
for(d=0;d<this.size3;d++){this.normal_cache[d*3]=0;this.field[d]=0}};this.render=function(d){this.begin();var e,f,b,h,j,g,m,n,z,u=this.size-2;for(h=1;h<u;h++){z=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(b=1;b<u;b++){n=z+this.size*b;g=(b-this.halfsize)/this.halfsize;for(f=1;f<u;f++){j=(f-this.halfsize)/this.halfsize;e=n+f;this.polygonize(j,g,m,e,this.isolation,d)}}}this.end(d)};this.generateGeometry=function(){var d=0,e=new THREE.Geometry;this.render(function(f){var b,h,j,g,m,n,z,u;for(b=
|
|
0;b<f.count;b++){m=b*3;z=m+1;u=m+2;h=f.positionArray[m];j=f.positionArray[z];g=f.positionArray[u];n=new THREE.Vector3(h,j,g);h=f.normalArray[m];j=f.normalArray[z];g=f.normalArray[u];m=new THREE.Vector3(h,j,g);m.normalize();m=new THREE.Vertex(n,m);e.vertices.push(m)}nfaces=f.count/3;for(b=0;b<nfaces;b++){m=(d+b)*3;z=m+1;u=m+2;n=e.vertices[m].normal;h=e.vertices[z].normal;j=e.vertices[u].normal;m=new THREE.Face3(m,z,u,[n,h,j]);e.faces.push(m)}d+=nfaces;f.count=0});e.sortFacesByMaterial();return e};
|
|
0;b<f.count;b++){m=b*3;z=m+1;u=m+2;h=f.positionArray[m];j=f.positionArray[z];g=f.positionArray[u];n=new THREE.Vector3(h,j,g);h=f.normalArray[m];j=f.normalArray[z];g=f.normalArray[u];m=new THREE.Vector3(h,j,g);m.normalize();m=new THREE.Vertex(n,m);e.vertices.push(m)}nfaces=f.count/3;for(b=0;b<nfaces;b++){m=(d+b)*3;z=m+1;u=m+2;n=e.vertices[m].normal;h=e.vertices[z].normal;j=e.vertices[u].normal;m=new THREE.Face3(m,z,u,[n,h,j]);e.faces.push(m)}d+=nfaces;f.count=0});e.sortFacesByMaterial();return e};
|
|
this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
@@ -300,23 +303,22 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
|
|
c},loadAsciiOld:function(a,c){var d=document.createElement("script");d.type="text/javascript";d.onload=c;d.src=a;document.getElementsByTagName("head")[0].appendChild(d)},loadAscii:function(a){var c=a.model,d=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,d,e)};c.postMessage(a)},loadBinary:function(a){var c=a.model,d=a.callback,e=a.texture_path?a.texture_path:
|
|
c},loadAsciiOld:function(a,c){var d=document.createElement("script");d.type="text/javascript";d.onload=c;d.src=a;document.getElementsByTagName("head")[0].appendChild(d)},loadAscii:function(a){var c=a.model,d=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,d,e)};c.postMessage(a)},loadBinary:function(a){var c=a.model,d=a.callback,e=a.texture_path?a.texture_path:
|
|
THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var b=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,d,f,e,b)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,d,e,f,b){var h=new XMLHttpRequest,j=e+"/"+a,g=0;
|
|
THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var b=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,d,f,e,b)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,d,e,f,b){var h=new XMLHttpRequest,j=e+"/"+a,g=0;
|
|
h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,d,f,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(b){if(g==0)g=h.getResponseHeader("Content-Length");b({total:g,loaded:h.responseText.length})}}else if(h.readyState==2)g=h.getResponseHeader("Content-Length")};h.open("GET",j,true);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
|
|
h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,d,f,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(b){if(g==0)g=h.getResponseHeader("Content-Length");b({total:g,loaded:h.responseText.length})}}else if(h.readyState==2)g=h.getResponseHeader("Content-Length")};h.open("GET",j,true);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
|
|
-createBinModel:function(a,c,d,e){var f=function(b){function h(E,L){var J=n(E,L),X=n(E,L+1),ea=n(E,L+2),ja=n(E,L+3),ia=(ja<<1&255|ea>>7)-127;J=(ea&127)<<16|X<<8|J;if(J==0&&ia==-127)return 0;return(1-2*(ja>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,ia)}function j(E,L){var J=n(E,L),X=n(E,L+1),ea=n(E,L+2);return(n(E,L+3)<<24)+(ea<<16)+(X<<8)+J}function g(E,L){var J=n(E,L);return(n(E,L+1)<<8)+J}function m(E,L){var J=n(E,L);return J>127?J-256:J}function n(E,L){return E.charCodeAt(L)&255}function z(E){var L,
|
|
|
|
-J,X;L=j(a,E);J=j(a,E+t);X=j(a,E+k);E=g(a,E+q);THREE.Loader.prototype.f3(w,L,J,X,E)}function u(E){var L,J,X,ea,ja,ia;L=j(a,E);J=j(a,E+t);X=j(a,E+k);ea=g(a,E+q);ja=j(a,E+x);ia=j(a,E+y);E=j(a,E+F);THREE.Loader.prototype.f3n(w,l,L,J,X,ea,ja,ia,E)}function o(E){var L,J,X,ea;L=j(a,E);J=j(a,E+B);X=j(a,E+D);ea=j(a,E+I);E=g(a,E+N);THREE.Loader.prototype.f4(w,L,J,X,ea,E)}function A(E){var L,J,X,ea,ja,ia,qa,ma;L=j(a,E);J=j(a,E+B);X=j(a,E+D);ea=j(a,E+I);ja=g(a,E+N);ia=j(a,E+O);qa=j(a,E+Q);ma=j(a,E+T);E=j(a,E+
|
|
|
|
-U);THREE.Loader.prototype.f4n(w,l,L,J,X,ea,ja,ia,qa,ma,E)}function C(E){var L,J;L=j(a,E);J=j(a,E+ba);E=j(a,E+ca);THREE.Loader.prototype.uv3(w.uvs,v[L*2],v[L*2+1],v[J*2],v[J*2+1],v[E*2],v[E*2+1])}function G(E){var L,J,X;L=j(a,E);J=j(a,E+S);X=j(a,E+K);E=j(a,E+Z);THREE.Loader.prototype.uv4(w.uvs,v[L*2],v[L*2+1],v[J*2],v[J*2+1],v[X*2],v[X*2+1],v[E*2],v[E*2+1])}var w=this,H=0,p,l=[],v=[],t,k,q,x,y,F,B,D,I,N,O,Q,T,U,ba,ca,S,K,Z,V,P,W,$,da,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,
|
|
|
|
-e,b);p={signature:a.substr(H,8),header_bytes:n(a,H+8),vertex_coordinate_bytes:n(a,H+9),normal_coordinate_bytes:n(a,H+10),uv_coordinate_bytes:n(a,H+11),vertex_index_bytes:n(a,H+12),normal_index_bytes:n(a,H+13),uv_index_bytes:n(a,H+14),material_index_bytes:n(a,H+15),nvertices:j(a,H+16),nnormals:j(a,H+16+4),nuvs:j(a,H+16+8),ntri_flat:j(a,H+16+12),ntri_smooth:j(a,H+16+16),ntri_flat_uv:j(a,H+16+20),ntri_smooth_uv:j(a,H+16+24),nquad_flat:j(a,H+16+28),nquad_smooth:j(a,H+16+32),nquad_flat_uv:j(a,H+16+36),
|
|
|
|
-nquad_smooth_uv:j(a,H+16+40)};H+=p.header_bytes;t=p.vertex_index_bytes;k=p.vertex_index_bytes*2;q=p.vertex_index_bytes*3;x=p.vertex_index_bytes*3+p.material_index_bytes;y=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes;F=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*2;B=p.vertex_index_bytes;D=p.vertex_index_bytes*2;I=p.vertex_index_bytes*3;N=p.vertex_index_bytes*4;O=p.vertex_index_bytes*4+p.material_index_bytes;Q=p.vertex_index_bytes*4+p.material_index_bytes+
|
|
|
|
-p.normal_index_bytes;T=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*2;U=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*3;ba=p.uv_index_bytes;ca=p.uv_index_bytes*2;S=p.uv_index_bytes;K=p.uv_index_bytes*2;Z=p.uv_index_bytes*3;b=p.vertex_index_bytes*3+p.material_index_bytes;ha=p.vertex_index_bytes*4+p.material_index_bytes;V=p.ntri_flat*b;P=p.ntri_smooth*(b+p.normal_index_bytes*3);W=p.ntri_flat_uv*(b+p.uv_index_bytes*3);$=p.ntri_smooth_uv*(b+p.normal_index_bytes*
|
|
|
|
-3+p.uv_index_bytes*3);da=p.nquad_flat*ha;b=p.nquad_smooth*(ha+p.normal_index_bytes*4);ha=p.nquad_flat_uv*(ha+p.uv_index_bytes*4);H+=function(E){var L,J,X,ea=p.vertex_coordinate_bytes*3,ja=E+p.nvertices*ea;for(E=E;E<ja;E+=ea){L=h(a,E);J=h(a,E+p.vertex_coordinate_bytes);X=h(a,E+p.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,L,J,X)}return p.nvertices*ea}(H);H+=function(E){var L,J,X,ea=p.normal_coordinate_bytes*3,ja=E+p.nnormals*ea;for(E=E;E<ja;E+=ea){L=m(a,E);J=m(a,E+p.normal_coordinate_bytes);
|
|
|
|
-X=m(a,E+p.normal_coordinate_bytes*2);l.push(L/127,J/127,X/127)}return p.nnormals*ea}(H);H+=function(E){var L,J,X=p.uv_coordinate_bytes*2,ea=E+p.nuvs*X;for(E=E;E<ea;E+=X){L=h(a,E);J=h(a,E+p.uv_coordinate_bytes);v.push(L,J)}return p.nuvs*X}(H);H=H;V=H+V;P=V+P;W=P+W;$=W+$;da=$+da;b=da+b;ha=b+ha;(function(E){var L,J=p.vertex_index_bytes*3+p.material_index_bytes,X=J+p.uv_index_bytes*3,ea=E+p.ntri_flat_uv*X;for(L=E;L<ea;L+=X){z(L);C(L+J)}return ea-E})(P);(function(E){var L,J=p.vertex_index_bytes*3+p.material_index_bytes+
|
|
|
|
-p.normal_index_bytes*3,X=J+p.uv_index_bytes*3,ea=E+p.ntri_smooth_uv*X;for(L=E;L<ea;L+=X){u(L);C(L+J)}return ea-E})(W);(function(E){var L,J=p.vertex_index_bytes*4+p.material_index_bytes,X=J+p.uv_index_bytes*4,ea=E+p.nquad_flat_uv*X;for(L=E;L<ea;L+=X){o(L);G(L+J)}return ea-E})(b);(function(E){var L,J=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,X=J+p.uv_index_bytes*4,ea=E+p.nquad_smooth_uv*X;for(L=E;L<ea;L+=X){A(L);G(L+J)}return ea-E})(ha);(function(E){var L,J=p.vertex_index_bytes*
|
|
|
|
-3+p.material_index_bytes,X=E+p.ntri_flat*J;for(L=E;L<X;L+=J)z(L);return X-E})(H);(function(E){var L,J=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,X=E+p.ntri_smooth*J;for(L=E;L<X;L+=J)u(L);return X-E})(V);(function(E){var L,J=p.vertex_index_bytes*4+p.material_index_bytes,X=E+p.nquad_flat*J;for(L=E;L<X;L+=J)o(L);return X-E})($);(function(E){var L,J=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,X=E+p.nquad_smooth*J;for(L=E;L<X;L+=J)A(L);return X-E})(da);
|
|
|
|
-this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(d))},createModel:function(a,c,d){var e=function(f){var b=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(b,a.materials,f);(function(){var h,j,g,m,n;h=0;for(j=a.vertices.length;h<j;h+=3){g=a.vertices[h];m=a.vertices[h+1];n=a.vertices[h+2];THREE.Loader.prototype.v(b,g,m,n)}})();(function(){function h(A,C){THREE.Loader.prototype.f3(b,A[C],
|
|
|
|
-A[C+1],A[C+2],A[C+3])}function j(A,C){THREE.Loader.prototype.f3n(b,a.normals,A[C],A[C+1],A[C+2],A[C+3],A[C+4],A[C+5],A[C+6])}function g(A,C){THREE.Loader.prototype.f4(b,A[C],A[C+1],A[C+2],A[C+3],A[C+4])}function m(A,C){THREE.Loader.prototype.f4n(b,a.normals,A[C],A[C+1],A[C+2],A[C+3],A[C+4],A[C+5],A[C+6],A[C+7],A[C+8])}function n(A,C){var G,w,H,p,l,v,t,k,q;G=A[C];w=A[C+1];H=A[C+2];p=a.uvs[G*2];t=a.uvs[G*2+1];l=a.uvs[w*2];k=a.uvs[w*2+1];v=a.uvs[H*2];q=a.uvs[H*2+1];THREE.Loader.prototype.uv3(b.uvs,p,
|
|
|
|
-t,l,k,v,q);if(a.uvs2){p=a.uvs2[G*2];t=a.uvs2[G*2+1];l=a.uvs2[w*2];k=a.uvs2[w*2+1];v=a.uvs2[H*2];q=a.uvs2[H*2+1];THREE.Loader.prototype.uv3(b.uvs2,p,1-t,l,1-k,v,1-q)}}function z(A,C){var G,w,H,p,l,v,t,k,q,x,y,F;G=A[C];w=A[C+1];H=A[C+2];p=A[C+3];l=a.uvs[G*2];q=a.uvs[G*2+1];v=a.uvs[w*2];x=a.uvs[w*2+1];t=a.uvs[H*2];y=a.uvs[H*2+1];k=a.uvs[p*2];F=a.uvs[p*2+1];THREE.Loader.prototype.uv4(b.uvs,l,q,v,x,t,y,k,F);if(a.uvs2){l=a.uvs2[G*2];q=a.uvs2[G*2+1];v=a.uvs2[w*2];x=a.uvs2[w*2+1];t=a.uvs2[H*2];y=a.uvs2[H*
|
|
|
|
-2+1];k=a.uvs2[p*2];F=a.uvs2[p*2+1];THREE.Loader.prototype.uv4(b.uvs2,l,1-q,v,1-x,t,1-y,k,1-F)}}var u,o;u=0;for(o=a.triangles_uv.length;u<o;u+=7){h(a.triangles_uv,u);n(a.triangles_uv,u+4)}u=0;for(o=a.triangles_n_uv.length;u<o;u+=10){j(a.triangles_n_uv,u);n(a.triangles_n_uv,u+7)}u=0;for(o=a.quads_uv.length;u<o;u+=9){g(a.quads_uv,u);z(a.quads_uv,u+5)}u=0;for(o=a.quads_n_uv.length;u<o;u+=13){m(a.quads_n_uv,u);z(a.quads_n_uv,u+9)}u=0;for(o=a.triangles.length;u<o;u+=4)h(a.triangles,u);u=0;for(o=a.triangles_n.length;u<
|
|
|
|
-o;u+=7)j(a.triangles_n,u);u=0;for(o=a.quads.length;u<o;u+=5)g(a.quads,u);u=0;for(o=a.quads_n.length;u<o;u+=9)m(a.quads_n,u)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(d))},v:function(a,c,d,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,e)))},f3:function(a,c,d,e,f){a.faces.push(new THREE.Face3(c,d,e,null,a.materials[f]))},f4:function(a,c,d,e,f,b){a.faces.push(new THREE.Face4(c,d,e,f,null,
|
|
|
|
-a.materials[b]))},f3n:function(a,c,d,e,f,b,h,j,g){b=a.materials[b];var m=c[j*3],n=c[j*3+1];j=c[j*3+2];var z=c[g*3],u=c[g*3+1];g=c[g*3+2];a.faces.push(new THREE.Face3(d,e,f,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,n,j),new THREE.Vector3(z,u,g)],b))},f4n:function(a,c,d,e,f,b,h,j,g,m,n){h=a.materials[h];var z=c[g*3],u=c[g*3+1];g=c[g*3+2];var o=c[m*3],A=c[m*3+1];m=c[m*3+2];var C=c[n*3],G=c[n*3+1];n=c[n*3+2];a.faces.push(new THREE.Face4(d,e,f,b,[new THREE.Vector3(c[j*3],c[j*3+1],
|
|
|
|
-c[j*3+2]),new THREE.Vector3(z,u,g),new THREE.Vector3(o,A,m),new THREE.Vector3(C,G,n)],h))},uv3:function(a,c,d,e,f,b,h){var j=[];j.push(new THREE.UV(c,d));j.push(new THREE.UV(e,f));j.push(new THREE.UV(b,h));a.push(j)},uv4:function(a,c,d,e,f,b,h,j,g){var m=[];m.push(new THREE.UV(c,d));m.push(new THREE.UV(e,f));m.push(new THREE.UV(b,h));m.push(new THREE.UV(j,g));a.push(m)},init_materials:function(a,c,d){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],
|
|
|
|
-d)]},createMaterial:function(a,c){function d(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function e(h,j){var g=new Image;g.onload=function(){if(!d(this.width)||!d(this.height)){var m=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),n=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));h.image.width=m;h.image.height=n;h.image.getContext("2d").drawImage(this,0,0,m,n)}else h.image=this;h.image.loaded=1};g.src=j}var f,b;if(a.map_diffuse&&c){b=document.createElement("canvas");f=new THREE.MeshLambertMaterial({map:new THREE.Texture(b)});
|
|
|
|
-e(f.map,c+"/"+a.map_diffuse)}else if(a.col_diffuse){f=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*255;f=new THREE.MeshLambertMaterial({color:f,opacity:a.transparency})}else f=a.a_dbg_color?new THREE.MeshLambertMaterial({color:a.a_dbg_color}):new THREE.MeshLambertMaterial({color:15658734});if(a.map_lightmap&&c){b=document.createElement("canvas");f.light_map=new THREE.Texture(b);e(f.light_map,c+"/"+a.map_lightmap)}return f},extractUrlbase:function(a){a=a.split("/");a.pop();
|
|
|
|
-return a.join("/")}};
|
|
|
|
|
|
+createBinModel:function(a,c,d,e){var f=function(b){function h(E,M){var K=n(E,M),X=n(E,M+1),$=n(E,M+2),ma=n(E,M+3),ia=(ma<<1&255|$>>7)-127;K=($&127)<<16|X<<8|K;if(K==0&&ia==-127)return 0;return(1-2*(ma>>7))*(1+K*Math.pow(2,-23))*Math.pow(2,ia)}function j(E,M){var K=n(E,M),X=n(E,M+1),$=n(E,M+2);return(n(E,M+3)<<24)+($<<16)+(X<<8)+K}function g(E,M){var K=n(E,M);return(n(E,M+1)<<8)+K}function m(E,M){var K=n(E,M);return K>127?K-256:K}function n(E,M){return E.charCodeAt(M)&255}function z(E){var M,K,X;M=
|
|
|
|
+j(a,E);K=j(a,E+t);X=j(a,E+l);E=g(a,E+o);THREE.Loader.prototype.f3(x,M,K,X,E)}function u(E){var M,K,X,$,ma,ia;M=j(a,E);K=j(a,E+t);X=j(a,E+l);$=g(a,E+o);ma=j(a,E+w);ia=j(a,E+y);E=j(a,E+G);THREE.Loader.prototype.f3n(x,k,M,K,X,$,ma,ia,E)}function p(E){var M,K,X,$;M=j(a,E);K=j(a,E+B);X=j(a,E+C);$=j(a,E+F);E=g(a,E+L);THREE.Loader.prototype.f4(x,M,K,X,$,E)}function A(E){var M,K,X,$,ma,ia,qa,ta;M=j(a,E);K=j(a,E+B);X=j(a,E+C);$=j(a,E+F);ma=g(a,E+L);ia=j(a,E+O);qa=j(a,E+Q);ta=j(a,E+T);E=j(a,E+U);THREE.Loader.prototype.f4n(x,
|
|
|
|
+k,M,K,X,$,ma,ia,qa,ta,E)}function D(E){var M,K;M=j(a,E);K=j(a,E+ba);E=j(a,E+ca);THREE.Loader.prototype.uv3(x.uvs,v[M*2],v[M*2+1],v[K*2],v[K*2+1],v[E*2],v[E*2+1])}function H(E){var M,K,X;M=j(a,E);K=j(a,E+S);X=j(a,E+N);E=j(a,E+Z);THREE.Loader.prototype.uv4(x.uvs,v[M*2],v[M*2+1],v[K*2],v[K*2+1],v[X*2],v[X*2+1],v[E*2],v[E*2+1])}var x=this,I=0,q,k=[],v=[],t,l,o,w,y,G,B,C,F,L,O,Q,T,U,ba,ca,S,N,Z,V,J,W,da,ha,ea;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,e,b);q={signature:a.substr(I,
|
|
|
|
+8),header_bytes:n(a,I+8),vertex_coordinate_bytes:n(a,I+9),normal_coordinate_bytes:n(a,I+10),uv_coordinate_bytes:n(a,I+11),vertex_index_bytes:n(a,I+12),normal_index_bytes:n(a,I+13),uv_index_bytes:n(a,I+14),material_index_bytes:n(a,I+15),nvertices:j(a,I+16),nnormals:j(a,I+16+4),nuvs:j(a,I+16+8),ntri_flat:j(a,I+16+12),ntri_smooth:j(a,I+16+16),ntri_flat_uv:j(a,I+16+20),ntri_smooth_uv:j(a,I+16+24),nquad_flat:j(a,I+16+28),nquad_smooth:j(a,I+16+32),nquad_flat_uv:j(a,I+16+36),nquad_smooth_uv:j(a,I+16+40)};
|
|
|
|
+I+=q.header_bytes;t=q.vertex_index_bytes;l=q.vertex_index_bytes*2;o=q.vertex_index_bytes*3;w=q.vertex_index_bytes*3+q.material_index_bytes;y=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;G=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;B=q.vertex_index_bytes;C=q.vertex_index_bytes*2;F=q.vertex_index_bytes*3;L=q.vertex_index_bytes*4;O=q.vertex_index_bytes*4+q.material_index_bytes;Q=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;T=q.vertex_index_bytes*
|
|
|
|
+4+q.material_index_bytes+q.normal_index_bytes*2;U=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;ba=q.uv_index_bytes;ca=q.uv_index_bytes*2;S=q.uv_index_bytes;N=q.uv_index_bytes*2;Z=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;ea=q.vertex_index_bytes*4+q.material_index_bytes;V=q.ntri_flat*b;J=q.ntri_smooth*(b+q.normal_index_bytes*3);W=q.ntri_flat_uv*(b+q.uv_index_bytes*3);da=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);ha=q.nquad_flat*ea;
|
|
|
|
+b=q.nquad_smooth*(ea+q.normal_index_bytes*4);ea=q.nquad_flat_uv*(ea+q.uv_index_bytes*4);I+=function(E){var M,K,X,$=q.vertex_coordinate_bytes*3,ma=E+q.nvertices*$;for(E=E;E<ma;E+=$){M=h(a,E);K=h(a,E+q.vertex_coordinate_bytes);X=h(a,E+q.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(x,M,K,X)}return q.nvertices*$}(I);I+=function(E){var M,K,X,$=q.normal_coordinate_bytes*3,ma=E+q.nnormals*$;for(E=E;E<ma;E+=$){M=m(a,E);K=m(a,E+q.normal_coordinate_bytes);X=m(a,E+q.normal_coordinate_bytes*2);k.push(M/
|
|
|
|
+127,K/127,X/127)}return q.nnormals*$}(I);I+=function(E){var M,K,X=q.uv_coordinate_bytes*2,$=E+q.nuvs*X;for(E=E;E<$;E+=X){M=h(a,E);K=h(a,E+q.uv_coordinate_bytes);v.push(M,K)}return q.nuvs*X}(I);I=I;V=I+V;J=V+J;W=J+W;da=W+da;ha=da+ha;b=ha+b;ea=b+ea;(function(E){var M,K=q.vertex_index_bytes*3+q.material_index_bytes,X=K+q.uv_index_bytes*3,$=E+q.ntri_flat_uv*X;for(M=E;M<$;M+=X){z(M);D(M+K)}return $-E})(J);(function(E){var M,K=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,X=K+q.uv_index_bytes*
|
|
|
|
+3,$=E+q.ntri_smooth_uv*X;for(M=E;M<$;M+=X){u(M);D(M+K)}return $-E})(W);(function(E){var M,K=q.vertex_index_bytes*4+q.material_index_bytes,X=K+q.uv_index_bytes*4,$=E+q.nquad_flat_uv*X;for(M=E;M<$;M+=X){p(M);H(M+K)}return $-E})(b);(function(E){var M,K=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,X=K+q.uv_index_bytes*4,$=E+q.nquad_smooth_uv*X;for(M=E;M<$;M+=X){A(M);H(M+K)}return $-E})(ea);(function(E){var M,K=q.vertex_index_bytes*3+q.material_index_bytes,X=E+q.ntri_flat*K;for(M=
|
|
|
|
+E;M<X;M+=K)z(M);return X-E})(I);(function(E){var M,K=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,X=E+q.ntri_smooth*K;for(M=E;M<X;M+=K)u(M);return X-E})(V);(function(E){var M,K=q.vertex_index_bytes*4+q.material_index_bytes,X=E+q.nquad_flat*K;for(M=E;M<X;M+=K)p(M);return X-E})(da);(function(E){var M,K=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,X=E+q.nquad_smooth*K;for(M=E;M<X;M+=K)A(M);return X-E})(ha);this.computeCentroids();this.computeFaceNormals();
|
|
|
|
+this.sortFacesByMaterial()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(d))},createModel:function(a,c,d){var e=function(f){var b=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(b,a.materials,f);(function(){var h,j,g,m,n;h=0;for(j=a.vertices.length;h<j;h+=3){g=a.vertices[h];m=a.vertices[h+1];n=a.vertices[h+2];THREE.Loader.prototype.v(b,g,m,n)}})();(function(){function h(A,D){THREE.Loader.prototype.f3(b,A[D],A[D+1],A[D+2],A[D+3])}function j(A,D){THREE.Loader.prototype.f3n(b,
|
|
|
|
+a.normals,A[D],A[D+1],A[D+2],A[D+3],A[D+4],A[D+5],A[D+6])}function g(A,D){THREE.Loader.prototype.f4(b,A[D],A[D+1],A[D+2],A[D+3],A[D+4])}function m(A,D){THREE.Loader.prototype.f4n(b,a.normals,A[D],A[D+1],A[D+2],A[D+3],A[D+4],A[D+5],A[D+6],A[D+7],A[D+8])}function n(A,D){var H,x,I,q,k,v,t,l,o;H=A[D];x=A[D+1];I=A[D+2];q=a.uvs[H*2];t=a.uvs[H*2+1];k=a.uvs[x*2];l=a.uvs[x*2+1];v=a.uvs[I*2];o=a.uvs[I*2+1];THREE.Loader.prototype.uv3(b.uvs,q,t,k,l,v,o);if(a.uvs2){q=a.uvs2[H*2];t=a.uvs2[H*2+1];k=a.uvs2[x*2];
|
|
|
|
+l=a.uvs2[x*2+1];v=a.uvs2[I*2];o=a.uvs2[I*2+1];THREE.Loader.prototype.uv3(b.uvs2,q,1-t,k,1-l,v,1-o)}}function z(A,D){var H,x,I,q,k,v,t,l,o,w,y,G;H=A[D];x=A[D+1];I=A[D+2];q=A[D+3];k=a.uvs[H*2];o=a.uvs[H*2+1];v=a.uvs[x*2];w=a.uvs[x*2+1];t=a.uvs[I*2];y=a.uvs[I*2+1];l=a.uvs[q*2];G=a.uvs[q*2+1];THREE.Loader.prototype.uv4(b.uvs,k,o,v,w,t,y,l,G);if(a.uvs2){k=a.uvs2[H*2];o=a.uvs2[H*2+1];v=a.uvs2[x*2];w=a.uvs2[x*2+1];t=a.uvs2[I*2];y=a.uvs2[I*2+1];l=a.uvs2[q*2];G=a.uvs2[q*2+1];THREE.Loader.prototype.uv4(b.uvs2,
|
|
|
|
+k,1-o,v,1-w,t,1-y,l,1-G)}}var u,p;u=0;for(p=a.triangles_uv.length;u<p;u+=7){h(a.triangles_uv,u);n(a.triangles_uv,u+4)}u=0;for(p=a.triangles_n_uv.length;u<p;u+=10){j(a.triangles_n_uv,u);n(a.triangles_n_uv,u+7)}u=0;for(p=a.quads_uv.length;u<p;u+=9){g(a.quads_uv,u);z(a.quads_uv,u+5)}u=0;for(p=a.quads_n_uv.length;u<p;u+=13){m(a.quads_n_uv,u);z(a.quads_n_uv,u+9)}u=0;for(p=a.triangles.length;u<p;u+=4)h(a.triangles,u);u=0;for(p=a.triangles_n.length;u<p;u+=7)j(a.triangles_n,u);u=0;for(p=a.quads.length;u<
|
|
|
|
+p;u+=5)g(a.quads,u);u=0;for(p=a.quads_n.length;u<p;u+=9)m(a.quads_n,u)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(d))},v:function(a,c,d,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,e)))},f3:function(a,c,d,e,f){a.faces.push(new THREE.Face3(c,d,e,null,a.materials[f]))},f4:function(a,c,d,e,f,b){a.faces.push(new THREE.Face4(c,d,e,f,null,a.materials[b]))},f3n:function(a,c,d,e,f,b,h,j,g){b=
|
|
|
|
+a.materials[b];var m=c[j*3],n=c[j*3+1];j=c[j*3+2];var z=c[g*3],u=c[g*3+1];g=c[g*3+2];a.faces.push(new THREE.Face3(d,e,f,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,n,j),new THREE.Vector3(z,u,g)],b))},f4n:function(a,c,d,e,f,b,h,j,g,m,n){h=a.materials[h];var z=c[g*3],u=c[g*3+1];g=c[g*3+2];var p=c[m*3],A=c[m*3+1];m=c[m*3+2];var D=c[n*3],H=c[n*3+1];n=c[n*3+2];a.faces.push(new THREE.Face4(d,e,f,b,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(z,u,g),new THREE.Vector3(p,
|
|
|
|
+A,m),new THREE.Vector3(D,H,n)],h))},uv3:function(a,c,d,e,f,b,h){var j=[];j.push(new THREE.UV(c,d));j.push(new THREE.UV(e,f));j.push(new THREE.UV(b,h));a.push(j)},uv4:function(a,c,d,e,f,b,h,j,g){var m=[];m.push(new THREE.UV(c,d));m.push(new THREE.UV(e,f));m.push(new THREE.UV(b,h));m.push(new THREE.UV(j,g));a.push(m)},init_materials:function(a,c,d){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],d)]},createMaterial:function(a,c){function d(h){h=Math.log(h)/
|
|
|
|
+Math.LN2;return Math.floor(h)==h}function e(h,j){var g=new Image;g.onload=function(){if(!d(this.width)||!d(this.height)){var m=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),n=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));h.image.width=m;h.image.height=n;h.image.getContext("2d").drawImage(this,0,0,m,n)}else h.image=this;h.image.loaded=1};g.src=j}var f,b;if(a.map_diffuse&&c){b=document.createElement("canvas");f=new THREE.MeshLambertMaterial({map:new THREE.Texture(b)});e(f.map,c+"/"+
|
|
|
|
+a.map_diffuse)}else if(a.col_diffuse){f=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*255;f=new THREE.MeshLambertMaterial({color:f,opacity:a.transparency})}else f=a.a_dbg_color?new THREE.MeshLambertMaterial({color:a.a_dbg_color}):new THREE.MeshLambertMaterial({color:15658734});if(a.map_lightmap&&c){b=document.createElement("canvas");f.light_map=new THREE.Texture(b);e(f.light_map,c+"/"+a.map_lightmap)}return f},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|