|
@@ -13,20 +13,20 @@ THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;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,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,h=[];a=0;for(b=e.length;a<b;a++){d=e[a];if(d instanceof THREE.Mesh)h=h.concat(this.intersectObject(d))}h.sort(function(n,o){return n.distance-o.distance});return h},intersectObject:function(a){function b(L,J,K,v){v=v.clone().subSelf(J);K=K.clone().subSelf(J);var f=L.clone().subSelf(J);L=v.dot(v);J=v.dot(K);v=v.dot(f);var k=K.dot(K);K=K.dot(f);f=1/(L*k-J*J);k=(k*v-J*K)*f;L=(L*K-J*v)*f;return k>0&&L>0&&k+L<1}var d,e,h,n,o,l,m,c,z,x,
|
|
THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,h=[];a=0;for(b=e.length;a<b;a++){d=e[a];if(d instanceof THREE.Mesh)h=h.concat(this.intersectObject(d))}h.sort(function(n,o){return n.distance-o.distance});return h},intersectObject:function(a){function b(L,J,K,v){v=v.clone().subSelf(J);K=K.clone().subSelf(J);var f=L.clone().subSelf(J);L=v.dot(v);J=v.dot(K);v=v.dot(f);var k=K.dot(K);K=K.dot(f);f=1/(L*k-J*J);k=(k*v-J*K)*f;L=(L*K-J*v)*f;return k>0&&L>0&&k+L<1}var d,e,h,n,o,l,m,c,z,x,
|
|
-r,s=a.geometry,H=s.vertices,F=[];d=0;for(e=s.faces.length;d<e;d++){h=s.faces[d];x=this.origin.clone();r=this.direction.clone();n=a.matrix.multiplyVector3(H[h.a].position.clone());o=a.matrix.multiplyVector3(H[h.b].position.clone());l=a.matrix.multiplyVector3(H[h.c].position.clone());m=h instanceof THREE.Face4?a.matrix.multiplyVector3(H[h.d].position.clone()):null;c=a.rotationMatrix.multiplyVector3(h.normal.clone());z=r.dot(c);if(z<0){c=c.dot((new THREE.Vector3).sub(n,x))/z;x=x.addSelf(r.multiplyScalar(c));
|
|
|
|
|
|
+r,t=a.geometry,H=t.vertices,F=[];d=0;for(e=t.faces.length;d<e;d++){h=t.faces[d];x=this.origin.clone();r=this.direction.clone();n=a.matrix.multiplyVector3(H[h.a].position.clone());o=a.matrix.multiplyVector3(H[h.b].position.clone());l=a.matrix.multiplyVector3(H[h.c].position.clone());m=h instanceof THREE.Face4?a.matrix.multiplyVector3(H[h.d].position.clone()):null;c=a.rotationMatrix.multiplyVector3(h.normal.clone());z=r.dot(c);if(z<0){c=c.dot((new THREE.Vector3).sub(n,x))/z;x=x.addSelf(r.multiplyScalar(c));
|
|
if(h instanceof THREE.Face3){if(b(x,n,o,l)){h={distance:this.origin.distanceTo(x),point:x,face:h,object:a};F.push(h)}}else if(h instanceof THREE.Face4)if(b(x,n,o,m)||b(x,o,l,m)){h={distance:this.origin.distanceTo(x),point:x,face:h,object:a};F.push(h)}}}return F}};
|
|
if(h instanceof THREE.Face3){if(b(x,n,o,l)){h={distance:this.origin.distanceTo(x),point:x,face:h,object:a};F.push(h)}}else if(h instanceof THREE.Face4)if(b(x,n,o,m)||b(x,o,l,m)){h={distance:this.origin.distanceTo(x),point:x,face:h,object:a};F.push(h)}}}return F}};
|
|
THREE.Rectangle=function(){function a(){n=e-b;o=h-d}var b,d,e,h,n,o,l=true;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return n};this.getHeight=function(){return o};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(m,c,z,x){l=false;b=m;d=c;e=z;h=x;a()};this.addPoint=function(m,c){if(l){l=false;b=m;d=c;e=m;h=c}else{b=b<m?b:m;d=d<c?d:c;e=e>m?e:m;h=h>c?
|
|
THREE.Rectangle=function(){function a(){n=e-b;o=h-d}var b,d,e,h,n,o,l=true;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return n};this.getHeight=function(){return o};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(m,c,z,x){l=false;b=m;d=c;e=z;h=x;a()};this.addPoint=function(m,c){if(l){l=false;b=m;d=c;e=m;h=c}else{b=b<m?b:m;d=d<c?d:c;e=e>m?e:m;h=h>c?
|
|
-h:c}a()};this.add3Points=function(m,c,z,x,r,s){if(l){l=false;b=m<z?m<r?m:r:z<r?z:r;d=c<x?c<s?c:s:x<s?x:s;e=m>z?m>r?m:r:z>r?z:r;h=c>x?c>s?c:s:x>s?x:s}else{b=m<z?m<r?m<b?m:b:r<b?r:b:z<r?z<b?z:b:r<b?r:b;d=c<x?c<s?c<d?c:d:s<d?s:d:x<s?x<d?x:d:s<d?s:d;e=m>z?m>r?m>e?m:e:r>e?r:e:z>r?z>e?z:e:r>e?r:e;h=c>x?c>s?c>h?c:h:s>h?s:h:x>s?x>h?x:h:s>h?s:h}a()};this.addRectangle=function(m){if(l){l=false;b=m.getLeft();d=m.getTop();e=m.getRight();h=m.getBottom()}else{b=b<m.getLeft()?b:m.getLeft();d=d<m.getTop()?d:m.getTop();
|
|
|
|
|
|
+h:c}a()};this.add3Points=function(m,c,z,x,r,t){if(l){l=false;b=m<z?m<r?m:r:z<r?z:r;d=c<x?c<t?c:t:x<t?x:t;e=m>z?m>r?m:r:z>r?z:r;h=c>x?c>t?c:t:x>t?x:t}else{b=m<z?m<r?m<b?m:b:r<b?r:b:z<r?z<b?z:b:r<b?r:b;d=c<x?c<t?c<d?c:d:t<d?t:d:x<t?x<d?x:d:t<d?t:d;e=m>z?m>r?m>e?m:e:r>e?r:e:z>r?z>e?z:e:r>e?r:e;h=c>x?c>t?c>h?c:h:t>h?t:h:x>t?x>h?x:h:t>h?t:h}a()};this.addRectangle=function(m){if(l){l=false;b=m.getLeft();d=m.getTop();e=m.getRight();h=m.getBottom()}else{b=b<m.getLeft()?b:m.getLeft();d=d<m.getTop()?d:m.getTop();
|
|
e=e>m.getRight()?e:m.getRight();h=h>m.getBottom()?h:m.getBottom()}a()};this.inflate=function(m){b-=m;d-=m;e+=m;h+=m;a()};this.minSelf=function(m){b=b>m.getLeft()?b:m.getLeft();d=d>m.getTop()?d:m.getTop();e=e<m.getRight()?e:m.getRight();h=h<m.getBottom()?h:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(b,m.getLeft())>=0&&Math.min(h,m.getBottom())-Math.max(d,m.getTop())>=0};this.empty=function(){l=true;h=e=d=b=0;a()};this.isEmpty=function(){return l};this.toString=
|
|
e=e>m.getRight()?e:m.getRight();h=h>m.getBottom()?h:m.getBottom()}a()};this.inflate=function(m){b-=m;d-=m;e+=m;h+=m;a()};this.minSelf=function(m){b=b>m.getLeft()?b:m.getLeft();d=d>m.getTop()?d:m.getTop();e=e<m.getRight()?e:m.getRight();h=h<m.getBottom()?h:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(b,m.getLeft())>=0&&Math.min(h,m.getBottom())-Math.max(d,m.getTop())>=0};this.empty=function(){l=true;h=e=d=b=0;a()};this.isEmpty=function(){return l};this.toString=
|
|
function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+d+", bottom: "+h+", width: "+n+", height: "+o+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
|
|
function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+d+", bottom: "+h+", width: "+n+", height: "+o+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
|
|
-THREE.Matrix4=function(a,b,d,e,h,n,o,l,m,c,z,x,r,s,H,F){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=h||0;this.n22=n||1;this.n23=o||0;this.n24=l||0;this.n31=m||0;this.n32=c||0;this.n33=z||1;this.n34=x||0;this.n41=r||0;this.n42=s||0;this.n43=H||0;this.n44=F||1};
|
|
|
|
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,h,n,o,l,m,c,z,x,r,s,H,F){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=h;this.n22=n;this.n23=o;this.n24=l;this.n31=m;this.n32=c;this.n33=z;this.n34=x;this.n41=r;this.n42=s;this.n43=H;this.n44=F;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
|
|
|
|
+THREE.Matrix4=function(a,b,d,e,h,n,o,l,m,c,z,x,r,t,H,F){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=h||0;this.n22=n||1;this.n23=o||0;this.n24=l||0;this.n31=m||0;this.n32=c||0;this.n33=z||1;this.n34=x||0;this.n41=r||0;this.n42=t||0;this.n43=H||0;this.n44=F||1};
|
|
|
|
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,h,n,o,l,m,c,z,x,r,t,H,F){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=h;this.n22=n;this.n23=o;this.n24=l;this.n31=m;this.n32=c;this.n33=z;this.n34=x;this.n41=r;this.n42=t;this.n43=H;this.n44=F;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=new THREE.Vector3,h=new THREE.Vector3,n=new THREE.Vector3;n.sub(a,b).normalize();e.cross(d,n).normalize();h.cross(n,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);this.n31=n.x;
|
|
a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=new THREE.Vector3,h=new THREE.Vector3,n=new THREE.Vector3;n.sub(a,b).normalize();e.cross(d,n).normalize();h.cross(n,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);this.n31=n.x;
|
|
this.n32=n.y;this.n33=n.z;this.n34=-n.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,h=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*h;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*
|
|
this.n32=n.y;this.n33=n.z;this.n34=-n.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,h=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*h;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*
|
|
h;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,h=a.n13,n=a.n14,o=a.n21,l=a.n22,m=a.n23,c=a.n24,z=a.n31,x=a.n32,
|
|
h;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,h=a.n13,n=a.n14,o=a.n21,l=a.n22,m=a.n23,c=a.n24,z=a.n31,x=a.n32,
|
|
-r=a.n33,s=a.n34,H=a.n41,F=a.n42,L=a.n43,J=a.n44,K=b.n11,v=b.n12,f=b.n13,k=b.n14,g=b.n21,q=b.n22,i=b.n23,j=b.n24,t=b.n31,p=b.n32,C=b.n33,y=b.n34,G=b.n41,O=b.n42,w=b.n43,P=b.n44;this.n11=d*K+e*g+h*t+n*G;this.n12=d*v+e*q+h*p+n*O;this.n13=d*f+e*i+h*C+n*w;this.n14=d*k+e*j+h*y+n*P;this.n21=o*K+l*g+m*t+c*G;this.n22=o*v+l*q+m*p+c*O;this.n23=o*f+l*i+m*C+c*w;this.n24=o*k+l*j+m*y+c*P;this.n31=z*K+x*g+r*t+s*G;this.n32=z*v+x*q+r*p+s*O;this.n33=z*f+x*i+r*C+s*w;this.n34=z*k+x*j+r*y+s*P;this.n41=H*K+F*g+L*t+J*G;
|
|
|
|
-this.n42=H*v+F*q+L*p+J*O;this.n43=H*f+F*i+L*C+J*w;this.n44=H*k+F*j+L*y+J*P;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,n=this.n21,o=this.n22,l=this.n23,m=this.n24,c=this.n31,z=this.n32,x=this.n33,r=this.n34,s=this.n41,H=this.n42,F=this.n43,L=this.n44,J=a.n11,K=a.n21,v=a.n31,f=a.n41,k=a.n12,g=a.n22,q=a.n32,i=a.n42,j=a.n13,t=a.n23,p=a.n33,C=a.n43,y=a.n14,G=a.n24,O=a.n34;a=a.n44;this.n11=b*J+d*K+e*v+h*f;this.n12=b*k+d*g+e*q+h*i;this.n13=b*j+d*t+e*p+h*C;this.n14=
|
|
|
|
-b*y+d*G+e*O+h*a;this.n21=n*J+o*K+l*v+m*f;this.n22=n*k+o*g+l*q+m*i;this.n23=n*j+o*t+l*p+m*C;this.n24=n*y+o*G+l*O+m*a;this.n31=c*J+z*K+x*v+r*f;this.n32=c*k+z*g+x*q+r*i;this.n33=c*j+z*t+x*p+r*C;this.n34=c*y+z*G+x*O+r*a;this.n41=s*J+H*K+F*v+L*f;this.n42=s*k+H*g+F*q+L*i;this.n43=s*j+H*t+F*p+L*C;this.n44=s*y+H*G+F*O+L*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=
|
|
|
|
|
|
+r=a.n33,t=a.n34,H=a.n41,F=a.n42,L=a.n43,J=a.n44,K=b.n11,v=b.n12,f=b.n13,k=b.n14,g=b.n21,q=b.n22,i=b.n23,j=b.n24,s=b.n31,p=b.n32,C=b.n33,y=b.n34,G=b.n41,O=b.n42,w=b.n43,P=b.n44;this.n11=d*K+e*g+h*s+n*G;this.n12=d*v+e*q+h*p+n*O;this.n13=d*f+e*i+h*C+n*w;this.n14=d*k+e*j+h*y+n*P;this.n21=o*K+l*g+m*s+c*G;this.n22=o*v+l*q+m*p+c*O;this.n23=o*f+l*i+m*C+c*w;this.n24=o*k+l*j+m*y+c*P;this.n31=z*K+x*g+r*s+t*G;this.n32=z*v+x*q+r*p+t*O;this.n33=z*f+x*i+r*C+t*w;this.n34=z*k+x*j+r*y+t*P;this.n41=H*K+F*g+L*s+J*G;
|
|
|
|
+this.n42=H*v+F*q+L*p+J*O;this.n43=H*f+F*i+L*C+J*w;this.n44=H*k+F*j+L*y+J*P;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,n=this.n21,o=this.n22,l=this.n23,m=this.n24,c=this.n31,z=this.n32,x=this.n33,r=this.n34,t=this.n41,H=this.n42,F=this.n43,L=this.n44,J=a.n11,K=a.n21,v=a.n31,f=a.n41,k=a.n12,g=a.n22,q=a.n32,i=a.n42,j=a.n13,s=a.n23,p=a.n33,C=a.n43,y=a.n14,G=a.n24,O=a.n34;a=a.n44;this.n11=b*J+d*K+e*v+h*f;this.n12=b*k+d*g+e*q+h*i;this.n13=b*j+d*s+e*p+h*C;this.n14=
|
|
|
|
+b*y+d*G+e*O+h*a;this.n21=n*J+o*K+l*v+m*f;this.n22=n*k+o*g+l*q+m*i;this.n23=n*j+o*s+l*p+m*C;this.n24=n*y+o*G+l*O+m*a;this.n31=c*J+z*K+x*v+r*f;this.n32=c*k+z*g+x*q+r*i;this.n33=c*j+z*s+x*p+r*C;this.n34=c*y+z*G+x*O+r*a;this.n41=t*J+H*K+F*v+L*f;this.n42=t*k+H*g+F*q+L*i;this.n43=t*j+H*s+F*p+L*C;this.n44=t*y+H*G+F*O+L*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=
|
|
a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*
|
|
a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*
|
|
this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,d,e){var h=b[d];b[d]=b[e];
|
|
this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,d,e){var h=b[d];b[d]=b[e];
|
|
b[e]=h}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
|
|
b[e]=h}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
|
|
@@ -48,7 +48,7 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.f
|
|
d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,h,n,o,l=new THREE.Vector3,m=new THREE.Vector3;e=0;for(h=this.vertices.length;e<h;e++){n=this.vertices[e];n.normal.set(0,0,0)}e=0;for(h=this.faces.length;e<h;e++){n=this.faces[e];if(a&&n.vertexNormals.length){l.set(0,0,0);b=0;for(d=n.normal.length;b<d;b++)l.addSelf(n.vertexNormals[b]);l.divideScalar(3)}else{b=this.vertices[n.a];d=this.vertices[n.b];o=this.vertices[n.c];l.sub(o.position,
|
|
d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,h,n,o,l=new THREE.Vector3,m=new THREE.Vector3;e=0;for(h=this.vertices.length;e<h;e++){n=this.vertices[e];n.normal.set(0,0,0)}e=0;for(h=this.faces.length;e<h;e++){n=this.faces[e];if(a&&n.vertexNormals.length){l.set(0,0,0);b=0;for(d=n.normal.length;b<d;b++)l.addSelf(n.vertexNormals[b]);l.divideScalar(3)}else{b=this.vertices[n.a];d=this.vertices[n.b];o=this.vertices[n.c];l.sub(o.position,
|
|
d.position);m.sub(b.position,d.position);l.crossSelf(m)}l.isZero()||l.normalize();n.normal.copy(l)}},computeVertexNormals:function(){var a,b=[],d,e;a=0;for(vl=this.vertices.length;a<vl;a++)b[a]=new THREE.Vector3;a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3){b[e.a].addSelf(e.normal);b[e.b].addSelf(e.normal);b[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){b[e.a].addSelf(e.normal);b[e.b].addSelf(e.normal);b[e.c].addSelf(e.normal);b[e.d].addSelf(e.normal)}}a=
|
|
d.position);m.sub(b.position,d.position);l.crossSelf(m)}l.isZero()||l.normalize();n.normal.copy(l)}},computeVertexNormals:function(){var a,b=[],d,e;a=0;for(vl=this.vertices.length;a<vl;a++)b[a]=new THREE.Vector3;a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3){b[e.a].addSelf(e.normal);b[e.b].addSelf(e.normal);b[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){b[e.a].addSelf(e.normal);b[e.b].addSelf(e.normal);b[e.c].addSelf(e.normal);b[e.d].addSelf(e.normal)}}a=
|
|
0;for(vl=this.vertices.length;a<vl;a++)b[a].normalize();a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3){e.vertexNormals[0]=b[e.a].clone();e.vertexNormals[1]=b[e.b].clone();e.vertexNormals[2]=b[e.c].clone()}else if(e instanceof THREE.Face4){e.vertexNormals[0]=b[e.a].clone();e.vertexNormals[1]=b[e.b].clone();e.vertexNormals[2]=b[e.c].clone();e.vertexNormals[3]=b[e.d].clone()}}},computeTangents:function(){function a(y,G,O,w){n=y.vertices[G].position;o=y.vertices[O].position;
|
|
0;for(vl=this.vertices.length;a<vl;a++)b[a].normalize();a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3){e.vertexNormals[0]=b[e.a].clone();e.vertexNormals[1]=b[e.b].clone();e.vertexNormals[2]=b[e.c].clone()}else if(e instanceof THREE.Face4){e.vertexNormals[0]=b[e.a].clone();e.vertexNormals[1]=b[e.b].clone();e.vertexNormals[2]=b[e.c].clone();e.vertexNormals[3]=b[e.d].clone()}}},computeTangents:function(){function a(y,G,O,w){n=y.vertices[G].position;o=y.vertices[O].position;
|
|
-l=y.vertices[w].position;m=h[0];c=h[1];z=h[2];x=o.x-n.x;r=l.x-n.x;s=o.y-n.y;H=l.y-n.y;F=o.z-n.z;L=l.z-n.z;J=c.u-m.u;K=z.u-m.u;v=c.v-m.v;f=z.v-m.v;k=1/(J*f-K*v);j.set((f*x-v*r)*k,(f*s-v*H)*k,(f*F-v*L)*k);t.set((J*r-K*x)*k,(J*H-K*s)*k,(J*L-K*F)*k);q[G].addSelf(j);q[O].addSelf(j);q[w].addSelf(j);i[G].addSelf(t);i[O].addSelf(t);i[w].addSelf(t)}var b,d,e,h,n,o,l,m,c,z,x,r,s,H,F,L,J,K,v,f,k,g,q=[],i=[],j=new THREE.Vector3,t=new THREE.Vector3,p=new THREE.Vector3,C=new THREE.Vector3;g=new THREE.Vector3;b=
|
|
|
|
|
|
+l=y.vertices[w].position;m=h[0];c=h[1];z=h[2];x=o.x-n.x;r=l.x-n.x;t=o.y-n.y;H=l.y-n.y;F=o.z-n.z;L=l.z-n.z;J=c.u-m.u;K=z.u-m.u;v=c.v-m.v;f=z.v-m.v;k=1/(J*f-K*v);j.set((f*x-v*r)*k,(f*t-v*H)*k,(f*F-v*L)*k);s.set((J*r-K*x)*k,(J*H-K*t)*k,(J*L-K*F)*k);q[G].addSelf(j);q[O].addSelf(j);q[w].addSelf(j);i[G].addSelf(s);i[O].addSelf(s);i[w].addSelf(s)}var b,d,e,h,n,o,l,m,c,z,x,r,t,H,F,L,J,K,v,f,k,g,q=[],i=[],j=new THREE.Vector3,s=new THREE.Vector3,p=new THREE.Vector3,C=new THREE.Vector3;g=new THREE.Vector3;b=
|
|
0;for(d=this.vertices.length;b<d;b++){q[b]=new THREE.Vector3;i[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];h=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c);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);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);
|
|
0;for(d=this.vertices.length;b<d;b++){q[b]=new THREE.Vector3;i[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];h=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c);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);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])}}b=0;for(d=this.vertices.length;b<d;b++){g.copy(this.vertices[b].normal);e=q[b];p.copy(e);p.subSelf(g.multiplyScalar(g.dot(e))).normalize();C.cross(this.vertices[b].normal,e);test=C.dot(i[b]);e=test<0?-1:1;this.vertices[b].tangent.set(p.x,p.y,p.z,e)}this.hasTangents=true},computeBoundingBox:function(){if(this.vertices.length>0){this.bbox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
|
|
this.vertices[e.c].normal.copy(e.vertexNormals[2]);this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){g.copy(this.vertices[b].normal);e=q[b];p.copy(e);p.subSelf(g.multiplyScalar(g.dot(e))).normalize();C.cross(this.vertices[b].normal,e);test=C.dot(i[b]);e=test<0?-1:1;this.vertices[b].tangent.set(p.x,p.y,p.z,e)}this.hasTangents=true},computeBoundingBox:function(){if(this.vertices.length>0){this.bbox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
|
|
y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var a=1,b=this.vertices.length;a<b;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=
|
|
y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var a=1,b=this.vertices.length;a<b;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=
|
|
@@ -90,19 +90,19 @@ THREE.Texture=function(a,b,d,e,h,n){this.image=a;this.mapping=b!==undefined?b:ne
|
|
this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
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.addObject=function(a){this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
|
|
THREE.Scene=function(){this.objects=[];this.lights=[];this.addObject=function(a){this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
|
|
-THREE.Projector=function(){function a(K,v){var f=0,k=1,g=K.z+K.w,q=v.z+v.w,i=-K.z+K.w,j=-v.z+v.w;if(g>=0&&q>=0&&i>=0&&j>=0)return true;else if(g<0&&q<0||i<0&&j<0)return false;else{if(g<0)f=Math.max(f,g/(g-q));else if(q<0)k=Math.min(k,g/(g-q));if(i<0)f=Math.max(f,i/(i-j));else if(j<0)k=Math.min(k,i/(i-j));if(k<f)return false;else{K.lerpSelf(v,f);v.lerpSelf(K,1-k);return true}}}var b=null,d,e,h,n=[],o,l,m=[],c,z,x=[],r=new THREE.Vector4,s=new THREE.Matrix4,H=new THREE.Matrix4,F=new THREE.Vector4,L=
|
|
|
|
-new THREE.Vector4,J;this.projectScene=function(K,v){var f,k,g,q,i,j,t,p,C,y,G,O,w,P,E,Q,R;b=[];h=l=z=0;v.autoUpdateMatrix&&v.updateMatrix();s.multiply(v.projectionMatrix,v.matrix);t=K.objects;f=0;for(k=t.length;f<k;f++){p=t[f];p.autoUpdateMatrix&&p.updateMatrix();C=p.matrix;y=p.rotationMatrix;G=p.material;O=p.overdraw;if(p instanceof THREE.Mesh){w=p.geometry.vertices;g=0;for(q=w.length;g<q;g++){P=w[g];P.positionWorld.copy(P.position);C.multiplyVector3(P.positionWorld);E=P.positionScreen;E.copy(P.positionWorld);
|
|
|
|
-s.multiplyVector4(E);E.multiplyScalar(1/E.w);P.__visible=E.z>0&&E.z<1}P=p.geometry.faces;g=0;for(q=P.length;g<q;g++){E=P[g];if(E instanceof THREE.Face3){i=w[E.a];j=w[E.b];Q=w[E.c];if(i.__visible&&j.__visible&&Q.__visible)if(p.doubleSided||p.flipSided!=(Q.positionScreen.x-i.positionScreen.x)*(j.positionScreen.y-i.positionScreen.y)-(Q.positionScreen.y-i.positionScreen.y)*(j.positionScreen.x-i.positionScreen.x)<0){d=n[h]=n[h]||new THREE.RenderableFace3;d.v1.positionWorld.copy(i.positionWorld);d.v2.positionWorld.copy(j.positionWorld);
|
|
|
|
-d.v3.positionWorld.copy(Q.positionWorld);d.v1.positionScreen.copy(i.positionScreen);d.v2.positionScreen.copy(j.positionScreen);d.v3.positionScreen.copy(Q.positionScreen);d.normalWorld.copy(E.normal);y.multiplyVector3(d.normalWorld);d.centroidWorld.copy(E.centroid);C.multiplyVector3(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);s.multiplyVector3(d.centroidScreen);Q=E.vertexNormals;J=d.vertexNormalsWorld;i=0;for(j=Q.length;i<j;i++){R=J[i]=J[i]||new THREE.Vector3;R.copy(Q[i]);y.multiplyVector3(R)}d.z=
|
|
|
|
|
|
+THREE.Projector=function(){function a(K,v){var f=0,k=1,g=K.z+K.w,q=v.z+v.w,i=-K.z+K.w,j=-v.z+v.w;if(g>=0&&q>=0&&i>=0&&j>=0)return true;else if(g<0&&q<0||i<0&&j<0)return false;else{if(g<0)f=Math.max(f,g/(g-q));else if(q<0)k=Math.min(k,g/(g-q));if(i<0)f=Math.max(f,i/(i-j));else if(j<0)k=Math.min(k,i/(i-j));if(k<f)return false;else{K.lerpSelf(v,f);v.lerpSelf(K,1-k);return true}}}var b=null,d,e,h,n=[],o,l,m=[],c,z,x=[],r=new THREE.Vector4,t=new THREE.Matrix4,H=new THREE.Matrix4,F=new THREE.Vector4,L=
|
|
|
|
+new THREE.Vector4,J;this.projectScene=function(K,v){var f,k,g,q,i,j,s,p,C,y,G,O,w,P,E,Q,R;b=[];h=l=z=0;v.autoUpdateMatrix&&v.updateMatrix();t.multiply(v.projectionMatrix,v.matrix);s=K.objects;f=0;for(k=s.length;f<k;f++){p=s[f];p.autoUpdateMatrix&&p.updateMatrix();C=p.matrix;y=p.rotationMatrix;G=p.material;O=p.overdraw;if(p instanceof THREE.Mesh){w=p.geometry.vertices;g=0;for(q=w.length;g<q;g++){P=w[g];P.positionWorld.copy(P.position);C.multiplyVector3(P.positionWorld);E=P.positionScreen;E.copy(P.positionWorld);
|
|
|
|
+t.multiplyVector4(E);E.multiplyScalar(1/E.w);P.__visible=E.z>0&&E.z<1}P=p.geometry.faces;g=0;for(q=P.length;g<q;g++){E=P[g];if(E instanceof THREE.Face3){i=w[E.a];j=w[E.b];Q=w[E.c];if(i.__visible&&j.__visible&&Q.__visible)if(p.doubleSided||p.flipSided!=(Q.positionScreen.x-i.positionScreen.x)*(j.positionScreen.y-i.positionScreen.y)-(Q.positionScreen.y-i.positionScreen.y)*(j.positionScreen.x-i.positionScreen.x)<0){d=n[h]=n[h]||new THREE.RenderableFace3;d.v1.positionWorld.copy(i.positionWorld);d.v2.positionWorld.copy(j.positionWorld);
|
|
|
|
+d.v3.positionWorld.copy(Q.positionWorld);d.v1.positionScreen.copy(i.positionScreen);d.v2.positionScreen.copy(j.positionScreen);d.v3.positionScreen.copy(Q.positionScreen);d.normalWorld.copy(E.normal);y.multiplyVector3(d.normalWorld);d.centroidWorld.copy(E.centroid);C.multiplyVector3(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);t.multiplyVector3(d.centroidScreen);Q=E.vertexNormals;J=d.vertexNormalsWorld;i=0;for(j=Q.length;i<j;i++){R=J[i]=J[i]||new THREE.Vector3;R.copy(Q[i]);y.multiplyVector3(R)}d.z=
|
|
d.centroidScreen.z;d.meshMaterial=G;d.faceMaterial=E.material;d.overdraw=O;if(p.geometry.uvs[g]){d.uvs[0]=p.geometry.uvs[g][0];d.uvs[1]=p.geometry.uvs[g][1];d.uvs[2]=p.geometry.uvs[g][2]}b.push(d);h++}}else if(E instanceof THREE.Face4){i=w[E.a];j=w[E.b];Q=w[E.c];R=w[E.d];if(i.__visible&&j.__visible&&Q.__visible&&R.__visible)if(p.doubleSided||p.flipSided!=((R.positionScreen.x-i.positionScreen.x)*(j.positionScreen.y-i.positionScreen.y)-(R.positionScreen.y-i.positionScreen.y)*(j.positionScreen.x-i.positionScreen.x)<
|
|
d.centroidScreen.z;d.meshMaterial=G;d.faceMaterial=E.material;d.overdraw=O;if(p.geometry.uvs[g]){d.uvs[0]=p.geometry.uvs[g][0];d.uvs[1]=p.geometry.uvs[g][1];d.uvs[2]=p.geometry.uvs[g][2]}b.push(d);h++}}else if(E instanceof THREE.Face4){i=w[E.a];j=w[E.b];Q=w[E.c];R=w[E.d];if(i.__visible&&j.__visible&&Q.__visible&&R.__visible)if(p.doubleSided||p.flipSided!=((R.positionScreen.x-i.positionScreen.x)*(j.positionScreen.y-i.positionScreen.y)-(R.positionScreen.y-i.positionScreen.y)*(j.positionScreen.x-i.positionScreen.x)<
|
|
0||(j.positionScreen.x-Q.positionScreen.x)*(R.positionScreen.y-Q.positionScreen.y)-(j.positionScreen.y-Q.positionScreen.y)*(R.positionScreen.x-Q.positionScreen.x)<0)){d=n[h]=n[h]||new THREE.RenderableFace3;d.v1.positionWorld.copy(i.positionWorld);d.v2.positionWorld.copy(j.positionWorld);d.v3.positionWorld.copy(R.positionWorld);d.v1.positionScreen.copy(i.positionScreen);d.v2.positionScreen.copy(j.positionScreen);d.v3.positionScreen.copy(R.positionScreen);d.normalWorld.copy(E.normal);y.multiplyVector3(d.normalWorld);
|
|
0||(j.positionScreen.x-Q.positionScreen.x)*(R.positionScreen.y-Q.positionScreen.y)-(j.positionScreen.y-Q.positionScreen.y)*(R.positionScreen.x-Q.positionScreen.x)<0)){d=n[h]=n[h]||new THREE.RenderableFace3;d.v1.positionWorld.copy(i.positionWorld);d.v2.positionWorld.copy(j.positionWorld);d.v3.positionWorld.copy(R.positionWorld);d.v1.positionScreen.copy(i.positionScreen);d.v2.positionScreen.copy(j.positionScreen);d.v3.positionScreen.copy(R.positionScreen);d.normalWorld.copy(E.normal);y.multiplyVector3(d.normalWorld);
|
|
-d.centroidWorld.copy(E.centroid);C.multiplyVector3(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);s.multiplyVector3(d.centroidScreen);d.z=d.centroidScreen.z;d.meshMaterial=G;d.faceMaterial=E.material;d.overdraw=O;if(p.geometry.uvs[g]){d.uvs[0]=p.geometry.uvs[g][0];d.uvs[1]=p.geometry.uvs[g][1];d.uvs[2]=p.geometry.uvs[g][3]}b.push(d);h++;e=n[h]=n[h]||new THREE.RenderableFace3;e.v1.positionWorld.copy(j.positionWorld);e.v2.positionWorld.copy(Q.positionWorld);e.v3.positionWorld.copy(R.positionWorld);
|
|
|
|
-e.v1.positionScreen.copy(j.positionScreen);e.v2.positionScreen.copy(Q.positionScreen);e.v3.positionScreen.copy(R.positionScreen);e.normalWorld.copy(d.normalWorld);e.centroidWorld.copy(d.centroidWorld);e.centroidScreen.copy(d.centroidScreen);e.z=e.centroidScreen.z;e.meshMaterial=G;e.faceMaterial=E.material;e.overdraw=O;if(p.geometry.uvs[g]){e.uvs[0]=p.geometry.uvs[g][1];e.uvs[1]=p.geometry.uvs[g][2];e.uvs[2]=p.geometry.uvs[g][3]}b.push(e);h++}}}}else if(p instanceof THREE.Line){H.multiply(s,C);w=p.geometry.vertices;
|
|
|
|
|
|
+d.centroidWorld.copy(E.centroid);C.multiplyVector3(d.centroidWorld);d.centroidScreen.copy(d.centroidWorld);t.multiplyVector3(d.centroidScreen);d.z=d.centroidScreen.z;d.meshMaterial=G;d.faceMaterial=E.material;d.overdraw=O;if(p.geometry.uvs[g]){d.uvs[0]=p.geometry.uvs[g][0];d.uvs[1]=p.geometry.uvs[g][1];d.uvs[2]=p.geometry.uvs[g][3]}b.push(d);h++;e=n[h]=n[h]||new THREE.RenderableFace3;e.v1.positionWorld.copy(j.positionWorld);e.v2.positionWorld.copy(Q.positionWorld);e.v3.positionWorld.copy(R.positionWorld);
|
|
|
|
+e.v1.positionScreen.copy(j.positionScreen);e.v2.positionScreen.copy(Q.positionScreen);e.v3.positionScreen.copy(R.positionScreen);e.normalWorld.copy(d.normalWorld);e.centroidWorld.copy(d.centroidWorld);e.centroidScreen.copy(d.centroidScreen);e.z=e.centroidScreen.z;e.meshMaterial=G;e.faceMaterial=E.material;e.overdraw=O;if(p.geometry.uvs[g]){e.uvs[0]=p.geometry.uvs[g][1];e.uvs[1]=p.geometry.uvs[g][2];e.uvs[2]=p.geometry.uvs[g][3]}b.push(e);h++}}}}else if(p instanceof THREE.Line){H.multiply(t,C);w=p.geometry.vertices;
|
|
P=w[0];P.positionScreen.copy(P.position);H.multiplyVector4(P.positionScreen);g=1;for(q=w.length;g<q;g++){i=w[g];i.positionScreen.copy(i.position);H.multiplyVector4(i.positionScreen);j=w[g-1];F.copy(i.positionScreen);L.copy(j.positionScreen);if(a(F,L)){F.multiplyScalar(1/F.w);L.multiplyScalar(1/L.w);o=m[l]=m[l]||new THREE.RenderableLine;o.v1.positionScreen.copy(F);o.v2.positionScreen.copy(L);o.z=Math.max(F.z,L.z);o.material=p.material;b.push(o);l++}}}else if(p instanceof THREE.Particle){r.set(p.position.x,
|
|
P=w[0];P.positionScreen.copy(P.position);H.multiplyVector4(P.positionScreen);g=1;for(q=w.length;g<q;g++){i=w[g];i.positionScreen.copy(i.position);H.multiplyVector4(i.positionScreen);j=w[g-1];F.copy(i.positionScreen);L.copy(j.positionScreen);if(a(F,L)){F.multiplyScalar(1/F.w);L.multiplyScalar(1/L.w);o=m[l]=m[l]||new THREE.RenderableLine;o.v1.positionScreen.copy(F);o.v2.positionScreen.copy(L);o.z=Math.max(F.z,L.z);o.material=p.material;b.push(o);l++}}}else if(p instanceof THREE.Particle){r.set(p.position.x,
|
|
-p.position.y,p.position.z,1);s.multiplyVector4(r);r.z/=r.w;if(r.z>0&&r.z<1){c=x[z]=x[z]||new THREE.RenderableParticle;c.x=r.x/r.w;c.y=r.y/r.w;c.z=r.z;c.rotation=p.rotation.z;c.scale.x=p.scale.x*Math.abs(c.x-(r.x+v.projectionMatrix.n11)/(r.w+v.projectionMatrix.n14));c.scale.y=p.scale.y*Math.abs(c.y-(r.y+v.projectionMatrix.n22)/(r.w+v.projectionMatrix.n24));c.material=p.material;b.push(c);z++}}}b.sort(function(M,B){return B.z-M.z});return b};this.unprojectVector=function(K,v){var f=new THREE.Matrix4;
|
|
|
|
|
|
+p.position.y,p.position.z,1);t.multiplyVector4(r);r.z/=r.w;if(r.z>0&&r.z<1){c=x[z]=x[z]||new THREE.RenderableParticle;c.x=r.x/r.w;c.y=r.y/r.w;c.z=r.z;c.rotation=p.rotation.z;c.scale.x=p.scale.x*Math.abs(c.x-(r.x+v.projectionMatrix.n11)/(r.w+v.projectionMatrix.n14));c.scale.y=p.scale.y*Math.abs(c.y-(r.y+v.projectionMatrix.n22)/(r.w+v.projectionMatrix.n24));c.material=p.material;b.push(c);z++}}}b.sort(function(M,B){return B.z-M.z});return b};this.unprojectVector=function(K,v){var f=new THREE.Matrix4;
|
|
f.multiply(THREE.Matrix4.makeInvert(v.matrix),THREE.Matrix4.makeInvert(v.projectionMatrix));f.multiplyVector3(K);return K}};
|
|
f.multiply(THREE.Matrix4.makeInvert(v.matrix),THREE.Matrix4.makeInvert(v.projectionMatrix));f.multiplyVector3(K);return K}};
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,h,n;this.domElement=document.createElement("div");this.setSize=function(o,l){d=o;e=l;h=d/2;n=e/2};this.render=function(o,l){var m,c,z,x,r,s,H,F;a=b.projectScene(o,l);m=0;for(c=a.length;m<c;m++){r=a[m];if(r instanceof THREE.RenderableParticle){H=r.x*h+h;F=r.y*n+n;z=0;for(x=r.material.length;z<x;z++){s=r.material[z];if(s instanceof THREE.ParticleDOMMaterial){s=s.domElement;s.style.left=H+"px";s.style.top=F+"px"}}}}}};
|
|
|
|
-THREE.CanvasRenderer=function(){var a=null,b=new THREE.Projector,d=document.createElement("canvas"),e,h,n,o,l=d.getContext("2d"),m=1,c=0,z=null,x=null,r=1,s=Math.min,H=Math.max,F,L,J,K,v,f,k,g,q,i=new THREE.Color,j=new THREE.Color,t=new THREE.Color,p=new THREE.Color,C=new THREE.Color,y,G,O,w,P,E,Q,R,M,B,D=new THREE.Rectangle,V=new THREE.Rectangle,Y=new THREE.Rectangle,T=false,S=new THREE.Color,Z=new THREE.Color,ia=new THREE.Color,ja=new THREE.Color,La=Math.PI*2,X=new THREE.Vector3,na,oa,Ca,ba,pa,
|
|
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,h,n;this.domElement=document.createElement("div");this.setSize=function(o,l){d=o;e=l;h=d/2;n=e/2};this.render=function(o,l){var m,c,z,x,r,t,H,F;a=b.projectScene(o,l);m=0;for(c=a.length;m<c;m++){r=a[m];if(r instanceof THREE.RenderableParticle){H=r.x*h+h;F=r.y*n+n;z=0;for(x=r.material.length;z<x;z++){t=r.material[z];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=H+"px";t.style.top=F+"px"}}}}}};
|
|
|
|
+THREE.CanvasRenderer=function(){var a=null,b=new THREE.Projector,d=document.createElement("canvas"),e,h,n,o,l=d.getContext("2d"),m=1,c=0,z=null,x=null,r=1,t=Math.min,H=Math.max,F,L,J,K,v,f,k,g,q,i=new THREE.Color,j=new THREE.Color,s=new THREE.Color,p=new THREE.Color,C=new THREE.Color,y,G,O,w,P,E,Q,R,M,B,D=new THREE.Rectangle,V=new THREE.Rectangle,Y=new THREE.Rectangle,T=false,S=new THREE.Color,Z=new THREE.Color,ia=new THREE.Color,ja=new THREE.Color,La=Math.PI*2,X=new THREE.Vector3,na,oa,Ca,ba,pa,
|
|
va,la=16;na=document.createElement("canvas");na.width=na.height=2;oa=na.getContext("2d");oa.fillStyle="rgba(0,0,0,1)";oa.fillRect(0,0,2,2);Ca=oa.getImageData(0,0,2,2);ba=Ca.data;pa=document.createElement("canvas");pa.width=pa.height=la;va=pa.getContext("2d");va.translate(-la/2,-la/2);va.scale(la,la);la--;this.domElement=d;this.autoClear=true;this.setSize=function(fa,wa){e=fa;h=wa;n=e/2;o=h/2;d.width=e;d.height=h;D.set(-n,-o,n,o)};this.clear=function(){if(!V.isEmpty()){V.inflate(1);V.minSelf(D);l.clearRect(V.getX(),
|
|
va,la=16;na=document.createElement("canvas");na.width=na.height=2;oa=na.getContext("2d");oa.fillStyle="rgba(0,0,0,1)";oa.fillRect(0,0,2,2);Ca=oa.getImageData(0,0,2,2);ba=Ca.data;pa=document.createElement("canvas");pa.width=pa.height=la;va=pa.getContext("2d");va.translate(-la/2,-la/2);va.scale(la,la);la--;this.domElement=d;this.autoClear=true;this.setSize=function(fa,wa){e=fa;h=wa;n=e/2;o=h/2;d.width=e;d.height=h;D.set(-n,-o,n,o)};this.clear=function(){if(!V.isEmpty()){V.inflate(1);V.minSelf(D);l.clearRect(V.getX(),
|
|
V.getY(),V.getWidth(),V.getHeight());V.empty()}};this.render=function(fa,wa){function Ma(u){var U,N,A,I=u.lights;Z.setRGB(0,0,0);ia.setRGB(0,0,0);ja.setRGB(0,0,0);u=0;for(U=I.length;u<U;u++){N=I[u];A=N.color;if(N instanceof THREE.AmbientLight){Z.r+=A.r;Z.g+=A.g;Z.b+=A.b}else if(N instanceof THREE.DirectionalLight){ia.r+=A.r;ia.g+=A.g;ia.b+=A.b}else if(N instanceof THREE.PointLight){ja.r+=A.r;ja.g+=A.g;ja.b+=A.b}}}function xa(u,U,N,A){var I,W,aa,ca,da=u.lights;u=0;for(I=da.length;u<I;u++){W=da[u];
|
|
V.getY(),V.getWidth(),V.getHeight());V.empty()}};this.render=function(fa,wa){function Ma(u){var U,N,A,I=u.lights;Z.setRGB(0,0,0);ia.setRGB(0,0,0);ja.setRGB(0,0,0);u=0;for(U=I.length;u<U;u++){N=I[u];A=N.color;if(N instanceof THREE.AmbientLight){Z.r+=A.r;Z.g+=A.g;Z.b+=A.b}else if(N instanceof THREE.DirectionalLight){ia.r+=A.r;ia.g+=A.g;ia.b+=A.b}else if(N instanceof THREE.PointLight){ja.r+=A.r;ja.g+=A.g;ja.b+=A.b}}}function xa(u,U,N,A){var I,W,aa,ca,da=u.lights;u=0;for(I=da.length;u<I;u++){W=da[u];
|
|
aa=W.color;ca=W.intensity;if(W instanceof THREE.DirectionalLight){W=N.dot(W.position)*ca;if(W>0){A.r+=aa.r*W;A.g+=aa.g*W;A.b+=aa.b*W}}else if(W instanceof THREE.PointLight){X.sub(W.position,U);X.normalize();W=N.dot(X)*ca;if(W>0){A.r+=aa.r*W;A.g+=aa.g*W;A.b+=aa.b*W}}}}function Na(u,U,N){if(N.opacity!=0){Da(N.opacity);ya(N.blending);var A,I,W,aa,ca,da;if(N instanceof THREE.ParticleBasicMaterial){if(N.map){aa=N.map;ca=aa.width>>1;da=aa.height>>1;I=U.scale.x*n;W=U.scale.y*o;N=I*ca;A=W*da;Y.set(u.x-N,
|
|
aa=W.color;ca=W.intensity;if(W instanceof THREE.DirectionalLight){W=N.dot(W.position)*ca;if(W>0){A.r+=aa.r*W;A.g+=aa.g*W;A.b+=aa.b*W}}else if(W instanceof THREE.PointLight){X.sub(W.position,U);X.normalize();W=N.dot(X)*ca;if(W>0){A.r+=aa.r*W;A.g+=aa.g*W;A.b+=aa.b*W}}}}function Na(u,U,N){if(N.opacity!=0){Da(N.opacity);ya(N.blending);var A,I,W,aa,ca,da;if(N instanceof THREE.ParticleBasicMaterial){if(N.map){aa=N.map;ca=aa.width>>1;da=aa.height>>1;I=U.scale.x*n;W=U.scale.y*o;N=I*ca;A=W*da;Y.set(u.x-N,
|
|
@@ -110,36 +110,36 @@ u.y-A,u.x+N,u.y+A);if(D.instersects(Y)){l.save();l.translate(u.x,u.y);l.rotate(-
|
|
x=I;l.save();l.translate(u.x,u.y);l.rotate(-U.rotation);l.scale(N,A);l.beginPath();l.arc(0,0,1,0,La,true);l.closePath();l.fill();l.restore()}}}}function Oa(u,U,N,A){if(A.opacity!=0){Da(A.opacity);ya(A.blending);l.beginPath();l.moveTo(u.positionScreen.x,u.positionScreen.y);l.lineTo(U.positionScreen.x,U.positionScreen.y);l.closePath();if(A instanceof THREE.LineBasicMaterial){i.__styleString=A.color.__styleString;u=A.linewidth;if(r!=u)l.lineWidth=r=u;u=i.__styleString;if(z!=u)l.strokeStyle=z=u;l.stroke();
|
|
x=I;l.save();l.translate(u.x,u.y);l.rotate(-U.rotation);l.scale(N,A);l.beginPath();l.arc(0,0,1,0,La,true);l.closePath();l.fill();l.restore()}}}}function Oa(u,U,N,A){if(A.opacity!=0){Da(A.opacity);ya(A.blending);l.beginPath();l.moveTo(u.positionScreen.x,u.positionScreen.y);l.lineTo(U.positionScreen.x,U.positionScreen.y);l.closePath();if(A instanceof THREE.LineBasicMaterial){i.__styleString=A.color.__styleString;u=A.linewidth;if(r!=u)l.lineWidth=r=u;u=i.__styleString;if(z!=u)l.strokeStyle=z=u;l.stroke();
|
|
Y.inflate(A.linewidth*2)}}}function Ha(u,U,N,A,I,W){if(I.opacity!=0){Da(I.opacity);ya(I.blending);K=u.positionScreen.x;v=u.positionScreen.y;f=U.positionScreen.x;k=U.positionScreen.y;g=N.positionScreen.x;q=N.positionScreen.y;l.beginPath();l.moveTo(K,v);l.lineTo(f,k);l.lineTo(g,q);l.lineTo(K,v);l.closePath();if(I instanceof THREE.MeshBasicMaterial)if(I.map)I.map.image.loaded&&I.map.mapping instanceof THREE.UVMapping&&qa(K,v,f,k,g,q,I.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,
|
|
Y.inflate(A.linewidth*2)}}}function Ha(u,U,N,A,I,W){if(I.opacity!=0){Da(I.opacity);ya(I.blending);K=u.positionScreen.x;v=u.positionScreen.y;f=U.positionScreen.x;k=U.positionScreen.y;g=N.positionScreen.x;q=N.positionScreen.y;l.beginPath();l.moveTo(K,v);l.lineTo(f,k);l.lineTo(g,q);l.lineTo(K,v);l.closePath();if(I instanceof THREE.MeshBasicMaterial)if(I.map)I.map.image.loaded&&I.map.mapping instanceof THREE.UVMapping&&qa(K,v,f,k,g,q,I.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,
|
|
A.uvs[2].v);else if(I.env_map){if(I.env_map.image.loaded)if(I.env_map.mapping instanceof THREE.SphericalReflectionMapping){u=wa.matrix;X.copy(A.vertexNormalsWorld[0]);P=(X.x*u.n11+X.y*u.n12+X.z*u.n13)*0.5+0.5;E=-(X.x*u.n21+X.y*u.n22+X.z*u.n23)*0.5+0.5;X.copy(A.vertexNormalsWorld[1]);Q=(X.x*u.n11+X.y*u.n12+X.z*u.n13)*0.5+0.5;R=-(X.x*u.n21+X.y*u.n22+X.z*u.n23)*0.5+0.5;X.copy(A.vertexNormalsWorld[2]);M=(X.x*u.n11+X.y*u.n12+X.z*u.n13)*0.5+0.5;B=-(X.x*u.n21+X.y*u.n22+X.z*u.n23)*0.5+0.5;qa(K,v,f,k,g,q,
|
|
A.uvs[2].v);else if(I.env_map){if(I.env_map.image.loaded)if(I.env_map.mapping instanceof THREE.SphericalReflectionMapping){u=wa.matrix;X.copy(A.vertexNormalsWorld[0]);P=(X.x*u.n11+X.y*u.n12+X.z*u.n13)*0.5+0.5;E=-(X.x*u.n21+X.y*u.n22+X.z*u.n23)*0.5+0.5;X.copy(A.vertexNormalsWorld[1]);Q=(X.x*u.n11+X.y*u.n12+X.z*u.n13)*0.5+0.5;R=-(X.x*u.n21+X.y*u.n22+X.z*u.n23)*0.5+0.5;X.copy(A.vertexNormalsWorld[2]);M=(X.x*u.n11+X.y*u.n12+X.z*u.n13)*0.5+0.5;B=-(X.x*u.n21+X.y*u.n22+X.z*u.n23)*0.5+0.5;qa(K,v,f,k,g,q,
|
|
-I.env_map.image,P,E,Q,R,M,B)}}else I.wireframe?za(I.color.__styleString,I.wireframe_linewidth):Aa(I.color.__styleString);else if(I instanceof THREE.MeshLambertMaterial){if(I.map&&!I.wireframe){I.map.mapping instanceof THREE.UVMapping&&qa(K,v,f,k,g,q,I.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);ya(THREE.SubtractiveBlending)}if(T)if(!I.wireframe&&I.shading==THREE.SmoothShading&&A.vertexNormalsWorld.length==3){j.r=t.r=p.r=Z.r;j.g=t.g=p.g=Z.g;j.b=t.b=p.b=Z.b;xa(W,A.v1.positionWorld,
|
|
|
|
-A.vertexNormalsWorld[0],j);xa(W,A.v2.positionWorld,A.vertexNormalsWorld[1],t);xa(W,A.v3.positionWorld,A.vertexNormalsWorld[2],p);C.r=(t.r+p.r)*0.5;C.g=(t.g+p.g)*0.5;C.b=(t.b+p.b)*0.5;w=Ia(j,t,p,C);qa(K,v,f,k,g,q,w,0,0,1,0,0,1)}else{S.r=Z.r;S.g=Z.g;S.b=Z.b;xa(W,A.centroidWorld,A.normalWorld,S);i.r=I.color.r*S.r;i.g=I.color.g*S.g;i.b=I.color.b*S.b;i.updateStyleString();I.wireframe?za(i.__styleString,I.wireframe_linewidth):Aa(i.__styleString)}else I.wireframe?za(I.color.__styleString,I.wireframe_linewidth):
|
|
|
|
-Aa(I.color.__styleString)}else if(I instanceof THREE.MeshDepthMaterial){y=I.__2near;G=I.__farPlusNear;O=I.__farMinusNear;j.r=j.g=j.b=1-y/(G-u.positionScreen.z*O);t.r=t.g=t.b=1-y/(G-U.positionScreen.z*O);p.r=p.g=p.b=1-y/(G-N.positionScreen.z*O);C.r=(t.r+p.r)*0.5;C.g=(t.g+p.g)*0.5;C.b=(t.b+p.b)*0.5;w=Ia(j,t,p,C);qa(K,v,f,k,g,q,w,0,0,1,0,0,1)}else if(I instanceof THREE.MeshNormalMaterial){i.r=Ea(A.normalWorld.x);i.g=Ea(A.normalWorld.y);i.b=Ea(A.normalWorld.z);i.updateStyleString();I.wireframe?za(i.__styleString,
|
|
|
|
|
|
+I.env_map.image,P,E,Q,R,M,B)}}else I.wireframe?za(I.color.__styleString,I.wireframe_linewidth):Aa(I.color.__styleString);else if(I instanceof THREE.MeshLambertMaterial){if(I.map&&!I.wireframe){I.map.mapping instanceof THREE.UVMapping&&qa(K,v,f,k,g,q,I.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);ya(THREE.SubtractiveBlending)}if(T)if(!I.wireframe&&I.shading==THREE.SmoothShading&&A.vertexNormalsWorld.length==3){j.r=s.r=p.r=Z.r;j.g=s.g=p.g=Z.g;j.b=s.b=p.b=Z.b;xa(W,A.v1.positionWorld,
|
|
|
|
+A.vertexNormalsWorld[0],j);xa(W,A.v2.positionWorld,A.vertexNormalsWorld[1],s);xa(W,A.v3.positionWorld,A.vertexNormalsWorld[2],p);C.r=(s.r+p.r)*0.5;C.g=(s.g+p.g)*0.5;C.b=(s.b+p.b)*0.5;w=Ia(j,s,p,C);qa(K,v,f,k,g,q,w,0,0,1,0,0,1)}else{S.r=Z.r;S.g=Z.g;S.b=Z.b;xa(W,A.centroidWorld,A.normalWorld,S);i.r=I.color.r*S.r;i.g=I.color.g*S.g;i.b=I.color.b*S.b;i.updateStyleString();I.wireframe?za(i.__styleString,I.wireframe_linewidth):Aa(i.__styleString)}else I.wireframe?za(I.color.__styleString,I.wireframe_linewidth):
|
|
|
|
+Aa(I.color.__styleString)}else if(I instanceof THREE.MeshDepthMaterial){y=I.__2near;G=I.__farPlusNear;O=I.__farMinusNear;j.r=j.g=j.b=1-y/(G-u.positionScreen.z*O);s.r=s.g=s.b=1-y/(G-U.positionScreen.z*O);p.r=p.g=p.b=1-y/(G-N.positionScreen.z*O);C.r=(s.r+p.r)*0.5;C.g=(s.g+p.g)*0.5;C.b=(s.b+p.b)*0.5;w=Ia(j,s,p,C);qa(K,v,f,k,g,q,w,0,0,1,0,0,1)}else if(I instanceof THREE.MeshNormalMaterial){i.r=Ea(A.normalWorld.x);i.g=Ea(A.normalWorld.y);i.b=Ea(A.normalWorld.z);i.updateStyleString();I.wireframe?za(i.__styleString,
|
|
I.wireframe_linewidth):Aa(i.__styleString)}}}function za(u,U){if(z!=u)l.strokeStyle=z=u;if(r!=U)l.lineWidth=r=U;l.stroke();Y.inflate(U*2)}function Aa(u){if(x!=u)l.fillStyle=x=u;l.fill()}function qa(u,U,N,A,I,W,aa,ca,da,ra,ha,sa,ta){var ka,ga;ka=aa.width-1;ga=aa.height-1;ca*=ka;da*=ga;ra*=ka;ha*=ga;sa*=ka;ta*=ga;N-=u;A-=U;I-=u;W-=U;ra-=ca;ha-=da;sa-=ca;ta-=da;ga=1/(ra*ta-sa*ha);ka=(ta*N-ha*I)*ga;ha=(ta*A-ha*W)*ga;N=(ra*I-sa*N)*ga;A=(ra*W-sa*A)*ga;u=u-ka*ca-N*da;U=U-ha*ca-A*da;l.save();l.transform(ka,
|
|
I.wireframe_linewidth):Aa(i.__styleString)}}}function za(u,U){if(z!=u)l.strokeStyle=z=u;if(r!=U)l.lineWidth=r=U;l.stroke();Y.inflate(U*2)}function Aa(u){if(x!=u)l.fillStyle=x=u;l.fill()}function qa(u,U,N,A,I,W,aa,ca,da,ra,ha,sa,ta){var ka,ga;ka=aa.width-1;ga=aa.height-1;ca*=ka;da*=ga;ra*=ka;ha*=ga;sa*=ka;ta*=ga;N-=u;A-=U;I-=u;W-=U;ra-=ca;ha-=da;sa-=ca;ta-=da;ga=1/(ra*ta-sa*ha);ka=(ta*N-ha*I)*ga;ha=(ta*A-ha*W)*ga;N=(ra*I-sa*N)*ga;A=(ra*W-sa*A)*ga;u=u-ka*ca-N*da;U=U-ha*ca-A*da;l.save();l.transform(ka,
|
|
-ha,N,A,u,U);l.clip();l.drawImage(aa,0,0);l.restore()}function Da(u){if(m!=u)l.globalAlpha=m=u}function ya(u){if(c!=u){switch(u){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}c=u}}function Ia(u,U,N,A){ba[0]=H(0,s(255,~~(u.r*255)));ba[1]=H(0,s(255,~~(u.g*255)));ba[2]=H(0,s(255,~~(u.b*255)));ba[4]=H(0,s(255,~~(U.r*255)));ba[5]=H(0,s(255,
|
|
|
|
-~~(U.g*255)));ba[6]=H(0,s(255,~~(U.b*255)));ba[8]=H(0,s(255,~~(N.r*255)));ba[9]=H(0,s(255,~~(N.g*255)));ba[10]=H(0,s(255,~~(N.b*255)));ba[12]=H(0,s(255,~~(A.r*255)));ba[13]=H(0,s(255,~~(A.g*255)));ba[14]=H(0,s(255,~~(A.b*255)));oa.putImageData(Ca,0,0);va.drawImage(na,0,0);return pa}function Ea(u){return u<0?s((1+u)*0.5,0.5):0.5+s(u*0.5,0.5)}function Fa(u,U){var N=U.x-u.x,A=U.y-u.y,I=1/Math.sqrt(N*N+A*A);N*=I;A*=I;U.x+=N;U.y+=A;u.x-=N;u.y-=A}var Ba,Ja,$,ea,ma,Ga,Ka,ua;l.setTransform(1,0,0,-1,n,o);
|
|
|
|
-this.autoClear&&this.clear();a=b.projectScene(fa,wa);(T=fa.lights.length>0)&&Ma(fa);Ba=0;for(Ja=a.length;Ba<Ja;Ba++){$=a[Ba];Y.empty();if($ instanceof THREE.RenderableParticle){F=$;F.x*=n;F.y*=o;ea=0;for(ma=$.material.length;ea<ma;ea++)Na(F,$,$.material[ea],fa)}else if($ instanceof THREE.RenderableLine){F=$.v1;L=$.v2;F.positionScreen.x*=n;F.positionScreen.y*=o;L.positionScreen.x*=n;L.positionScreen.y*=o;Y.addPoint(F.positionScreen.x,F.positionScreen.y);Y.addPoint(L.positionScreen.x,L.positionScreen.y);
|
|
|
|
-if(D.instersects(Y)){ea=0;for(ma=$.material.length;ea<ma;)Oa(F,L,$,$.material[ea++],fa)}}else if($ instanceof THREE.RenderableFace3){F=$.v1;L=$.v2;J=$.v3;F.positionScreen.x*=n;F.positionScreen.y*=o;L.positionScreen.x*=n;L.positionScreen.y*=o;J.positionScreen.x*=n;J.positionScreen.y*=o;if($.overdraw){Fa(F.positionScreen,L.positionScreen);Fa(L.positionScreen,J.positionScreen);Fa(J.positionScreen,F.positionScreen)}Y.add3Points(F.positionScreen.x,F.positionScreen.y,L.positionScreen.x,L.positionScreen.y,
|
|
|
|
-J.positionScreen.x,J.positionScreen.y);if(D.instersects(Y)){ea=0;for(ma=$.meshMaterial.length;ea<ma;){ua=$.meshMaterial[ea++];if(ua instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=$.faceMaterial.length;Ga<Ka;)(ua=$.faceMaterial[Ga++])&&Ha(F,L,J,$,ua,fa)}else Ha(F,L,J,$,ua,fa)}}}V.addRectangle(Y)}l.setTransform(1,0,0,1,0,0)}};
|
|
|
|
|
|
+ha,N,A,u,U);l.clip();l.drawImage(aa,0,0);l.restore()}function Da(u){if(m!=u)l.globalAlpha=m=u}function ya(u){if(c!=u){switch(u){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}c=u}}function Ia(u,U,N,A){ba[0]=H(0,t(255,~~(u.r*255)));ba[1]=H(0,t(255,~~(u.g*255)));ba[2]=H(0,t(255,~~(u.b*255)));ba[4]=H(0,t(255,~~(U.r*255)));ba[5]=H(0,t(255,
|
|
|
|
+~~(U.g*255)));ba[6]=H(0,t(255,~~(U.b*255)));ba[8]=H(0,t(255,~~(N.r*255)));ba[9]=H(0,t(255,~~(N.g*255)));ba[10]=H(0,t(255,~~(N.b*255)));ba[12]=H(0,t(255,~~(A.r*255)));ba[13]=H(0,t(255,~~(A.g*255)));ba[14]=H(0,t(255,~~(A.b*255)));oa.putImageData(Ca,0,0);va.drawImage(na,0,0);return pa}function Ea(u){u=(u+1)*0.5;return u<0?0:u>1?1:u}function Fa(u,U){var N=U.x-u.x,A=U.y-u.y,I=1/Math.sqrt(N*N+A*A);N*=I;A*=I;U.x+=N;U.y+=A;u.x-=N;u.y-=A}var Ba,Ja,$,ea,ma,Ga,Ka,ua;l.setTransform(1,0,0,-1,n,o);this.autoClear&&
|
|
|
|
+this.clear();a=b.projectScene(fa,wa);(T=fa.lights.length>0)&&Ma(fa);Ba=0;for(Ja=a.length;Ba<Ja;Ba++){$=a[Ba];Y.empty();if($ instanceof THREE.RenderableParticle){F=$;F.x*=n;F.y*=o;ea=0;for(ma=$.material.length;ea<ma;ea++)Na(F,$,$.material[ea],fa)}else if($ instanceof THREE.RenderableLine){F=$.v1;L=$.v2;F.positionScreen.x*=n;F.positionScreen.y*=o;L.positionScreen.x*=n;L.positionScreen.y*=o;Y.addPoint(F.positionScreen.x,F.positionScreen.y);Y.addPoint(L.positionScreen.x,L.positionScreen.y);if(D.instersects(Y)){ea=
|
|
|
|
+0;for(ma=$.material.length;ea<ma;)Oa(F,L,$,$.material[ea++],fa)}}else if($ instanceof THREE.RenderableFace3){F=$.v1;L=$.v2;J=$.v3;F.positionScreen.x*=n;F.positionScreen.y*=o;L.positionScreen.x*=n;L.positionScreen.y*=o;J.positionScreen.x*=n;J.positionScreen.y*=o;if($.overdraw){Fa(F.positionScreen,L.positionScreen);Fa(L.positionScreen,J.positionScreen);Fa(J.positionScreen,F.positionScreen)}Y.add3Points(F.positionScreen.x,F.positionScreen.y,L.positionScreen.x,L.positionScreen.y,J.positionScreen.x,J.positionScreen.y);
|
|
|
|
+if(D.instersects(Y)){ea=0;for(ma=$.meshMaterial.length;ea<ma;){ua=$.meshMaterial[ea++];if(ua instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=$.faceMaterial.length;Ga<Ka;)(ua=$.faceMaterial[Ga++])&&Ha(F,L,J,$,ua,fa)}else Ha(F,L,J,$,ua,fa)}}}V.addRectangle(Y)}l.setTransform(1,0,0,1,0,0)}};
|
|
THREE.SVGRenderer=function(){function a(E,Q,R){var M,B,D,V;M=0;for(B=E.lights.length;M<B;M++){D=E.lights[M];if(D instanceof THREE.DirectionalLight){V=Q.normalWorld.dot(D.position)*D.intensity;if(V>0){R.r+=D.color.r*V;R.g+=D.color.g*V;R.b+=D.color.b*V}}else if(D instanceof THREE.PointLight){j.sub(D.position,Q.centroidWorld);j.normalize();V=Q.normalWorld.dot(j)*D.intensity;if(V>0){R.r+=D.color.r*V;R.g+=D.color.g*V;R.b+=D.color.b*V}}}}function b(E,Q,R,M,B,D){y=e(G++);y.setAttribute("d","M "+E.positionScreen.x+
|
|
THREE.SVGRenderer=function(){function a(E,Q,R){var M,B,D,V;M=0;for(B=E.lights.length;M<B;M++){D=E.lights[M];if(D instanceof THREE.DirectionalLight){V=Q.normalWorld.dot(D.position)*D.intensity;if(V>0){R.r+=D.color.r*V;R.g+=D.color.g*V;R.b+=D.color.b*V}}else if(D instanceof THREE.PointLight){j.sub(D.position,Q.centroidWorld);j.normalize();V=Q.normalWorld.dot(j)*D.intensity;if(V>0){R.r+=D.color.r*V;R.g+=D.color.g*V;R.b+=D.color.b*V}}}}function b(E,Q,R,M,B,D){y=e(G++);y.setAttribute("d","M "+E.positionScreen.x+
|
|
" "+E.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)v.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(K){f.r=k.r;f.g=k.g;f.b=k.b;a(D,M,f);v.r=B.color.r*f.r;v.g=B.color.g*f.g;v.b=B.color.b*f.b;v.updateStyleString()}else v.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){i=1-B.__2near/(B.__farPlusNear-M.z*B.__farMinusNear);
|
|
" "+E.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)v.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(K){f.r=k.r;f.g=k.g;f.b=k.b;a(D,M,f);v.r=B.color.r*f.r;v.g=B.color.g*f.g;v.b=B.color.b*f.b;v.updateStyleString()}else v.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){i=1-B.__2near/(B.__farPlusNear-M.z*B.__farMinusNear);
|
|
v.setRGB(i,i,i)}else B instanceof THREE.MeshNormalMaterial&&v.setRGB(h(M.normalWorld.x),h(M.normalWorld.y),h(M.normalWorld.z));B.wireframe?y.setAttribute("style","fill: none; stroke: "+v.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):y.setAttribute("style","fill: "+v.__styleString+"; fill-opacity: "+B.opacity);l.appendChild(y)}function d(E,Q,R,M,B,D,V){y=e(G++);y.setAttribute("d",
|
|
v.setRGB(i,i,i)}else B instanceof THREE.MeshNormalMaterial&&v.setRGB(h(M.normalWorld.x),h(M.normalWorld.y),h(M.normalWorld.z));B.wireframe?y.setAttribute("style","fill: none; stroke: "+v.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):y.setAttribute("style","fill: "+v.__styleString+"; fill-opacity: "+B.opacity);l.appendChild(y)}function d(E,Q,R,M,B,D,V){y=e(G++);y.setAttribute("d",
|
|
"M "+E.positionScreen.x+" "+E.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(D instanceof THREE.MeshBasicMaterial)v.__styleString=D.color.__styleString;else if(D instanceof THREE.MeshLambertMaterial)if(K){f.r=k.r;f.g=k.g;f.b=k.b;a(V,B,f);v.r=D.color.r*f.r;v.g=D.color.g*f.g;v.b=D.color.b*f.b;v.updateStyleString()}else v.__styleString=D.color.__styleString;else if(D instanceof THREE.MeshDepthMaterial){i=
|
|
"M "+E.positionScreen.x+" "+E.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(D instanceof THREE.MeshBasicMaterial)v.__styleString=D.color.__styleString;else if(D instanceof THREE.MeshLambertMaterial)if(K){f.r=k.r;f.g=k.g;f.b=k.b;a(V,B,f);v.r=D.color.r*f.r;v.g=D.color.g*f.g;v.b=D.color.b*f.b;v.updateStyleString()}else v.__styleString=D.color.__styleString;else if(D instanceof THREE.MeshDepthMaterial){i=
|
|
1-D.__2near/(D.__farPlusNear-B.z*D.__farMinusNear);v.setRGB(i,i,i)}else D instanceof THREE.MeshNormalMaterial&&v.setRGB(h(B.normalWorld.x),h(B.normalWorld.y),h(B.normalWorld.z));D.wireframe?y.setAttribute("style","fill: none; stroke: "+v.__styleString+"; stroke-width: "+D.wireframe_linewidth+"; stroke-opacity: "+D.opacity+"; stroke-linecap: "+D.wireframe_linecap+"; stroke-linejoin: "+D.wireframe_linejoin):y.setAttribute("style","fill: "+v.__styleString+"; fill-opacity: "+D.opacity);l.appendChild(y)}
|
|
1-D.__2near/(D.__farPlusNear-B.z*D.__farMinusNear);v.setRGB(i,i,i)}else D instanceof THREE.MeshNormalMaterial&&v.setRGB(h(B.normalWorld.x),h(B.normalWorld.y),h(B.normalWorld.z));D.wireframe?y.setAttribute("style","fill: none; stroke: "+v.__styleString+"; stroke-width: "+D.wireframe_linewidth+"; stroke-opacity: "+D.opacity+"; stroke-linecap: "+D.wireframe_linecap+"; stroke-linejoin: "+D.wireframe_linejoin):y.setAttribute("style","fill: "+v.__styleString+"; fill-opacity: "+D.opacity);l.appendChild(y)}
|
|
-function e(E){if(t[E]==null){t[E]=document.createElementNS("http://www.w3.org/2000/svg","path");P==0&&t[E].setAttribute("shape-rendering","crispEdges");return t[E]}return t[E]}function h(E){return E<0?Math.min((1+E)*0.5,0.5):0.5+Math.min(E*0.5,0.5)}var n=null,o=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,c,z,x,r,s,H,F,L=new THREE.Rectangle,J=new THREE.Rectangle,K=false,v=new THREE.Color(16777215),f=new THREE.Color(16777215),k=new THREE.Color(0),g=new THREE.Color(0),
|
|
|
|
-q=new THREE.Color(0),i,j=new THREE.Vector3,t=[],p=[],C=[],y,G,O,w,P=1;this.domElement=l;this.autoClear=true;this.setQuality=function(E){switch(E){case "high":P=1;break;case "low":P=0}};this.setSize=function(E,Q){m=E;c=Q;z=m/2;x=c/2;l.setAttribute("viewBox",-z+" "+-x+" "+m+" "+c);l.setAttribute("width",m);l.setAttribute("height",c);L.set(-z,-x,z,x)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(E,Q){var R,M,B,D,V,Y,T,S;this.autoClear&&this.clear();
|
|
|
|
|
|
+function e(E){if(s[E]==null){s[E]=document.createElementNS("http://www.w3.org/2000/svg","path");P==0&&s[E].setAttribute("shape-rendering","crispEdges");return s[E]}return s[E]}function h(E){return E<0?Math.min((1+E)*0.5,0.5):0.5+Math.min(E*0.5,0.5)}var n=null,o=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,c,z,x,r,t,H,F,L=new THREE.Rectangle,J=new THREE.Rectangle,K=false,v=new THREE.Color(16777215),f=new THREE.Color(16777215),k=new THREE.Color(0),g=new THREE.Color(0),
|
|
|
|
+q=new THREE.Color(0),i,j=new THREE.Vector3,s=[],p=[],C=[],y,G,O,w,P=1;this.domElement=l;this.autoClear=true;this.setQuality=function(E){switch(E){case "high":P=1;break;case "low":P=0}};this.setSize=function(E,Q){m=E;c=Q;z=m/2;x=c/2;l.setAttribute("viewBox",-z+" "+-x+" "+m+" "+c);l.setAttribute("width",m);l.setAttribute("height",c);L.set(-z,-x,z,x)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(E,Q){var R,M,B,D,V,Y,T,S;this.autoClear&&this.clear();
|
|
n=o.projectScene(E,Q);w=O=G=0;if(K=E.lights.length>0){T=E.lights;k.setRGB(0,0,0);g.setRGB(0,0,0);q.setRGB(0,0,0);R=0;for(M=T.length;R<M;R++){B=T[R];D=B.color;if(B instanceof THREE.AmbientLight){k.r+=D.r;k.g+=D.g;k.b+=D.b}else if(B instanceof THREE.DirectionalLight){g.r+=D.r;g.g+=D.g;g.b+=D.b}else if(B instanceof THREE.PointLight){q.r+=D.r;q.g+=D.g;q.b+=D.b}}}R=0;for(M=n.length;R<M;R++){T=n[R];J.empty();if(T instanceof THREE.RenderableParticle){r=T;r.x*=z;r.y*=-x;B=0;for(D=T.material.length;B<D;B++)if(S=
|
|
n=o.projectScene(E,Q);w=O=G=0;if(K=E.lights.length>0){T=E.lights;k.setRGB(0,0,0);g.setRGB(0,0,0);q.setRGB(0,0,0);R=0;for(M=T.length;R<M;R++){B=T[R];D=B.color;if(B instanceof THREE.AmbientLight){k.r+=D.r;k.g+=D.g;k.b+=D.b}else if(B instanceof THREE.DirectionalLight){g.r+=D.r;g.g+=D.g;g.b+=D.b}else if(B instanceof THREE.PointLight){q.r+=D.r;q.g+=D.g;q.b+=D.b}}}R=0;for(M=n.length;R<M;R++){T=n[R];J.empty();if(T instanceof THREE.RenderableParticle){r=T;r.x*=z;r.y*=-x;B=0;for(D=T.material.length;B<D;B++)if(S=
|
|
T.material[B]){V=r;Y=T;S=S;var Z=O++;if(p[Z]==null){p[Z]=document.createElementNS("http://www.w3.org/2000/svg","circle");P==0&&p[Z].setAttribute("shape-rendering","crispEdges")}y=p[Z];y.setAttribute("cx",V.x);y.setAttribute("cy",V.y);y.setAttribute("r",Y.scale.x*z);if(S instanceof THREE.ParticleCircleMaterial){if(K){f.r=k.r+g.r+q.r;f.g=k.g+g.g+q.g;f.b=k.b+g.b+q.b;v.r=S.color.r*f.r;v.g=S.color.g*f.g;v.b=S.color.b*f.b;v.updateStyleString()}else v=S.color;y.setAttribute("style","fill: "+v.__styleString)}l.appendChild(y)}}else if(T instanceof
|
|
T.material[B]){V=r;Y=T;S=S;var Z=O++;if(p[Z]==null){p[Z]=document.createElementNS("http://www.w3.org/2000/svg","circle");P==0&&p[Z].setAttribute("shape-rendering","crispEdges")}y=p[Z];y.setAttribute("cx",V.x);y.setAttribute("cy",V.y);y.setAttribute("r",Y.scale.x*z);if(S instanceof THREE.ParticleCircleMaterial){if(K){f.r=k.r+g.r+q.r;f.g=k.g+g.g+q.g;f.b=k.b+g.b+q.b;v.r=S.color.r*f.r;v.g=S.color.g*f.g;v.b=S.color.b*f.b;v.updateStyleString()}else v=S.color;y.setAttribute("style","fill: "+v.__styleString)}l.appendChild(y)}}else if(T instanceof
|
|
-THREE.RenderableLine){r=T.v1;s=T.v2;r.positionScreen.x*=z;r.positionScreen.y*=-x;s.positionScreen.x*=z;s.positionScreen.y*=-x;J.addPoint(r.positionScreen.x,r.positionScreen.y);J.addPoint(s.positionScreen.x,s.positionScreen.y);if(L.instersects(J)){B=0;for(D=T.material.length;B<D;)if(S=T.material[B++]){V=r;Y=s;S=S;Z=w++;if(C[Z]==null){C[Z]=document.createElementNS("http://www.w3.org/2000/svg","line");P==0&&C[Z].setAttribute("shape-rendering","crispEdges")}y=C[Z];y.setAttribute("x1",V.positionScreen.x);
|
|
|
|
-y.setAttribute("y1",V.positionScreen.y);y.setAttribute("x2",Y.positionScreen.x);y.setAttribute("y2",Y.positionScreen.y);if(S instanceof THREE.LineBasicMaterial){v.__styleString=S.color.__styleString;y.setAttribute("style","fill: none; stroke: "+v.__styleString+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin);l.appendChild(y)}}}}else if(T instanceof THREE.RenderableFace3){r=T.v1;s=T.v2;H=T.v3;r.positionScreen.x*=z;r.positionScreen.y*=
|
|
|
|
--x;s.positionScreen.x*=z;s.positionScreen.y*=-x;H.positionScreen.x*=z;H.positionScreen.y*=-x;J.addPoint(r.positionScreen.x,r.positionScreen.y);J.addPoint(s.positionScreen.x,s.positionScreen.y);J.addPoint(H.positionScreen.x,H.positionScreen.y);if(L.instersects(J)){B=0;for(D=T.meshMaterial.length;B<D;){S=T.meshMaterial[B++];if(S instanceof THREE.MeshFaceMaterial){V=0;for(Y=T.faceMaterial.length;V<Y;)(S=T.faceMaterial[V++])&&b(r,s,H,T,S,E)}else S&&b(r,s,H,T,S,E)}}}else if(T instanceof THREE.RenderableFace4){r=
|
|
|
|
-T.v1;s=T.v2;H=T.v3;F=T.v4;r.positionScreen.x*=z;r.positionScreen.y*=-x;s.positionScreen.x*=z;s.positionScreen.y*=-x;H.positionScreen.x*=z;H.positionScreen.y*=-x;F.positionScreen.x*=z;F.positionScreen.y*=-x;J.addPoint(r.positionScreen.x,r.positionScreen.y);J.addPoint(s.positionScreen.x,s.positionScreen.y);J.addPoint(H.positionScreen.x,H.positionScreen.y);J.addPoint(F.positionScreen.x,F.positionScreen.y);if(L.instersects(J)){B=0;for(D=T.meshMaterial.length;B<D;){S=T.meshMaterial[B++];if(S instanceof
|
|
|
|
-THREE.MeshFaceMaterial){V=0;for(Y=T.faceMaterial.length;V<Y;)(S=T.faceMaterial[V++])&&d(r,s,H,F,T,S,E)}else S&&d(r,s,H,F,T,S,E)}}}}}};
|
|
|
|
|
|
+THREE.RenderableLine){r=T.v1;t=T.v2;r.positionScreen.x*=z;r.positionScreen.y*=-x;t.positionScreen.x*=z;t.positionScreen.y*=-x;J.addPoint(r.positionScreen.x,r.positionScreen.y);J.addPoint(t.positionScreen.x,t.positionScreen.y);if(L.instersects(J)){B=0;for(D=T.material.length;B<D;)if(S=T.material[B++]){V=r;Y=t;S=S;Z=w++;if(C[Z]==null){C[Z]=document.createElementNS("http://www.w3.org/2000/svg","line");P==0&&C[Z].setAttribute("shape-rendering","crispEdges")}y=C[Z];y.setAttribute("x1",V.positionScreen.x);
|
|
|
|
+y.setAttribute("y1",V.positionScreen.y);y.setAttribute("x2",Y.positionScreen.x);y.setAttribute("y2",Y.positionScreen.y);if(S instanceof THREE.LineBasicMaterial){v.__styleString=S.color.__styleString;y.setAttribute("style","fill: none; stroke: "+v.__styleString+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin);l.appendChild(y)}}}}else if(T instanceof THREE.RenderableFace3){r=T.v1;t=T.v2;H=T.v3;r.positionScreen.x*=z;r.positionScreen.y*=
|
|
|
|
+-x;t.positionScreen.x*=z;t.positionScreen.y*=-x;H.positionScreen.x*=z;H.positionScreen.y*=-x;J.addPoint(r.positionScreen.x,r.positionScreen.y);J.addPoint(t.positionScreen.x,t.positionScreen.y);J.addPoint(H.positionScreen.x,H.positionScreen.y);if(L.instersects(J)){B=0;for(D=T.meshMaterial.length;B<D;){S=T.meshMaterial[B++];if(S instanceof THREE.MeshFaceMaterial){V=0;for(Y=T.faceMaterial.length;V<Y;)(S=T.faceMaterial[V++])&&b(r,t,H,T,S,E)}else S&&b(r,t,H,T,S,E)}}}else if(T instanceof THREE.RenderableFace4){r=
|
|
|
|
+T.v1;t=T.v2;H=T.v3;F=T.v4;r.positionScreen.x*=z;r.positionScreen.y*=-x;t.positionScreen.x*=z;t.positionScreen.y*=-x;H.positionScreen.x*=z;H.positionScreen.y*=-x;F.positionScreen.x*=z;F.positionScreen.y*=-x;J.addPoint(r.positionScreen.x,r.positionScreen.y);J.addPoint(t.positionScreen.x,t.positionScreen.y);J.addPoint(H.positionScreen.x,H.positionScreen.y);J.addPoint(F.positionScreen.x,F.positionScreen.y);if(L.instersects(J)){B=0;for(D=T.meshMaterial.length;B<D;){S=T.meshMaterial[B++];if(S instanceof
|
|
|
|
+THREE.MeshFaceMaterial){V=0;for(Y=T.faceMaterial.length;V<Y;)(S=T.faceMaterial[V++])&&d(r,t,H,F,T,S,E)}else S&&d(r,t,H,F,T,S,E)}}}}}};
|
|
THREE.WebGLRenderer=function(a){function b(f,k){var g=c.createProgram(),q=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");c.attachShader(g,o("fragment","#ifdef GL_ES\nprecision highp float;\n#endif\nuniform mat4 viewMatrix;\n"+
|
|
THREE.WebGLRenderer=function(a){function b(f,k){var g=c.createProgram(),q=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");c.attachShader(g,o("fragment","#ifdef GL_ES\nprecision highp float;\n#endif\nuniform mat4 viewMatrix;\n"+
|
|
f));c.attachShader(g,o("vertex",q+k));c.linkProgram(g);c.getProgramParameter(g,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(g,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");g.uniforms={};g.attributes={};return g}function d(f,k){if(f.image.length==6){if(!f.image.__webGLTextureCube&&!f.image.__cubeMapInitialized&&f.image.loadCount==6){f.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,f.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,
|
|
f));c.attachShader(g,o("vertex",q+k));c.linkProgram(g);c.getProgramParameter(g,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(g,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");g.uniforms={};g.attributes={};return g}function d(f,k){if(f.image.length==6){if(!f.image.__webGLTextureCube&&!f.image.__cubeMapInitialized&&f.image.loadCount==6){f.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,f.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,
|
|
c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(var g=0;g<6;++g)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image[g]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);f.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_CUBE_MAP,
|
|
c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(var g=0;g<6;++g)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image[g]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);f.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_CUBE_MAP,
|
|
f.image.__webGLTextureCube)}}function e(f,k){if(!f.__webGLTexture&&f.image.loaded){f.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,l(f.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,l(f.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,l(f.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,l(f.min_filter));c.generateMipmap(c.TEXTURE_2D);
|
|
f.image.__webGLTextureCube)}}function e(f,k){if(!f.__webGLTexture&&f.image.loaded){f.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,l(f.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,l(f.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,l(f.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,l(f.min_filter));c.generateMipmap(c.TEXTURE_2D);
|
|
c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_2D,f.__webGLTexture)}function h(f,k){var g,q,i;g=0;for(q=k.length;g<q;g++){i=k[g];f.uniforms[i]=c.getUniformLocation(f,i)}}function n(f,k){var g,q,i;g=0;for(q=k.length;g<q;g++){i=k[g];f.attributes[i]=c.getAttribLocation(f,i);f.attributes[i]>=0&&c.enableVertexAttribArray(f.attributes[i])}}function o(f,k){var g;if(f=="fragment")g=c.createShader(c.FRAGMENT_SHADER);else if(f=="vertex")g=c.createShader(c.VERTEX_SHADER);
|
|
c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_2D,f.__webGLTexture)}function h(f,k){var g,q,i;g=0;for(q=k.length;g<q;g++){i=k[g];f.uniforms[i]=c.getUniformLocation(f,i)}}function n(f,k){var g,q,i;g=0;for(q=k.length;g<q;g++){i=k[g];f.attributes[i]=c.getAttribLocation(f,i);f.attributes[i]>=0&&c.enableVertexAttribArray(f.attributes[i])}}function o(f,k){var g;if(f=="fragment")g=c.createShader(c.FRAGMENT_SHADER);else if(f=="vertex")g=c.createShader(c.VERTEX_SHADER);
|
|
c.shaderSource(g,k);c.compileShader(g);if(!c.getShaderParameter(g,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(g));return null}return g}function l(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;
|
|
c.shaderSource(g,k);c.compileShader(g);if(!c.getShaderParameter(g,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(g));return null}return g}function l(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;
|
|
-case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR}return 0}var m=document.createElement("canvas"),c,z,x,r=new THREE.Matrix4,s,H=new Float32Array(16),F=new Float32Array(16),L=new Float32Array(16),J=new Float32Array(9),K=new Float32Array(16);a=function(f,k){if(f){var g,q,i,j=pointLights=maxDirLights=maxPointLights=0;g=0;for(q=f.lights.length;g<q;g++){i=f.lights[g];i instanceof THREE.DirectionalLight&&j++;i instanceof
|
|
|
|
|
|
+case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR}return 0}var m=document.createElement("canvas"),c,z,x,r=new THREE.Matrix4,t,H=new Float32Array(16),F=new Float32Array(16),L=new Float32Array(16),J=new Float32Array(9),K=new Float32Array(16);a=function(f,k){if(f){var g,q,i,j=pointLights=maxDirLights=maxPointLights=0;g=0;for(q=f.lights.length;g<q;g++){i=f.lights[g];i instanceof THREE.DirectionalLight&&j++;i instanceof
|
|
THREE.PointLight&&pointLights++}if(pointLights+j<=k){maxDirLights=j;maxPointLights=pointLights}else{maxDirLights=Math.ceil(k*j/(pointLights+j));maxPointLights=k-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:k-1}}(a,4);this.domElement=m;this.autoClear=true;try{c=m.getContext("experimental-webgl",{antialias:true})}catch(v){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);
|
|
THREE.PointLight&&pointLights++}if(pointLights+j<=k){maxDirLights=j;maxPointLights=pointLights}else{maxDirLights=Math.ceil(k*j/(pointLights+j));maxPointLights=k-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:k-1}}(a,4);this.domElement=m;this.autoClear=true;try{c=m.getContext("experimental-webgl",{antialias:true})}catch(v){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);
|
|
c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(0,0,0,0);z=x=function(f,k){var g=[f?"#define MAX_DIR_LIGHTS "+f:"",k?"#define MAX_POINT_LIGHTS "+k:"","uniform bool enableLighting;\nuniform bool useRefract;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;\nuniform vec3 ambientLightColor;",f?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":"",f?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":
|
|
c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(0,0,0,0);z=x=function(f,k){var g=[f?"#define MAX_DIR_LIGHTS "+f:"",k?"#define MAX_POINT_LIGHTS "+k:"","uniform bool enableLighting;\nuniform bool useRefract;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;\nuniform vec3 ambientLightColor;",f?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":"",f?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":
|
|
"",k?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",k?"uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",k?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform float mRefractionRatio;\nvoid main(void) {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec3 transformedNormal = normalize( normalMatrix * normal );\nif ( !enableLighting ) {\nvLightWeighting = vec3( 1.0, 1.0, 1.0 );\n} else {\nvLightWeighting = ambientLightColor;",
|
|
"",k?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",k?"uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",k?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform float mRefractionRatio;\nvoid main(void) {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec3 transformedNormal = normalize( normalMatrix * normal );\nif ( !enableLighting ) {\nvLightWeighting = vec3( 1.0, 1.0, 1.0 );\n} else {\nvLightWeighting = ambientLightColor;",
|
|
@@ -152,26 +152,26 @@ k?"vec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );":"",k?"vec4 pointSpecular =
|
|
"",f?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",f?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",f?"float dirSpecularWeight = 0.0;":"",f?"if ( dirDotNormalHalf >= 0.0 )":"",f?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",f?"dirDiffuse += mColor * dirDiffuseWeight;":"",f?"dirSpecular += mSpecular * dirSpecularWeight;":"",f?"}":"","vec4 totalLight = mAmbient;",f?"totalLight += dirDiffuse + dirSpecular;":"",k?"totalLight += pointDiffuse + pointSpecular;":
|
|
"",f?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",f?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",f?"float dirSpecularWeight = 0.0;":"",f?"if ( dirDotNormalHalf >= 0.0 )":"",f?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",f?"dirDiffuse += mColor * dirDiffuseWeight;":"",f?"dirSpecular += mSpecular * dirSpecularWeight;":"",f?"}":"","vec4 totalLight = mAmbient;",f?"totalLight += dirDiffuse + dirSpecular;":"",k?"totalLight += pointDiffuse + pointSpecular;":
|
|
"","if ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mapColor.rgb * totalLight.xyz * vLightWeighting, cubeColor.rgb, mReflectivity ), mapColor.a );\n} else {\ngl_FragColor = vec4( mapColor.rgb * cubeColor.rgb * totalLight.xyz * vLightWeighting, mapColor.a );\n}\n} else if ( material == 1 ) {\nif ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mColor.rgb * mapColor.rgb * vLightWeighting, cubeColor.rgb, mReflectivity ), mColor.a * mapColor.a );\n} else {\ngl_FragColor = vec4( mColor.rgb * mapColor.rgb * cubeColor.rgb * vLightWeighting, mColor.a * mapColor.a );\n}\n} else {\nif ( mixEnvMap ) {\ngl_FragColor = mix( mColor * mapColor, cubeColor, mReflectivity );\n} else {\ngl_FragColor = mColor * mapColor * cubeColor;\n}\n}\n}"].join("\n");
|
|
"","if ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mapColor.rgb * totalLight.xyz * vLightWeighting, cubeColor.rgb, mReflectivity ), mapColor.a );\n} else {\ngl_FragColor = vec4( mapColor.rgb * cubeColor.rgb * totalLight.xyz * vLightWeighting, mapColor.a );\n}\n} else if ( material == 1 ) {\nif ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mColor.rgb * mapColor.rgb * vLightWeighting, cubeColor.rgb, mReflectivity ), mColor.a * mapColor.a );\n} else {\ngl_FragColor = vec4( mColor.rgb * mapColor.rgb * cubeColor.rgb * vLightWeighting, mColor.a * mapColor.a );\n}\n} else {\nif ( mixEnvMap ) {\ngl_FragColor = mix( mColor * mapColor, cubeColor, mReflectivity );\n} else {\ngl_FragColor = mColor * mapColor * cubeColor;\n}\n}\n}"].join("\n");
|
|
g=b(q,g);c.useProgram(g);h(g,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract","m2Near","mFarPlusNear","mFarMinusNear"]);f&&h(g,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);k&&h(g,["pointLightNumber","pointLightColor",
|
|
g=b(q,g);c.useProgram(g);h(g,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract","m2Near","mFarPlusNear","mFarMinusNear"]);f&&h(g,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);k&&h(g,["pointLightNumber","pointLightColor",
|
|
-"pointLightPosition"]);c.uniform1i(g.uniforms.enableMap,0);c.uniform1i(g.uniforms.tMap,0);c.uniform1i(g.uniforms.enableCubeMap,0);c.uniform1i(g.uniforms.tCube,1);c.uniform1i(g.uniforms.mixEnvMap,0);c.uniform1i(g.uniforms.useRefract,0);n(g,["position","normal","uv"]);return g}(a.directional,a.point);this.setSize=function(f,k){m.width=f;m.height=k;c.viewport(0,0,m.width,m.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(f,k){var g,q,i,j,t,p=[],
|
|
|
|
-C=[],y=[];j=[];t=[];c.uniform1i(f.uniforms.enableLighting,k.length);g=0;for(q=k.length;g<q;g++){i=k[g];if(i instanceof THREE.AmbientLight)p.push(i);else if(i instanceof THREE.DirectionalLight)y.push(i);else i instanceof THREE.PointLight&&C.push(i)}g=i=j=t=0;for(q=p.length;g<q;g++){i+=p[g].color.r;j+=p[g].color.g;t+=p[g].color.b}c.uniform3f(f.uniforms.ambientLightColor,i,j,t);j=[];t=[];g=0;for(q=y.length;g<q;g++){i=y[g];j.push(i.color.r*i.intensity);j.push(i.color.g*i.intensity);j.push(i.color.b*i.intensity);
|
|
|
|
-t.push(i.position.x);t.push(i.position.y);t.push(i.position.z)}if(y.length){c.uniform1i(f.uniforms.directionalLightNumber,y.length);c.uniform3fv(f.uniforms.directionalLightDirection,t);c.uniform3fv(f.uniforms.directionalLightColor,j)}j=[];t=[];g=0;for(q=C.length;g<q;g++){i=C[g];j.push(i.color.r*i.intensity);j.push(i.color.g*i.intensity);j.push(i.color.b*i.intensity);t.push(i.position.x);t.push(i.position.y);t.push(i.position.z)}if(C.length){c.uniform1i(f.uniforms.pointLightNumber,C.length);c.uniform3fv(f.uniforms.pointLightPosition,
|
|
|
|
-t);c.uniform3fv(f.uniforms.pointLightColor,j)}};this.createBuffers=function(f,k){var g,q,i,j,t,p,C,y,G,O=[],w=[],P=[],E=[],Q=[],R=[],M=0,B=f.geometry.geometryChunks[k],D;i=false;g=0;for(q=f.material.length;g<q;g++){meshMaterial=f.material[g];if(meshMaterial instanceof THREE.MeshFaceMaterial){t=0;for(D=B.material.length;t<D;t++)if(B.material[t]&&B.material[t].shading!=undefined&&B.material[t].shading==THREE.SmoothShading){i=true;break}}else if(meshMaterial&&meshMaterial.shading!=undefined&&meshMaterial.shading==
|
|
|
|
-THREE.SmoothShading){i=true;break}if(i)break}D=i;g=0;for(q=B.faces.length;g<q;g++){i=B.faces[g];j=f.geometry.faces[i];t=j.vertexNormals;faceNormal=j.normal;i=f.geometry.uvs[i];if(j instanceof THREE.Face3){p=f.geometry.vertices[j.a].position;C=f.geometry.vertices[j.b].position;y=f.geometry.vertices[j.c].position;P.push(p.x,p.y,p.z);P.push(C.x,C.y,C.z);P.push(y.x,y.y,y.z);if(f.geometry.hasTangents){p=f.geometry.vertices[j.a].tangent;C=f.geometry.vertices[j.b].tangent;y=f.geometry.vertices[j.c].tangent;
|
|
|
|
-Q.push(p.x,p.y,p.z,p.w);Q.push(C.x,C.y,C.z,C.w);Q.push(y.x,y.y,y.z,y.w)}if(t.length==3&&D)for(j=0;j<3;j++)E.push(t[j].x,t[j].y,t[j].z);else for(j=0;j<3;j++)E.push(faceNormal.x,faceNormal.y,faceNormal.z);if(i)for(j=0;j<3;j++)R.push(i[j].u,i[j].v);O.push(M,M+1,M+2);w.push(M,M+1);w.push(M,M+2);w.push(M+1,M+2);M+=3}else if(j instanceof THREE.Face4){p=f.geometry.vertices[j.a].position;C=f.geometry.vertices[j.b].position;y=f.geometry.vertices[j.c].position;G=f.geometry.vertices[j.d].position;P.push(p.x,
|
|
|
|
-p.y,p.z);P.push(C.x,C.y,C.z);P.push(y.x,y.y,y.z);P.push(G.x,G.y,G.z);if(f.geometry.hasTangents){p=f.geometry.vertices[j.a].tangent;C=f.geometry.vertices[j.b].tangent;y=f.geometry.vertices[j.c].tangent;j=f.geometry.vertices[j.d].tangent;Q.push(p.x,p.y,p.z,p.w);Q.push(C.x,C.y,C.z,C.w);Q.push(y.x,y.y,y.z,y.w);Q.push(j.x,j.y,j.z,j.w)}if(t.length==4&&D)for(j=0;j<4;j++)E.push(t[j].x,t[j].y,t[j].z);else for(j=0;j<4;j++)E.push(faceNormal.x,faceNormal.y,faceNormal.z);if(i)for(j=0;j<4;j++)R.push(i[j].u,i[j].v);
|
|
|
|
|
|
+"pointLightPosition"]);c.uniform1i(g.uniforms.enableMap,0);c.uniform1i(g.uniforms.tMap,0);c.uniform1i(g.uniforms.enableCubeMap,0);c.uniform1i(g.uniforms.tCube,1);c.uniform1i(g.uniforms.mixEnvMap,0);c.uniform1i(g.uniforms.useRefract,0);n(g,["position","normal","uv"]);return g}(a.directional,a.point);this.setSize=function(f,k){m.width=f;m.height=k;c.viewport(0,0,m.width,m.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(f,k){var g,q,i,j,s,p=[],
|
|
|
|
+C=[],y=[];j=[];s=[];c.uniform1i(f.uniforms.enableLighting,k.length);g=0;for(q=k.length;g<q;g++){i=k[g];if(i instanceof THREE.AmbientLight)p.push(i);else if(i instanceof THREE.DirectionalLight)y.push(i);else i instanceof THREE.PointLight&&C.push(i)}g=i=j=s=0;for(q=p.length;g<q;g++){i+=p[g].color.r;j+=p[g].color.g;s+=p[g].color.b}c.uniform3f(f.uniforms.ambientLightColor,i,j,s);j=[];s=[];g=0;for(q=y.length;g<q;g++){i=y[g];j.push(i.color.r*i.intensity);j.push(i.color.g*i.intensity);j.push(i.color.b*i.intensity);
|
|
|
|
+s.push(i.position.x);s.push(i.position.y);s.push(i.position.z)}if(y.length){c.uniform1i(f.uniforms.directionalLightNumber,y.length);c.uniform3fv(f.uniforms.directionalLightDirection,s);c.uniform3fv(f.uniforms.directionalLightColor,j)}j=[];s=[];g=0;for(q=C.length;g<q;g++){i=C[g];j.push(i.color.r*i.intensity);j.push(i.color.g*i.intensity);j.push(i.color.b*i.intensity);s.push(i.position.x);s.push(i.position.y);s.push(i.position.z)}if(C.length){c.uniform1i(f.uniforms.pointLightNumber,C.length);c.uniform3fv(f.uniforms.pointLightPosition,
|
|
|
|
+s);c.uniform3fv(f.uniforms.pointLightColor,j)}};this.createBuffers=function(f,k){var g,q,i,j,s,p,C,y,G,O=[],w=[],P=[],E=[],Q=[],R=[],M=0,B=f.geometry.geometryChunks[k],D;i=false;g=0;for(q=f.material.length;g<q;g++){meshMaterial=f.material[g];if(meshMaterial instanceof THREE.MeshFaceMaterial){s=0;for(D=B.material.length;s<D;s++)if(B.material[s]&&B.material[s].shading!=undefined&&B.material[s].shading==THREE.SmoothShading){i=true;break}}else if(meshMaterial&&meshMaterial.shading!=undefined&&meshMaterial.shading==
|
|
|
|
+THREE.SmoothShading){i=true;break}if(i)break}D=i;g=0;for(q=B.faces.length;g<q;g++){i=B.faces[g];j=f.geometry.faces[i];s=j.vertexNormals;faceNormal=j.normal;i=f.geometry.uvs[i];if(j instanceof THREE.Face3){p=f.geometry.vertices[j.a].position;C=f.geometry.vertices[j.b].position;y=f.geometry.vertices[j.c].position;P.push(p.x,p.y,p.z);P.push(C.x,C.y,C.z);P.push(y.x,y.y,y.z);if(f.geometry.hasTangents){p=f.geometry.vertices[j.a].tangent;C=f.geometry.vertices[j.b].tangent;y=f.geometry.vertices[j.c].tangent;
|
|
|
|
+Q.push(p.x,p.y,p.z,p.w);Q.push(C.x,C.y,C.z,C.w);Q.push(y.x,y.y,y.z,y.w)}if(s.length==3&&D)for(j=0;j<3;j++)E.push(s[j].x,s[j].y,s[j].z);else for(j=0;j<3;j++)E.push(faceNormal.x,faceNormal.y,faceNormal.z);if(i)for(j=0;j<3;j++)R.push(i[j].u,i[j].v);O.push(M,M+1,M+2);w.push(M,M+1);w.push(M,M+2);w.push(M+1,M+2);M+=3}else if(j instanceof THREE.Face4){p=f.geometry.vertices[j.a].position;C=f.geometry.vertices[j.b].position;y=f.geometry.vertices[j.c].position;G=f.geometry.vertices[j.d].position;P.push(p.x,
|
|
|
|
+p.y,p.z);P.push(C.x,C.y,C.z);P.push(y.x,y.y,y.z);P.push(G.x,G.y,G.z);if(f.geometry.hasTangents){p=f.geometry.vertices[j.a].tangent;C=f.geometry.vertices[j.b].tangent;y=f.geometry.vertices[j.c].tangent;j=f.geometry.vertices[j.d].tangent;Q.push(p.x,p.y,p.z,p.w);Q.push(C.x,C.y,C.z,C.w);Q.push(y.x,y.y,y.z,y.w);Q.push(j.x,j.y,j.z,j.w)}if(s.length==4&&D)for(j=0;j<4;j++)E.push(s[j].x,s[j].y,s[j].z);else for(j=0;j<4;j++)E.push(faceNormal.x,faceNormal.y,faceNormal.z);if(i)for(j=0;j<4;j++)R.push(i[j].u,i[j].v);
|
|
O.push(M,M+1,M+2);O.push(M,M+2,M+3);w.push(M,M+1);w.push(M,M+2);w.push(M,M+3);w.push(M+1,M+2);w.push(M+2,M+3);M+=4}}if(P.length){B.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(P),c.STATIC_DRAW);B.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(E),c.STATIC_DRAW);if(f.geometry.hasTangents){B.__webGLTangentBuffer=c.createBuffer();
|
|
O.push(M,M+1,M+2);O.push(M,M+2,M+3);w.push(M,M+1);w.push(M,M+2);w.push(M,M+3);w.push(M+1,M+2);w.push(M+2,M+3);M+=4}}if(P.length){B.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(P),c.STATIC_DRAW);B.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(E),c.STATIC_DRAW);if(f.geometry.hasTangents){B.__webGLTangentBuffer=c.createBuffer();
|
|
c.bindBuffer(c.ARRAY_BUFFER,B.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(Q),c.STATIC_DRAW)}if(R.length>0){B.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(R),c.STATIC_DRAW)}B.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(O),c.STATIC_DRAW);B.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
|
|
c.bindBuffer(c.ARRAY_BUFFER,B.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(Q),c.STATIC_DRAW)}if(R.length>0){B.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(R),c.STATIC_DRAW)}B.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(O),c.STATIC_DRAW);B.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
|
|
-B.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(w),c.STATIC_DRAW);B.__webGLFaceCount=O.length;B.__webGLLineCount=w.length}};this.renderBuffer=function(f,k,g,q){var i,j,t,p,C,y,G,O,w;if(g instanceof THREE.MeshShaderMaterial){if(!g.program){g.program=b(g.fragment_shader,g.vertex_shader);G=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(w in g.uniforms)G.push(w);h(g.program,G);n(g.program,["position","normal","uv","tangent"])}w=
|
|
|
|
-g.program}else w=x;if(w!=z){c.useProgram(w);z=w}w==x&&this.setupLights(w,k);this.loadCamera(w,f);this.loadMatrices(w);if(g instanceof THREE.MeshShaderMaterial){t=g.wireframe;p=g.wireframe_linewidth;f=w;k=g.uniforms;var P;for(i in k){O=k[i].type;G=k[i].value;P=f.uniforms[i];if(O=="i")c.uniform1i(P,G);else if(O=="f")c.uniform1f(P,G);else if(O=="v3")c.uniform3f(P,G.x,G.y,G.z);else if(O=="c")c.uniform3f(P,G.r,G.g,G.b);else if(O=="t"){c.uniform1i(P,G);if(O=k[i].texture)O.image instanceof Array&&O.image.length==
|
|
|
|
-6?d(O,G):e(O,G)}}}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshBasicMaterial){i=g.color;j=g.opacity;t=g.wireframe;p=g.wireframe_linewidth;C=g.map;y=g.env_map;k=g.combine==THREE.MixOperation;f=g.reflectivity;O=g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping;G=g.refraction_ratio;c.uniform4f(w.uniforms.mColor,i.r*j,i.g*j,i.b*j,j);c.uniform1i(w.uniforms.mixEnvMap,k);c.uniform1f(w.uniforms.mReflectivity,f);c.uniform1i(w.uniforms.useRefract,
|
|
|
|
-O);c.uniform1f(w.uniforms.mRefractionRatio,G)}if(g instanceof THREE.MeshNormalMaterial){j=g.opacity;c.uniform1f(w.uniforms.mOpacity,j);c.uniform1i(w.uniforms.material,4)}else if(g instanceof THREE.MeshDepthMaterial){j=g.opacity;t=g.wireframe;p=g.wireframe_linewidth;c.uniform1f(w.uniforms.mOpacity,j);c.uniform1f(w.uniforms.m2Near,g.__2near);c.uniform1f(w.uniforms.mFarPlusNear,g.__farPlusNear);c.uniform1f(w.uniforms.mFarMinusNear,g.__farMinusNear);c.uniform1i(w.uniforms.material,3)}else if(g instanceof
|
|
|
|
|
|
+B.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(w),c.STATIC_DRAW);B.__webGLFaceCount=O.length;B.__webGLLineCount=w.length}};this.renderBuffer=function(f,k,g,q){var i,j,s,p,C,y,G,O,w;if(g instanceof THREE.MeshShaderMaterial){if(!g.program){g.program=b(g.fragment_shader,g.vertex_shader);G=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(w in g.uniforms)G.push(w);h(g.program,G);n(g.program,["position","normal","uv","tangent"])}w=
|
|
|
|
+g.program}else w=x;if(w!=z){c.useProgram(w);z=w}w==x&&this.setupLights(w,k);this.loadCamera(w,f);this.loadMatrices(w);if(g instanceof THREE.MeshShaderMaterial){s=g.wireframe;p=g.wireframe_linewidth;f=w;k=g.uniforms;var P;for(i in k){O=k[i].type;G=k[i].value;P=f.uniforms[i];if(O=="i")c.uniform1i(P,G);else if(O=="f")c.uniform1f(P,G);else if(O=="v3")c.uniform3f(P,G.x,G.y,G.z);else if(O=="c")c.uniform3f(P,G.r,G.g,G.b);else if(O=="t"){c.uniform1i(P,G);if(O=k[i].texture)O.image instanceof Array&&O.image.length==
|
|
|
|
+6?d(O,G):e(O,G)}}}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshBasicMaterial){i=g.color;j=g.opacity;s=g.wireframe;p=g.wireframe_linewidth;C=g.map;y=g.env_map;k=g.combine==THREE.MixOperation;f=g.reflectivity;O=g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping;G=g.refraction_ratio;c.uniform4f(w.uniforms.mColor,i.r*j,i.g*j,i.b*j,j);c.uniform1i(w.uniforms.mixEnvMap,k);c.uniform1f(w.uniforms.mReflectivity,f);c.uniform1i(w.uniforms.useRefract,
|
|
|
|
+O);c.uniform1f(w.uniforms.mRefractionRatio,G)}if(g instanceof THREE.MeshNormalMaterial){j=g.opacity;c.uniform1f(w.uniforms.mOpacity,j);c.uniform1i(w.uniforms.material,4)}else if(g instanceof THREE.MeshDepthMaterial){j=g.opacity;s=g.wireframe;p=g.wireframe_linewidth;c.uniform1f(w.uniforms.mOpacity,j);c.uniform1f(w.uniforms.m2Near,g.__2near);c.uniform1f(w.uniforms.mFarPlusNear,g.__farPlusNear);c.uniform1f(w.uniforms.mFarMinusNear,g.__farMinusNear);c.uniform1i(w.uniforms.material,3)}else if(g instanceof
|
|
THREE.MeshPhongMaterial){i=g.ambient;f=g.specular;g=g.shininess;c.uniform4f(w.uniforms.mAmbient,i.r,i.g,i.b,j);c.uniform4f(w.uniforms.mSpecular,f.r,f.g,f.b,j);c.uniform1f(w.uniforms.mShininess,g);c.uniform1i(w.uniforms.material,2)}else if(g instanceof THREE.MeshLambertMaterial)c.uniform1i(w.uniforms.material,1);else if(g instanceof THREE.MeshBasicMaterial)c.uniform1i(w.uniforms.material,0);else if(g instanceof THREE.MeshCubeMaterial){c.uniform1i(w.uniforms.material,5);y=g.env_map}if(C){e(C,0);c.uniform1i(w.uniforms.tMap,
|
|
THREE.MeshPhongMaterial){i=g.ambient;f=g.specular;g=g.shininess;c.uniform4f(w.uniforms.mAmbient,i.r,i.g,i.b,j);c.uniform4f(w.uniforms.mSpecular,f.r,f.g,f.b,j);c.uniform1f(w.uniforms.mShininess,g);c.uniform1i(w.uniforms.material,2)}else if(g instanceof THREE.MeshLambertMaterial)c.uniform1i(w.uniforms.material,1);else if(g instanceof THREE.MeshBasicMaterial)c.uniform1i(w.uniforms.material,0);else if(g instanceof THREE.MeshCubeMaterial){c.uniform1i(w.uniforms.material,5);y=g.env_map}if(C){e(C,0);c.uniform1i(w.uniforms.tMap,
|
|
0);c.uniform1i(w.uniforms.enableMap,1)}else c.uniform1i(w.uniforms.enableMap,0);if(y){d(y,1);c.uniform1i(w.uniforms.tCube,1);c.uniform1i(w.uniforms.enableCubeMap,1)}else c.uniform1i(w.uniforms.enableCubeMap,0);j=w.attributes;c.bindBuffer(c.ARRAY_BUFFER,q.__webGLVertexBuffer);c.vertexAttribPointer(j.position,3,c.FLOAT,false,0,0);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLNormalBuffer);c.vertexAttribPointer(j.normal,3,c.FLOAT,false,0,0);if(j.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLTangentBuffer);
|
|
0);c.uniform1i(w.uniforms.enableMap,1)}else c.uniform1i(w.uniforms.enableMap,0);if(y){d(y,1);c.uniform1i(w.uniforms.tCube,1);c.uniform1i(w.uniforms.enableCubeMap,1)}else c.uniform1i(w.uniforms.enableCubeMap,0);j=w.attributes;c.bindBuffer(c.ARRAY_BUFFER,q.__webGLVertexBuffer);c.vertexAttribPointer(j.position,3,c.FLOAT,false,0,0);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLNormalBuffer);c.vertexAttribPointer(j.normal,3,c.FLOAT,false,0,0);if(j.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLTangentBuffer);
|
|
-c.vertexAttribPointer(j.tangent,4,c.FLOAT,false,0,0)}if(j.uv>=0)if(q.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLUVBuffer);c.enableVertexAttribArray(j.uv);c.vertexAttribPointer(j.uv,2,c.FLOAT,false,0,0)}else c.disableVertexAttribArray(j.uv);if(t){c.lineWidth(p);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);c.drawElements(c.LINES,q.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,q.__webGLFaceCount,c.UNSIGNED_SHORT,
|
|
|
|
-0)}};this.renderPass=function(f,k,g,q,i,j){var t,p,C,y,G;C=0;for(y=g.material.length;C<y;C++){t=g.material[C];if(t instanceof THREE.MeshFaceMaterial){t=0;for(p=q.material.length;t<p;t++)if((G=q.material[t])&&G.blending==i&&G.opacity<1==j){this.setBlending(G.blending);this.renderBuffer(f,k,G,q)}}else if((G=t)&&G.blending==i&&G.opacity<1==j){this.setBlending(G.blending);this.renderBuffer(f,k,G,q)}}};this.render=function(f,k){var g,q,i,j,t=f.lights;this.initWebGLObjects(f);this.autoClear&&this.clear();
|
|
|
|
-k.autoUpdateMatrix&&k.updateMatrix();g=0;for(q=f.__webGLObjects.length;g<q;g++){i=f.__webGLObjects[g];j=i.object;i=i.buffer;if(j.visible){this.setupMatrices(j,k);this.renderPass(k,t,j,i,THREE.NormalBlending,false)}}g=0;for(q=f.__webGLObjects.length;g<q;g++){i=f.__webGLObjects[g];j=i.object;i=i.buffer;if(j.visible){this.setupMatrices(j,k);this.renderPass(k,t,j,i,THREE.AdditiveBlending,false);this.renderPass(k,t,j,i,THREE.SubtractiveBlending,false);this.renderPass(k,t,j,i,THREE.AdditiveBlending,true);
|
|
|
|
-this.renderPass(k,t,j,i,THREE.SubtractiveBlending,true);this.renderPass(k,t,j,i,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(f){var k,g,q,i,j,t;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={}}k=0;for(g=f.objects.length;k<g;k++){q=f.objects[k];if(f.__webGLObjectsMap[q.id]==undefined)f.__webGLObjectsMap[q.id]={};t=f.__webGLObjectsMap[q.id];if(q instanceof THREE.Mesh)for(j in q.geometry.geometryChunks){i=q.geometry.geometryChunks[j];i.__webGLVertexBuffer||this.createBuffers(q,
|
|
|
|
-j);if(t[j]==undefined){i={buffer:i,object:q};f.__webGLObjects.push(i);t[j]=1}}}};this.removeObject=function(f,k){var g,q;for(g=f.__webGLObjects.length-1;g>=0;g--){q=f.__webGLObjects[g].object;k==q&&f.__webGLObjects.splice(g,1)}};this.setupMatrices=function(f,k){f.autoUpdateMatrix&&f.updateMatrix();r.multiply(k.matrix,f.matrix);H.set(k.matrix.flatten());F.set(r.flatten());L.set(k.projectionMatrix.flatten());s=THREE.Matrix4.makeInvert3x3(r).transpose();J.set(s.m);K.set(f.matrix.flatten())};this.loadMatrices=
|
|
|
|
|
|
+c.vertexAttribPointer(j.tangent,4,c.FLOAT,false,0,0)}if(j.uv>=0)if(q.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLUVBuffer);c.enableVertexAttribArray(j.uv);c.vertexAttribPointer(j.uv,2,c.FLOAT,false,0,0)}else c.disableVertexAttribArray(j.uv);if(s){c.lineWidth(p);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);c.drawElements(c.LINES,q.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,q.__webGLFaceCount,c.UNSIGNED_SHORT,
|
|
|
|
+0)}};this.renderPass=function(f,k,g,q,i,j){var s,p,C,y,G;C=0;for(y=g.material.length;C<y;C++){s=g.material[C];if(s instanceof THREE.MeshFaceMaterial){s=0;for(p=q.material.length;s<p;s++)if((G=q.material[s])&&G.blending==i&&G.opacity<1==j){this.setBlending(G.blending);this.renderBuffer(f,k,G,q)}}else if((G=s)&&G.blending==i&&G.opacity<1==j){this.setBlending(G.blending);this.renderBuffer(f,k,G,q)}}};this.render=function(f,k){var g,q,i,j,s=f.lights;this.initWebGLObjects(f);this.autoClear&&this.clear();
|
|
|
|
+k.autoUpdateMatrix&&k.updateMatrix();g=0;for(q=f.__webGLObjects.length;g<q;g++){i=f.__webGLObjects[g];j=i.object;i=i.buffer;if(j.visible){this.setupMatrices(j,k);this.renderPass(k,s,j,i,THREE.NormalBlending,false)}}g=0;for(q=f.__webGLObjects.length;g<q;g++){i=f.__webGLObjects[g];j=i.object;i=i.buffer;if(j.visible){this.setupMatrices(j,k);this.renderPass(k,s,j,i,THREE.AdditiveBlending,false);this.renderPass(k,s,j,i,THREE.SubtractiveBlending,false);this.renderPass(k,s,j,i,THREE.AdditiveBlending,true);
|
|
|
|
+this.renderPass(k,s,j,i,THREE.SubtractiveBlending,true);this.renderPass(k,s,j,i,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(f){var k,g,q,i,j,s;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={}}k=0;for(g=f.objects.length;k<g;k++){q=f.objects[k];if(f.__webGLObjectsMap[q.id]==undefined)f.__webGLObjectsMap[q.id]={};s=f.__webGLObjectsMap[q.id];if(q instanceof THREE.Mesh)for(j in q.geometry.geometryChunks){i=q.geometry.geometryChunks[j];i.__webGLVertexBuffer||this.createBuffers(q,
|
|
|
|
+j);if(s[j]==undefined){i={buffer:i,object:q};f.__webGLObjects.push(i);s[j]=1}}}};this.removeObject=function(f,k){var g,q;for(g=f.__webGLObjects.length-1;g>=0;g--){q=f.__webGLObjects[g].object;k==q&&f.__webGLObjects.splice(g,1)}};this.setupMatrices=function(f,k){f.autoUpdateMatrix&&f.updateMatrix();r.multiply(k.matrix,f.matrix);H.set(k.matrix.flatten());F.set(r.flatten());L.set(k.projectionMatrix.flatten());t=THREE.Matrix4.makeInvert3x3(r).transpose();J.set(t.m);K.set(f.matrix.flatten())};this.loadMatrices=
|
|
function(f){c.uniformMatrix4fv(f.uniforms.viewMatrix,false,H);c.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,F);c.uniformMatrix4fv(f.uniforms.projectionMatrix,false,L);c.uniformMatrix3fv(f.uniforms.normalMatrix,false,J);c.uniformMatrix4fv(f.uniforms.objectMatrix,false,K)};this.loadCamera=function(f,k){c.uniform3f(f.uniforms.cameraPosition,k.position.x,k.position.y,k.position.z)};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);
|
|
function(f){c.uniformMatrix4fv(f.uniforms.viewMatrix,false,H);c.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,F);c.uniformMatrix4fv(f.uniforms.projectionMatrix,false,L);c.uniformMatrix3fv(f.uniforms.normalMatrix,false,J);c.uniformMatrix4fv(f.uniforms.objectMatrix,false,K)};this.loadCamera=function(f,k){c.uniform3f(f.uniforms.cameraPosition,k.position.x,k.position.y,k.position.z)};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);
|
|
break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,k){if(f){!k||k=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,k){if(f){!k||k=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
THREE.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.faceMaterial=this.meshMaterial=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.material=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.faceMaterial=this.meshMaterial=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.material=null};
|