|
@@ -1,8 +1,7 @@
|
|
|
// ThreeCanvas.js r40 - http://github.com/mrdoob/three.js
|
|
|
var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(a){this.setHex(a)};
|
|
|
-THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,h,f,k,g;if(c==0)d=e=h=0;else{f=Math.floor(a*6);k=a*6-f;a=c*(1-b);g=c*(1-b*k);b=c*(1-b*(1-k));switch(f){case 1:d=g;e=c;h=a;break;case 2:d=a;e=c;h=b;break;case 3:d=a;e=g;h=c;break;case 4:d=b;e=a;h=c;break;case 5:d=c;e=a;
|
|
|
-h=g;break;case 6:case 0:d=c;e=b;h=a}}this.r=d;this.g=e;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
|
|
|
-255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
|
|
|
+THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,i,h;if(c==0)d=e=g=0;else{f=Math.floor(a*6);i=a*6-f;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(f){case 1:d=h;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=h;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=h;break;case 6:case 0:d=c;e=b;g=a}}this.setRGB(d,
|
|
|
+e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
|
|
|
THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
|
|
|
this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
|
|
|
THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
|
|
@@ -12,59 +11,59 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
|
|
|
1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
|
|
|
THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
|
|
|
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(h,f){return h.distance-f.distance});return e},intersectObject:function(a){function b(D,z,T,U){U=U.clone().subSelf(z);T=T.clone().subSelf(z);var X=D.clone().subSelf(z);D=U.dot(U);z=U.dot(T);U=U.dot(X);var s=T.dot(T);T=T.dot(X);X=1/(D*s-z*z);s=(s*U-z*T)*X;D=(D*T-z*U)*X;return s>0&&D>0&&s+D<1}var c,d,e,h,f,k,g,i,n,j,
|
|
|
-p,r=a.geometry,y=r.vertices,A=[];c=0;for(d=r.faces.length;c<d;c++){e=r.faces[c];j=this.origin.clone();p=this.direction.clone();g=a.matrixWorld;h=g.multiplyVector3(y[e.a].position.clone());f=g.multiplyVector3(y[e.b].position.clone());k=g.multiplyVector3(y[e.c].position.clone());g=e instanceof THREE.Face4?g.multiplyVector3(y[e.d].position.clone()):null;i=a.matrixRotationWorld.multiplyVector3(e.normal.clone());n=p.dot(i);if(a.doubleSided||(a.flipSided?n>0:n<0)){i=i.dot((new THREE.Vector3).sub(h,j))/
|
|
|
-n;j=j.addSelf(p.multiplyScalar(i));if(e instanceof THREE.Face3){if(b(j,h,f,k)){e={distance:this.origin.distanceTo(j),point:j,face:e,object:a};A.push(e)}}else if(e instanceof THREE.Face4&&(b(j,h,f,g)||b(j,f,k,g))){e={distance:this.origin.distanceTo(j),point:j,face:e,object:a};A.push(e)}}}return A}};
|
|
|
-THREE.Rectangle=function(){function a(){h=d-b;f=e-c}var b,c,d,e,h,f,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,i,n,j){k=!1;b=g;c=i;d=n;e=j;a()};this.addPoint=function(g,i){if(k){k=!1;b=g;c=i;d=g;e=i}else{b=b<g?b:g;c=c<i?c:i;d=d>g?d:g;e=e>i?e:i}a()};
|
|
|
-this.add3Points=function(g,i,n,j,p,r){if(k){k=!1;b=g<n?g<p?g:p:n<p?n:p;c=i<j?i<r?i:r:j<r?j:r;d=g>n?g>p?g:p:n>p?n:p;e=i>j?i>r?i:r:j>r?j:r}else{b=g<n?g<p?g<b?g:b:p<b?p:b:n<p?n<b?n:b:p<b?p:b;c=i<j?i<r?i<c?i:c:r<c?r:c:j<r?j<c?j:c:r<c?r:c;d=g>n?g>p?g>d?g:d:p>d?p:d:n>p?n>d?n:d:p>d?p:d;e=i>j?i>r?i>e?i:e:r>e?r:e:j>r?j>e?j:e:r>e?r:e}a()};this.addRectangle=function(g){if(k){k=!1;b=g.getLeft();c=g.getTop();d=g.getRight();e=g.getBottom()}else{b=b<g.getLeft()?b:g.getLeft();c=c<g.getTop()?c:g.getTop();d=d>g.getRight()?
|
|
|
-d:g.getRight();e=e>g.getBottom()?e:g.getBottom()}a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.instersects=function(g){return Math.min(d,g.getRight())-Math.max(b,g.getLeft())>=0&&Math.min(e,g.getBottom())-Math.max(c,g.getTop())>=0};this.empty=function(){k=!0;e=d=c=b=0;a()};this.isEmpty=function(){return k}};
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(g,f){return g.distance-f.distance});return e},intersectObject:function(a){function b(D,x,W,X){X=X.clone().subSelf(x);W=W.clone().subSelf(x);var aa=D.clone().subSelf(x);D=X.dot(X);x=X.dot(W);X=X.dot(aa);var H=W.dot(W);W=W.dot(aa);aa=1/(D*H-x*x);H=(H*X-x*W)*aa;D=(D*W-x*X)*aa;return H>0&&D>0&&H+D<1}var c,d,e,g,f,i,h,
|
|
|
+j,p,n,o,k=a.geometry,t=k.vertices,w=[];c=0;for(d=k.faces.length;c<d;c++){e=k.faces[c];n=this.origin.clone();o=this.direction.clone();h=a.matrixWorld;g=h.multiplyVector3(t[e.a].position.clone());f=h.multiplyVector3(t[e.b].position.clone());i=h.multiplyVector3(t[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(t[e.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(e.normal.clone());p=o.dot(j);if(a.doubleSided||(a.flipSided?p>0:p<0)){j=j.dot((new THREE.Vector3).sub(g,
|
|
|
+n))/p;n=n.addSelf(o.multiplyScalar(j));if(e instanceof THREE.Face3){if(b(n,g,f,i)){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};w.push(e)}}else if(e instanceof THREE.Face4&&(b(n,g,f,h)||b(n,f,i,h))){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};w.push(e)}}}return w}};
|
|
|
+THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,j,p,n){i=!1;b=h;c=j;d=p;e=n;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;d=h;e=j}else{b=b<h?b:h;c=c<j?c:j;d=d>h?d:h;e=e>j?e:j}a()};
|
|
|
+this.add3Points=function(h,j,p,n,o,k){if(i){i=!1;b=h<p?h<o?h:o:p<o?p:o;c=j<n?j<k?j:k:n<k?n:k;d=h>p?h>o?h:o:p>o?p:o;e=j>n?j>k?j:k:n>k?n:k}else{b=h<p?h<o?h<b?h:b:o<b?o:b:p<o?p<b?p:b:o<b?o:b;c=j<n?j<k?j<c?j:c:k<c?k:c:n<k?n<c?n:c:k<c?k:c;d=h>p?h>o?h>d?h:d:o>d?o:d:p>o?p>d?p:d:o>d?o:d;e=j>n?j>k?j>e?j:e:k>e?k:e:n>k?n>e?n:e:k>e?k:e}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
|
|
|
+d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
|
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
|
-THREE.Matrix4=function(a,b,c,d,e,h,f,k,g,i,n,j,p,r,y,A){this.set(a||1,b||0,c||0,d||0,e||0,h||1,f||0,k||0,g||0,i||0,n||1,j||0,p||0,r||0,y||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,h,f,k,g,i,n,j,p,r,y,A){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=h;this.n23=f;this.n24=k;this.n31=g;this.n32=i;this.n33=n;this.n34=j;this.n41=p;this.n42=r;this.n43=y;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
|
|
|
-e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;d.cross(c,h).normalize();if(d.length()===0){h.x+=1.0E-4;d.cross(c,h).normalize()}e.cross(h,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=h.x;this.n21=d.y;this.n22=e.y;this.n23=h.y;this.n31=d.z;this.n32=e.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
|
|
|
+THREE.Matrix4=function(a,b,c,d,e,g,f,i,h,j,p,n,o,k,t,w){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,i||0,h||0,j||0,p||1,n||0,o||0,k||0,t||0,w||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,i,h,j,p,n,o,k,t,w){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=i;this.n31=h;this.n32=j;this.n33=p;this.n34=n;this.n41=o;this.n42=k;this.n43=t;this.n44=w;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
|
|
|
+e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(c,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
|
|
|
d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
|
|
|
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,f=a.n21,k=a.n22,g=a.n23,i=a.n24,n=a.n31,j=a.n32,p=a.n33,r=a.n34,y=a.n41,A=a.n42,D=a.n43,z=a.n44,T=b.n11,U=b.n12,X=b.n13,s=b.n14,o=b.n21,L=b.n22,
|
|
|
-R=b.n23,aa=b.n24,ba=b.n31,w=b.n32,u=b.n33,H=b.n34;this.n11=c*T+d*o+e*ba;this.n12=c*U+d*L+e*w;this.n13=c*X+d*R+e*u;this.n14=c*s+d*aa+e*H+h;this.n21=f*T+k*o+g*ba;this.n22=f*U+k*L+g*w;this.n23=f*X+k*R+g*u;this.n24=f*s+k*aa+g*H+i;this.n31=n*T+j*o+p*ba;this.n32=n*U+j*L+p*w;this.n33=n*X+j*R+p*u;this.n34=n*s+j*aa+p*H+r;this.n41=y*T+A*o+D*ba;this.n42=y*U+A*L+D*w;this.n43=y*X+A*R+D*u;this.n44=y*s+A*aa+D*H+z;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;
|
|
|
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,p=a.n31,n=a.n32,o=a.n33,k=a.n34,t=a.n41,w=a.n42,D=a.n43,x=a.n44,W=b.n11,X=b.n12,aa=b.n13,H=b.n14,q=b.n21,B=b.n22,
|
|
|
+z=b.n23,L=b.n24,Y=b.n31,C=b.n32,A=b.n33,I=b.n34;this.n11=c*W+d*q+e*Y;this.n12=c*X+d*B+e*C;this.n13=c*aa+d*z+e*A;this.n14=c*H+d*L+e*I+g;this.n21=f*W+i*q+h*Y;this.n22=f*X+i*B+h*C;this.n23=f*aa+i*z+h*A;this.n24=f*H+i*L+h*I+j;this.n31=p*W+n*q+o*Y;this.n32=p*X+n*B+o*C;this.n33=p*aa+n*z+o*A;this.n34=p*H+n*L+o*I+k;this.n41=t*W+w*q+D*Y;this.n42=t*X+w*B+D*C;this.n43=t*aa+w*z+D*A;this.n44=t*H+w*L+D*I+x;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;
|
|
|
c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
|
|
|
-this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,h=this.n22,f=this.n23,k=this.n24,g=this.n31,i=this.n32,n=this.n33,j=this.n34,p=this.n41,r=this.n42,y=this.n43,A=this.n44;return d*f*i*p-c*k*i*p-d*h*n*p+b*k*n*p+c*h*j*p-b*f*j*p-d*f*g*r+c*k*g*r+d*e*n*r-a*k*n*r-c*e*j*r+a*f*j*r+d*h*g*y-b*k*g*y-d*e*i*y+a*k*i*y+b*e*j*y-a*h*j*y-c*h*g*A+b*f*g*A+c*e*i*A-a*f*i*A-b*e*n*A+a*h*n*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
|
|
|
+this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,i=this.n24,h=this.n31,j=this.n32,p=this.n33,n=this.n34,o=this.n41,k=this.n42,t=this.n43,w=this.n44;return d*f*j*o-c*i*j*o-d*g*p*o+b*i*p*o+c*g*n*o-b*f*n*o-d*f*h*k+c*i*h*k+d*e*p*k-a*i*p*k-c*e*n*k+a*f*n*k+d*g*h*t-b*i*h*t-d*e*j*t+a*i*j*t+b*e*n*t-a*g*n*t-c*g*h*w+b*f*h*w+c*e*j*w-a*f*j*w-b*e*p*w+a*g*p*w},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
|
|
|
this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
|
|
|
this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
|
|
|
this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
|
|
|
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,h=a.x,f=a.y,k=a.z,g=e*h,i=e*f;this.set(g*
|
|
|
-h+c,g*f-d*k,g*k+d*f,0,g*f+d*k,i*f+c,i*k-d*h,0,g*k-d*f,i*k+d*h,e*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
|
|
|
-this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var f=a*c,k=b*c;this.n11=e*h;this.n12=-e*d;this.n13=c;this.n21=k*h+a*d;this.n22=-k*d+a*h;this.n23=-b*e;this.n31=-f*h+b*d;this.n32=f*d+b*h;this.n33=a*e;return this},
|
|
|
-setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,h=b+b,f=c+c,k=d+d;a=b*h;var g=b*f;b*=k;var i=c*f;c*=k;d*=k;h*=e;f*=e;e*=k;this.n11=1-(i+d);this.n12=g-e;this.n13=b+f;this.n21=g+e;this.n22=1-(a+d);this.n23=c-h;this.n31=b-f;this.n32=c+h;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
|
|
|
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,i=a.z,h=e*g,j=e*f;this.set(h*
|
|
|
+g+c,h*f-d*i,h*i+d*f,0,h*f+d*i,j*f+c,j*i-d*g,0,h*i-d*f,j*i+d*g,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
|
|
|
+this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var f=a*c,i=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=i*g+a*d;this.n22=-i*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;return this},
|
|
|
+setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,i=d+d;a=b*g;var h=b*f;b*=i;var j=c*f;c*=i;d*=i;g*=e;f*=e;e*=i;this.n11=1-(j+d);this.n12=h-e;this.n13=b+f;this.n21=h+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
|
|
|
a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
|
|
|
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,f=a.n21,k=a.n22,g=a.n23,i=a.n24,n=a.n31,j=a.n32,p=a.n33,r=a.n34,y=a.n41,A=a.n42,D=a.n43,z=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=g*r*A-i*p*A+i*j*D-k*r*D-g*j*z+k*p*z;b.n12=h*p*A-e*r*A-h*j*D+d*r*D+e*j*z-d*p*z;b.n13=e*i*A-h*g*A+h*k*D-d*i*D-e*k*z+d*g*z;b.n14=h*g*j-e*i*j-h*k*p+d*i*p+e*k*r-d*g*r;b.n21=i*p*y-g*r*y-i*n*D+f*r*D+g*n*z-f*p*z;b.n22=e*r*y-h*p*y+h*n*D-c*r*D-e*n*z+c*p*z;b.n23=h*g*y-e*i*y-h*f*D+c*i*D+e*f*z-c*g*z;
|
|
|
-b.n24=e*i*n-h*g*n+h*f*p-c*i*p-e*f*r+c*g*r;b.n31=k*r*y-i*j*y+i*n*A-f*r*A-k*n*z+f*j*z;b.n32=h*j*y-d*r*y-h*n*A+c*r*A+d*n*z-c*j*z;b.n33=e*i*y-h*k*y+h*f*A-c*i*A-d*f*z+c*k*z;b.n34=h*k*n-d*i*n-h*f*j+c*i*j+d*f*r-c*k*r;b.n41=g*j*y-k*p*y-g*n*A+f*p*A+k*n*D-f*j*D;b.n42=d*p*y-e*j*y+e*n*A-c*p*A-d*n*D+c*j*D;b.n43=e*k*y-d*g*y-e*f*A+c*g*A+d*f*D-c*k*D;b.n44=d*g*n-e*k*n+e*f*j-c*g*j-d*f*p+c*k*p;b.multiplyScalar(1/a.determinant());return b};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*f+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*h;c[3]=a*f;c[4]=a*k;c[5]=a*g;c[6]=a*i;c[7]=a*n;c[8]=a*j;return b};
|
|
|
-THREE.Matrix4.makeFrustum=function(a,b,c,d,e,h){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(h+e)/(h-e);f.n34=-2*h*e/(h-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,h){var f,k,g,i;f=new THREE.Matrix4;k=b-a;g=c-d;i=h-e;f.n11=2/k;f.n12=0;f.n13=0;f.n14=-((b+a)/k);f.n21=0;f.n22=2/g;f.n23=0;f.n24=-((c+d)/g);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((h+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,p=a.n31,n=a.n32,o=a.n33,k=a.n34,t=a.n41,w=a.n42,D=a.n43,x=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*w-j*o*w+j*n*D-i*k*D-h*n*x+i*o*x;b.n12=g*o*w-e*k*w-g*n*D+d*k*D+e*n*x-d*o*x;b.n13=e*j*w-g*h*w+g*i*D-d*j*D-e*i*x+d*h*x;b.n14=g*h*n-e*j*n-g*i*o+d*j*o+e*i*k-d*h*k;b.n21=j*o*t-h*k*t-j*p*D+f*k*D+h*p*x-f*o*x;b.n22=e*k*t-g*o*t+g*p*D-c*k*D-e*p*x+c*o*x;b.n23=g*h*t-e*j*t-g*f*D+c*j*D+e*f*x-c*h*x;
|
|
|
+b.n24=e*j*p-g*h*p+g*f*o-c*j*o-e*f*k+c*h*k;b.n31=i*k*t-j*n*t+j*p*w-f*k*w-i*p*x+f*n*x;b.n32=g*n*t-d*k*t-g*p*w+c*k*w+d*p*x-c*n*x;b.n33=e*j*t-g*i*t+g*f*w-c*j*w-d*f*x+c*i*x;b.n34=g*i*p-d*j*p-g*f*n+c*j*n+d*f*k-c*i*k;b.n41=h*n*t-i*o*t-h*p*w+f*o*w+i*p*D-f*n*D;b.n42=d*o*t-e*n*t+e*p*w-c*o*w-d*p*D+c*n*D;b.n43=e*i*t-d*h*t-e*f*w+c*h*w+d*f*D-c*i*D;b.n44=d*h*p-e*i*p+e*f*n-c*h*n-d*f*o+c*i*o;b.multiplyScalar(1/a.determinant());return b};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*f+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*p;c[8]=a*n;return b};
|
|
|
+THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
|
|
|
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,i,h,j;f=new THREE.Matrix4;i=b-a;h=c-d;j=g-e;f.n11=2/i;f.n12=0;f.n13=0;f.n14=-((b+a)/i);f.n21=0;f.n22=2/h;f.n23=0;f.n24=-((c+d)/h);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((g+e)/j);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
|
|
|
!0;this._vector=new THREE.Vector3;this.name=""};
|
|
|
THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
|
|
|
-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==undefined;)b=b.parent;b!==undefined&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b){e=e.getChildByName(a,b);if(e!==undefined)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
|
|
|
this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);
|
|
|
this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
|
|
|
-THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var f=a*b,k=d*e;this.w=f*h-k*c;this.x=f*c+k*h;this.y=d*b*h+a*e*c;this.z=a*e*h-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=
|
|
|
+THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=d*e;this.w=f*g-i*c;this.x=f*c+i*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=
|
|
|
a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},
|
|
|
-multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,h=a.x,f=a.y,k=a.z;a=a.w;this.x=b*a+e*h+c*k-d*f;this.y=c*a+e*f+d*h-b*k;this.z=d*a+e*k+b*f-c*h;this.w=e*a-b*h-c*f-d*k;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,k=this.z,g=this.w,i=g*c+f*e-k*d,n=
|
|
|
-g*d+k*c-h*e,j=g*e+h*d-f*c;c=-h*c-f*d-k*e;b.x=i*g+c*-h+n*-k-j*-f;b.y=n*g+c*-f+j*-h-i*-k;b.z=j*g+c*-k+i*-f-n*-h;return b}};
|
|
|
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
-THREE.Face3=function(a,b,c,d,e,h){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
-THREE.Face4=function(a,b,c,d,e,h,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
|
|
|
+multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+e*g+c*i-d*f;this.y=c*a+e*f+d*g-b*i;this.z=d*a+e*i+b*f-c*g;this.w=e*a-b*g-c*f-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*e-i*d,p=
|
|
|
+h*d+i*c-g*e,n=h*e+g*d-f*c;c=-g*c-f*d-i*e;b.x=j*h+c*-g+p*-i-n*-f;b.y=p*h+c*-f+n*-g-j*-i;b.z=n*h+c*-i+j*-f-p*-g;return b}};
|
|
|
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
+THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
|
|
|
+THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
|
|
|
THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
|
|
|
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,h,f,k=new THREE.Vector3,g=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){h=this.faces[d];if(a&&h.vertexNormals.length){k.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)k.addSelf(h.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[h.a];c=this.vertices[h.b];f=this.vertices[h.c];k.sub(f.position,c.position);g.sub(b.position,c.position);k.crossSelf(g)}k.isZero()||
|
|
|
-k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
|
|
|
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,g,f,i=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){i.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)i.addSelf(g.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];f=this.vertices[g.c];i.sub(f.position,c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||
|
|
|
+i.normalize();g.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
|
|
|
this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);
|
|
|
-c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(E,O,S,V,F,Y,B){k=E.vertices[O].position;g=E.vertices[S].position;i=E.vertices[V].position;n=f[F];j=f[Y];p=f[B];r=g.x-k.x;y=i.x-k.x;A=g.y-k.y;D=i.y-k.y;z=g.z-k.z;T=i.z-k.z;U=j.u-n.u;X=p.u-n.u;s=j.v-n.v;o=p.v-n.v;L=1/(U*o-X*s);w.set((o*
|
|
|
-r-s*y)*L,(o*A-s*D)*L,(o*z-s*T)*L);u.set((U*y-X*r)*L,(U*D-X*A)*L,(U*T-X*z)*L);aa[O].addSelf(w);aa[S].addSelf(w);aa[V].addSelf(w);ba[O].addSelf(u);ba[S].addSelf(u);ba[V].addSelf(u)}var b,c,d,e,h,f,k,g,i,n,j,p,r,y,A,D,z,T,U,X,s,o,L,R,aa=[],ba=[],w=new THREE.Vector3,u=new THREE.Vector3,H=new THREE.Vector3,M=new THREE.Vector3,P=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){aa[b]=new THREE.Vector3;ba[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];f=this.faceVertexUvs[0][b];
|
|
|
-if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(d=0;d<h.vertexNormals.length;d++){P.copy(h.vertexNormals[d]);e=h[I[d]];R=aa[e];H.copy(R);H.subSelf(P.multiplyScalar(P.dot(R))).normalize();M.cross(h.vertexNormals[d],R);e=M.dot(ba[e]);e=e<0?-1:1;h.vertexTangents[d]=new THREE.Vector4(H.x,H.y,H.z,e)}}this.hasTangents=!0},computeBoundingBox:function(){var a;
|
|
|
+c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(y,F,Q,S,G,ba,Z){i=y.vertices[F].position;h=y.vertices[Q].position;j=y.vertices[S].position;p=f[G];n=f[ba];o=f[Z];k=h.x-i.x;t=j.x-i.x;w=h.y-i.y;D=j.y-i.y;x=h.z-i.z;W=j.z-i.z;X=n.u-p.u;aa=o.u-p.u;H=n.v-p.v;q=o.v-p.v;B=1/(X*q-aa*H);C.set((q*
|
|
|
+k-H*t)*B,(q*w-H*D)*B,(q*x-H*W)*B);A.set((X*t-aa*k)*B,(X*D-aa*w)*B,(X*W-aa*x)*B);L[F].addSelf(C);L[Q].addSelf(C);L[S].addSelf(C);Y[F].addSelf(A);Y[Q].addSelf(A);Y[S].addSelf(A)}var b,c,d,e,g,f,i,h,j,p,n,o,k,t,w,D,x,W,X,aa,H,q,B,z,L=[],Y=[],C=new THREE.Vector3,A=new THREE.Vector3,I=new THREE.Vector3,O=new THREE.Vector3,R=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){L[b]=new THREE.Vector3;Y[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];f=this.faceVertexUvs[0][b];
|
|
|
+if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var J=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++){R.copy(g.vertexNormals[d]);e=g[J[d]];z=L[e];I.copy(z);I.subSelf(R.multiplyScalar(R.dot(z))).normalize();O.cross(g.vertexNormals[d],z);e=O.dot(Y[e]);e=e<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(I.x,I.y,I.z,e)}}this.hasTangents=!0},computeBoundingBox:function(){var a;
|
|
|
if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;
|
|
|
-else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},computeEdgeFaces:function(){function a(g,i){return Math.min(g,
|
|
|
-i)+"_"+Math.max(g,i)}function b(g,i,n){if(g[i]===undefined){g[i]={set:{},array:[]};g[i].set[n]=1;g[i].array.push(n)}else if(g[i].set[n]===undefined){g[i].set[n]=1;g[i].array.push(n)}}var c,d,e,h,f,k={};c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];if(f instanceof THREE.Face3){e=a(f.a,f.b);b(k,e,c);e=a(f.b,f.c);b(k,e,c);e=a(f.a,f.c);b(k,e,c)}else if(f instanceof THREE.Face4){e=a(f.b,f.d);b(k,e,c);e=a(f.a,f.b);b(k,e,c);e=a(f.a,f.d);b(k,e,c);e=a(f.b,f.c);b(k,e,c);e=a(f.c,f.d);b(k,e,c)}}c=0;for(d=
|
|
|
-this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];h=f.vertexIndices[1];f.faceIndices=k[a(e,h)].array;for(e=0;e<f.faceIndices.length;e++){h=f.faceIndices[e];f.faces.push(this.faces[h])}}}};THREE.GeometryIdCounter=0;THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};
|
|
|
+else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},computeEdgeFaces:function(){function a(h,j){return Math.min(h,
|
|
|
+j)+"_"+Math.max(h,j)}function b(h,j,p){if(h[j]===undefined){h[j]={set:{},array:[]};h[j].set[p]=1;h[j].array.push(p)}else if(h[j].set[p]===undefined){h[j].set[p]=1;h[j].array.push(p)}}var c,d,e,g,f,i={};c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];if(f instanceof THREE.Face3){e=a(f.a,f.b);b(i,e,c);e=a(f.b,f.c);b(i,e,c);e=a(f.a,f.c);b(i,e,c)}else if(f instanceof THREE.Face4){e=a(f.b,f.d);b(i,e,c);e=a(f.a,f.b);b(i,e,c);e=a(f.a,f.d);b(i,e,c);e=a(f.b,f.c);b(i,e,c);e=a(f.c,f.d);b(i,e,c)}}c=0;for(d=
|
|
|
+this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];g=f.vertexIndices[1];f.faceIndices=i[a(e,g)].array;for(e=0;e<f.faceIndices.length;e++){g=f.faceIndices[e];f.faces.push(this.faces[g])}}}};THREE.GeometryIdCounter=0;THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};
|
|
|
THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
|
!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
@@ -85,7 +84,7 @@ THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.sha
|
|
|
THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
|
|
|
THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.size=a.size!==undefined?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==undefined?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
|
|
|
THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==undefined?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;
|
|
|
-THREE.Texture=function(a,b,c,d,e,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
|
|
|
+THREE.Texture=function(a,b,c,d,e,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
|
|
|
THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
|
|
|
THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
|
|
|
THREE.Line.prototype.constructor=THREE.Line;
|
|
@@ -103,43 +102,43 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
|
|
|
THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
|
|
|
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
|
|
|
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
|
|
|
-THREE.Projector=function(){function a(){var w=g[k]=g[k]||new THREE.RenderableVertex;k++;return w}function b(w,u){return u.z-w.z}function c(w,u){var H=0,M=1,P=w.z+w.w,I=u.z+u.w,E=-w.z+w.w,O=-u.z+u.w;if(P>=0&&I>=0&&E>=0&&O>=0)return!0;else if(P<0&&I<0||E<0&&O<0)return!1;else{if(P<0)H=Math.max(H,P/(P-I));else I<0&&(M=Math.min(M,P/(P-I)));if(E<0)H=Math.max(H,E/(E-O));else O<0&&(M=Math.min(M,E/(E-O)));if(M<H)return!1;else{w.lerpSelf(u,H);u.lerpSelf(w,1-M);return!0}}}var d,e,h=[],f,k,g=[],i,n,j=[],p,r=
|
|
|
-[],y,A,D=[],z,T,U=[],X=new THREE.Vector4,s=new THREE.Vector4,o=new THREE.Matrix4,L=new THREE.Matrix4,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],aa=new THREE.Vector4,ba=new THREE.Vector4;this.projectVector=function(w,u){o.multiply(u.projectionMatrix,u.matrixWorldInverse);o.multiplyVector3(w);return w};this.unprojectVector=function(w,u){o.multiply(u.matrixWorld,THREE.Matrix4.makeInvert(u.projectionMatrix));o.multiplyVector3(w);return w};
|
|
|
-this.projectObjects=function(w,u,H){u=[];var M,P,I;e=0;P=w.objects;w=0;for(M=P.length;w<M;w++){I=P[w];var E;if(!(E=!I.visible))if(E=I instanceof THREE.Mesh){a:{E=void 0;for(var O=I.matrixWorld,S=-I.geometry.boundingSphere.radius*Math.max(I.scale.x,Math.max(I.scale.y,I.scale.z)),V=0;V<6;V++){E=R[V].x*O.n14+R[V].y*O.n24+R[V].z*O.n34+R[V].w;if(E<=S){E=!1;break a}}E=!0}E=!E}if(!E){E=h[e]=h[e]||new THREE.RenderableObject;e++;d=E;X.copy(I.position);o.multiplyVector3(X);d.object=I;d.z=X.z;u.push(d)}}H&&
|
|
|
-u.sort(b);return u};this.projectScene=function(w,u,H){var M=[],P=u.near,I=u.far,E,O,S,V,F,Y,B,Q,K,C,Z,ia,ma,ja,ca,Da,wa;T=A=p=n=0;u.matrixAutoUpdate&&u.update(undefined,!0);w.update(undefined,!1,u);o.multiply(u.projectionMatrix,u.matrixWorldInverse);R[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);R[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);R[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);R[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);R[4].set(o.n41-o.n31,
|
|
|
-o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);R[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(E=0;E<6;E++){K=R[E];K.divideScalar(Math.sqrt(K.x*K.x+K.y*K.y+K.z*K.z))}K=this.projectObjects(w,u,!0);w=0;for(E=K.length;w<E;w++){C=K[w].object;if(C.visible){Z=C.matrixWorld;ia=C.matrixRotationWorld;ma=C.materials;ja=C.overdraw;k=0;if(C instanceof THREE.Mesh){ca=C.geometry;V=ca.vertices;Da=ca.faces;ca=ca.faceVertexUvs;O=0;for(S=V.length;O<S;O++){f=a();f.positionWorld.copy(V[O].position);Z.multiplyVector3(f.positionWorld);
|
|
|
-f.positionScreen.copy(f.positionWorld);o.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>P&&f.positionScreen.z<I}V=0;for(O=Da.length;V<O;V++){S=Da[V];if(S instanceof THREE.Face3){F=g[S.a];Y=g[S.b];B=g[S.c];if(F.visible&&Y.visible&&B.visible&&(C.doubleSided||C.flipSided!=(B.positionScreen.x-F.positionScreen.x)*(Y.positionScreen.y-F.positionScreen.y)-(B.positionScreen.y-F.positionScreen.y)*(Y.positionScreen.x-
|
|
|
-F.positionScreen.x)<0)){Q=j[n]=j[n]||new THREE.RenderableFace3;n++;i=Q;i.v1.copy(F);i.v2.copy(Y);i.v3.copy(B)}else continue}else if(S instanceof THREE.Face4){F=g[S.a];Y=g[S.b];B=g[S.c];Q=g[S.d];if(F.visible&&Y.visible&&B.visible&&Q.visible&&(C.doubleSided||C.flipSided!=((Q.positionScreen.x-F.positionScreen.x)*(Y.positionScreen.y-F.positionScreen.y)-(Q.positionScreen.y-F.positionScreen.y)*(Y.positionScreen.x-F.positionScreen.x)<0||(Y.positionScreen.x-B.positionScreen.x)*(Q.positionScreen.y-B.positionScreen.y)-
|
|
|
-(Y.positionScreen.y-B.positionScreen.y)*(Q.positionScreen.x-B.positionScreen.x)<0))){wa=r[p]=r[p]||new THREE.RenderableFace4;p++;i=wa;i.v1.copy(F);i.v2.copy(Y);i.v3.copy(B);i.v4.copy(Q)}else continue}i.normalWorld.copy(S.normal);ia.multiplyVector3(i.normalWorld);i.centroidWorld.copy(S.centroid);Z.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);B=S.vertexNormals;F=0;for(Y=B.length;F<Y;F++){Q=i.vertexNormalsWorld[F];Q.copy(B[F]);ia.multiplyVector3(Q)}F=
|
|
|
-0;for(Y=ca.length;F<Y;F++)if(wa=ca[F][V]){B=0;for(Q=wa.length;B<Q;B++)i.uvs[F][B]=wa[B]}i.meshMaterials=ma;i.faceMaterials=S.materials;i.overdraw=ja;i.z=i.centroidScreen.z;M.push(i)}}else if(C instanceof THREE.Line){L.multiply(o,Z);V=C.geometry.vertices;F=a();F.positionScreen.copy(V[0].position);L.multiplyVector4(F.positionScreen);O=1;for(S=V.length;O<S;O++){F=a();F.positionScreen.copy(V[O].position);L.multiplyVector4(F.positionScreen);Y=g[k-2];aa.copy(F.positionScreen);ba.copy(Y.positionScreen);
|
|
|
-if(c(aa,ba)){aa.multiplyScalar(1/aa.w);ba.multiplyScalar(1/ba.w);Z=D[A]=D[A]||new THREE.RenderableLine;A++;y=Z;y.v1.positionScreen.copy(aa);y.v2.positionScreen.copy(ba);y.z=Math.max(aa.z,ba.z);y.materials=C.materials;M.push(y)}}}else if(C instanceof THREE.Particle){s.set(C.matrixWorld.n14,C.matrixWorld.n24,C.matrixWorld.n34,1);o.multiplyVector4(s);s.z/=s.w;if(s.z>0&&s.z<1){Z=U[T]=U[T]||new THREE.RenderableParticle;T++;z=Z;z.x=s.x/s.w;z.y=s.y/s.w;z.z=s.z;z.rotation=C.rotation.z;z.scale.x=C.scale.x*
|
|
|
-Math.abs(z.x-(s.x+u.projectionMatrix.n11)/(s.w+u.projectionMatrix.n14));z.scale.y=C.scale.y*Math.abs(z.y-(s.y+u.projectionMatrix.n22)/(s.w+u.projectionMatrix.n24));z.materials=C.materials;M.push(z)}}}}H&&M.sort(b);return M}};
|
|
|
-THREE.CanvasRenderer=function(){function a($){if(y!=$)j.globalAlpha=y=$}function b($){if(A!=$){switch($){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}A=$}}function c($){if(D!=$)j.strokeStyle=D=$}var d=this,e=null,h=new THREE.Projector,f=document.createElement("canvas"),k,g,i,n,j=f.getContext("2d"),p=new THREE.Color(0),r=0,y=1,A=0,D=null,
|
|
|
-z=null,T=null,U=null,X=null,s,o,L,R,aa=new THREE.RenderableVertex,ba=new THREE.RenderableVertex,w,u,H,M,P,I,E,O,S,V,F,Y,B=new THREE.Color,Q=new THREE.Color,K=new THREE.Color,C=new THREE.Color,Z=new THREE.Color,ia,ma,ja,ca,Da,wa,Wa,Xa,Ya,Za,Ba=new THREE.Rectangle,ka=new THREE.Rectangle,fa=new THREE.Rectangle,Ua=!1,ha=new THREE.Color,ga=new THREE.Color,Ma=new THREE.Color,Na=new THREE.Color,da=new THREE.Vector3,Ha,Ia,Va,la,Ja,Oa,Ea=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;Ia=Ha.getContext("2d");
|
|
|
-Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Va=Ia.getImageData(0,0,2,2);la=Va.data;Ja=document.createElement("canvas");Ja.width=Ja.height=Ea;Oa=Ja.getContext("2d");Oa.translate(-Ea/2,-Ea/2);Oa.scale(Ea,Ea);Ea--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function($,na){k=$;g=na;i=k/2;n=g/2;f.width=k;f.height=g;Ba.set(-i,-n,i,n);y=1;A=0;X=U=T=z=D=null};this.setClearColor=function($,na){p=$;r=na};this.setClearColorHex=
|
|
|
-function($,na){p.setHex($);r=na};this.clear=function(){j.setTransform(1,0,0,-1,i,n);if(!ka.isEmpty()){ka.inflate(1);ka.minSelf(Ba);if(p.hex==0&&r==0)j.clearRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight());else{b(THREE.NormalBlending);a(1);j.fillStyle="rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")";j.fillRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight())}ka.empty()}};this.render=function($,na){function bb(m){var x,t,q,J=m.lights;ga.setRGB(0,0,0);Ma.setRGB(0,
|
|
|
-0,0);Na.setRGB(0,0,0);m=0;for(x=J.length;m<x;m++){t=J[m];q=t.color;if(t instanceof THREE.AmbientLight){ga.r+=q.r;ga.g+=q.g;ga.b+=q.b}else if(t instanceof THREE.DirectionalLight){Ma.r+=q.r;Ma.g+=q.g;Ma.b+=q.b}else if(t instanceof THREE.PointLight){Na.r+=q.r;Na.g+=q.g;Na.b+=q.b}}}function ra(m,x,t,q){var J,G,v,l,W=m.lights;m=0;for(J=W.length;m<J;m++){G=W[m];v=G.color;if(G instanceof THREE.DirectionalLight){l=t.dot(G.position);if(!(l<=0)){l*=G.intensity;q.r+=v.r*l;q.g+=v.g*l;q.b+=v.b*l}}else if(G instanceof
|
|
|
-THREE.PointLight){l=t.dot(da.sub(G.position,x).normalize());if(!(l<=0)){l*=G.distance==0?1:1-Math.min(x.distanceTo(G.position)/G.distance,1);if(l!=0){l*=G.intensity;q.r+=v.r*l;q.g+=v.g*l;q.b+=v.b*l}}}}}function cb(m,x,t){a(t.opacity);b(t.blending);var q,J,G,v,l,W;if(t instanceof THREE.ParticleBasicMaterial){if(t.map){v=t.map.image;l=v.width>>1;W=v.height>>1;t=x.scale.x*i;G=x.scale.y*n;q=t*l;J=G*W;fa.set(m.x-q,m.y-J,m.x+q,m.y+J);if(Ba.instersects(fa)){j.save();j.translate(m.x,m.y);j.rotate(-x.rotation);
|
|
|
-j.scale(t,-G);j.translate(-l,-W);j.drawImage(v,0,0);j.restore()}}}else if(t instanceof THREE.ParticleCanvasMaterial){q=x.scale.x*i;J=x.scale.y*n;fa.set(m.x-q,m.y-J,m.x+q,m.y+J);if(Ba.instersects(fa)){c(t.color.__styleString);G=t.color.__styleString;if(z!=G)j.fillStyle=z=G;j.save();j.translate(m.x,m.y);j.rotate(-x.rotation);j.scale(q,J);t.program(j);j.restore()}}}function db(m,x,t,q){a(q.opacity);b(q.blending);j.beginPath();j.moveTo(m.positionScreen.x,m.positionScreen.y);j.lineTo(x.positionScreen.x,
|
|
|
-x.positionScreen.y);j.closePath();if(q instanceof THREE.LineBasicMaterial){B.__styleString=q.color.__styleString;m=q.linewidth;if(T!=m)j.lineWidth=T=m;m=q.linecap;if(U!=m)j.lineCap=U=m;m=q.linejoin;if(X!=m)j.lineJoin=X=m;c(B.__styleString);j.stroke();fa.inflate(q.linewidth*2)}}function Pa(m,x,t,q,J,G,v,l,W){d.data.vertices+=3;d.data.faces++;a(l.opacity);b(l.blending);w=m.positionScreen.x;u=m.positionScreen.y;H=x.positionScreen.x;M=x.positionScreen.y;P=t.positionScreen.x;I=t.positionScreen.y;Ka(w,
|
|
|
-u,H,M,P,I);if(l instanceof THREE.MeshBasicMaterial)if(l.map){if(l.map.mapping instanceof THREE.UVMapping){ca=v.uvs[0];sa(w,u,H,M,P,I,l.map.image,ca[q].u,ca[q].v,ca[J].u,ca[J].v,ca[G].u,ca[G].v)}}else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping){m=na.matrixWorldInverse;da.copy(v.vertexNormalsWorld[0]);Da=(da.x*m.n11+da.y*m.n12+da.z*m.n13)*0.5+0.5;wa=-(da.x*m.n21+da.y*m.n22+da.z*m.n23)*0.5+0.5;da.copy(v.vertexNormalsWorld[1]);Wa=(da.x*m.n11+da.y*m.n12+da.z*m.n13)*0.5+
|
|
|
-0.5;Xa=-(da.x*m.n21+da.y*m.n22+da.z*m.n23)*0.5+0.5;da.copy(v.vertexNormalsWorld[2]);Ya=(da.x*m.n11+da.y*m.n12+da.z*m.n13)*0.5+0.5;Za=-(da.x*m.n21+da.y*m.n22+da.z*m.n23)*0.5+0.5;sa(w,u,H,M,P,I,l.envMap.image,Da,wa,Wa,Xa,Ya,Za)}}else l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString);else if(l instanceof THREE.MeshLambertMaterial){if(l.map&&!l.wireframe){if(l.map.mapping instanceof THREE.UVMapping){ca=v.uvs[0];sa(w,u,H,M,P,I,l.map.image,
|
|
|
-ca[q].u,ca[q].v,ca[J].u,ca[J].v,ca[G].u,ca[G].v)}b(THREE.SubtractiveBlending)}if(Ua)if(!l.wireframe&&l.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3){Q.r=K.r=C.r=ga.r;Q.g=K.g=C.g=ga.g;Q.b=K.b=C.b=ga.b;ra(W,v.v1.positionWorld,v.vertexNormalsWorld[0],Q);ra(W,v.v2.positionWorld,v.vertexNormalsWorld[1],K);ra(W,v.v3.positionWorld,v.vertexNormalsWorld[2],C);Z.r=(K.r+C.r)*0.5;Z.g=(K.g+C.g)*0.5;Z.b=(K.b+C.b)*0.5;ja=Qa(Q,K,C,Z);sa(w,u,H,M,P,I,ja,0,0,1,0,0,1)}else{ha.r=ga.r;ha.g=ga.g;ha.b=ga.b;
|
|
|
-ra(W,v.centroidWorld,v.normalWorld,ha);B.r=l.color.r*ha.r;B.g=l.color.g*ha.g;B.b=l.color.b*ha.b;B.updateStyleString();l.wireframe?xa(B.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(B.__styleString)}else l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString)}else if(l instanceof THREE.MeshDepthMaterial){ia=na.near;ma=na.far;Q.r=Q.g=Q.b=1-Ca(m.positionScreen.z,ia,ma);K.r=K.g=K.b=1-Ca(x.positionScreen.z,
|
|
|
-ia,ma);C.r=C.g=C.b=1-Ca(t.positionScreen.z,ia,ma);Z.r=(K.r+C.r)*0.5;Z.g=(K.g+C.g)*0.5;Z.b=(K.b+C.b)*0.5;ja=Qa(Q,K,C,Z);sa(w,u,H,M,P,I,ja,0,0,1,0,0,1)}else if(l instanceof THREE.MeshNormalMaterial){B.r=Fa(v.normalWorld.x);B.g=Fa(v.normalWorld.y);B.b=Fa(v.normalWorld.z);B.updateStyleString();l.wireframe?xa(B.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(B.__styleString)}}function $a(m,x,t,q,J,G,v,l,W){d.data.vertices+=4;d.data.faces++;a(l.opacity);b(l.blending);if(l.map||
|
|
|
-l.envMap){Pa(m,x,q,0,1,3,v,l,W);Pa(J,t,G,1,2,3,v,l,W)}else{w=m.positionScreen.x;u=m.positionScreen.y;H=x.positionScreen.x;M=x.positionScreen.y;P=t.positionScreen.x;I=t.positionScreen.y;E=q.positionScreen.x;O=q.positionScreen.y;S=J.positionScreen.x;V=J.positionScreen.y;F=G.positionScreen.x;Y=G.positionScreen.y;if(l instanceof THREE.MeshBasicMaterial){Ra(w,u,H,M,P,I,E,O);l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString)}else if(l instanceof
|
|
|
-THREE.MeshLambertMaterial)if(Ua)if(!l.wireframe&&l.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4){Q.r=K.r=C.r=Z.r=ga.r;Q.g=K.g=C.g=Z.g=ga.g;Q.b=K.b=C.b=Z.b=ga.b;ra(W,v.v1.positionWorld,v.vertexNormalsWorld[0],Q);ra(W,v.v2.positionWorld,v.vertexNormalsWorld[1],K);ra(W,v.v4.positionWorld,v.vertexNormalsWorld[3],C);ra(W,v.v3.positionWorld,v.vertexNormalsWorld[2],Z);ja=Qa(Q,K,C,Z);Ka(w,u,H,M,E,O);sa(w,u,H,M,E,O,ja,0,0,1,0,0,1);Ka(S,V,P,I,F,Y);sa(S,V,P,I,F,Y,ja,1,0,1,1,0,1)}else{ha.r=ga.r;
|
|
|
-ha.g=ga.g;ha.b=ga.b;ra(W,v.centroidWorld,v.normalWorld,ha);B.r=l.color.r*ha.r;B.g=l.color.g*ha.g;B.b=l.color.b*ha.b;B.updateStyleString();Ra(w,u,H,M,P,I,E,O);l.wireframe?xa(B.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(B.__styleString)}else{Ra(w,u,H,M,P,I,E,O);l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString)}else if(l instanceof THREE.MeshNormalMaterial){B.r=Fa(v.normalWorld.x);B.g=Fa(v.normalWorld.y);
|
|
|
-B.b=Fa(v.normalWorld.z);B.updateStyleString();Ra(w,u,H,M,P,I,E,O);l.wireframe?xa(B.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(B.__styleString)}else if(l instanceof THREE.MeshDepthMaterial){ia=na.near;ma=na.far;Q.r=Q.g=Q.b=1-Ca(m.positionScreen.z,ia,ma);K.r=K.g=K.b=1-Ca(x.positionScreen.z,ia,ma);C.r=C.g=C.b=1-Ca(q.positionScreen.z,ia,ma);Z.r=Z.g=Z.b=1-Ca(t.positionScreen.z,ia,ma);ja=Qa(Q,K,C,Z);Ka(w,u,H,M,E,O);sa(w,u,H,M,E,O,ja,0,0,1,0,0,1);Ka(S,V,P,I,F,Y);sa(S,V,
|
|
|
-P,I,F,Y,ja,1,0,1,1,0,1)}}}function Ka(m,x,t,q,J,G){j.beginPath();j.moveTo(m,x);j.lineTo(t,q);j.lineTo(J,G);j.lineTo(m,x);j.closePath()}function Ra(m,x,t,q,J,G,v,l){j.beginPath();j.moveTo(m,x);j.lineTo(t,q);j.lineTo(J,G);j.lineTo(v,l);j.lineTo(m,x);j.closePath()}function xa(m,x,t,q){if(T!=x)j.lineWidth=T=x;if(U!=t)j.lineCap=U=t;if(X!=q)j.lineJoin=X=q;c(m);j.stroke();fa.inflate(x*2)}function ya(m){if(z!=m)j.fillStyle=z=m;j.fill()}function sa(m,x,t,q,J,G,v,l,W,ta,oa,ua,La){var qa,va;qa=v.width-1;va=
|
|
|
-v.height-1;l*=qa;W*=va;ta*=qa;oa*=va;ua*=qa;La*=va;t-=m;q-=x;J-=m;G-=x;ta-=l;oa-=W;ua-=l;La-=W;qa=ta*La-ua*oa;if(qa!=0){va=1/qa;qa=(La*t-oa*J)*va;oa=(La*q-oa*G)*va;t=(ta*J-ua*t)*va;q=(ta*G-ua*q)*va;m=m-qa*l-t*W;x=x-oa*l-q*W;j.save();j.transform(qa,oa,t,q,m,x);j.clip();j.drawImage(v,0,0);j.restore()}}function Qa(m,x,t,q){var J=~~(m.r*255),G=~~(m.g*255);m=~~(m.b*255);var v=~~(x.r*255),l=~~(x.g*255);x=~~(x.b*255);var W=~~(t.r*255),ta=~~(t.g*255);t=~~(t.b*255);var oa=~~(q.r*255),ua=~~(q.g*255);q=~~(q.b*
|
|
|
-255);la[0]=J<0?0:J>255?255:J;la[1]=G<0?0:G>255?255:G;la[2]=m<0?0:m>255?255:m;la[4]=v<0?0:v>255?255:v;la[5]=l<0?0:l>255?255:l;la[6]=x<0?0:x>255?255:x;la[8]=W<0?0:W>255?255:W;la[9]=ta<0?0:ta>255?255:ta;la[10]=t<0?0:t>255?255:t;la[12]=oa<0?0:oa>255?255:oa;la[13]=ua<0?0:ua>255?255:ua;la[14]=q<0?0:q>255?255:q;Ia.putImageData(Va,0,0);Oa.drawImage(Ha,0,0);return Ja}function Ca(m,x,t){m=(m-x)/(t-x);return m*m*(3-2*m)}function Fa(m){m=(m+1)*0.5;return m<0?0:m>1?1:m}function za(m,x){var t=x.x-m.x,q=x.y-m.y,
|
|
|
-J=1/Math.sqrt(t*t+q*q);t*=J;q*=J;x.x+=t;x.y+=q;m.x-=t;m.y-=q}var Sa,ab,N,pa,Aa,Ga,Ta,ea;this.autoClear?this.clear():j.setTransform(1,0,0,-1,i,n);d.data.vertices=0;d.data.faces=0;e=h.projectScene($,na,this.sortElements);(Ua=$.lights.length>0)&&bb($);Sa=0;for(ab=e.length;Sa<ab;Sa++){N=e[Sa];fa.empty();if(N instanceof THREE.RenderableParticle){s=N;s.x*=i;s.y*=n;pa=0;for(Aa=N.materials.length;pa<Aa;){ea=N.materials[pa++];ea.opacity!=0&&cb(s,N,ea,$)}}else if(N instanceof THREE.RenderableLine){s=N.v1;o=
|
|
|
-N.v2;s.positionScreen.x*=i;s.positionScreen.y*=n;o.positionScreen.x*=i;o.positionScreen.y*=n;fa.addPoint(s.positionScreen.x,s.positionScreen.y);fa.addPoint(o.positionScreen.x,o.positionScreen.y);if(Ba.instersects(fa)){pa=0;for(Aa=N.materials.length;pa<Aa;){ea=N.materials[pa++];ea.opacity!=0&&db(s,o,N,ea,$)}}}else if(N instanceof THREE.RenderableFace3){s=N.v1;o=N.v2;L=N.v3;s.positionScreen.x*=i;s.positionScreen.y*=n;o.positionScreen.x*=i;o.positionScreen.y*=n;L.positionScreen.x*=i;L.positionScreen.y*=
|
|
|
-n;if(N.overdraw){za(s.positionScreen,o.positionScreen);za(o.positionScreen,L.positionScreen);za(L.positionScreen,s.positionScreen)}fa.add3Points(s.positionScreen.x,s.positionScreen.y,o.positionScreen.x,o.positionScreen.y,L.positionScreen.x,L.positionScreen.y);if(Ba.instersects(fa)){pa=0;for(Aa=N.meshMaterials.length;pa<Aa;){ea=N.meshMaterials[pa++];if(ea instanceof THREE.MeshFaceMaterial){Ga=0;for(Ta=N.faceMaterials.length;Ga<Ta;)(ea=N.faceMaterials[Ga++])&&ea.opacity!=0&&Pa(s,o,L,0,1,2,N,ea,$)}else ea.opacity!=
|
|
|
-0&&Pa(s,o,L,0,1,2,N,ea,$)}}}else if(N instanceof THREE.RenderableFace4){s=N.v1;o=N.v2;L=N.v3;R=N.v4;s.positionScreen.x*=i;s.positionScreen.y*=n;o.positionScreen.x*=i;o.positionScreen.y*=n;L.positionScreen.x*=i;L.positionScreen.y*=n;R.positionScreen.x*=i;R.positionScreen.y*=n;aa.positionScreen.copy(o.positionScreen);ba.positionScreen.copy(R.positionScreen);if(N.overdraw){za(s.positionScreen,o.positionScreen);za(o.positionScreen,R.positionScreen);za(R.positionScreen,s.positionScreen);za(L.positionScreen,
|
|
|
-aa.positionScreen);za(L.positionScreen,ba.positionScreen)}fa.addPoint(s.positionScreen.x,s.positionScreen.y);fa.addPoint(o.positionScreen.x,o.positionScreen.y);fa.addPoint(L.positionScreen.x,L.positionScreen.y);fa.addPoint(R.positionScreen.x,R.positionScreen.y);if(Ba.instersects(fa)){pa=0;for(Aa=N.meshMaterials.length;pa<Aa;){ea=N.meshMaterials[pa++];if(ea instanceof THREE.MeshFaceMaterial){Ga=0;for(Ta=N.faceMaterials.length;Ga<Ta;)(ea=N.faceMaterials[Ga++])&&ea.opacity!=0&&$a(s,o,L,R,aa,ba,N,ea,
|
|
|
-$)}else ea.opacity!=0&&$a(s,o,L,R,aa,ba,N,ea,$)}}}ka.addRectangle(fa)}j.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.Projector=function(){function a(){var C=h[i]=h[i]||new THREE.RenderableVertex;i++;return C}function b(C,A){return A.z-C.z}function c(C,A){var I=0,O=1,R=C.z+C.w,J=A.z+A.w,y=-C.z+C.w,F=-A.z+A.w;if(R>=0&&J>=0&&y>=0&&F>=0)return!0;else if(R<0&&J<0||y<0&&F<0)return!1;else{if(R<0)I=Math.max(I,R/(R-J));else J<0&&(O=Math.min(O,R/(R-J)));if(y<0)I=Math.max(I,y/(y-F));else F<0&&(O=Math.min(O,y/(y-F)));if(O<I)return!1;else{C.lerpSelf(A,I);A.lerpSelf(C,1-O);return!0}}}var d,e,g=[],f,i,h=[],j,p,n=[],o,k=
|
|
|
+[],t,w,D=[],x,W,X=[],aa=new THREE.Vector4,H=new THREE.Vector4,q=new THREE.Matrix4,B=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,Y=new THREE.Vector4;this.projectVector=function(C,A){q.multiply(A.projectionMatrix,A.matrixWorldInverse);q.multiplyVector3(C);return C};this.unprojectVector=function(C,A){q.multiply(A.matrixWorld,THREE.Matrix4.makeInvert(A.projectionMatrix));q.multiplyVector3(C);return C};
|
|
|
+this.projectObjects=function(C,A,I){A=[];var O,R,J;e=0;R=C.objects;C=0;for(O=R.length;C<O;C++){J=R[C];var y;if(!(y=!J.visible))if(y=J instanceof THREE.Mesh){a:{y=void 0;for(var F=J.matrixWorld,Q=-J.geometry.boundingSphere.radius*Math.max(J.scale.x,Math.max(J.scale.y,J.scale.z)),S=0;S<6;S++){y=z[S].x*F.n14+z[S].y*F.n24+z[S].z*F.n34+z[S].w;if(y<=Q){y=!1;break a}}y=!0}y=!y}if(!y){y=g[e]=g[e]||new THREE.RenderableObject;e++;d=y;aa.copy(J.position);q.multiplyVector3(aa);d.object=J;d.z=aa.z;A.push(d)}}I&&
|
|
|
+A.sort(b);return A};this.projectScene=function(C,A,I){var O=[],R=A.near,J=A.far,y,F,Q,S,G,ba,Z,da,M,E,T,$,ea,oa,ia,ka,fa;W=w=o=p=0;A.matrixAutoUpdate&&A.update(undefined,!0);C.update(undefined,!1,A);q.multiply(A.projectionMatrix,A.matrixWorldInverse);z[0].set(q.n41-q.n11,q.n42-q.n12,q.n43-q.n13,q.n44-q.n14);z[1].set(q.n41+q.n11,q.n42+q.n12,q.n43+q.n13,q.n44+q.n14);z[2].set(q.n41+q.n21,q.n42+q.n22,q.n43+q.n23,q.n44+q.n24);z[3].set(q.n41-q.n21,q.n42-q.n22,q.n43-q.n23,q.n44-q.n24);z[4].set(q.n41-q.n31,
|
|
|
+q.n42-q.n32,q.n43-q.n33,q.n44-q.n34);z[5].set(q.n41+q.n31,q.n42+q.n32,q.n43+q.n33,q.n44+q.n34);for(y=0;y<6;y++){M=z[y];M.divideScalar(Math.sqrt(M.x*M.x+M.y*M.y+M.z*M.z))}M=this.projectObjects(C,A,!0);C=0;for(y=M.length;C<y;C++){E=M[C].object;if(E.visible){T=E.matrixWorld;$=E.matrixRotationWorld;ea=E.materials;oa=E.overdraw;i=0;if(E instanceof THREE.Mesh){ia=E.geometry;S=ia.vertices;ka=ia.faces;ia=ia.faceVertexUvs;F=0;for(Q=S.length;F<Q;F++){f=a();f.positionWorld.copy(S[F].position);T.multiplyVector3(f.positionWorld);
|
|
|
+f.positionScreen.copy(f.positionWorld);q.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>R&&f.positionScreen.z<J}S=0;for(F=ka.length;S<F;S++){Q=ka[S];if(Q instanceof THREE.Face3){G=h[Q.a];ba=h[Q.b];Z=h[Q.c];if(G.visible&&ba.visible&&Z.visible&&(E.doubleSided||E.flipSided!=(Z.positionScreen.x-G.positionScreen.x)*(ba.positionScreen.y-G.positionScreen.y)-(Z.positionScreen.y-G.positionScreen.y)*(ba.positionScreen.x-
|
|
|
+G.positionScreen.x)<0)){da=n[p]=n[p]||new THREE.RenderableFace3;p++;j=da;j.v1.copy(G);j.v2.copy(ba);j.v3.copy(Z)}else continue}else if(Q instanceof THREE.Face4){G=h[Q.a];ba=h[Q.b];Z=h[Q.c];da=h[Q.d];if(G.visible&&ba.visible&&Z.visible&&da.visible&&(E.doubleSided||E.flipSided!=((da.positionScreen.x-G.positionScreen.x)*(ba.positionScreen.y-G.positionScreen.y)-(da.positionScreen.y-G.positionScreen.y)*(ba.positionScreen.x-G.positionScreen.x)<0||(ba.positionScreen.x-Z.positionScreen.x)*(da.positionScreen.y-
|
|
|
+Z.positionScreen.y)-(ba.positionScreen.y-Z.positionScreen.y)*(da.positionScreen.x-Z.positionScreen.x)<0))){fa=k[o]=k[o]||new THREE.RenderableFace4;o++;j=fa;j.v1.copy(G);j.v2.copy(ba);j.v3.copy(Z);j.v4.copy(da)}else continue}j.normalWorld.copy(Q.normal);$.multiplyVector3(j.normalWorld);j.centroidWorld.copy(Q.centroid);T.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);q.multiplyVector3(j.centroidScreen);Z=Q.vertexNormals;G=0;for(ba=Z.length;G<ba;G++){da=j.vertexNormalsWorld[G];
|
|
|
+da.copy(Z[G]);$.multiplyVector3(da)}G=0;for(ba=ia.length;G<ba;G++)if(fa=ia[G][S]){Z=0;for(da=fa.length;Z<da;Z++)j.uvs[G][Z]=fa[Z]}j.meshMaterials=ea;j.faceMaterials=Q.materials;j.overdraw=oa;j.z=j.centroidScreen.z;O.push(j)}}else if(E instanceof THREE.Line){B.multiply(q,T);S=E.geometry.vertices;G=a();G.positionScreen.copy(S[0].position);B.multiplyVector4(G.positionScreen);F=1;for(Q=S.length;F<Q;F++){G=a();G.positionScreen.copy(S[F].position);B.multiplyVector4(G.positionScreen);ba=h[i-2];L.copy(G.positionScreen);
|
|
|
+Y.copy(ba.positionScreen);if(c(L,Y)){L.multiplyScalar(1/L.w);Y.multiplyScalar(1/Y.w);T=D[w]=D[w]||new THREE.RenderableLine;w++;t=T;t.v1.positionScreen.copy(L);t.v2.positionScreen.copy(Y);t.z=Math.max(L.z,Y.z);t.materials=E.materials;O.push(t)}}}else if(E instanceof THREE.Particle){H.set(E.matrixWorld.n14,E.matrixWorld.n24,E.matrixWorld.n34,1);q.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){T=X[W]=X[W]||new THREE.RenderableParticle;W++;x=T;x.x=H.x/H.w;x.y=H.y/H.w;x.z=H.z;x.rotation=E.rotation.z;x.scale.x=
|
|
|
+E.scale.x*Math.abs(x.x-(H.x+A.projectionMatrix.n11)/(H.w+A.projectionMatrix.n14));x.scale.y=E.scale.y*Math.abs(x.y-(H.y+A.projectionMatrix.n22)/(H.w+A.projectionMatrix.n24));x.materials=E.materials;O.push(x)}}}}I&&O.sort(b);return O}};
|
|
|
+THREE.CanvasRenderer=function(){function a(U){if(D!=U)k.globalAlpha=D=U}function b(U){if(x!=U){switch(U){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}x=U}}function c(U){if(W!=U.hex){W=U.hex;k.strokeStyle="#"+e(W.toString(16))}}function d(U){if(X!=U.hex){X=U.hex;k.fillStyle="#"+e(X.toString(16))}}function e(U){for(;U.length<6;)U="0"+U;
|
|
|
+return U}var g=this,f=null,i=new THREE.Projector,h=document.createElement("canvas"),j,p,n,o,k=h.getContext("2d"),t=new THREE.Color(0),w=0,D=1,x=0,W=null,X=null,aa=null,H=null,q=null,B,z,L,Y,C=new THREE.RenderableVertex,A=new THREE.RenderableVertex,I,O,R,J,y,F,Q,S,G,ba,Z,da,M=new THREE.Color(0),E=new THREE.Color(0),T=new THREE.Color(0),$=new THREE.Color(0),ea=new THREE.Color(0),oa,ia,ka,fa,Wa,Xa,Ya,Za,$a,ab,Ca=new THREE.Rectangle,ma=new THREE.Rectangle,ha=new THREE.Rectangle,Ua=!1,la=new THREE.Color,
|
|
|
+ja=new THREE.Color,Ma=new THREE.Color,Na=new THREE.Color,ca=new THREE.Vector3,Ha,Ia,Va,na,Ja,Oa,Ea=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;Ia=Ha.getContext("2d");Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Va=Ia.getImageData(0,0,2,2);na=Va.data;Ja=document.createElement("canvas");Ja.width=Ja.height=Ea;Oa=Ja.getContext("2d");Oa.translate(-Ea/2,-Ea/2);Oa.scale(Ea,Ea);Ea--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};
|
|
|
+this.setSize=function(U,pa){j=U;p=pa;n=j/2;o=p/2;h.width=j;h.height=p;Ca.set(-n,-o,n,o);D=1;x=0;q=H=aa=X=W=null};this.setClearColor=function(U,pa){t=U;w=pa};this.setClearColorHex=function(U,pa){t.setHex(U);w=pa};this.clear=function(){k.setTransform(1,0,0,-1,n,o);if(!ma.isEmpty()){ma.inflate(1);ma.minSelf(Ca);if(t.hex==0&&w==0)k.clearRect(ma.getX(),ma.getY(),ma.getWidth(),ma.getHeight());else{b(THREE.NormalBlending);a(1);k.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*
|
|
|
+255)+","+w+")";k.fillRect(ma.getX(),ma.getY(),ma.getWidth(),ma.getHeight())}ma.empty()}};this.render=function(U,pa){function db(m){var v,s,r,K=m.lights;ja.setRGB(0,0,0);Ma.setRGB(0,0,0);Na.setRGB(0,0,0);m=0;for(v=K.length;m<v;m++){s=K[m];r=s.color;if(s instanceof THREE.AmbientLight){ja.r+=r.r;ja.g+=r.g;ja.b+=r.b}else if(s instanceof THREE.DirectionalLight){Ma.r+=r.r;Ma.g+=r.g;Ma.b+=r.b}else if(s instanceof THREE.PointLight){Na.r+=r.r;Na.g+=r.g;Na.b+=r.b}}}function ta(m,v,s,r){var K,N,u,l,V=m.lights;
|
|
|
+m=0;for(K=V.length;m<K;m++){N=V[m];u=N.color;if(N instanceof THREE.DirectionalLight){l=s.dot(N.position);if(!(l<=0)){l*=N.intensity;r.r+=u.r*l;r.g+=u.g*l;r.b+=u.b*l}}else if(N instanceof THREE.PointLight){l=s.dot(ca.sub(N.position,v).normalize());if(!(l<=0)){l*=N.distance==0?1:1-Math.min(v.distanceTo(N.position)/N.distance,1);if(l!=0){l*=N.intensity;r.r+=u.r*l;r.g+=u.g*l;r.b+=u.b*l}}}}}function eb(m,v,s){a(s.opacity);b(s.blending);var r,K,N,u,l,V;if(s instanceof THREE.ParticleBasicMaterial){if(s.map){u=
|
|
|
+s.map.image;l=u.width>>1;V=u.height>>1;s=v.scale.x*n;N=v.scale.y*o;r=s*l;K=N*V;ha.set(m.x-r,m.y-K,m.x+r,m.y+K);if(Ca.instersects(ha)){k.save();k.translate(m.x,m.y);k.rotate(-v.rotation);k.scale(s,-N);k.translate(-l,-V);k.drawImage(u,0,0);k.restore()}}}else if(s instanceof THREE.ParticleCanvasMaterial){r=v.scale.x*n;K=v.scale.y*o;ha.set(m.x-r,m.y-K,m.x+r,m.y+K);if(Ca.instersects(ha)){c(s.color);d(s.color);k.save();k.translate(m.x,m.y);k.rotate(-v.rotation);k.scale(r,K);s.program(k);k.restore()}}}function fb(m,
|
|
|
+v,s,r){a(r.opacity);b(r.blending);k.beginPath();k.moveTo(m.positionScreen.x,m.positionScreen.y);k.lineTo(v.positionScreen.x,v.positionScreen.y);k.closePath();if(r instanceof THREE.LineBasicMaterial){m=r.linewidth;if(aa!=m)k.lineWidth=aa=m;m=r.linecap;if(H!=m)k.lineCap=H=m;m=r.linejoin;if(q!=m)k.lineJoin=q=m;c(r.color);k.stroke();ha.inflate(r.linewidth*2)}}function Pa(m,v,s,r,K,N,u,l,V){g.data.vertices+=3;g.data.faces++;a(l.opacity);b(l.blending);I=m.positionScreen.x;O=m.positionScreen.y;R=v.positionScreen.x;
|
|
|
+J=v.positionScreen.y;y=s.positionScreen.x;F=s.positionScreen.y;Ka(I,O,R,J,y,F);if(l instanceof THREE.MeshBasicMaterial)if(l.map){if(l.map.mapping instanceof THREE.UVMapping){fa=u.uvs[0];ua(I,O,R,J,y,F,l.map.image,fa[r].u,fa[r].v,fa[K].u,fa[K].v,fa[N].u,fa[N].v)}}else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping){m=pa.matrixWorldInverse;ca.copy(u.vertexNormalsWorld[0]);Wa=(ca.x*m.n11+ca.y*m.n12+ca.z*m.n13)*0.5+0.5;Xa=-(ca.x*m.n21+ca.y*m.n22+ca.z*m.n23)*0.5+0.5;ca.copy(u.vertexNormalsWorld[1]);
|
|
|
+Ya=(ca.x*m.n11+ca.y*m.n12+ca.z*m.n13)*0.5+0.5;Za=-(ca.x*m.n21+ca.y*m.n22+ca.z*m.n23)*0.5+0.5;ca.copy(u.vertexNormalsWorld[2]);$a=(ca.x*m.n11+ca.y*m.n12+ca.z*m.n13)*0.5+0.5;ab=-(ca.x*m.n21+ca.y*m.n22+ca.z*m.n23)*0.5+0.5;ua(I,O,R,J,y,F,l.envMap.image,Wa,Xa,Ya,Za,$a,ab)}}else l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color);else if(l instanceof THREE.MeshLambertMaterial){if(l.map&&!l.wireframe){if(l.map.mapping instanceof THREE.UVMapping){fa=u.uvs[0];ua(I,
|
|
|
+O,R,J,y,F,l.map.image,fa[r].u,fa[r].v,fa[K].u,fa[K].v,fa[N].u,fa[N].v)}b(THREE.SubtractiveBlending)}if(Ua)if(!l.wireframe&&l.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3){E.r=T.r=$.r=ja.r;E.g=T.g=$.g=ja.g;E.b=T.b=$.b=ja.b;ta(V,u.v1.positionWorld,u.vertexNormalsWorld[0],E);ta(V,u.v2.positionWorld,u.vertexNormalsWorld[1],T);ta(V,u.v3.positionWorld,u.vertexNormalsWorld[2],$);ea.r=(T.r+$.r)*0.5;ea.g=(T.g+$.g)*0.5;ea.b=(T.b+$.b)*0.5;ka=Qa(E,T,$,ea);ua(I,O,R,J,y,F,ka,0,0,1,0,0,1)}else{la.r=
|
|
|
+ja.r;la.g=ja.g;la.b=ja.b;ta(V,u.centroidWorld,u.normalWorld,la);M.r=Math.max(0,Math.min(l.color.r*la.r,1));M.g=Math.max(0,Math.min(l.color.g*la.g,1));M.b=Math.max(0,Math.min(l.color.b*la.b,1));M.updateHex();l.wireframe?ya(M,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(M)}else l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color)}else if(l instanceof THREE.MeshDepthMaterial){oa=pa.near;ia=pa.far;E.r=E.g=E.b=1-Da(m.positionScreen.z,oa,ia);
|
|
|
+T.r=T.g=T.b=1-Da(v.positionScreen.z,oa,ia);$.r=$.g=$.b=1-Da(s.positionScreen.z,oa,ia);ea.r=(T.r+$.r)*0.5;ea.g=(T.g+$.g)*0.5;ea.b=(T.b+$.b)*0.5;ka=Qa(E,T,$,ea);ua(I,O,R,J,y,F,ka,0,0,1,0,0,1)}else if(l instanceof THREE.MeshNormalMaterial){M.r=Fa(u.normalWorld.x);M.g=Fa(u.normalWorld.y);M.b=Fa(u.normalWorld.z);M.updateHex();l.wireframe?ya(M,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(M)}}function bb(m,v,s,r,K,N,u,l,V){g.data.vertices+=4;g.data.faces++;a(l.opacity);b(l.blending);if(l.map||
|
|
|
+l.envMap){Pa(m,v,r,0,1,3,u,l,V);Pa(K,s,N,1,2,3,u,l,V)}else{I=m.positionScreen.x;O=m.positionScreen.y;R=v.positionScreen.x;J=v.positionScreen.y;y=s.positionScreen.x;F=s.positionScreen.y;Q=r.positionScreen.x;S=r.positionScreen.y;G=K.positionScreen.x;ba=K.positionScreen.y;Z=N.positionScreen.x;da=N.positionScreen.y;if(l instanceof THREE.MeshBasicMaterial){Ra(I,O,R,J,y,F,Q,S);l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color)}else if(l instanceof THREE.MeshLambertMaterial)if(Ua)if(!l.wireframe&&
|
|
|
+l.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==4){E.r=T.r=$.r=ea.r=ja.r;E.g=T.g=$.g=ea.g=ja.g;E.b=T.b=$.b=ea.b=ja.b;ta(V,u.v1.positionWorld,u.vertexNormalsWorld[0],E);ta(V,u.v2.positionWorld,u.vertexNormalsWorld[1],T);ta(V,u.v4.positionWorld,u.vertexNormalsWorld[3],$);ta(V,u.v3.positionWorld,u.vertexNormalsWorld[2],ea);ka=Qa(E,T,$,ea);Ka(I,O,R,J,Q,S);ua(I,O,R,J,Q,S,ka,0,0,1,0,0,1);Ka(G,ba,y,F,Z,da);ua(G,ba,y,F,Z,da,ka,1,0,1,1,0,1)}else{la.r=ja.r;la.g=ja.g;la.b=ja.b;ta(V,u.centroidWorld,
|
|
|
+u.normalWorld,la);M.r=Math.max(0,Math.min(l.color.r*la.r,1));M.g=Math.max(0,Math.min(l.color.g*la.g,1));M.b=Math.max(0,Math.min(l.color.b*la.b,1));M.updateHex();Ra(I,O,R,J,y,F,Q,S);l.wireframe?ya(M,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(M)}else{Ra(I,O,R,J,y,F,Q,S);l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color)}else if(l instanceof THREE.MeshNormalMaterial){M.r=Fa(u.normalWorld.x);M.g=Fa(u.normalWorld.y);M.b=Fa(u.normalWorld.z);
|
|
|
+M.updateHex();Ra(I,O,R,J,y,F,Q,S);l.wireframe?ya(M,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(M)}else if(l instanceof THREE.MeshDepthMaterial){oa=pa.near;ia=pa.far;E.r=E.g=E.b=1-Da(m.positionScreen.z,oa,ia);T.r=T.g=T.b=1-Da(v.positionScreen.z,oa,ia);$.r=$.g=$.b=1-Da(r.positionScreen.z,oa,ia);ea.r=ea.g=ea.b=1-Da(s.positionScreen.z,oa,ia);ka=Qa(E,T,$,ea);Ka(I,O,R,J,Q,S);ua(I,O,R,J,Q,S,ka,0,0,1,0,0,1);Ka(G,ba,y,F,Z,da);ua(G,ba,y,F,Z,da,ka,1,0,1,1,0,1)}}}function Ka(m,v,s,r,K,N){k.beginPath();
|
|
|
+k.moveTo(m,v);k.lineTo(s,r);k.lineTo(K,N);k.lineTo(m,v);k.closePath()}function Ra(m,v,s,r,K,N,u,l){k.beginPath();k.moveTo(m,v);k.lineTo(s,r);k.lineTo(K,N);k.lineTo(u,l);k.lineTo(m,v);k.closePath()}function ya(m,v,s,r){if(aa!=v)k.lineWidth=aa=v;if(H!=s)k.lineCap=H=s;if(q!=r)k.lineJoin=q=r;c(m);k.stroke();ha.inflate(v*2)}function za(m){d(m);k.fill()}function ua(m,v,s,r,K,N,u,l,V,va,qa,wa,La){var sa,xa;sa=u.width-1;xa=u.height-1;l*=sa;V*=xa;va*=sa;qa*=xa;wa*=sa;La*=xa;s-=m;r-=v;K-=m;N-=v;va-=l;qa-=V;
|
|
|
+wa-=l;La-=V;sa=va*La-wa*qa;if(sa!=0){xa=1/sa;sa=(La*s-qa*K)*xa;qa=(La*r-qa*N)*xa;s=(va*K-wa*s)*xa;r=(va*N-wa*r)*xa;m=m-sa*l-s*V;v=v-qa*l-r*V;k.save();k.transform(sa,qa,s,r,m,v);k.clip();k.drawImage(u,0,0);k.restore()}}function Qa(m,v,s,r){var K=~~(m.r*255),N=~~(m.g*255);m=~~(m.b*255);var u=~~(v.r*255),l=~~(v.g*255);v=~~(v.b*255);var V=~~(s.r*255),va=~~(s.g*255);s=~~(s.b*255);var qa=~~(r.r*255),wa=~~(r.g*255);r=~~(r.b*255);na[0]=K<0?0:K>255?255:K;na[1]=N<0?0:N>255?255:N;na[2]=m<0?0:m>255?255:m;na[4]=
|
|
|
+u<0?0:u>255?255:u;na[5]=l<0?0:l>255?255:l;na[6]=v<0?0:v>255?255:v;na[8]=V<0?0:V>255?255:V;na[9]=va<0?0:va>255?255:va;na[10]=s<0?0:s>255?255:s;na[12]=qa<0?0:qa>255?255:qa;na[13]=wa<0?0:wa>255?255:wa;na[14]=r<0?0:r>255?255:r;Ia.putImageData(Va,0,0);Oa.drawImage(Ha,0,0);return Ja}function Da(m,v,s){m=(m-v)/(s-v);return m*m*(3-2*m)}function Fa(m){m=(m+1)*0.5;return m<0?0:m>1?1:m}function Aa(m,v){var s=v.x-m.x,r=v.y-m.y,K=1/Math.sqrt(s*s+r*r);s*=K;r*=K;v.x+=s;v.y+=r;m.x-=s;m.y-=r}var Sa,cb,P,ra,Ba,Ga,
|
|
|
+Ta,ga;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,o);g.data.vertices=0;g.data.faces=0;f=i.projectScene(U,pa,this.sortElements);(Ua=U.lights.length>0)&&db(U);Sa=0;for(cb=f.length;Sa<cb;Sa++){P=f[Sa];ha.empty();if(P instanceof THREE.RenderableParticle){B=P;B.x*=n;B.y*=o;ra=0;for(Ba=P.materials.length;ra<Ba;){ga=P.materials[ra++];ga.opacity!=0&&eb(B,P,ga,U)}}else if(P instanceof THREE.RenderableLine){B=P.v1;z=P.v2;B.positionScreen.x*=n;B.positionScreen.y*=o;z.positionScreen.x*=n;z.positionScreen.y*=
|
|
|
+o;ha.addPoint(B.positionScreen.x,B.positionScreen.y);ha.addPoint(z.positionScreen.x,z.positionScreen.y);if(Ca.instersects(ha)){ra=0;for(Ba=P.materials.length;ra<Ba;){ga=P.materials[ra++];ga.opacity!=0&&fb(B,z,P,ga,U)}}}else if(P instanceof THREE.RenderableFace3){B=P.v1;z=P.v2;L=P.v3;B.positionScreen.x*=n;B.positionScreen.y*=o;z.positionScreen.x*=n;z.positionScreen.y*=o;L.positionScreen.x*=n;L.positionScreen.y*=o;if(P.overdraw){Aa(B.positionScreen,z.positionScreen);Aa(z.positionScreen,L.positionScreen);
|
|
|
+Aa(L.positionScreen,B.positionScreen)}ha.add3Points(B.positionScreen.x,B.positionScreen.y,z.positionScreen.x,z.positionScreen.y,L.positionScreen.x,L.positionScreen.y);if(Ca.instersects(ha)){ra=0;for(Ba=P.meshMaterials.length;ra<Ba;){ga=P.meshMaterials[ra++];if(ga instanceof THREE.MeshFaceMaterial){Ga=0;for(Ta=P.faceMaterials.length;Ga<Ta;)(ga=P.faceMaterials[Ga++])&&ga.opacity!=0&&Pa(B,z,L,0,1,2,P,ga,U)}else ga.opacity!=0&&Pa(B,z,L,0,1,2,P,ga,U)}}}else if(P instanceof THREE.RenderableFace4){B=P.v1;
|
|
|
+z=P.v2;L=P.v3;Y=P.v4;B.positionScreen.x*=n;B.positionScreen.y*=o;z.positionScreen.x*=n;z.positionScreen.y*=o;L.positionScreen.x*=n;L.positionScreen.y*=o;Y.positionScreen.x*=n;Y.positionScreen.y*=o;C.positionScreen.copy(z.positionScreen);A.positionScreen.copy(Y.positionScreen);if(P.overdraw){Aa(B.positionScreen,z.positionScreen);Aa(z.positionScreen,Y.positionScreen);Aa(Y.positionScreen,B.positionScreen);Aa(L.positionScreen,C.positionScreen);Aa(L.positionScreen,A.positionScreen)}ha.addPoint(B.positionScreen.x,
|
|
|
+B.positionScreen.y);ha.addPoint(z.positionScreen.x,z.positionScreen.y);ha.addPoint(L.positionScreen.x,L.positionScreen.y);ha.addPoint(Y.positionScreen.x,Y.positionScreen.y);if(Ca.instersects(ha)){ra=0;for(Ba=P.meshMaterials.length;ra<Ba;){ga=P.meshMaterials[ra++];if(ga instanceof THREE.MeshFaceMaterial){Ga=0;for(Ta=P.faceMaterials.length;Ga<Ta;)(ga=P.faceMaterials[Ga++])&&ga.opacity!=0&&bb(B,z,L,Y,C,A,P,ga,U)}else ga.opacity!=0&&bb(B,z,L,Y,C,A,P,ga,U)}}}ma.addRectangle(ha)}k.setTransform(1,0,0,1,
|
|
|
+0,0)}};
|
|
|
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
|
|
|
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|