|
@@ -1,6 +1,6 @@
|
|
// Three.js r36 - http://github.com/mrdoob/three.js
|
|
// Three.js r36 - http://github.com/mrdoob/three.js
|
|
var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
|
|
var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
|
|
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,e,h,g,k,j;if(b==0)d=e=h=0;else{g=Math.floor(a*6);k=a*6-g;a=b*(1-c);j=b*(1-c*k);c=b*(1-c*(1-k));switch(g){case 1:d=j;e=b;h=a;break;case 2:d=a;e=b;h=c;break;case 3:d=a;e=j;h=b;break;case 4:d=c;e=a;h=b;break;case 5:d=b;e=a;h=j;break;case 6:case 0:d=b;e=c;h=a}}this.r=d;this.g=e;this.b=h;if(this.autoUpdate){this.updateHex();
|
|
|
|
|
|
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,e,g,h,k,j;if(b==0)d=e=g=0;else{h=Math.floor(a*6);k=a*6-h;a=b*(1-c);j=b*(1-c*k);c=b*(1-c*(1-k));switch(h){case 1:d=j;e=b;g=a;break;case 2:d=a;e=b;g=c;break;case 3:d=a;e=j;g=b;break;case 4:d=c;e=a;g=b;break;case 5:d=b;e=a;g=j;break;case 6:case 0:d=b;e=c;g=a}}this.r=d;this.g=e;this.b=g;if(this.autoUpdate){this.updateHex();
|
|
this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
|
|
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,c){this.set(a||0,c||0)};
|
|
THREE.Vector2=function(a,c){this.set(a||0,c||0)};
|
|
THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;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,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.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/
|
|
THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;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,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.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/
|
|
@@ -12,76 +12,76 @@ 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,c,b,d){this.set(a||0,c||0,b||0,d||1)};
|
|
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,c,b,d){this.set(a||0,c||0,b||0,d||1)};
|
|
THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.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,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.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*
|
|
THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.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,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.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,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
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,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
-THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(h,g){return h.distance-g.distance});return e},intersectObject:function(a){function c(I,E,H,z){z=z.clone().subSelf(E);H=H.clone().subSelf(E);var S=I.clone().subSelf(E);I=z.dot(z);E=z.dot(H);z=z.dot(S);var Q=H.dot(H);H=H.dot(S);S=1/(I*Q-E*E);Q=(Q*z-E*H)*S;I=(I*H-E*z)*S;return Q>0&&I>0&&Q+I<1}var b,d,e,h,g,k,j,m,t,x,
|
|
|
|
-y,q=a.geometry,A=q.vertices,G=[];b=0;for(d=q.faces.length;b<d;b++){e=q.faces[b];x=this.origin.clone();y=this.direction.clone();j=a.matrixWorld;h=j.multiplyVector3(A[e.a].position.clone());g=j.multiplyVector3(A[e.b].position.clone());k=j.multiplyVector3(A[e.c].position.clone());j=e instanceof THREE.Face4?j.multiplyVector3(A[e.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(e.normal.clone());t=y.dot(m);if(t<0){m=m.dot((new THREE.Vector3).sub(h,x))/t;x=x.addSelf(y.multiplyScalar(m));
|
|
|
|
-if(e instanceof THREE.Face3){if(c(x,h,g,k)){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};G.push(e)}}else if(e instanceof THREE.Face4&&(c(x,h,g,j)||c(x,g,k,j))){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};G.push(e)}}}return G}};
|
|
|
|
-THREE.Rectangle=function(){function a(){h=d-c;g=e-b}var c,b,d,e,h,g,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return h};this.getHeight=function(){return g};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(j,m,t,x){k=!1;c=j;b=m;d=t;e=x;a()};this.addPoint=function(j,m){if(k){k=!1;c=j;b=m;d=j;e=m}else{c=c<j?c:j;b=b<m?b:m;d=d>j?d:j;e=e>m?e:m}a()};
|
|
|
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(H,E,I,z){z=z.clone().subSelf(E);I=I.clone().subSelf(E);var S=H.clone().subSelf(E);H=z.dot(z);E=z.dot(I);z=z.dot(S);var P=I.dot(I);I=I.dot(S);S=1/(H*P-E*E);P=(P*z-E*I)*S;H=(H*I-E*z)*S;return P>0&&H>0&&P+H<1}var b,d,e,g,h,k,j,m,t,x,
|
|
|
|
+y,q=a.geometry,A=q.vertices,G=[];b=0;for(d=q.faces.length;b<d;b++){e=q.faces[b];x=this.origin.clone();y=this.direction.clone();j=a.matrixWorld;g=j.multiplyVector3(A[e.a].position.clone());h=j.multiplyVector3(A[e.b].position.clone());k=j.multiplyVector3(A[e.c].position.clone());j=e instanceof THREE.Face4?j.multiplyVector3(A[e.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(e.normal.clone());t=y.dot(m);if(t<0){m=m.dot((new THREE.Vector3).sub(g,x))/t;x=x.addSelf(y.multiplyScalar(m));
|
|
|
|
+if(e instanceof THREE.Face3){if(c(x,g,h,k)){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};G.push(e)}}else if(e instanceof THREE.Face4&&(c(x,g,h,j)||c(x,h,k,j))){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};G.push(e)}}}return G}};
|
|
|
|
+THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(j,m,t,x){k=!1;c=j;b=m;d=t;e=x;a()};this.addPoint=function(j,m){if(k){k=!1;c=j;b=m;d=j;e=m}else{c=c<j?c:j;b=b<m?b:m;d=d>j?d:j;e=e>m?e:m}a()};
|
|
this.add3Points=function(j,m,t,x,y,q){if(k){k=!1;c=j<t?j<y?j:y:t<y?t:y;b=m<x?m<q?m:q:x<q?x:q;d=j>t?j>y?j:y:t>y?t:y;e=m>x?m>q?m:q:x>q?x:q}else{c=j<t?j<y?j<c?j:c:y<c?y:c:t<y?t<c?t:c:y<c?y:c;b=m<x?m<q?m<b?m:b:q<b?q:b:x<q?x<b?x:b:q<b?q:b;d=j>t?j>y?j>d?j:d:y>d?y:d:t>y?t>d?t:d:y>d?y:d;e=m>x?m>q?m>e?m:e:q>e?q:e:x>q?x>e?x:e:q>e?q:e}a()};this.addRectangle=function(j){if(k){k=!1;c=j.getLeft();b=j.getTop();d=j.getRight();e=j.getBottom()}else{c=c<j.getLeft()?c:j.getLeft();b=b<j.getTop()?b:j.getTop();d=d>j.getRight()?
|
|
this.add3Points=function(j,m,t,x,y,q){if(k){k=!1;c=j<t?j<y?j:y:t<y?t:y;b=m<x?m<q?m:q:x<q?x:q;d=j>t?j>y?j:y:t>y?t:y;e=m>x?m>q?m:q:x>q?x:q}else{c=j<t?j<y?j<c?j:c:y<c?y:c:t<y?t<c?t:c:y<c?y:c;b=m<x?m<q?m<b?m:b:q<b?q:b:x<q?x<b?x:b:q<b?q:b;d=j>t?j>y?j>d?j:d:y>d?y:d:t>y?t>d?t:d:y>d?y:d;e=m>x?m>q?m>e?m:e:q>e?q:e:x>q?x>e?x:e:q>e?q:e}a()};this.addRectangle=function(j){if(k){k=!1;c=j.getLeft();b=j.getTop();d=j.getRight();e=j.getBottom()}else{c=c<j.getLeft()?c:j.getLeft();b=b<j.getTop()?b:j.getTop();d=d>j.getRight()?
|
|
d:j.getRight();e=e>j.getBottom()?e:j.getBottom()}a()};this.inflate=function(j){c-=j;b-=j;d+=j;e+=j;a()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();b=b>j.getTop()?b:j.getTop();d=d<j.getRight()?d:j.getRight();e=e<j.getBottom()?e:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(c,j.getLeft())>=0&&Math.min(e,j.getBottom())-Math.max(b,j.getTop())>=0};this.empty=function(){k=!0;e=d=b=c=0;a()};this.isEmpty=function(){return k}};
|
|
d:j.getRight();e=e>j.getBottom()?e:j.getBottom()}a()};this.inflate=function(j){c-=j;b-=j;d+=j;e+=j;a()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();b=b>j.getTop()?b:j.getTop();d=d<j.getRight()?d:j.getRight();e=e<j.getBottom()?e:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(c,j.getLeft())>=0&&Math.min(e,j.getBottom())-Math.max(b,j.getTop())>=0};this.empty=function(){k=!0;e=d=b=c=0;a()};this.isEmpty=function(){return k}};
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
-THREE.Matrix4=function(a,c,b,d,e,h,g,k,j,m,t,x,y,q,A,G){this.set(a||1,c||0,b||0,d||0,e||0,h||1,g||0,k||0,j||0,m||0,t||1,x||0,y||0,q||0,A||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={set:function(a,c,b,d,e,h,g,k,j,m,t,x,y,q,A,G){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=h;this.n23=g;this.n24=k;this.n31=j;this.n32=m;this.n33=t;this.n34=x;this.n41=y;this.n42=q;this.n43=A;this.n44=G;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,c,b){var d=THREE.Matrix4.__v1,
|
|
|
|
-e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;d.cross(b,h).normalize();if(d.length()===0){h.x+=1.0E-4;d.cross(b,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 c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*
|
|
|
|
|
|
+THREE.Matrix4=function(a,c,b,d,e,g,h,k,j,m,t,x,y,q,A,G){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,k||0,j||0,m||0,t||1,x||0,y||0,q||0,A||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,k,j,m,t,x,y,q,A,G){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=t;this.n34=x;this.n41=y;this.n42=q;this.n43=A;this.n44=G;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,c,b){var d=THREE.Matrix4.__v1,
|
|
|
|
+e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,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 c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*
|
|
d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
|
|
d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
|
|
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,h=a.n14,g=a.n21,k=a.n22,j=a.n23,m=a.n24,t=a.n31,x=a.n32,y=a.n33,q=a.n34,A=a.n41,G=a.n42,I=a.n43,E=a.n44,H=c.n11,z=c.n12,S=c.n13,Q=c.n14,N=c.n21,da=c.n22,
|
|
|
|
-f=c.n23,ja=c.n24,na=c.n31,aa=c.n32,Y=c.n33,Da=c.n34;this.n11=b*H+d*N+e*na;this.n12=b*z+d*da+e*aa;this.n13=b*S+d*f+e*Y;this.n14=b*Q+d*ja+e*Da+h;this.n21=g*H+k*N+j*na;this.n22=g*z+k*da+j*aa;this.n23=g*S+k*f+j*Y;this.n24=g*Q+k*ja+j*Da+m;this.n31=t*H+x*N+y*na;this.n32=t*z+x*da+y*aa;this.n33=t*S+x*f+y*Y;this.n34=t*Q+x*ja+y*Da+q;this.n41=A*H+G*N+I*na;this.n42=A*z+G*da+I*aa;this.n43=A*S+G*f+I*Y;this.n44=A*Q+G*ja+I*Da+E;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;
|
|
|
|
|
|
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,t=a.n31,x=a.n32,y=a.n33,q=a.n34,A=a.n41,G=a.n42,H=a.n43,E=a.n44,I=c.n11,z=c.n12,S=c.n13,P=c.n14,O=c.n21,aa=c.n22,
|
|
|
|
+f=c.n23,ha=c.n24,oa=c.n31,$=c.n32,W=c.n33,Da=c.n34;this.n11=b*I+d*O+e*oa;this.n12=b*z+d*aa+e*$;this.n13=b*S+d*f+e*W;this.n14=b*P+d*ha+e*Da+g;this.n21=h*I+k*O+j*oa;this.n22=h*z+k*aa+j*$;this.n23=h*S+k*f+j*W;this.n24=h*P+k*ha+j*Da+m;this.n31=t*I+x*O+y*oa;this.n32=t*z+x*aa+y*$;this.n33=t*S+x*f+y*W;this.n34=t*P+x*ha+y*Da+q;this.n41=A*I+G*O+H*oa;this.n42=A*z+G*aa+H*$;this.n43=A*S+G*f+H*W;this.n44=A*P+G*ha+H*Da+E;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;
|
|
b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[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},
|
|
b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[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,c=this.n12,b=this.n13,d=this.n14,e=this.n21,h=this.n22,g=this.n23,k=this.n24,j=this.n31,m=this.n32,t=this.n33,x=this.n34,y=this.n41,q=this.n42,A=this.n43,G=this.n44;return d*g*m*y-b*k*m*y-d*h*t*y+c*k*t*y+b*h*x*y-c*g*x*y-d*g*j*q+b*k*j*q+d*e*t*q-a*k*t*q-b*e*x*q+a*g*x*q+d*h*j*A-c*k*j*A-d*e*m*A+a*k*m*A+c*e*x*A-a*h*x*A-b*h*j*G+c*g*j*G+b*e*m*G-a*g*m*G-c*e*t*G+a*h*t*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
|
|
|
|
|
|
+determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,t=this.n33,x=this.n34,y=this.n41,q=this.n42,A=this.n43,G=this.n44;return d*h*m*y-b*k*m*y-d*g*t*y+c*k*t*y+b*g*x*y-c*h*x*y-d*h*j*q+b*k*j*q+d*e*t*q-a*k*t*q-b*e*x*q+a*h*x*q+d*g*j*A-c*k*j*A-d*e*m*A+a*k*m*A+c*e*x*A-a*g*x*A-b*g*j*G+c*h*j*G+b*e*m*G-a*h*m*G-c*e*t*G+a*g*t*G},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;
|
|
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;
|
|
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,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},
|
|
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,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},
|
|
-setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),e=1-b,h=a.x,g=a.y,k=
|
|
|
|
-a.z,j=e*h,m=e*g;this.set(j*h+b,j*g-d*k,j*k+d*g,0,j*g+d*k,m*g+b,m*k-d*h,0,j*k-d*g,m*k+d*h,e*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var h=Math.cos(d);d=Math.sin(d);var g=a*b,k=c*b;this.n11=e*h;this.n12=-e*d;this.n13=b;this.n21=k*h+a*d;this.n22=-k*d+a*h;this.n23=-c*e;this.n31=-g*h+c*d;this.n32=g*d+c*h;this.n33=a*e;return this},
|
|
|
|
-setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,e=a.w,h=c+c,g=b+b,k=d+d;a=c*h;var j=c*g;c*=k;var m=b*g;b*=k;d*=k;h*=e;g*=e;e*=k;this.n11=1-(m+d);this.n12=j-e;this.n13=c+g;this.n21=j+e;this.n22=1-(a+d);this.n23=b-h;this.n31=c-g;this.n32=b+h;this.n33=1-(a+m);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
|
|
|
|
|
|
+setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),e=1-b,g=a.x,h=a.y,k=
|
|
|
|
+a.z,j=e*g,m=e*h;this.set(j*g+b,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+b,m*k-d*g,0,j*k-d*h,m*k+d*g,e*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,k=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=k*g+a*d;this.n22=-k*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},
|
|
|
|
+setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,k=d+d;a=c*g;var j=c*h;c*=k;var m=b*h;b*=k;d*=k;g*=e;h*=e;e*=k;this.n11=1-(m+d);this.n12=j-e;this.n13=c+h;this.n21=j+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+m);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
|
|
a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;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}};
|
|
a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;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,c){var b=a.n11,d=a.n12,e=a.n13,h=a.n14,g=a.n21,k=a.n22,j=a.n23,m=a.n24,t=a.n31,x=a.n32,y=a.n33,q=a.n34,A=a.n41,G=a.n42,I=a.n43,E=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=j*q*G-m*y*G+m*x*I-k*q*I-j*x*E+k*y*E;c.n12=h*y*G-e*q*G-h*x*I+d*q*I+e*x*E-d*y*E;c.n13=e*m*G-h*j*G+h*k*I-d*m*I-e*k*E+d*j*E;c.n14=h*j*x-e*m*x-h*k*y+d*m*y+e*k*q-d*j*q;c.n21=m*y*A-j*q*A-m*t*I+g*q*I+j*t*E-g*y*E;c.n22=e*q*A-h*y*A+h*t*I-b*q*I-e*t*E+b*y*E;c.n23=h*j*A-e*m*A-h*g*I+b*m*I+e*g*E-b*j*E;
|
|
|
|
-c.n24=e*m*t-h*j*t+h*g*y-b*m*y-e*g*q+b*j*q;c.n31=k*q*A-m*x*A+m*t*G-g*q*G-k*t*E+g*x*E;c.n32=h*x*A-d*q*A-h*t*G+b*q*G+d*t*E-b*x*E;c.n33=e*m*A-h*k*A+h*g*G-b*m*G-d*g*E+b*k*E;c.n34=h*k*t-d*m*t-h*g*x+b*m*x+d*g*q-b*k*q;c.n41=j*x*A-k*y*A-j*t*G+g*y*G+k*t*I-g*x*I;c.n42=d*y*A-e*x*A+e*t*G-b*y*G-d*t*I+b*x*I;c.n43=e*k*A-d*j*A-e*g*G+b*j*G+d*g*I-b*k*I;c.n44=d*j*t-e*k*t+e*g*x-b*j*x-d*g*y+b*k*y;c.multiplyScalar(1/a.determinant());return c};
|
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.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,g=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*h;b[3]=a*g;b[4]=a*k;b[5]=a*j;b[6]=a*m;b[7]=a*t;b[8]=a*x;return c};
|
|
|
|
-THREE.Matrix4.makeFrustum=function(a,c,b,d,e,h){var g;g=new THREE.Matrix4;g.n11=2*e/(c-a);g.n12=0;g.n13=(c+a)/(c-a);g.n14=0;g.n21=0;g.n22=2*e/(d-b);g.n23=(d+b)/(d-b);g.n24=0;g.n31=0;g.n32=0;g.n33=-(h+e)/(h-e);g.n34=-2*h*e/(h-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)};
|
|
|
|
-THREE.Matrix4.makeOrtho=function(a,c,b,d,e,h){var g,k,j,m;g=new THREE.Matrix4;k=c-a;j=b-d;m=h-e;g.n11=2/k;g.n12=0;g.n13=0;g.n14=-((c+a)/k);g.n21=0;g.n22=2/j;g.n23=0;g.n24=-((b+d)/j);g.n31=0;g.n32=0;g.n33=-2/m;g.n34=-((h+e)/m);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
|
|
|
+THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,t=a.n31,x=a.n32,y=a.n33,q=a.n34,A=a.n41,G=a.n42,H=a.n43,E=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=j*q*G-m*y*G+m*x*H-k*q*H-j*x*E+k*y*E;c.n12=g*y*G-e*q*G-g*x*H+d*q*H+e*x*E-d*y*E;c.n13=e*m*G-g*j*G+g*k*H-d*m*H-e*k*E+d*j*E;c.n14=g*j*x-e*m*x-g*k*y+d*m*y+e*k*q-d*j*q;c.n21=m*y*A-j*q*A-m*t*H+h*q*H+j*t*E-h*y*E;c.n22=e*q*A-g*y*A+g*t*H-b*q*H-e*t*E+b*y*E;c.n23=g*j*A-e*m*A-g*h*H+b*m*H+e*h*E-b*j*E;
|
|
|
|
+c.n24=e*m*t-g*j*t+g*h*y-b*m*y-e*h*q+b*j*q;c.n31=k*q*A-m*x*A+m*t*G-h*q*G-k*t*E+h*x*E;c.n32=g*x*A-d*q*A-g*t*G+b*q*G+d*t*E-b*x*E;c.n33=e*m*A-g*k*A+g*h*G-b*m*G-d*h*E+b*k*E;c.n34=g*k*t-d*m*t-g*h*x+b*m*x+d*h*q-b*k*q;c.n41=j*x*A-k*y*A-j*t*G+h*y*G+k*t*H-h*x*H;c.n42=d*y*A-e*x*A+e*t*G-b*y*G-d*t*H+b*x*H;c.n43=e*k*A-d*j*A-e*h*G+b*j*G+d*h*H-b*k*H;c.n44=d*j*t-e*k*t+e*h*x-b*j*x-d*h*y+b*k*y;c.multiplyScalar(1/a.determinant());return c};
|
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.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,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*k;b[5]=a*j;b[6]=a*m;b[7]=a*t;b[8]=a*x;return c};
|
|
|
|
+THREE.Matrix4.makeFrustum=function(a,c,b,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*e/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)};
|
|
|
|
+THREE.Matrix4.makeOrtho=function(a,c,b,d,e,g){var h,k,j,m;h=new THREE.Matrix4;k=c-a;j=b-d;m=g-e;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((b+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+e)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};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=
|
|
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};
|
|
!0;this._vector=new THREE.Vector3};
|
|
THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.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(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
|
|
THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.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(this.position,a,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 c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
|
|
undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
|
|
1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
|
|
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,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
|
|
c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
|
|
c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
|
|
-THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(b);b=Math.sin(b);var g=a*c,k=d*e;this.w=g*h-k*b;this.x=g*b+k*h;this.y=d*c*h+a*e*b;this.z=a*e*h-d*c*b;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 c=this.x,b=this.y,d=this.z,e=this.w,h=a.x,g=a.y,k=a.z;a=a.w;this.x=c*a+e*h+b*k-d*g;this.y=b*a+e*g+d*h-c*k;this.z=d*a+e*k+c*g-b*h;this.w=e*a-c*h-b*g-d*k;return this},
|
|
|
|
-multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,h=this.x,g=this.y,k=this.z,j=this.w,m=j*b+g*e-k*d,t=j*d+k*b-h*e,x=j*e+h*d-g*b;b=-h*b-g*d-k*e;c.x=m*j+b*-h+t*-k-x*-g;c.y=t*j+b*-g+x*-h-m*-k;c.z=x*j+b*-k+m*-g-t*-h;return c}};
|
|
|
|
-THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var h=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*h)/g;d=Math.sin(d*h)/g;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
|
-THREE.Face3=function(a,c,b,d,e,h){this.a=a;this.b=c;this.c=b;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.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
|
|
-THREE.Face4=function(a,c,b,d,e,h,g){this.a=a;this.b=c;this.c=b;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.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
|
|
|
|
+THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,k=d*e;this.w=h*g-k*b;this.x=h*b+k*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;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 c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=c*a+e*g+b*k-d*h;this.y=b*a+e*h+d*g-c*k;this.z=d*a+e*k+c*h-b*g;this.w=e*a-c*g-b*h-d*k;return this},
|
|
|
|
+multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*b+h*e-k*d,t=j*d+k*b-g*e,x=j*e+g*d-h*b;b=-g*b-h*d-k*e;c.x=m*j+b*-g+t*-k-x*-h;c.y=t*j+b*-h+x*-g-m*-k;c.z=x*j+b*-k+m*-h-t*-g;return c}};
|
|
|
|
+THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
|
+THREE.Face3=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;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,c,b,d,e,g,h){this.a=a;this.b=c;this.c=b;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=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
|
|
|
|
+THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
|
|
THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.centroid.set(0,0,0);if(b instanceof THREE.Face3){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);b.centroid.divideScalar(3)}else if(b instanceof THREE.Face4){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);
|
|
THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.centroid.set(0,0,0);if(b instanceof THREE.Face3){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);b.centroid.divideScalar(3)}else if(b instanceof THREE.Face4){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);
|
|
-b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,h,g,k=new THREE.Vector3,j=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);c=0;for(b=h.vertexNormals.length;c<b;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[h.a];b=this.vertices[h.b];g=this.vertices[h.c];k.sub(g.position,b.position);j.sub(c.position,b.position);k.crossSelf(j)}k.isZero()||
|
|
|
|
-k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
|
|
|
|
|
|
+b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,b.position);j.sub(c.position,b.position);k.crossSelf(j)}k.isZero()||
|
|
|
|
+k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
|
|
this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);
|
|
this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);
|
|
-b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(Da,ea,Ea,ia,ra,oa,$){h=Da.vertices[ea].position;g=Da.vertices[Ea].position;k=Da.vertices[ia].position;j=e[ra];m=e[oa];t=e[$];x=g.x-h.x;y=k.x-h.x;q=g.y-h.y;A=k.y-h.y;G=g.z-h.z;I=k.z-h.z;E=m.u-j.u;H=t.u-j.u;z=m.v-j.v;S=t.v-j.v;Q=1/(E*S-
|
|
|
|
-H*z);f.set((S*x-z*y)*Q,(S*q-z*A)*Q,(S*G-z*I)*Q);ja.set((E*y-H*x)*Q,(E*A-H*q)*Q,(E*I-H*G)*Q);N[ea].addSelf(f);N[Ea].addSelf(f);N[ia].addSelf(f);da[ea].addSelf(ja);da[Ea].addSelf(ja);da[ia].addSelf(ja)}var c,b,d,e,h,g,k,j,m,t,x,y,q,A,G,I,E,H,z,S,Q,N=[],da=[],f=new THREE.Vector3,ja=new THREE.Vector3,na=new THREE.Vector3,aa=new THREE.Vector3,Y=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){N[c]=new THREE.Vector3;da[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){d=this.faces[c];e=
|
|
|
|
-this.faceVertexUvs[c][0];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=
|
|
|
|
-0;for(b=this.vertices.length;c<b;c++){Y.copy(this.vertices[c].normal);d=N[c];na.copy(d);na.subSelf(Y.multiplyScalar(Y.dot(d))).normalize();aa.cross(this.vertices[c].normal,d);d=aa.dot(da[c]);d=d<0?-1:1;this.vertices[c].tangent.set(na.x,na.y,na.z,d)}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 c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=
|
|
|
|
-a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
|
|
|
|
-THREE.Spline=function(a){function c(q,A,G,I,E,H,z){q=(G-q)*0.5;I=(I-A)*0.5;return(2*(A-G)+q+I)*z+(-3*(A-G)-2*q-I)*H+q*E+A}this.points=a;var b=[],d={x:0,y:0,z:0},e,h,g,k,j,m,t,x,y;this.initFromArray=function(q){this.points=[];for(var A=0;A<q.length;A++)this.points[A]={x:q[A][0],y:q[A][1],z:q[A][2]}};this.getPoint=function(q){e=(this.points.length-1)*q;h=Math.floor(e);g=e-h;b[0]=h==0?h:h-1;b[1]=h;b[2]=h>this.points.length-2?h:h+1;b[3]=h>this.points.length-3?h:h+2;m=this.points[b[0]];t=this.points[b[1]];
|
|
|
|
-x=this.points[b[2]];y=this.points[b[3]];k=g*g;j=g*k;d.x=c(m.x,t.x,x.x,y.x,g,k,j);d.y=c(m.y,t.y,x.y,y.y,g,k,j);d.z=c(m.z,t.z,x.z,y.z,g,k,j);return d};this.getControlPointsArray=function(){var q,A,G=this.points.length,I=[];for(q=0;q<G;q++){A=this.points[q];I[q]=[A.x,A.y,A.z]}return I};this.getLength=function(q){var A,G,I=A=A=0,E=new THREE.Vector3,H=new THREE.Vector3,z=[],S=0;z[0]=0;q||(q=100);G=this.points.length*q;E.copy(this.points[0]);for(q=1;q<G;q++){A=q/G;position=this.getPoint(A);H.copy(position);
|
|
|
|
-S+=H.distanceTo(E);E.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=I){z[A]=S;I=A}}z[z.length]=S;return{chunks:z,total:S}};this.reparametrizeByArcLength=function(q){var A,G,I,E,H,z,S=[],Q=new THREE.Vector3,N=this.getLength();S.push(Q.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){G=N.chunks[A]-N.chunks[A-1];z=Math.ceil(q*G/N.total);E=(A-1)/(this.points.length-1);H=A/(this.points.length-1);for(G=1;G<z-1;G++){I=E+G*(1/z)*(H-E);position=this.getPoint(I);S.push(Q.copy(position).clone())}S.push(Q.copy(this.points[A]).clone())}this.points=
|
|
|
|
|
|
+b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(qa,ma,Z,Q,M,ea,ua){k=qa.vertices[ma].position;j=qa.vertices[Z].position;m=qa.vertices[Q].position;t=h[M];x=h[ea];y=h[ua];q=j.x-k.x;A=m.x-k.x;G=j.y-k.y;H=m.y-k.y;E=j.z-k.z;I=m.z-k.z;z=x.u-t.u;S=y.u-t.u;P=x.v-t.v;O=y.v-t.v;aa=1/(z*O-S*P);
|
|
|
|
+$.set((O*q-P*A)*aa,(O*G-P*H)*aa,(O*E-P*I)*aa);W.set((z*A-S*q)*aa,(z*H-S*G)*aa,(z*I-S*E)*aa);ha[ma].addSelf($);ha[Z].addSelf($);ha[Q].addSelf($);oa[ma].addSelf(W);oa[Z].addSelf(W);oa[Q].addSelf(W)}var c,b,d,e,g,h,k,j,m,t,x,y,q,A,G,H,E,I,z,S,P,O,aa,f,ha=[],oa=[],$=new THREE.Vector3,W=new THREE.Vector3,Da=new THREE.Vector3,da=new THREE.Vector3,Fa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){ha[c]=new THREE.Vector3;oa[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];
|
|
|
|
+h=this.faceVertexUvs[0][c];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 ja=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];for(d=0;d<g.vertexNormals.length;d++){Fa.copy(g.vertexNormals[d]);e=g[ja[d]];f=ha[e];Da.copy(f);Da.subSelf(Fa.multiplyScalar(Fa.dot(f))).normalize();da.cross(g.vertexNormals[d],f);e=da.dot(oa[e]);e=e<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(Da.x,Da.y,
|
|
|
|
+Da.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 c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;
|
|
|
|
+if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere=
|
|
|
|
+{radius:a}}};THREE.GeometryIdCounter=0;
|
|
|
|
+THREE.Spline=function(a){function c(q,A,G,H,E,I,z){q=(G-q)*0.5;H=(H-A)*0.5;return(2*(A-G)+q+H)*z+(-3*(A-G)-2*q-H)*I+q*E+A}this.points=a;var b=[],d={x:0,y:0,z:0},e,g,h,k,j,m,t,x,y;this.initFromArray=function(q){this.points=[];for(var A=0;A<q.length;A++)this.points[A]={x:q[A][0],y:q[A][1],z:q[A][2]}};this.getPoint=function(q){e=(this.points.length-1)*q;g=Math.floor(e);h=e-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;m=this.points[b[0]];t=this.points[b[1]];
|
|
|
|
+x=this.points[b[2]];y=this.points[b[3]];k=h*h;j=h*k;d.x=c(m.x,t.x,x.x,y.x,h,k,j);d.y=c(m.y,t.y,x.y,y.y,h,k,j);d.z=c(m.z,t.z,x.z,y.z,h,k,j);return d};this.getControlPointsArray=function(){var q,A,G=this.points.length,H=[];for(q=0;q<G;q++){A=this.points[q];H[q]=[A.x,A.y,A.z]}return H};this.getLength=function(q){var A,G,H=A=A=0,E=new THREE.Vector3,I=new THREE.Vector3,z=[],S=0;z[0]=0;q||(q=100);G=this.points.length*q;E.copy(this.points[0]);for(q=1;q<G;q++){A=q/G;position=this.getPoint(A);I.copy(position);
|
|
|
|
+S+=I.distanceTo(E);E.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=H){z[A]=S;H=A}}z[z.length]=S;return{chunks:z,total:S}};this.reparametrizeByArcLength=function(q){var A,G,H,E,I,z,S=[],P=new THREE.Vector3,O=this.getLength();S.push(P.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){G=O.chunks[A]-O.chunks[A-1];z=Math.ceil(q*G/O.total);E=(A-1)/(this.points.length-1);I=A/(this.points.length-1);for(G=1;G<z-1;G++){H=E+G*(1/z)*(I-E);position=this.getPoint(H);S.push(P.copy(position).clone())}S.push(P.copy(this.points[A]).clone())}this.points=
|
|
S}};
|
|
S}};
|
|
-THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(e){for(var h=0;h<a.length;h++)a[h].update(e)};b.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};b.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};b.add=function(e){c[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");c[e.name]=e;if(e.initialized!==!0){for(var h=0;h<e.hierarchy.length;h++){for(var g=0;g<e.hierarchy[h].keys.length;g++){if(e.hierarchy[h].keys[g].time<0)e.hierarchy[h].keys[g].time=
|
|
|
|
-0;if(e.hierarchy[h].keys[g].rot!==undefined&&!(e.hierarchy[h].keys[g].rot instanceof THREE.Quaternion)){var k=e.hierarchy[h].keys[g].rot;e.hierarchy[h].keys[g].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(e.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(g=0;g<e.hierarchy[h].keys.length;g++)for(var j=0;j<e.hierarchy[h].keys[g].morphTargets.length;j++){var m=e.hierarchy[h].keys[g].morphTargets[j];k[m]=-1}e.hierarchy[h].usedMorphTargets=k;for(g=0;g<e.hierarchy[h].keys.length;g++){var t=
|
|
|
|
-{};for(m in k){for(j=0;j<e.hierarchy[h].keys[g].morphTargets.length;j++)if(e.hierarchy[h].keys[g].morphTargets[j]===m){t[m]=e.hierarchy[h].keys[g].morphTargetsInfluences[j];break}j===e.hierarchy[h].keys[g].morphTargets.length&&(t[m]=0)}e.hierarchy[h].keys[g].morphTargetsInfluences=t}}for(g=1;g<e.hierarchy[h].keys.length;g++)if(e.hierarchy[h].keys[g].time===e.hierarchy[h].keys[g-1].time){e.hierarchy[h].keys.splice(g,1);g--}for(g=1;g<e.hierarchy[h].keys.length;g++)e.hierarchy[h].keys[g].index=g}g=parseInt(e.length*
|
|
|
|
-e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(h=0;h<e.hierarchy.length;h++)e.JIT.hierarchy.push(Array(g));e.initialized=!0}};b.get=function(e){if(typeof e==="string")if(c[e])return c[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};b.parse=function(e){var h=[];if(e instanceof THREE.SkinnedMesh)for(var g=0;g<e.bones.length;g++)h.push(e.bones[g]);else d(e,h);return h};var d=function(e,h){h.push(e);for(var g=0;g<e.children.length;g++)d(e.children[g],h)};b.LINEAR=
|
|
|
|
|
|
+THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(e){for(var g=0;g<a.length;g++)a[g].update(e)};b.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};b.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};b.add=function(e){c[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");c[e.name]=e;if(e.initialized!==!0){for(var g=0;g<e.hierarchy.length;g++){for(var h=0;h<e.hierarchy[g].keys.length;h++){if(e.hierarchy[g].keys[h].time<0)e.hierarchy[g].keys[h].time=
|
|
|
|
+0;if(e.hierarchy[g].keys[h].rot!==undefined&&!(e.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var k=e.hierarchy[g].keys[h].rot;e.hierarchy[g].keys[h].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(e.hierarchy[g].keys[0].morphTargets!==undefined){k={};for(h=0;h<e.hierarchy[g].keys.length;h++)for(var j=0;j<e.hierarchy[g].keys[h].morphTargets.length;j++){var m=e.hierarchy[g].keys[h].morphTargets[j];k[m]=-1}e.hierarchy[g].usedMorphTargets=k;for(h=0;h<e.hierarchy[g].keys.length;h++){var t=
|
|
|
|
+{};for(m in k){for(j=0;j<e.hierarchy[g].keys[h].morphTargets.length;j++)if(e.hierarchy[g].keys[h].morphTargets[j]===m){t[m]=e.hierarchy[g].keys[h].morphTargetsInfluences[j];break}j===e.hierarchy[g].keys[h].morphTargets.length&&(t[m]=0)}e.hierarchy[g].keys[h].morphTargetsInfluences=t}}for(h=1;h<e.hierarchy[g].keys.length;h++)if(e.hierarchy[g].keys[h].time===e.hierarchy[g].keys[h-1].time){e.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<e.hierarchy[g].keys.length;h++)e.hierarchy[g].keys[h].index=h}h=parseInt(e.length*
|
|
|
|
+e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(g=0;g<e.hierarchy.length;g++)e.JIT.hierarchy.push(Array(h));e.initialized=!0}};b.get=function(e){if(typeof e==="string")if(c[e])return c[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};b.parse=function(e){var g=[];if(e instanceof THREE.SkinnedMesh)for(var h=0;h<e.bones.length;h++)g.push(e.bones[h]);else d(e,g);return g};var d=function(e,g){g.push(e);for(var h=0;h<e.children.length;h++)d(e.children[h],g)};b.LINEAR=
|
|
0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
|
|
0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
|
|
THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,d=this.hierarchy.length,e;for(b=0;b<d;b++){e=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
|
|
THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,d=this.hierarchy.length,e;for(b=0;b<d;b++){e=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
|
|
-e instanceof THREE.Bone?e.skinMatrix:e.matrix}var h=e.animationCache.prevKey;e=e.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
|
|
|
+e instanceof THREE.Bone?e.skinMatrix:e.matrix}var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
|
|
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,h,g,k,j,m,t=this.data.JIT.hierarchy,x,y;this.currentTime+=a*this.timeScale;y=this.currentTime;x=this.currentTime%=this.data.length;m=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var q=0,A=this.hierarchy.length;q<A;q++){a=this.hierarchy[q];j=a.animationCache;if(this.JITCompile&&t[q][m]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=t[q][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
|
|
|
|
-!1}else{a.matrix=t[q][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var G=0;G<3;G++){b=c[G];g=j.prevKey[b];k=j.nextKey[b];if(k.time<=y){if(x<y)if(this.loop){g=this.data.hierarchy[q].keys[0];for(k=this.getNextKeyWith(b,q,1);k.time<x;){g=k;k=this.getNextKeyWith(b,q,k.index+1)}}else{this.stop();return}else{do{g=k;k=this.getNextKeyWith(b,q,k.index+1)}while(k.time<
|
|
|
|
-x)}j.prevKey[b]=g;j.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-g.time)/(k.time-g.time);e=g[b];h=k[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+q);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(h[0]-e[0])*d;b.y=e[1]+(h[1]-e[1])*d;b.z=e[2]+(h[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
|
|
-this.getPrevKeyWith("pos",q,g.index-1).pos;this.points[1]=e;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",q,k.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
|
|
|
|
-"rot")THREE.Quaternion.slerp(e,h,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(h[0]-e[0])*d;b.y=e[1]+(h[1]-e[1])*d;b.z=e[2]+(h[2]-e[2])*d}}}}if(this.JITCompile&&t[0][m]===undefined){this.hierarchy[0].update(undefined,!0);for(q=0;q<this.hierarchy.length;q++)t[q][m]=this.hierarchy[q]instanceof THREE.Bone?this.hierarchy[q].skinMatrix.clone():this.hierarchy[q].matrix.clone()}}};
|
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,h,g,k,j,m;e=(a.length-1)*c;h=Math.floor(e);e-=h;b[0]=h==0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];j=a[b[2]];m=a[b[3]];b=e*e;g=e*b;d[0]=this.interpolate(h[0],k[0],j[0],m[0],e,b,g);d[1]=this.interpolate(h[1],k[1],j[1],m[1],e,b,g);d[2]=this.interpolate(h[2],k[2],j[2],m[2],e,b,g);return d};
|
|
|
|
-THREE.Animation.prototype.interpolate=function(a,c,b,d,e,h,g){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*g+(-3*(c-b)-2*a-d)*h+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,g,h,k,j,m,t=this.data.JIT.hierarchy,x,y;this.currentTime+=a*this.timeScale;y=this.currentTime;x=this.currentTime%=this.data.length;m=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var q=0,A=this.hierarchy.length;q<A;q++){a=this.hierarchy[q];j=a.animationCache;if(this.JITCompile&&t[q][m]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=t[q][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
|
|
|
|
+!1}else{a.matrix=t[q][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var G=0;G<3;G++){b=c[G];h=j.prevKey[b];k=j.nextKey[b];if(k.time<=y){if(x<y)if(this.loop){h=this.data.hierarchy[q].keys[0];for(k=this.getNextKeyWith(b,q,1);k.time<x;){h=k;k=this.getNextKeyWith(b,q,k.index+1)}}else{this.stop();return}else{do{h=k;k=this.getNextKeyWith(b,q,k.index+1)}while(k.time<
|
|
|
|
+x)}j.prevKey[b]=h;j.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-h.time)/(k.time-h.time);e=h[b];g=k[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+q);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
|
|
|
|
+this.getPrevKeyWith("pos",q,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",q,k.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
|
|
|
|
+"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&t[0][m]===undefined){this.hierarchy[0].update(undefined,!0);for(q=0;q<this.hierarchy.length;q++)t[q][m]=this.hierarchy[q]instanceof THREE.Bone?this.hierarchy[q].skinMatrix.clone():this.hierarchy[q].matrix.clone()}}};
|
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,h,k,j,m;e=(a.length-1)*c;g=Math.floor(e);e-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];k=a[b[1]];j=a[b[2]];m=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],k[0],j[0],m[0],e,b,h);d[1]=this.interpolate(g[1],k[1],j[1],m[1],e,b,h);d[2]=this.interpolate(g[2],k[2],j[2],m[2],e,b,h);return d};
|
|
|
|
+THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
|
|
THREE.Camera=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||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=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||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,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
|
|
THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
|
|
@@ -114,7 +114,7 @@ if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if
|
|
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
|
|
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
|
|
a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
|
|
a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
|
|
THREE.ParticleCanvasMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.program=function(){};this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.program!==undefined)this.program=a.program;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};
|
|
THREE.ParticleCanvasMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.program=function(){};this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.program!==undefined)this.program=a.program;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};
|
|
-THREE.Texture=function(a,c,b,d,e,h){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b: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,c,b,d,e,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b: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.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.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
THREE.RenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==undefined?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==undefined?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==undefined?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==undefined?b.minFilter:THREE.LinearMipMapLinearFilter;this.format=b.format!==undefined?b.format:THREE.RGBFormat;this.type=b.type!==undefined?b.type:THREE.UnsignedByteType};
|
|
THREE.RenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==undefined?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==undefined?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==undefined?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==undefined?b.minFilter:THREE.LinearMipMapLinearFilter;this.format=b.format!==undefined?b.format:THREE.RGBFormat;this.type=b.type!==undefined?b.type:THREE.UnsignedByteType};
|
|
@@ -126,12 +126,12 @@ this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}}}};THREE.Mesh.
|
|
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
|
|
THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
|
|
c,b)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
c,b)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
-THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,d,e,h,g,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){e=this.geometry.bones[b];h=e.pos;g=e.rotq;k=e.scl;d=this.addBone();d.name=e.name;d.position.set(h[0],h[1],h[2]);d.quaternion.set(g[0],g[1],g[2],g[3]);d.useQuaternion=!0;k!==undefined?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){e=this.geometry.bones[b];
|
|
|
|
|
|
+THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,d,e,g,h,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){e=this.geometry.bones[b];g=e.pos;h=e.rotq;k=e.scl;d=this.addBone();d.name=e.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=!0;k!==undefined?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){e=this.geometry.bones[b];
|
|
d=this.bones[b];e.parent===-1?this.addChild(d):this.bones[e.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
d=this.bones[b];e.parent===-1?this.addChild(d):this.bones[e.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
|
|
c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
|
|
|
|
-d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[e].multiplyVector3(d));d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
|
|
|
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
|
|
|
|
+d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[e].multiplyVector3(d));d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
|
|
THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
|
|
THREE.Sound=function(a,c,b,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)e=
|
|
THREE.Sound=function(a,c,b,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)e=
|
|
"audio/mpeg";else if(c.indexOf(".ogg")!==-1)e="audio/ogg";else c.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
|
|
"audio/mpeg";else if(c.indexOf(".ogg")!==-1)e="audio/ogg";else c.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
|
|
@@ -144,55 +144,56 @@ THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updat
|
|
THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};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 c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
|
|
THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};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 c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
|
|
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 c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
|
|
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 c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
|
|
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.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
|
|
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.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
|
|
-THREE.Projector=function(){function a(){var aa=j[k]=j[k]||new THREE.RenderableVertex;k++;return aa}function c(aa,Y){return Y.z-aa.z}function b(aa,Y){var Da=0,ea=1,Ea=aa.z+aa.w,ia=Y.z+Y.w,ra=-aa.z+aa.w,oa=-Y.z+Y.w;if(Ea>=0&&ia>=0&&ra>=0&&oa>=0)return!0;else if(Ea<0&&ia<0||ra<0&&oa<0)return!1;else{if(Ea<0)Da=Math.max(Da,Ea/(Ea-ia));else ia<0&&(ea=Math.min(ea,Ea/(Ea-ia)));if(ra<0)Da=Math.max(Da,ra/(ra-oa));else oa<0&&(ea=Math.min(ea,ra/(ra-oa)));if(ea<Da)return!1;else{aa.lerpSelf(Y,Da);Y.lerpSelf(aa,
|
|
|
|
-1-ea);return!0}}}var d,e,h=[],g,k,j=[],m,t,x=[],y,q=[],A,G,I=[],E,H,z=[],S=new THREE.Vector4,Q=new THREE.Vector4,N=new THREE.Matrix4,da=new THREE.Matrix4,f=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Vector4,na=new THREE.Vector4;this.projectVector=function(aa,Y){N.multiply(Y.projectionMatrix,Y.matrixWorldInverse);N.multiplyVector3(aa);return aa};this.unprojectVector=function(aa,Y){N.multiply(Y.matrixWorld,THREE.Matrix4.makeInvert(Y.projectionMatrix));
|
|
|
|
-N.multiplyVector3(aa);return aa};this.projectObjects=function(aa,Y,Da){Y=[];var ea,Ea,ia;e=0;Ea=aa.objects;aa=0;for(ea=Ea.length;aa<ea;aa++){ia=Ea[aa];var ra;if(!(ra=!ia.visible))if(ra=ia instanceof THREE.Mesh){a:{ra=void 0;for(var oa=ia.matrixWorld,$=-ia.geometry.boundingSphere.radius*Math.max(ia.scale.x,Math.max(ia.scale.y,ia.scale.z)),R=0;R<6;R++){ra=f[R].x*oa.n14+f[R].y*oa.n24+f[R].z*oa.n34+f[R].w;if(ra<=$){ra=!1;break a}}ra=!0}ra=!ra}if(!ra){ra=h[e]=h[e]||new THREE.RenderableObject;e++;d=ra;
|
|
|
|
-S.copy(ia.position);N.multiplyVector3(S);d.object=ia;d.z=S.z;Y.push(d)}}Da&&Y.sort(c);return Y};this.projectScene=function(aa,Y,Da){var ea=[],Ea=Y.near,ia=Y.far,ra,oa,$,R,O,ha,va,ka,ta,xa,Ma,ab,n,C,p,o,w;H=G=y=t=0;Y.matrixAutoUpdate&&Y.updateMatrix();aa.update(undefined,!1,Y);N.multiply(Y.projectionMatrix,Y.matrixWorldInverse);f[0].set(N.n41-N.n11,N.n42-N.n12,N.n43-N.n13,N.n44-N.n14);f[1].set(N.n41+N.n11,N.n42+N.n12,N.n43+N.n13,N.n44+N.n14);f[2].set(N.n41+N.n21,N.n42+N.n22,N.n43+N.n23,N.n44+N.n24);
|
|
|
|
-f[3].set(N.n41-N.n21,N.n42-N.n22,N.n43-N.n23,N.n44-N.n24);f[4].set(N.n41-N.n31,N.n42-N.n32,N.n43-N.n33,N.n44-N.n34);f[5].set(N.n41+N.n31,N.n42+N.n32,N.n43+N.n33,N.n44+N.n34);for(ra=0;ra<6;ra++){ta=f[ra];ta.divideScalar(Math.sqrt(ta.x*ta.x+ta.y*ta.y+ta.z*ta.z))}ta=this.projectObjects(aa,Y,!0);aa=0;for(ra=ta.length;aa<ra;aa++){xa=ta[aa].object;if(xa.visible){Ma=xa.matrixWorld;ab=xa.matrixRotationWorld;n=xa.materials;C=xa.overdraw;k=0;if(xa instanceof THREE.Mesh){p=xa.geometry;R=p.vertices;o=p.faces;
|
|
|
|
-p=p.faceVertexUvs;oa=0;for($=R.length;oa<$;oa++){g=a();g.positionWorld.copy(R[oa].position);Ma.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);N.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>Ea&&g.positionScreen.z<ia}R=0;for(oa=o.length;R<oa;R++){$=o[R];if($ instanceof THREE.Face3){O=j[$.a];ha=j[$.b];va=j[$.c];if(O.visible&&ha.visible&&va.visible&&(xa.doubleSided||xa.flipSided!=(va.positionScreen.x-
|
|
|
|
-O.positionScreen.x)*(ha.positionScreen.y-O.positionScreen.y)-(va.positionScreen.y-O.positionScreen.y)*(ha.positionScreen.x-O.positionScreen.x)<0)){ka=x[t]=x[t]||new THREE.RenderableFace3;t++;m=ka;m.v1.copy(O);m.v2.copy(ha);m.v3.copy(va)}else continue}else if($ instanceof THREE.Face4){O=j[$.a];ha=j[$.b];va=j[$.c];ka=j[$.d];if(O.visible&&ha.visible&&va.visible&&ka.visible&&(xa.doubleSided||xa.flipSided!=((ka.positionScreen.x-O.positionScreen.x)*(ha.positionScreen.y-O.positionScreen.y)-(ka.positionScreen.y-
|
|
|
|
-O.positionScreen.y)*(ha.positionScreen.x-O.positionScreen.x)<0||(ha.positionScreen.x-va.positionScreen.x)*(ka.positionScreen.y-va.positionScreen.y)-(ha.positionScreen.y-va.positionScreen.y)*(ka.positionScreen.x-va.positionScreen.x)<0))){w=q[y]=q[y]||new THREE.RenderableFace4;y++;m=w;m.v1.copy(O);m.v2.copy(ha);m.v3.copy(va);m.v4.copy(ka)}else continue}m.normalWorld.copy($.normal);ab.multiplyVector3(m.normalWorld);m.centroidWorld.copy($.centroid);Ma.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);
|
|
|
|
-N.multiplyVector3(m.centroidScreen);va=$.vertexNormals;O=0;for(ha=va.length;O<ha;O++){ka=m.vertexNormalsWorld[O];ka.copy(va[O]);ab.multiplyVector3(ka)}O=0;for(ha=p.length;O<ha;O++)if(w=p[O][R]){va=0;for(ka=w.length;va<ka;va++)m.uvs[O][va]=w[va]}m.meshMaterials=n;m.faceMaterials=$.materials;m.overdraw=C;m.z=m.centroidScreen.z;ea.push(m)}}else if(xa instanceof THREE.Line){da.multiply(N,Ma);R=xa.geometry.vertices;O=a();O.positionScreen.copy(R[0].position);da.multiplyVector4(O.positionScreen);oa=1;for($=
|
|
|
|
-R.length;oa<$;oa++){O=a();O.positionScreen.copy(R[oa].position);da.multiplyVector4(O.positionScreen);ha=j[k-2];ja.copy(O.positionScreen);na.copy(ha.positionScreen);if(b(ja,na)){ja.multiplyScalar(1/ja.w);na.multiplyScalar(1/na.w);Ma=I[G]=I[G]||new THREE.RenderableLine;G++;A=Ma;A.v1.positionScreen.copy(ja);A.v2.positionScreen.copy(na);A.z=Math.max(ja.z,na.z);A.materials=xa.materials;ea.push(A)}}}else if(xa instanceof THREE.Particle){Q.set(xa.position.x,xa.position.y,xa.position.z,1);N.multiplyVector4(Q);
|
|
|
|
-Q.z/=Q.w;if(Q.z>0&&Q.z<1){Ma=z[H]=z[H]||new THREE.RenderableParticle;H++;E=Ma;E.x=Q.x/Q.w;E.y=Q.y/Q.w;E.z=Q.z;E.rotation=xa.rotation.z;E.scale.x=xa.scale.x*Math.abs(E.x-(Q.x+Y.projectionMatrix.n11)/(Q.w+Y.projectionMatrix.n14));E.scale.y=xa.scale.y*Math.abs(E.y-(Q.y+Y.projectionMatrix.n22)/(Q.w+Y.projectionMatrix.n24));E.materials=xa.materials;ea.push(E)}}}}Da&&ea.sort(c);return ea}};
|
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,h;this.domElement=document.createElement("div");this.setSize=function(g,k){b=g;d=k;e=b/2;h=d/2};this.render=function(g,k){var j,m,t,x,y,q,A,G;a=c.projectScene(g,k);j=0;for(m=a.length;j<m;j++){y=a[j];if(y instanceof THREE.RenderableParticle){A=y.x*e+e;G=y.y*h+h;t=0;for(x=y.material.length;t<x;t++){q=y.material[t];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=A+"px";q.style.top=G+"px"}}}}}};
|
|
|
|
-THREE.CanvasRenderer=function(){function a(za){if(y!=za)m.globalAlpha=y=za}function c(za){if(q!=za){switch(za){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=za}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),h,g,k,j,m=e.getContext("2d"),t=new THREE.Color(0),x=0,y=1,q=0,A=null,G=null,I=1,E,H,z,S,Q=new THREE.RenderableVertex,
|
|
|
|
-N=new THREE.RenderableVertex,da,f,ja,na,aa,Y,Da,ea,Ea,ia,ra,oa,$=new THREE.Color,R=new THREE.Color,O=new THREE.Color,ha=new THREE.Color,va=new THREE.Color,ka,ta,xa,Ma,ab,n,C,p,o,w,D=new THREE.Rectangle,B=new THREE.Rectangle,F=new THREE.Rectangle,V=!1,M=new THREE.Color,J=new THREE.Color,qa=new THREE.Color,Ca=new THREE.Color,W=new THREE.Vector3,wa,la,Ga,Na,ua,Ha,P=16;wa=document.createElement("canvas");wa.width=wa.height=2;la=wa.getContext("2d");la.fillStyle="rgba(0,0,0,1)";la.fillRect(0,0,2,2);Ga=
|
|
|
|
-la.getImageData(0,0,2,2);Na=Ga.data;ua=document.createElement("canvas");ua.width=ua.height=P;Ha=ua.getContext("2d");Ha.translate(-P/2,-P/2);Ha.scale(P,P);P--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(za,Aa){h=za;g=Aa;k=h/2;j=g/2;e.width=h;e.height=g;D.set(-k,-j,k,j);y=1;q=0;G=A=null;I=1};this.setClearColor=function(za,Aa){t=za;x=Aa};this.setClearColorHex=function(za,Aa){t.setHex(za);x=Aa};this.clear=function(){m.setTransform(1,0,0,-1,k,j);if(!B.isEmpty()){B.inflate(1);
|
|
|
|
-B.minSelf(D);if(t.hex==0&&x==0)m.clearRect(B.getX(),B.getY(),B.getWidth(),B.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+x+")";m.fillRect(B.getX(),B.getY(),B.getWidth(),B.getHeight())}B.empty()}};this.render=function(za,Aa){function Wa(K){var ca,U,T,Fa=K.lights;J.setRGB(0,0,0);qa.setRGB(0,0,0);Ca.setRGB(0,0,0);K=0;for(ca=Fa.length;K<ca;K++){U=Fa[K];T=U.color;if(U instanceof THREE.AmbientLight){J.r+=T.r;J.g+=
|
|
|
|
-T.g;J.b+=T.b}else if(U instanceof THREE.DirectionalLight){qa.r+=T.r;qa.g+=T.g;qa.b+=T.b}else if(U instanceof THREE.PointLight){Ca.r+=T.r;Ca.g+=T.g;Ca.b+=T.b}}}function X(K,ca,U,T){var Fa,sa,ma,Z,ya=K.lights;K=0;for(Fa=ya.length;K<Fa;K++){sa=ya[K];ma=sa.color;Z=sa.intensity;if(sa instanceof THREE.DirectionalLight){sa=U.dot(sa.position)*Z;if(sa>0){T.r+=ma.r*sa;T.g+=ma.g*sa;T.b+=ma.b*sa}}else if(sa instanceof THREE.PointLight){W.sub(sa.position,ca);W.normalize();sa=U.dot(W)*Z;if(sa>0){T.r+=ma.r*sa;T.g+=
|
|
|
|
-ma.g*sa;T.b+=ma.b*sa}}}}function fa(K,ca,U){a(U.opacity);c(U.blending);var T,Fa,sa,ma,Z,ya;if(U instanceof THREE.ParticleBasicMaterial){if(U.map){ma=U.map.image;Z=ma.width>>1;ya=ma.height>>1;U=ca.scale.x*k;sa=ca.scale.y*j;T=U*Z;Fa=sa*ya;F.set(K.x-T,K.y-Fa,K.x+T,K.y+Fa);if(D.instersects(F)){m.save();m.translate(K.x,K.y);m.rotate(-ca.rotation);m.scale(U,-sa);m.translate(-Z,-ya);m.drawImage(ma,0,0);m.restore()}}}else if(U instanceof THREE.ParticleCanvasMaterial){if(V){M.r=J.r+qa.r+Ca.r;M.g=J.g+qa.g+
|
|
|
|
-Ca.g;M.b=J.b+qa.b+Ca.b;$.r=U.color.r*M.r;$.g=U.color.g*M.g;$.b=U.color.b*M.b;$.updateStyleString()}else $.__styleString=U.color.__styleString;T=ca.scale.x*k;Fa=ca.scale.y*j;F.set(K.x-T,K.y-Fa,K.x+T,K.y+Fa);if(D.instersects(F)){m.save();m.translate(K.x,K.y);m.rotate(-ca.rotation);m.scale(T,Fa);U.program(m,$);m.restore()}}}function ga(K,ca,U,T){a(T.opacity);c(T.blending);m.beginPath();m.moveTo(K.positionScreen.x,K.positionScreen.y);m.lineTo(ca.positionScreen.x,ca.positionScreen.y);m.closePath();if(T instanceof
|
|
|
|
-THREE.LineBasicMaterial){$.__styleString=T.color.__styleString;K=T.linewidth;if(I!=K)m.lineWidth=I=K;K=$.__styleString;if(A!=K)m.strokeStyle=A=K;m.stroke();F.inflate(T.linewidth*2)}}function Ia(K,ca,U,T,Fa,sa,ma,Z,ya){a(Z.opacity);c(Z.blending);da=K.positionScreen.x;f=K.positionScreen.y;ja=ca.positionScreen.x;na=ca.positionScreen.y;aa=U.positionScreen.x;Y=U.positionScreen.y;var Xa=da,Sa=f,Ta=ja,fb=na,$a=aa,bb=Y;m.beginPath();m.moveTo(Xa,Sa);m.lineTo(Ta,fb);m.lineTo($a,bb);m.lineTo(Xa,Sa);m.closePath();
|
|
|
|
-if(Z instanceof THREE.MeshBasicMaterial)if(Z.map){if(Z.map.mapping instanceof THREE.UVMapping){Ma=ma.uvs[0];Za(da,f,ja,na,aa,Y,Z.map.image,Ma[T].u,Ma[T].v,Ma[Fa].u,Ma[Fa].v,Ma[sa].u,Ma[sa].v)}}else if(Z.envMap){if(Z.envMap.mapping instanceof THREE.SphericalReflectionMapping){K=Aa.matrixWorldInverse;W.copy(ma.vertexNormalsWorld[0]);ab=(W.x*K.n11+W.y*K.n12+W.z*K.n13)*0.5+0.5;n=-(W.x*K.n21+W.y*K.n22+W.z*K.n23)*0.5+0.5;W.copy(ma.vertexNormalsWorld[1]);C=(W.x*K.n11+W.y*K.n12+W.z*K.n13)*0.5+0.5;p=-(W.x*
|
|
|
|
-K.n21+W.y*K.n22+W.z*K.n23)*0.5+0.5;W.copy(ma.vertexNormalsWorld[2]);o=(W.x*K.n11+W.y*K.n12+W.z*K.n13)*0.5+0.5;w=-(W.x*K.n21+W.y*K.n22+W.z*K.n23)*0.5+0.5;Za(da,f,ja,na,aa,Y,Z.envMap.image,ab,n,C,p,o,w)}}else Z.wireframe?cb(Z.color.__styleString,Z.wireframeLinewidth):Oa(Z.color.__styleString);else if(Z instanceof THREE.MeshLambertMaterial){if(Z.map&&!Z.wireframe){if(Z.map.mapping instanceof THREE.UVMapping){Ma=ma.uvs[0];Za(da,f,ja,na,aa,Y,Z.map.image,Ma[T].u,Ma[T].v,Ma[Fa].u,Ma[Fa].v,Ma[sa].u,Ma[sa].v)}c(THREE.SubtractiveBlending)}if(V)if(!Z.wireframe&&
|
|
|
|
-Z.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==3){R.r=O.r=ha.r=J.r;R.g=O.g=ha.g=J.g;R.b=O.b=ha.b=J.b;X(ya,ma.v1.positionWorld,ma.vertexNormalsWorld[0],R);X(ya,ma.v2.positionWorld,ma.vertexNormalsWorld[1],O);X(ya,ma.v3.positionWorld,ma.vertexNormalsWorld[2],ha);va.r=(O.r+ha.r)*0.5;va.g=(O.g+ha.g)*0.5;va.b=(O.b+ha.b)*0.5;xa=Ua(R,O,ha,va);Za(da,f,ja,na,aa,Y,xa,0,0,1,0,0,1)}else{M.r=J.r;M.g=J.g;M.b=J.b;X(ya,ma.centroidWorld,ma.normalWorld,M);$.r=Z.color.r*M.r;$.g=Z.color.g*M.g;$.b=Z.color.b*
|
|
|
|
-M.b;$.updateStyleString();Z.wireframe?cb($.__styleString,Z.wireframeLinewidth):Oa($.__styleString)}else Z.wireframe?cb(Z.color.__styleString,Z.wireframeLinewidth):Oa(Z.color.__styleString)}else if(Z instanceof THREE.MeshDepthMaterial){ka=Aa.near;ta=Aa.far;R.r=R.g=R.b=1-Ja(K.positionScreen.z,ka,ta);O.r=O.g=O.b=1-Ja(ca.positionScreen.z,ka,ta);ha.r=ha.g=ha.b=1-Ja(U.positionScreen.z,ka,ta);va.r=(O.r+ha.r)*0.5;va.g=(O.g+ha.g)*0.5;va.b=(O.b+ha.b)*0.5;xa=Ua(R,O,ha,va);Za(da,f,ja,na,aa,Y,xa,0,0,1,0,0,1)}else if(Z instanceof
|
|
|
|
-THREE.MeshNormalMaterial){$.r=Qa(ma.normalWorld.x);$.g=Qa(ma.normalWorld.y);$.b=Qa(ma.normalWorld.z);$.updateStyleString();Z.wireframe?cb($.__styleString,Z.wireframeLinewidth):Oa($.__styleString)}}function Ra(K,ca,U,T,Fa,sa,ma,Z,ya){a(Z.opacity);c(Z.blending);if(Z.map||Z.envMap){Ia(K,ca,T,0,1,3,ma,Z,ya);Ia(Fa,U,sa,1,2,3,ma,Z,ya)}else{da=K.positionScreen.x;f=K.positionScreen.y;ja=ca.positionScreen.x;na=ca.positionScreen.y;aa=U.positionScreen.x;Y=U.positionScreen.y;Da=T.positionScreen.x;ea=T.positionScreen.y;
|
|
|
|
-Ea=Fa.positionScreen.x;ia=Fa.positionScreen.y;ra=sa.positionScreen.x;oa=sa.positionScreen.y;Fa=da;sa=f;var Xa=ja,Sa=na,Ta=aa,fb=Y;m.beginPath();m.moveTo(Fa,sa);m.lineTo(Xa,Sa);m.lineTo(Ta,fb);m.lineTo(Da,ea);m.lineTo(Fa,sa);m.closePath();if(Z instanceof THREE.MeshBasicMaterial)Z.wireframe?cb(Z.color.__styleString,Z.wireframeLinewidth):Oa(Z.color.__styleString);else if(Z instanceof THREE.MeshLambertMaterial)if(V){M.r=J.r;M.g=J.g;M.b=J.b;X(ya,ma.centroidWorld,ma.normalWorld,M);$.r=Z.color.r*M.r;$.g=
|
|
|
|
-Z.color.g*M.g;$.b=Z.color.b*M.b;$.updateStyleString();Z.wireframe?cb($.__styleString,Z.wireframeLinewidth):Oa($.__styleString)}else Z.wireframe?cb(Z.color.__styleString,Z.wireframeLinewidth):Oa(Z.color.__styleString);else if(Z instanceof THREE.MeshDepthMaterial){_2near=Z.__2near;_farPlusNear=Z.__farPlusNear;_farMinusNear=Z.__farMinusNear;R=~~((1-_2near/(_farPlusNear-K.positionScreen.z*_farMinusNear))*255);O=~~((1-_2near/(_farPlusNear-ca.positionScreen.z*_farMinusNear))*255);ha=~~((1-_2near/(_farPlusNear-
|
|
|
|
-U.positionScreen.z*_farMinusNear))*255);va=~~((1-_2near/(_farPlusNear-T.positionScreen.z*_farMinusNear))*255);xa=Ua([R,R,R],[O,O,O],[va,va,va],[ha,ha,ha]);_uv1.u=0;_uv1.v=0;_uv2.u=P;_uv2.v=0;_uv3.u=P;_uv3.v=P;_uv4.u=0;_uv4.v=P;drawTexturedTriangle(xa,da,f,ja,na,Da,ea,_uv1.u,_uv1.v,_uv2.u,_uv2.v,_uv4.u,_uv4.v);drawTexturedTriangle(xa,Ea,ia,aa,Y,ra,oa,_uv2.u,_uv2.v,_uv3.u,_uv3.v,_uv4.u,_uv4.v)}else if(Z instanceof THREE.MeshNormalMaterial){$.r=Qa(ma.normalWorld.x);$.g=Qa(ma.normalWorld.y);$.b=Qa(ma.normalWorld.z);
|
|
|
|
-$.updateStyleString();Z.wireframe?cb($.__styleString,Z.wireframeLinewidth):Oa($.__styleString)}}}function cb(K,ca){if(A!=K)m.strokeStyle=A=K;if(I!=ca)m.lineWidth=I=ca;m.stroke();F.inflate(ca*2)}function Oa(K){if(G!=K)m.fillStyle=G=K;m.fill()}function Za(K,ca,U,T,Fa,sa,ma,Z,ya,Xa,Sa,Ta,fb){var $a,bb;$a=ma.width-1;bb=ma.height-1;Z*=$a;ya*=bb;Xa*=$a;Sa*=bb;Ta*=$a;fb*=bb;U-=K;T-=ca;Fa-=K;sa-=ca;Xa-=Z;Sa-=ya;Ta-=Z;fb-=ya;$a=Xa*fb-Ta*Sa;if($a!=0){bb=1/$a;$a=(fb*U-Sa*Fa)*bb;Sa=(fb*T-Sa*sa)*bb;U=(Xa*Fa-Ta*
|
|
|
|
-U)*bb;T=(Xa*sa-Ta*T)*bb;K=K-$a*Z-U*ya;ca=ca-Sa*Z-T*ya;m.save();m.transform($a,Sa,U,T,K,ca);m.clip();m.drawImage(ma,0,0);m.restore()}}function Ua(K,ca,U,T){var Fa=~~(K.r*255),sa=~~(K.g*255);K=~~(K.b*255);var ma=~~(ca.r*255),Z=~~(ca.g*255);ca=~~(ca.b*255);var ya=~~(U.r*255),Xa=~~(U.g*255);U=~~(U.b*255);var Sa=~~(T.r*255),Ta=~~(T.g*255);T=~~(T.b*255);Na[0]=Fa<0?0:Fa>255?255:Fa;Na[1]=sa<0?0:sa>255?255:sa;Na[2]=K<0?0:K>255?255:K;Na[4]=ma<0?0:ma>255?255:ma;Na[5]=Z<0?0:Z>255?255:Z;Na[6]=ca<0?0:ca>255?255:
|
|
|
|
-ca;Na[8]=ya<0?0:ya>255?255:ya;Na[9]=Xa<0?0:Xa>255?255:Xa;Na[10]=U<0?0:U>255?255:U;Na[12]=Sa<0?0:Sa>255?255:Sa;Na[13]=Ta<0?0:Ta>255?255:Ta;Na[14]=T<0?0:T>255?255:T;la.putImageData(Ga,0,0);Ha.drawImage(wa,0,0);return ua}function Ja(K,ca,U){K=(K-ca)/(U-ca);return K*K*(3-2*K)}function Qa(K){K=(K+1)*0.5;return K<0?0:K>1?1:K}function La(K,ca){var U=ca.x-K.x,T=ca.y-K.y,Fa=1/Math.sqrt(U*U+T*T);U*=Fa;T*=Fa;ca.x+=U;ca.y+=T;K.x-=U;K.y-=T}var L,Pa,pa,Ya,db,Va,Ka,Ba;this.autoClear?this.clear():m.setTransform(1,
|
|
|
|
-0,0,-1,k,j);b=d.projectScene(za,Aa,this.sortElements);(V=za.lights.length>0)&&Wa(za);L=0;for(Pa=b.length;L<Pa;L++){pa=b[L];F.empty();if(pa instanceof THREE.RenderableParticle){E=pa;E.x*=k;E.y*=j;Ya=0;for(db=pa.materials.length;Ya<db;){Ba=pa.materials[Ya++];Ba.opacity!=0&&fa(E,pa,Ba,za)}}else if(pa instanceof THREE.RenderableLine){E=pa.v1;H=pa.v2;E.positionScreen.x*=k;E.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=j;F.addPoint(E.positionScreen.x,E.positionScreen.y);F.addPoint(H.positionScreen.x,
|
|
|
|
-H.positionScreen.y);if(D.instersects(F)){Ya=0;for(db=pa.materials.length;Ya<db;){Ba=pa.materials[Ya++];Ba.opacity!=0&&ga(E,H,pa,Ba,za)}}}else if(pa instanceof THREE.RenderableFace3){E=pa.v1;H=pa.v2;z=pa.v3;E.positionScreen.x*=k;E.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=j;z.positionScreen.x*=k;z.positionScreen.y*=j;if(pa.overdraw){La(E.positionScreen,H.positionScreen);La(H.positionScreen,z.positionScreen);La(z.positionScreen,E.positionScreen)}F.add3Points(E.positionScreen.x,E.positionScreen.y,
|
|
|
|
-H.positionScreen.x,H.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(D.instersects(F)){Ya=0;for(db=pa.meshMaterials.length;Ya<db;){Ba=pa.meshMaterials[Ya++];if(Ba instanceof THREE.MeshFaceMaterial){Va=0;for(Ka=pa.faceMaterials.length;Va<Ka;)(Ba=pa.faceMaterials[Va++])&&Ba.opacity!=0&&Ia(E,H,z,0,1,2,pa,Ba,za)}else Ba.opacity!=0&&Ia(E,H,z,0,1,2,pa,Ba,za)}}}else if(pa instanceof THREE.RenderableFace4){E=pa.v1;H=pa.v2;z=pa.v3;S=pa.v4;E.positionScreen.x*=k;E.positionScreen.y*=j;H.positionScreen.x*=
|
|
|
|
-k;H.positionScreen.y*=j;z.positionScreen.x*=k;z.positionScreen.y*=j;S.positionScreen.x*=k;S.positionScreen.y*=j;Q.positionScreen.copy(H.positionScreen);N.positionScreen.copy(S.positionScreen);if(pa.overdraw){La(E.positionScreen,H.positionScreen);La(H.positionScreen,S.positionScreen);La(S.positionScreen,E.positionScreen);La(z.positionScreen,Q.positionScreen);La(z.positionScreen,N.positionScreen)}F.addPoint(E.positionScreen.x,E.positionScreen.y);F.addPoint(H.positionScreen.x,H.positionScreen.y);F.addPoint(z.positionScreen.x,
|
|
|
|
-z.positionScreen.y);F.addPoint(S.positionScreen.x,S.positionScreen.y);if(D.instersects(F)){Ya=0;for(db=pa.meshMaterials.length;Ya<db;){Ba=pa.meshMaterials[Ya++];if(Ba instanceof THREE.MeshFaceMaterial){Va=0;for(Ka=pa.faceMaterials.length;Va<Ka;)(Ba=pa.faceMaterials[Va++])&&Ba.opacity!=0&&Ra(E,H,z,S,Q,N,pa,Ba,za)}else Ba.opacity!=0&&Ra(E,H,z,S,Q,N,pa,Ba,za)}}}B.addRectangle(F)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function a(ia,ra,oa){var $,R,O,ha;$=0;for(R=ia.lights.length;$<R;$++){O=ia.lights[$];if(O instanceof THREE.DirectionalLight){ha=ra.normalWorld.dot(O.position)*O.intensity;if(ha>0){oa.r+=O.color.r*ha;oa.g+=O.color.g*ha;oa.b+=O.color.b*ha}}else if(O instanceof THREE.PointLight){ja.sub(O.position,ra.centroidWorld);ja.normalize();ha=ra.normalWorld.dot(ja)*O.intensity;if(ha>0){oa.r+=O.color.r*ha;oa.g+=O.color.g*ha;oa.b+=O.color.b*ha}}}}function c(ia,ra,oa,$,R,O){Y=d(Da++);
|
|
|
|
-Y.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+oa.positionScreen.x+","+oa.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)z.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(H){S.r=Q.r;S.g=Q.g;S.b=Q.b;a(O,$,S);z.r=R.color.r*S.r;z.g=R.color.g*S.g;z.b=R.color.b*S.b;z.updateStyleString()}else z.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshDepthMaterial){f=
|
|
|
|
-1-R.__2near/(R.__farPlusNear-$.z*R.__farMinusNear);z.setRGB(f,f,f)}else R instanceof THREE.MeshNormalMaterial&&z.setRGB(e($.normalWorld.x),e($.normalWorld.y),e($.normalWorld.z));R.wireframe?Y.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+R.wireframeLinewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframeLinecap+"; stroke-linejoin: "+R.wireframeLinejoin):Y.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+R.opacity);k.appendChild(Y)}
|
|
|
|
-function b(ia,ra,oa,$,R,O,ha){Y=d(Da++);Y.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+oa.positionScreen.x+","+oa.positionScreen.y+" L "+$.positionScreen.x+","+$.positionScreen.y+"z");if(O instanceof THREE.MeshBasicMaterial)z.__styleString=O.color.__styleString;else if(O instanceof THREE.MeshLambertMaterial)if(H){S.r=Q.r;S.g=Q.g;S.b=Q.b;a(ha,R,S);z.r=O.color.r*S.r;z.g=O.color.g*S.g;z.b=O.color.b*S.b;z.updateStyleString()}else z.__styleString=
|
|
|
|
-O.color.__styleString;else if(O instanceof THREE.MeshDepthMaterial){f=1-O.__2near/(O.__farPlusNear-R.z*O.__farMinusNear);z.setRGB(f,f,f)}else O instanceof THREE.MeshNormalMaterial&&z.setRGB(e(R.normalWorld.x),e(R.normalWorld.y),e(R.normalWorld.z));O.wireframe?Y.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+O.wireframeLinewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.wireframeLinecap+"; stroke-linejoin: "+O.wireframeLinejoin):Y.setAttribute("style","fill: "+
|
|
|
|
-z.__styleString+"; fill-opacity: "+O.opacity);k.appendChild(Y)}function d(ia){if(na[ia]==null){na[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");Ea==0&&na[ia].setAttribute("shape-rendering","crispEdges")}return na[ia]}function e(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var h=null,g=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,t,x,y,q,A,G,I=new THREE.Rectangle,E=new THREE.Rectangle,H=!1,z=new THREE.Color(16777215),
|
|
|
|
-S=new THREE.Color(16777215),Q=new THREE.Color(0),N=new THREE.Color(0),da=new THREE.Color(0),f,ja=new THREE.Vector3,na=[],aa=[],Y,Da,ea,Ea=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":Ea=1;break;case "low":Ea=0}};this.setSize=function(ia,ra){j=ia;m=ra;t=j/2;x=m/2;k.setAttribute("viewBox",-t+" "+-x+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);I.set(-t,-x,t,x)};this.clear=function(){for(;k.childNodes.length>
|
|
|
|
-0;)k.removeChild(k.childNodes[0])};this.render=function(ia,ra){var oa,$,R,O,ha,va,ka,ta;this.autoClear&&this.clear();h=g.projectScene(ia,ra,this.sortElements);ea=Da=0;if(H=ia.lights.length>0){ka=ia.lights;Q.setRGB(0,0,0);N.setRGB(0,0,0);da.setRGB(0,0,0);oa=0;for($=ka.length;oa<$;oa++){R=ka[oa];O=R.color;if(R instanceof THREE.AmbientLight){Q.r+=O.r;Q.g+=O.g;Q.b+=O.b}else if(R instanceof THREE.DirectionalLight){N.r+=O.r;N.g+=O.g;N.b+=O.b}else if(R instanceof THREE.PointLight){da.r+=O.r;da.g+=O.g;da.b+=
|
|
|
|
-O.b}}}oa=0;for($=h.length;oa<$;oa++){ka=h[oa];E.empty();if(ka instanceof THREE.RenderableParticle){y=ka;y.x*=t;y.y*=-x;R=0;for(O=ka.materials.length;R<O;)R++}else if(ka instanceof THREE.RenderableLine){y=ka.v1;q=ka.v2;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;E.addPoint(y.positionScreen.x,y.positionScreen.y);E.addPoint(q.positionScreen.x,q.positionScreen.y);if(I.instersects(E)){R=0;for(O=ka.materials.length;R<O;)if((ta=ka.materials[R++])&&ta.opacity!=
|
|
|
|
-0){ha=y;va=q;var xa=ea++;if(aa[xa]==null){aa[xa]=document.createElementNS("http://www.w3.org/2000/svg","line");Ea==0&&aa[xa].setAttribute("shape-rendering","crispEdges")}Y=aa[xa];Y.setAttribute("x1",ha.positionScreen.x);Y.setAttribute("y1",ha.positionScreen.y);Y.setAttribute("x2",va.positionScreen.x);Y.setAttribute("y2",va.positionScreen.y);if(ta instanceof THREE.LineBasicMaterial){z.__styleString=ta.color.__styleString;Y.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+
|
|
|
|
-ta.linewidth+"; stroke-opacity: "+ta.opacity+"; stroke-linecap: "+ta.linecap+"; stroke-linejoin: "+ta.linejoin);k.appendChild(Y)}}}}else if(ka instanceof THREE.RenderableFace3){y=ka.v1;q=ka.v2;A=ka.v3;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;A.positionScreen.x*=t;A.positionScreen.y*=-x;E.addPoint(y.positionScreen.x,y.positionScreen.y);E.addPoint(q.positionScreen.x,q.positionScreen.y);E.addPoint(A.positionScreen.x,A.positionScreen.y);if(I.instersects(E)){R=
|
|
|
|
-0;for(O=ka.meshMaterials.length;R<O;){ta=ka.meshMaterials[R++];if(ta instanceof THREE.MeshFaceMaterial){ha=0;for(va=ka.faceMaterials.length;ha<va;)(ta=ka.faceMaterials[ha++])&&ta.opacity!=0&&c(y,q,A,ka,ta,ia)}else ta&&ta.opacity!=0&&c(y,q,A,ka,ta,ia)}}}else if(ka instanceof THREE.RenderableFace4){y=ka.v1;q=ka.v2;A=ka.v3;G=ka.v4;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;A.positionScreen.x*=t;A.positionScreen.y*=-x;G.positionScreen.x*=t;G.positionScreen.y*=
|
|
|
|
--x;E.addPoint(y.positionScreen.x,y.positionScreen.y);E.addPoint(q.positionScreen.x,q.positionScreen.y);E.addPoint(A.positionScreen.x,A.positionScreen.y);E.addPoint(G.positionScreen.x,G.positionScreen.y);if(I.instersects(E)){R=0;for(O=ka.meshMaterials.length;R<O;){ta=ka.meshMaterials[R++];if(ta instanceof THREE.MeshFaceMaterial){ha=0;for(va=ka.faceMaterials.length;ha<va;)(ta=ka.faceMaterials[ha++])&&ta.opacity!=0&&b(y,q,A,G,ka,ta,ia)}else ta&&ta.opacity!=0&&b(y,q,A,G,ka,ta,ia)}}}}}};
|
|
|
|
|
|
+THREE.Projector=function(){function a(){var $=j[k]=j[k]||new THREE.RenderableVertex;k++;return $}function c($,W){return W.z-$.z}function b($,W){var Da=0,da=1,Fa=$.z+$.w,ja=W.z+W.w,qa=-$.z+$.w,ma=-W.z+W.w;if(Fa>=0&&ja>=0&&qa>=0&&ma>=0)return!0;else if(Fa<0&&ja<0||qa<0&&ma<0)return!1;else{if(Fa<0)Da=Math.max(Da,Fa/(Fa-ja));else ja<0&&(da=Math.min(da,Fa/(Fa-ja)));if(qa<0)Da=Math.max(Da,qa/(qa-ma));else ma<0&&(da=Math.min(da,qa/(qa-ma)));if(da<Da)return!1;else{$.lerpSelf(W,Da);W.lerpSelf($,1-da);return!0}}}
|
|
|
|
+var d,e,g=[],h,k,j=[],m,t,x=[],y,q=[],A,G,H=[],E,I,z=[],S=new THREE.Vector4,P=new THREE.Vector4,O=new THREE.Matrix4,aa=new THREE.Matrix4,f=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Vector4,oa=new THREE.Vector4;this.projectVector=function($,W){O.multiply(W.projectionMatrix,W.matrixWorldInverse);O.multiplyVector3($);return $};this.unprojectVector=function($,W){O.multiply(W.matrixWorld,THREE.Matrix4.makeInvert(W.projectionMatrix));
|
|
|
|
+O.multiplyVector3($);return $};this.projectObjects=function($,W,Da){W=[];var da,Fa,ja;e=0;Fa=$.objects;$=0;for(da=Fa.length;$<da;$++){ja=Fa[$];var qa;if(!(qa=!ja.visible))if(qa=ja instanceof THREE.Mesh){a:{qa=void 0;for(var ma=ja.matrixWorld,Z=-ja.geometry.boundingSphere.radius*Math.max(ja.scale.x,Math.max(ja.scale.y,ja.scale.z)),Q=0;Q<6;Q++){qa=f[Q].x*ma.n14+f[Q].y*ma.n24+f[Q].z*ma.n34+f[Q].w;if(qa<=Z){qa=!1;break a}}qa=!0}qa=!qa}if(!qa){qa=g[e]=g[e]||new THREE.RenderableObject;e++;d=qa;S.copy(ja.position);
|
|
|
|
+O.multiplyVector3(S);d.object=ja;d.z=S.z;W.push(d)}}Da&&W.sort(c);return W};this.projectScene=function($,W,Da){var da=[],Fa=W.near,ja=W.far,qa,ma,Z,Q,M,ea,ua,ka,va,za,La,$a,n,C,p,o,w;I=G=y=t=0;W.matrixAutoUpdate&&W.updateMatrix();$.update(undefined,!1,W);O.multiply(W.projectionMatrix,W.matrixWorldInverse);f[0].set(O.n41-O.n11,O.n42-O.n12,O.n43-O.n13,O.n44-O.n14);f[1].set(O.n41+O.n11,O.n42+O.n12,O.n43+O.n13,O.n44+O.n14);f[2].set(O.n41+O.n21,O.n42+O.n22,O.n43+O.n23,O.n44+O.n24);f[3].set(O.n41-O.n21,
|
|
|
|
+O.n42-O.n22,O.n43-O.n23,O.n44-O.n24);f[4].set(O.n41-O.n31,O.n42-O.n32,O.n43-O.n33,O.n44-O.n34);f[5].set(O.n41+O.n31,O.n42+O.n32,O.n43+O.n33,O.n44+O.n34);for(qa=0;qa<6;qa++){va=f[qa];va.divideScalar(Math.sqrt(va.x*va.x+va.y*va.y+va.z*va.z))}va=this.projectObjects($,W,!0);$=0;for(qa=va.length;$<qa;$++){za=va[$].object;if(za.visible){La=za.matrixWorld;$a=za.matrixRotationWorld;n=za.materials;C=za.overdraw;k=0;if(za instanceof THREE.Mesh){p=za.geometry;Q=p.vertices;o=p.faces;p=p.faceVertexUvs;ma=0;for(Z=
|
|
|
|
+Q.length;ma<Z;ma++){h=a();h.positionWorld.copy(Q[ma].position);La.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);O.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>Fa&&h.positionScreen.z<ja}Q=0;for(ma=o.length;Q<ma;Q++){Z=o[Q];if(Z instanceof THREE.Face3){M=j[Z.a];ea=j[Z.b];ua=j[Z.c];if(M.visible&&ea.visible&&ua.visible&&(za.doubleSided||za.flipSided!=(ua.positionScreen.x-M.positionScreen.x)*
|
|
|
|
+(ea.positionScreen.y-M.positionScreen.y)-(ua.positionScreen.y-M.positionScreen.y)*(ea.positionScreen.x-M.positionScreen.x)<0)){ka=x[t]=x[t]||new THREE.RenderableFace3;t++;m=ka;m.v1.copy(M);m.v2.copy(ea);m.v3.copy(ua)}else continue}else if(Z instanceof THREE.Face4){M=j[Z.a];ea=j[Z.b];ua=j[Z.c];ka=j[Z.d];if(M.visible&&ea.visible&&ua.visible&&ka.visible&&(za.doubleSided||za.flipSided!=((ka.positionScreen.x-M.positionScreen.x)*(ea.positionScreen.y-M.positionScreen.y)-(ka.positionScreen.y-M.positionScreen.y)*
|
|
|
|
+(ea.positionScreen.x-M.positionScreen.x)<0||(ea.positionScreen.x-ua.positionScreen.x)*(ka.positionScreen.y-ua.positionScreen.y)-(ea.positionScreen.y-ua.positionScreen.y)*(ka.positionScreen.x-ua.positionScreen.x)<0))){w=q[y]=q[y]||new THREE.RenderableFace4;y++;m=w;m.v1.copy(M);m.v2.copy(ea);m.v3.copy(ua);m.v4.copy(ka)}else continue}m.normalWorld.copy(Z.normal);$a.multiplyVector3(m.normalWorld);m.centroidWorld.copy(Z.centroid);La.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);
|
|
|
|
+O.multiplyVector3(m.centroidScreen);ua=Z.vertexNormals;M=0;for(ea=ua.length;M<ea;M++){ka=m.vertexNormalsWorld[M];ka.copy(ua[M]);$a.multiplyVector3(ka)}M=0;for(ea=p.length;M<ea;M++)if(w=p[M][Q]){ua=0;for(ka=w.length;ua<ka;ua++)m.uvs[M][ua]=w[ua]}m.meshMaterials=n;m.faceMaterials=Z.materials;m.overdraw=C;m.z=m.centroidScreen.z;da.push(m)}}else if(za instanceof THREE.Line){aa.multiply(O,La);Q=za.geometry.vertices;M=a();M.positionScreen.copy(Q[0].position);aa.multiplyVector4(M.positionScreen);ma=1;for(Z=
|
|
|
|
+Q.length;ma<Z;ma++){M=a();M.positionScreen.copy(Q[ma].position);aa.multiplyVector4(M.positionScreen);ea=j[k-2];ha.copy(M.positionScreen);oa.copy(ea.positionScreen);if(b(ha,oa)){ha.multiplyScalar(1/ha.w);oa.multiplyScalar(1/oa.w);La=H[G]=H[G]||new THREE.RenderableLine;G++;A=La;A.v1.positionScreen.copy(ha);A.v2.positionScreen.copy(oa);A.z=Math.max(ha.z,oa.z);A.materials=za.materials;da.push(A)}}}else if(za instanceof THREE.Particle){P.set(za.position.x,za.position.y,za.position.z,1);O.multiplyVector4(P);
|
|
|
|
+P.z/=P.w;if(P.z>0&&P.z<1){La=z[I]=z[I]||new THREE.RenderableParticle;I++;E=La;E.x=P.x/P.w;E.y=P.y/P.w;E.z=P.z;E.rotation=za.rotation.z;E.scale.x=za.scale.x*Math.abs(E.x-(P.x+W.projectionMatrix.n11)/(P.w+W.projectionMatrix.n14));E.scale.y=za.scale.y*Math.abs(E.y-(P.y+W.projectionMatrix.n22)/(P.w+W.projectionMatrix.n24));E.materials=za.materials;da.push(E)}}}}Da&&da.sort(c);return da}};
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,k){b=h;d=k;e=b/2;g=d/2};this.render=function(h,k){var j,m,t,x,y,q,A,G;a=c.projectScene(h,k);j=0;for(m=a.length;j<m;j++){y=a[j];if(y instanceof THREE.RenderableParticle){A=y.x*e+e;G=y.y*g+g;t=0;for(x=y.material.length;t<x;t++){q=y.material[t];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=A+"px";q.style.top=G+"px"}}}}}};
|
|
|
|
+THREE.CanvasRenderer=function(){function a(Ba){if(y!=Ba)m.globalAlpha=y=Ba}function c(Ba){if(q!=Ba){switch(Ba){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=Ba}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,k,j,m=e.getContext("2d"),t=new THREE.Color(0),x=0,y=1,q=0,A=null,G=null,H=1,E,I,z,S,P=new THREE.RenderableVertex,
|
|
|
|
+O=new THREE.RenderableVertex,aa,f,ha,oa,$,W,Da,da,Fa,ja,qa,ma,Z=new THREE.Color,Q=new THREE.Color,M=new THREE.Color,ea=new THREE.Color,ua=new THREE.Color,ka,va,za,La,$a,n,C,p,o,w,D=new THREE.Rectangle,B=new THREE.Rectangle,F=new THREE.Rectangle,X=!1,N=new THREE.Color,J=new THREE.Color,sa=new THREE.Color,Ea=new THREE.Color,Y=new THREE.Vector3,ya,la,Ha,Ma,xa,Ia,U=16;ya=document.createElement("canvas");ya.width=ya.height=2;la=ya.getContext("2d");la.fillStyle="rgba(0,0,0,1)";la.fillRect(0,0,2,2);Ha=la.getImageData(0,
|
|
|
|
+0,2,2);Ma=Ha.data;xa=document.createElement("canvas");xa.width=xa.height=U;Ia=xa.getContext("2d");Ia.translate(-U/2,-U/2);Ia.scale(U,U);U--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(Ba,Ca){g=Ba;h=Ca;k=g/2;j=h/2;e.width=g;e.height=h;D.set(-k,-j,k,j);y=1;q=0;G=A=null;H=1};this.setClearColor=function(Ba,Ca){t=Ba;x=Ca};this.setClearColorHex=function(Ba,Ca){t.setHex(Ba);x=Ca};this.clear=function(){m.setTransform(1,0,0,-1,k,j);if(!B.isEmpty()){B.inflate(1);
|
|
|
|
+B.minSelf(D);if(t.hex==0&&x==0)m.clearRect(B.getX(),B.getY(),B.getWidth(),B.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+x+")";m.fillRect(B.getX(),B.getY(),B.getWidth(),B.getHeight())}B.empty()}};this.render=function(Ba,Ca){function Va(K){var ca,V,T,ia=K.lights;J.setRGB(0,0,0);sa.setRGB(0,0,0);Ea.setRGB(0,0,0);K=0;for(ca=ia.length;K<ca;K++){V=ia[K];T=V.color;if(V instanceof THREE.AmbientLight){J.r+=T.r;J.g+=
|
|
|
|
+T.g;J.b+=T.b}else if(V instanceof THREE.DirectionalLight){sa.r+=T.r;sa.g+=T.g;sa.b+=T.b}else if(V instanceof THREE.PointLight){Ea.r+=T.r;Ea.g+=T.g;Ea.b+=T.b}}}function ta(K,ca,V,T){var ia,Aa,ra,R,Qa=K.lights;K=0;for(ia=Qa.length;K<ia;K++){Aa=Qa[K];ra=Aa.color;R=Aa.intensity;if(Aa instanceof THREE.DirectionalLight){Aa=V.dot(Aa.position)*R;if(Aa>0){T.r+=ra.r*Aa;T.g+=ra.g*Aa;T.b+=ra.b*Aa}}else if(Aa instanceof THREE.PointLight){Y.sub(Aa.position,ca);Y.normalize();Aa=V.dot(Y)*R;if(Aa>0){T.r+=ra.r*Aa;
|
|
|
|
+T.g+=ra.g*Aa;T.b+=ra.b*Aa}}}}function fa(K,ca,V){a(V.opacity);c(V.blending);var T,ia,Aa,ra,R,Qa;if(V instanceof THREE.ParticleBasicMaterial){if(V.map){ra=V.map.image;R=ra.width>>1;Qa=ra.height>>1;V=ca.scale.x*k;Aa=ca.scale.y*j;T=V*R;ia=Aa*Qa;F.set(K.x-T,K.y-ia,K.x+T,K.y+ia);if(D.instersects(F)){m.save();m.translate(K.x,K.y);m.rotate(-ca.rotation);m.scale(V,-Aa);m.translate(-R,-Qa);m.drawImage(ra,0,0);m.restore()}}}else if(V instanceof THREE.ParticleCanvasMaterial){if(X){N.r=J.r+sa.r+Ea.r;N.g=J.g+
|
|
|
|
+sa.g+Ea.g;N.b=J.b+sa.b+Ea.b;Z.r=V.color.r*N.r;Z.g=V.color.g*N.g;Z.b=V.color.b*N.b;Z.updateStyleString()}else Z.__styleString=V.color.__styleString;T=ca.scale.x*k;ia=ca.scale.y*j;F.set(K.x-T,K.y-ia,K.x+T,K.y+ia);if(D.instersects(F)){m.save();m.translate(K.x,K.y);m.rotate(-ca.rotation);m.scale(T,ia);V.program(m,Z);m.restore()}}}function ga(K,ca,V,T){a(T.opacity);c(T.blending);m.beginPath();m.moveTo(K.positionScreen.x,K.positionScreen.y);m.lineTo(ca.positionScreen.x,ca.positionScreen.y);m.closePath();
|
|
|
|
+if(T instanceof THREE.LineBasicMaterial){Z.__styleString=T.color.__styleString;K=T.linewidth;if(H!=K)m.lineWidth=H=K;K=Z.__styleString;if(A!=K)m.strokeStyle=A=K;m.stroke();F.inflate(T.linewidth*2)}}function na(K,ca,V,T,ia,Aa,ra,R,Qa){a(R.opacity);c(R.blending);aa=K.positionScreen.x;f=K.positionScreen.y;ha=ca.positionScreen.x;oa=ca.positionScreen.y;$=V.positionScreen.x;W=V.positionScreen.y;var Ka=aa,Ta=f,Xa=ha,Ya=oa,Za=$,ab=W;m.beginPath();m.moveTo(Ka,Ta);m.lineTo(Xa,Ya);m.lineTo(Za,ab);m.lineTo(Ka,
|
|
|
|
+Ta);m.closePath();if(R instanceof THREE.MeshBasicMaterial)if(R.map){if(R.map.mapping instanceof THREE.UVMapping){La=ra.uvs[0];Na(aa,f,ha,oa,$,W,R.map.image,La[T].u,La[T].v,La[ia].u,La[ia].v,La[Aa].u,La[Aa].v)}}else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping){K=Ca.matrixWorldInverse;Y.copy(ra.vertexNormalsWorld[0]);$a=(Y.x*K.n11+Y.y*K.n12+Y.z*K.n13)*0.5+0.5;n=-(Y.x*K.n21+Y.y*K.n22+Y.z*K.n23)*0.5+0.5;Y.copy(ra.vertexNormalsWorld[1]);C=(Y.x*K.n11+Y.y*K.n12+Y.z*K.n13)*
|
|
|
|
+0.5+0.5;p=-(Y.x*K.n21+Y.y*K.n22+Y.z*K.n23)*0.5+0.5;Y.copy(ra.vertexNormalsWorld[2]);o=(Y.x*K.n11+Y.y*K.n12+Y.z*K.n13)*0.5+0.5;w=-(Y.x*K.n21+Y.y*K.n22+Y.z*K.n23)*0.5+0.5;Na(aa,f,ha,oa,$,W,R.envMap.image,$a,n,C,p,o,w)}}else R.wireframe?Oa(R.color.__styleString,R.wireframeLinewidth):bb(R.color.__styleString);else if(R instanceof THREE.MeshLambertMaterial){if(R.map&&!R.wireframe){if(R.map.mapping instanceof THREE.UVMapping){La=ra.uvs[0];Na(aa,f,ha,oa,$,W,R.map.image,La[T].u,La[T].v,La[ia].u,La[ia].v,
|
|
|
|
+La[Aa].u,La[Aa].v)}c(THREE.SubtractiveBlending)}if(X)if(!R.wireframe&&R.shading==THREE.SmoothShading&&ra.vertexNormalsWorld.length==3){Q.r=M.r=ea.r=J.r;Q.g=M.g=ea.g=J.g;Q.b=M.b=ea.b=J.b;ta(Qa,ra.v1.positionWorld,ra.vertexNormalsWorld[0],Q);ta(Qa,ra.v2.positionWorld,ra.vertexNormalsWorld[1],M);ta(Qa,ra.v3.positionWorld,ra.vertexNormalsWorld[2],ea);ua.r=(M.r+ea.r)*0.5;ua.g=(M.g+ea.g)*0.5;ua.b=(M.b+ea.b)*0.5;za=cb(Q,M,ea,ua);Na(aa,f,ha,oa,$,W,za,0,0,1,0,0,1)}else{N.r=J.r;N.g=J.g;N.b=J.b;ta(Qa,ra.centroidWorld,
|
|
|
|
+ra.normalWorld,N);Z.r=R.color.r*N.r;Z.g=R.color.g*N.g;Z.b=R.color.b*N.b;Z.updateStyleString();R.wireframe?Oa(Z.__styleString,R.wireframeLinewidth):bb(Z.__styleString)}else R.wireframe?Oa(R.color.__styleString,R.wireframeLinewidth):bb(R.color.__styleString)}else if(R instanceof THREE.MeshDepthMaterial){ka=Ca.near;va=Ca.far;Q.r=Q.g=Q.b=1-Ua(K.positionScreen.z,ka,va);M.r=M.g=M.b=1-Ua(ca.positionScreen.z,ka,va);ea.r=ea.g=ea.b=1-Ua(V.positionScreen.z,ka,va);ua.r=(M.r+ea.r)*0.5;ua.g=(M.g+ea.g)*0.5;ua.b=
|
|
|
|
+(M.b+ea.b)*0.5;za=cb(Q,M,ea,ua);Na(aa,f,ha,oa,$,W,za,0,0,1,0,0,1)}else if(R instanceof THREE.MeshNormalMaterial){Z.r=Ga(ra.normalWorld.x);Z.g=Ga(ra.normalWorld.y);Z.b=Ga(ra.normalWorld.z);Z.updateStyleString();R.wireframe?Oa(Z.__styleString,R.wireframeLinewidth):bb(Z.__styleString)}}function Ra(K,ca,V,T,ia,Aa,ra,R,Qa){a(R.opacity);c(R.blending);if(R.map||R.envMap){na(K,ca,T,0,1,3,ra,R,Qa);na(ia,V,Aa,1,2,3,ra,R,Qa)}else{aa=K.positionScreen.x;f=K.positionScreen.y;ha=ca.positionScreen.x;oa=ca.positionScreen.y;
|
|
|
|
+$=V.positionScreen.x;W=V.positionScreen.y;Da=T.positionScreen.x;da=T.positionScreen.y;Fa=ia.positionScreen.x;ja=ia.positionScreen.y;qa=Aa.positionScreen.x;ma=Aa.positionScreen.y;ia=aa;Aa=f;var Ka=ha,Ta=oa,Xa=$,Ya=W;m.beginPath();m.moveTo(ia,Aa);m.lineTo(Ka,Ta);m.lineTo(Xa,Ya);m.lineTo(Da,da);m.lineTo(ia,Aa);m.closePath();if(R instanceof THREE.MeshBasicMaterial)R.wireframe?Oa(R.color.__styleString,R.wireframeLinewidth):bb(R.color.__styleString);else if(R instanceof THREE.MeshLambertMaterial)if(X){N.r=
|
|
|
|
+J.r;N.g=J.g;N.b=J.b;ta(Qa,ra.centroidWorld,ra.normalWorld,N);Z.r=R.color.r*N.r;Z.g=R.color.g*N.g;Z.b=R.color.b*N.b;Z.updateStyleString();R.wireframe?Oa(Z.__styleString,R.wireframeLinewidth):bb(Z.__styleString)}else R.wireframe?Oa(R.color.__styleString,R.wireframeLinewidth):bb(R.color.__styleString);else if(R instanceof THREE.MeshDepthMaterial){_2near=R.__2near;_farPlusNear=R.__farPlusNear;_farMinusNear=R.__farMinusNear;Q=~~((1-_2near/(_farPlusNear-K.positionScreen.z*_farMinusNear))*255);M=~~((1-_2near/
|
|
|
|
+(_farPlusNear-ca.positionScreen.z*_farMinusNear))*255);ea=~~((1-_2near/(_farPlusNear-V.positionScreen.z*_farMinusNear))*255);ua=~~((1-_2near/(_farPlusNear-T.positionScreen.z*_farMinusNear))*255);za=cb([Q,Q,Q],[M,M,M],[ua,ua,ua],[ea,ea,ea]);_uv1.u=0;_uv1.v=0;_uv2.u=U;_uv2.v=0;_uv3.u=U;_uv3.v=U;_uv4.u=0;_uv4.v=U;drawTexturedTriangle(za,aa,f,ha,oa,Da,da,_uv1.u,_uv1.v,_uv2.u,_uv2.v,_uv4.u,_uv4.v);drawTexturedTriangle(za,Fa,ja,$,W,qa,ma,_uv2.u,_uv2.v,_uv3.u,_uv3.v,_uv4.u,_uv4.v)}else if(R instanceof THREE.MeshNormalMaterial){Z.r=
|
|
|
|
+Ga(ra.normalWorld.x);Z.g=Ga(ra.normalWorld.y);Z.b=Ga(ra.normalWorld.z);Z.updateStyleString();R.wireframe?Oa(Z.__styleString,R.wireframeLinewidth):bb(Z.__styleString)}}}function Oa(K,ca){if(A!=K)m.strokeStyle=A=K;if(H!=ca)m.lineWidth=H=ca;m.stroke();F.inflate(ca*2)}function bb(K){if(G!=K)m.fillStyle=G=K;m.fill()}function Na(K,ca,V,T,ia,Aa,ra,R,Qa,Ka,Ta,Xa,Ya){var Za,ab;Za=ra.width-1;ab=ra.height-1;R*=Za;Qa*=ab;Ka*=Za;Ta*=ab;Xa*=Za;Ya*=ab;V-=K;T-=ca;ia-=K;Aa-=ca;Ka-=R;Ta-=Qa;Xa-=R;Ya-=Qa;Za=Ka*Ya-Xa*
|
|
|
|
+Ta;if(Za!=0){ab=1/Za;Za=(Ya*V-Ta*ia)*ab;Ta=(Ya*T-Ta*Aa)*ab;V=(Ka*ia-Xa*V)*ab;T=(Ka*Aa-Xa*T)*ab;K=K-Za*R-V*Qa;ca=ca-Ta*R-T*Qa;m.save();m.transform(Za,Ta,V,T,K,ca);m.clip();m.drawImage(ra,0,0);m.restore()}}function cb(K,ca,V,T){var ia=~~(K.r*255),Aa=~~(K.g*255);K=~~(K.b*255);var ra=~~(ca.r*255),R=~~(ca.g*255);ca=~~(ca.b*255);var Qa=~~(V.r*255),Ka=~~(V.g*255);V=~~(V.b*255);var Ta=~~(T.r*255),Xa=~~(T.g*255);T=~~(T.b*255);Ma[0]=ia<0?0:ia>255?255:ia;Ma[1]=Aa<0?0:Aa>255?255:Aa;Ma[2]=K<0?0:K>255?255:K;Ma[4]=
|
|
|
|
+ra<0?0:ra>255?255:ra;Ma[5]=R<0?0:R>255?255:R;Ma[6]=ca<0?0:ca>255?255:ca;Ma[8]=Qa<0?0:Qa>255?255:Qa;Ma[9]=Ka<0?0:Ka>255?255:Ka;Ma[10]=V<0?0:V>255?255:V;Ma[12]=Ta<0?0:Ta>255?255:Ta;Ma[13]=Xa<0?0:Xa>255?255:Xa;Ma[14]=T<0?0:T>255?255:T;la.putImageData(Ha,0,0);Ia.drawImage(ya,0,0);return xa}function Ua(K,ca,V){K=(K-ca)/(V-ca);return K*K*(3-2*K)}function Ga(K){K=(K+1)*0.5;return K<0?0:K>1?1:K}function Sa(K,ca){var V=ca.x-K.x,T=ca.y-K.y,ia=1/Math.sqrt(V*V+T*T);V*=ia;T*=ia;ca.x+=V;ca.y+=T;K.x-=V;K.y-=T}var Pa,
|
|
|
|
+L,pa,Ja,db,eb,Wa,wa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);b=d.projectScene(Ba,Ca,this.sortElements);(X=Ba.lights.length>0)&&Va(Ba);Pa=0;for(L=b.length;Pa<L;Pa++){pa=b[Pa];F.empty();if(pa instanceof THREE.RenderableParticle){E=pa;E.x*=k;E.y*=j;Ja=0;for(db=pa.materials.length;Ja<db;){wa=pa.materials[Ja++];wa.opacity!=0&&fa(E,pa,wa,Ba)}}else if(pa instanceof THREE.RenderableLine){E=pa.v1;I=pa.v2;E.positionScreen.x*=k;E.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=
|
|
|
|
+j;F.addPoint(E.positionScreen.x,E.positionScreen.y);F.addPoint(I.positionScreen.x,I.positionScreen.y);if(D.instersects(F)){Ja=0;for(db=pa.materials.length;Ja<db;){wa=pa.materials[Ja++];wa.opacity!=0&&ga(E,I,pa,wa,Ba)}}}else if(pa instanceof THREE.RenderableFace3){E=pa.v1;I=pa.v2;z=pa.v3;E.positionScreen.x*=k;E.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j;z.positionScreen.x*=k;z.positionScreen.y*=j;if(pa.overdraw){Sa(E.positionScreen,I.positionScreen);Sa(I.positionScreen,z.positionScreen);
|
|
|
|
+Sa(z.positionScreen,E.positionScreen)}F.add3Points(E.positionScreen.x,E.positionScreen.y,I.positionScreen.x,I.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(D.instersects(F)){Ja=0;for(db=pa.meshMaterials.length;Ja<db;){wa=pa.meshMaterials[Ja++];if(wa instanceof THREE.MeshFaceMaterial){eb=0;for(Wa=pa.faceMaterials.length;eb<Wa;)(wa=pa.faceMaterials[eb++])&&wa.opacity!=0&&na(E,I,z,0,1,2,pa,wa,Ba)}else wa.opacity!=0&&na(E,I,z,0,1,2,pa,wa,Ba)}}}else if(pa instanceof THREE.RenderableFace4){E=
|
|
|
|
+pa.v1;I=pa.v2;z=pa.v3;S=pa.v4;E.positionScreen.x*=k;E.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j;z.positionScreen.x*=k;z.positionScreen.y*=j;S.positionScreen.x*=k;S.positionScreen.y*=j;P.positionScreen.copy(I.positionScreen);O.positionScreen.copy(S.positionScreen);if(pa.overdraw){Sa(E.positionScreen,I.positionScreen);Sa(I.positionScreen,S.positionScreen);Sa(S.positionScreen,E.positionScreen);Sa(z.positionScreen,P.positionScreen);Sa(z.positionScreen,O.positionScreen)}F.addPoint(E.positionScreen.x,
|
|
|
|
+E.positionScreen.y);F.addPoint(I.positionScreen.x,I.positionScreen.y);F.addPoint(z.positionScreen.x,z.positionScreen.y);F.addPoint(S.positionScreen.x,S.positionScreen.y);if(D.instersects(F)){Ja=0;for(db=pa.meshMaterials.length;Ja<db;){wa=pa.meshMaterials[Ja++];if(wa instanceof THREE.MeshFaceMaterial){eb=0;for(Wa=pa.faceMaterials.length;eb<Wa;)(wa=pa.faceMaterials[eb++])&&wa.opacity!=0&&Ra(E,I,z,S,P,O,pa,wa,Ba)}else wa.opacity!=0&&Ra(E,I,z,S,P,O,pa,wa,Ba)}}}B.addRectangle(F)}m.setTransform(1,0,0,1,
|
|
|
|
+0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function a(ja,qa,ma){var Z,Q,M,ea;Z=0;for(Q=ja.lights.length;Z<Q;Z++){M=ja.lights[Z];if(M instanceof THREE.DirectionalLight){ea=qa.normalWorld.dot(M.position)*M.intensity;if(ea>0){ma.r+=M.color.r*ea;ma.g+=M.color.g*ea;ma.b+=M.color.b*ea}}else if(M instanceof THREE.PointLight){ha.sub(M.position,qa.centroidWorld);ha.normalize();ea=qa.normalWorld.dot(ha)*M.intensity;if(ea>0){ma.r+=M.color.r*ea;ma.g+=M.color.g*ea;ma.b+=M.color.b*ea}}}}function c(ja,qa,ma,Z,Q,M){W=d(Da++);W.setAttribute("d",
|
|
|
|
+"M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");if(Q instanceof THREE.MeshBasicMaterial)z.__styleString=Q.color.__styleString;else if(Q instanceof THREE.MeshLambertMaterial)if(I){S.r=P.r;S.g=P.g;S.b=P.b;a(M,Z,S);z.r=Q.color.r*S.r;z.g=Q.color.g*S.g;z.b=Q.color.b*S.b;z.updateStyleString()}else z.__styleString=Q.color.__styleString;else if(Q instanceof THREE.MeshDepthMaterial){f=1-Q.__2near/(Q.__farPlusNear-
|
|
|
|
+Z.z*Q.__farMinusNear);z.setRGB(f,f,f)}else Q instanceof THREE.MeshNormalMaterial&&z.setRGB(e(Z.normalWorld.x),e(Z.normalWorld.y),e(Z.normalWorld.z));Q.wireframe?W.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+Q.wireframeLinewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.wireframeLinecap+"; stroke-linejoin: "+Q.wireframeLinejoin):W.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+Q.opacity);k.appendChild(W)}function b(ja,qa,ma,Z,Q,M,ea){W=
|
|
|
|
+d(Da++);W.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)z.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(I){S.r=P.r;S.g=P.g;S.b=P.b;a(ea,Q,S);z.r=M.color.r*S.r;z.g=M.color.g*S.g;z.b=M.color.b*S.b;z.updateStyleString()}else z.__styleString=M.color.__styleString;
|
|
|
|
+else if(M instanceof THREE.MeshDepthMaterial){f=1-M.__2near/(M.__farPlusNear-Q.z*M.__farMinusNear);z.setRGB(f,f,f)}else M instanceof THREE.MeshNormalMaterial&&z.setRGB(e(Q.normalWorld.x),e(Q.normalWorld.y),e(Q.normalWorld.z));M.wireframe?W.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+M.wireframeLinewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframeLinecap+"; stroke-linejoin: "+M.wireframeLinejoin):W.setAttribute("style","fill: "+z.__styleString+
|
|
|
|
+"; fill-opacity: "+M.opacity);k.appendChild(W)}function d(ja){if(oa[ja]==null){oa[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");Fa==0&&oa[ja].setAttribute("shape-rendering","crispEdges")}return oa[ja]}function e(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,t,x,y,q,A,G,H=new THREE.Rectangle,E=new THREE.Rectangle,I=!1,z=new THREE.Color(16777215),S=new THREE.Color(16777215),
|
|
|
|
+P=new THREE.Color(0),O=new THREE.Color(0),aa=new THREE.Color(0),f,ha=new THREE.Vector3,oa=[],$=[],W,Da,da,Fa=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ja){switch(ja){case "high":Fa=1;break;case "low":Fa=0}};this.setSize=function(ja,qa){j=ja;m=qa;t=j/2;x=m/2;k.setAttribute("viewBox",-t+" "+-x+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);H.set(-t,-x,t,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
|
|
|
|
+this.render=function(ja,qa){var ma,Z,Q,M,ea,ua,ka,va;this.autoClear&&this.clear();g=h.projectScene(ja,qa,this.sortElements);da=Da=0;if(I=ja.lights.length>0){ka=ja.lights;P.setRGB(0,0,0);O.setRGB(0,0,0);aa.setRGB(0,0,0);ma=0;for(Z=ka.length;ma<Z;ma++){Q=ka[ma];M=Q.color;if(Q instanceof THREE.AmbientLight){P.r+=M.r;P.g+=M.g;P.b+=M.b}else if(Q instanceof THREE.DirectionalLight){O.r+=M.r;O.g+=M.g;O.b+=M.b}else if(Q instanceof THREE.PointLight){aa.r+=M.r;aa.g+=M.g;aa.b+=M.b}}}ma=0;for(Z=g.length;ma<Z;ma++){ka=
|
|
|
|
+g[ma];E.empty();if(ka instanceof THREE.RenderableParticle){y=ka;y.x*=t;y.y*=-x;Q=0;for(M=ka.materials.length;Q<M;)Q++}else if(ka instanceof THREE.RenderableLine){y=ka.v1;q=ka.v2;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;E.addPoint(y.positionScreen.x,y.positionScreen.y);E.addPoint(q.positionScreen.x,q.positionScreen.y);if(H.instersects(E)){Q=0;for(M=ka.materials.length;Q<M;)if((va=ka.materials[Q++])&&va.opacity!=0){ea=y;ua=q;var za=da++;if($[za]==null){$[za]=
|
|
|
|
+document.createElementNS("http://www.w3.org/2000/svg","line");Fa==0&&$[za].setAttribute("shape-rendering","crispEdges")}W=$[za];W.setAttribute("x1",ea.positionScreen.x);W.setAttribute("y1",ea.positionScreen.y);W.setAttribute("x2",ua.positionScreen.x);W.setAttribute("y2",ua.positionScreen.y);if(va instanceof THREE.LineBasicMaterial){z.__styleString=va.color.__styleString;W.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+va.linewidth+"; stroke-opacity: "+va.opacity+"; stroke-linecap: "+
|
|
|
|
+va.linecap+"; stroke-linejoin: "+va.linejoin);k.appendChild(W)}}}}else if(ka instanceof THREE.RenderableFace3){y=ka.v1;q=ka.v2;A=ka.v3;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;A.positionScreen.x*=t;A.positionScreen.y*=-x;E.addPoint(y.positionScreen.x,y.positionScreen.y);E.addPoint(q.positionScreen.x,q.positionScreen.y);E.addPoint(A.positionScreen.x,A.positionScreen.y);if(H.instersects(E)){Q=0;for(M=ka.meshMaterials.length;Q<M;){va=ka.meshMaterials[Q++];
|
|
|
|
+if(va instanceof THREE.MeshFaceMaterial){ea=0;for(ua=ka.faceMaterials.length;ea<ua;)(va=ka.faceMaterials[ea++])&&va.opacity!=0&&c(y,q,A,ka,va,ja)}else va&&va.opacity!=0&&c(y,q,A,ka,va,ja)}}}else if(ka instanceof THREE.RenderableFace4){y=ka.v1;q=ka.v2;A=ka.v3;G=ka.v4;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;A.positionScreen.x*=t;A.positionScreen.y*=-x;G.positionScreen.x*=t;G.positionScreen.y*=-x;E.addPoint(y.positionScreen.x,y.positionScreen.y);E.addPoint(q.positionScreen.x,
|
|
|
|
+q.positionScreen.y);E.addPoint(A.positionScreen.x,A.positionScreen.y);E.addPoint(G.positionScreen.x,G.positionScreen.y);if(H.instersects(E)){Q=0;for(M=ka.meshMaterials.length;Q<M;){va=ka.meshMaterials[Q++];if(va instanceof THREE.MeshFaceMaterial){ea=0;for(ua=ka.faceMaterials.length;ea<ua;)(va=ka.faceMaterials[ea++])&&va.opacity!=0&&b(y,q,A,G,ka,va,ja)}else va&&va.opacity!=0&&b(y,q,A,G,ka,va,ja)}}}}}};
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
|
|
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -217,43 +218,43 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
|
|
vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
|
|
vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
|
|
THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
|
|
THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
|
|
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
|
|
-THREE.WebGLRenderer=function(a){function c(n,C,p){var o,w,D,B=n.vertices,F=B.length,V=n.colors,M=V.length,J=n.__vertexArray,qa=n.__colorArray,Ca=n.__sortArray,W=n.__dirtyVertices,wa=n.__dirtyColors;if(p.sortParticles){O.multiplySelf(p.matrixWorld);for(o=0;o<F;o++){w=B[o].position;ka.copy(w);O.multiplyVector3(ka);Ca[o]=[ka.z,o]}Ca.sort(function(la,Ga){return Ga[0]-la[0]});for(o=0;o<F;o++){w=B[Ca[o][1]].position;D=o*3;J[D]=w.x;J[D+1]=w.y;J[D+2]=w.z}for(o=0;o<M;o++){D=o*3;color=V[Ca[o][1]];qa[D]=color.r;
|
|
|
|
-qa[D+1]=color.g;qa[D+2]=color.b}}else{if(W)for(o=0;o<F;o++){w=B[o].position;D=o*3;J[D]=w.x;J[D+1]=w.y;J[D+2]=w.z}if(wa)for(o=0;o<M;o++){color=V[o];D=o*3;qa[D]=color.r;qa[D+1]=color.g;qa[D+2]=color.b}}if(W||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,J,C)}if(wa||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,qa,C)}}function b(n,C){n.fragmentShader=C.fragmentShader;n.vertexShader=C.vertexShader;n.uniforms=
|
|
|
|
-Uniforms.clone(C.uniforms)}function d(n,C,p,o,w){o.program||aa.initMaterial(o,C,p,w);var D=o.program,B=D.uniforms,F=o.uniforms;if(D!=ja){f.useProgram(D);ja=D}f.uniformMatrix4fv(B.projectionMatrix,!1,ha);if(p&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){F.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){F.fogNear.value=p.near;F.fogFar.value=
|
|
|
|
-p.far}else if(p instanceof THREE.FogExp2)F.fogDensity.value=p.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var V,M,J=0,qa=0,Ca=0,W,wa,la,Ga=ta,Na=Ga.directional.colors,ua=Ga.directional.positions,Ha=Ga.point.colors,P=Ga.point.positions,za=0,Aa=0;p=M=M=0;for(V=C.length;p<V;p++){M=C[p];W=M.color;wa=M.position;la=M.intensity;if(M instanceof THREE.AmbientLight){J+=W.r;qa+=W.g;Ca+=W.b}else if(M instanceof THREE.DirectionalLight){M=za*3;Na[M]=W.r*la;
|
|
|
|
-Na[M+1]=W.g*la;Na[M+2]=W.b*la;ua[M]=wa.x;ua[M+1]=wa.y;ua[M+2]=wa.z;za+=1}else if(M instanceof THREE.PointLight){M=Aa*3;Ha[M]=W.r*la;Ha[M+1]=W.g*la;Ha[M+2]=W.b*la;P[M]=wa.x;P[M+1]=wa.y;P[M+2]=wa.z;Aa+=1}}for(p=za*3;p<Na.length;p++)Na[p]=0;for(p=Aa*3;p<Ha.length;p++)Ha[p]=0;Ga.point.length=Aa;Ga.directional.length=za;Ga.ambient[0]=J;Ga.ambient[1]=qa;Ga.ambient[2]=Ca;C=ta;F.enableLighting.value=C.directional.length+C.point.length;F.ambientLightColor.value=C.ambient;F.directionalLightColor.value=C.directional.colors;
|
|
|
|
|
|
+THREE.WebGLRenderer=function(a){function c(n,C,p){var o,w,D,B=n.vertices,F=B.length,X=n.colors,N=X.length,J=n.__vertexArray,sa=n.__colorArray,Ea=n.__sortArray,Y=n.__dirtyVertices,ya=n.__dirtyColors;if(p.sortParticles){M.multiplySelf(p.matrixWorld);for(o=0;o<F;o++){w=B[o].position;ka.copy(w);M.multiplyVector3(ka);Ea[o]=[ka.z,o]}Ea.sort(function(la,Ha){return Ha[0]-la[0]});for(o=0;o<F;o++){w=B[Ea[o][1]].position;D=o*3;J[D]=w.x;J[D+1]=w.y;J[D+2]=w.z}for(o=0;o<N;o++){D=o*3;color=X[Ea[o][1]];sa[D]=color.r;
|
|
|
|
+sa[D+1]=color.g;sa[D+2]=color.b}}else{if(Y)for(o=0;o<F;o++){w=B[o].position;D=o*3;J[D]=w.x;J[D+1]=w.y;J[D+2]=w.z}if(ya)for(o=0;o<N;o++){color=X[o];D=o*3;sa[D]=color.r;sa[D+1]=color.g;sa[D+2]=color.b}}if(Y||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,J,C)}if(ya||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,sa,C)}}function b(n,C){n.fragmentShader=C.fragmentShader;n.vertexShader=C.vertexShader;n.uniforms=
|
|
|
|
+Uniforms.clone(C.uniforms)}function d(n,C,p,o,w){o.program||$.initMaterial(o,C,p,w);var D=o.program,B=D.uniforms,F=o.uniforms;if(D!=ha){f.useProgram(D);ha=D}f.uniformMatrix4fv(B.projectionMatrix,!1,ea);if(p&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){F.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){F.fogNear.value=p.near;F.fogFar.value=
|
|
|
|
+p.far}else if(p instanceof THREE.FogExp2)F.fogDensity.value=p.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var X,N,J=0,sa=0,Ea=0,Y,ya,la,Ha=va,Ma=Ha.directional.colors,xa=Ha.directional.positions,Ia=Ha.point.colors,U=Ha.point.positions,Ba=0,Ca=0;p=N=N=0;for(X=C.length;p<X;p++){N=C[p];Y=N.color;ya=N.position;la=N.intensity;if(N instanceof THREE.AmbientLight){J+=Y.r;sa+=Y.g;Ea+=Y.b}else if(N instanceof THREE.DirectionalLight){N=Ba*3;Ma[N]=Y.r*la;
|
|
|
|
+Ma[N+1]=Y.g*la;Ma[N+2]=Y.b*la;xa[N]=ya.x;xa[N+1]=ya.y;xa[N+2]=ya.z;Ba+=1}else if(N instanceof THREE.PointLight){N=Ca*3;Ia[N]=Y.r*la;Ia[N+1]=Y.g*la;Ia[N+2]=Y.b*la;U[N]=ya.x;U[N+1]=ya.y;U[N+2]=ya.z;Ca+=1}}for(p=Ba*3;p<Ma.length;p++)Ma[p]=0;for(p=Ca*3;p<Ia.length;p++)Ia[p]=0;Ha.point.length=Ca;Ha.directional.length=Ba;Ha.ambient[0]=J;Ha.ambient[1]=sa;Ha.ambient[2]=Ea;C=va;F.enableLighting.value=C.directional.length+C.point.length;F.ambientLightColor.value=C.ambient;F.directionalLightColor.value=C.directional.colors;
|
|
F.directionalLightDirection.value=C.directional.positions;F.pointLightColor.value=C.point.colors;F.pointLightPosition.value=C.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){F.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity;F.map.texture=o.map;F.lightMap.texture=o.lightMap;F.envMap.texture=o.envMap;F.reflectivity.value=o.reflectivity;F.refractionRatio.value=
|
|
F.directionalLightDirection.value=C.directional.positions;F.pointLightColor.value=C.point.colors;F.pointLightPosition.value=C.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){F.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity;F.map.texture=o.map;F.lightMap.texture=o.lightMap;F.envMap.texture=o.envMap;F.reflectivity.value=o.reflectivity;F.refractionRatio.value=
|
|
-o.refractionRatio;F.combine.value=o.combine;F.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){F.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){F.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity;F.size.value=o.size;F.scale.value=da.height/2;F.map.texture=o.map}else if(o instanceof
|
|
|
|
-THREE.MeshPhongMaterial){F.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);F.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);F.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){F.mNear.value=n.near;F.mFar.value=n.far;F.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)F.opacity.value=o.opacity;for(var Wa in F)if(J=D.uniforms[Wa]){p=F[Wa];V=p.type;C=p.value;if(V=="i")f.uniform1i(J,C);else if(V=="f")f.uniform1f(J,C);else if(V=="fv1")f.uniform1fv(J,
|
|
|
|
-C);else if(V=="fv")f.uniform3fv(J,C);else if(V=="v2")f.uniform2f(J,C.x,C.y);else if(V=="v3")f.uniform3f(J,C.x,C.y,C.z);else if(V=="c")f.uniform3f(J,C.r,C.g,C.b);else if(V=="t"){f.uniform1i(J,C);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(V=0;V<6;++V)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+V,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image[V])}else{p.image.__webGLTextureCube=
|
|
|
|
-f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(V=0;V<6;++V)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+V,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[V]);p.__wasSetOnce=!0}H(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+C);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,
|
|
|
|
-0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}H(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+C);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(B.modelViewMatrix,!1,w._modelViewMatrixArray);f.uniformMatrix3fv(B.normalMatrix,!1,w._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||
|
|
|
|
-o instanceof THREE.MeshPhongMaterial||o.envMap)&&f.uniform3f(B.cameraPosition,n.position.x,n.position.y,n.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&f.uniformMatrix4fv(B.objectMatrix,!1,w._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&f.uniformMatrix4fv(B.viewMatrix,!1,va);if(o.skinning){f.uniformMatrix4fv(B.cameraInverseMatrix,!1,va);f.uniformMatrix4fv(B.boneGlobalMatrices,
|
|
|
|
|
|
+o.refractionRatio;F.combine.value=o.combine;F.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){F.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){F.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity;F.size.value=o.size;F.scale.value=aa.height/2;F.map.texture=o.map}else if(o instanceof
|
|
|
|
+THREE.MeshPhongMaterial){F.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);F.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);F.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){F.mNear.value=n.near;F.mFar.value=n.far;F.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)F.opacity.value=o.opacity;for(var Va in F)if(J=D.uniforms[Va]){p=F[Va];X=p.type;C=p.value;if(X=="i")f.uniform1i(J,C);else if(X=="f")f.uniform1f(J,C);else if(X=="fv1")f.uniform1fv(J,
|
|
|
|
+C);else if(X=="fv")f.uniform3fv(J,C);else if(X=="v2")f.uniform2f(J,C.x,C.y);else if(X=="v3")f.uniform3f(J,C.x,C.y,C.z);else if(X=="c")f.uniform3f(J,C.r,C.g,C.b);else if(X=="t"){f.uniform1i(J,C);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(X=0;X<6;++X)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image[X])}else{p.image.__webGLTextureCube=
|
|
|
|
+f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(X=0;X<6;++X)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[X]);p.__wasSetOnce=!0}I(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+C);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,
|
|
|
|
+0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}I(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+C);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(B.modelViewMatrix,!1,w._modelViewMatrixArray);f.uniformMatrix3fv(B.normalMatrix,!1,w._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||
|
|
|
|
+o instanceof THREE.MeshPhongMaterial||o.envMap)&&f.uniform3f(B.cameraPosition,n.position.x,n.position.y,n.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&f.uniformMatrix4fv(B.objectMatrix,!1,w._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&f.uniformMatrix4fv(B.viewMatrix,!1,ua);if(o.skinning){f.uniformMatrix4fv(B.cameraInverseMatrix,!1,ua);f.uniformMatrix4fv(B.boneGlobalMatrices,
|
|
!1,w.boneMatrices)}return D}function e(n,C,p,o,w,D){if(o.opacity!=0){n=d(n,C,p,o,D).attributes;if(o.morphTargets){C=o.program.attributes;D.morphTargetBase!==-1?f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[D.morphTargetBase]):f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(C.position,3,f.FLOAT,!1,0,0);if(D.morphTargetForcedOrder.length){p=0;for(var B=D.morphTargetForcedOrder,F=D.morphTargetInfluences;p<o.numSupportedMorphTargets&&p<B.length;){f.bindBuffer(f.ARRAY_BUFFER,
|
|
!1,w.boneMatrices)}return D}function e(n,C,p,o,w,D){if(o.opacity!=0){n=d(n,C,p,o,D).attributes;if(o.morphTargets){C=o.program.attributes;D.morphTargetBase!==-1?f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[D.morphTargetBase]):f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(C.position,3,f.FLOAT,!1,0,0);if(D.morphTargetForcedOrder.length){p=0;for(var B=D.morphTargetForcedOrder,F=D.morphTargetInfluences;p<o.numSupportedMorphTargets&&p<B.length;){f.bindBuffer(f.ARRAY_BUFFER,
|
|
-w.__webGLMorphTargetsBuffers[B[p]]);f.vertexAttribPointer(C["morphTarget"+p],3,f.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[p]=F[B[p]];p++}}else{B=[];var V=-1,M=0;F=D.morphTargetInfluences;var J,qa=F.length;p=0;for(D.morphTargetBase!==-1&&(B[D.morphTargetBase]=!0);p<o.numSupportedMorphTargets;){for(J=0;J<qa;J++)if(!B[J]&&F[J]>V){M=J;V=F[M]}f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[M]);f.vertexAttribPointer(C["morphTarget"+p],3,f.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[p]=V;B[M]=
|
|
|
|
-1;V=-1;p++}}f.uniform1fv(o.program.uniforms.morphTargetInfluences,D.__webGLMorphTargetInfluences)}else{f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(n.position,3,f.FLOAT,!1,0,0)}if(n.color>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLColorBuffer);f.vertexAttribPointer(n.color,3,f.FLOAT,!1,0,0)}if(n.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLNormalBuffer);f.vertexAttribPointer(n.normal,3,f.FLOAT,!1,0,0)}if(n.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLTangentBuffer);
|
|
|
|
|
|
+w.__webGLMorphTargetsBuffers[B[p]]);f.vertexAttribPointer(C["morphTarget"+p],3,f.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[p]=F[B[p]];p++}}else{B=[];var X=-1,N=0;F=D.morphTargetInfluences;var J,sa=F.length;p=0;for(D.morphTargetBase!==-1&&(B[D.morphTargetBase]=!0);p<o.numSupportedMorphTargets;){for(J=0;J<sa;J++)if(!B[J]&&F[J]>X){N=J;X=F[N]}f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[N]);f.vertexAttribPointer(C["morphTarget"+p],3,f.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[p]=X;B[N]=
|
|
|
|
+1;X=-1;p++}}f.uniform1fv(o.program.uniforms.morphTargetInfluences,D.__webGLMorphTargetInfluences)}else{f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(n.position,3,f.FLOAT,!1,0,0)}if(n.color>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLColorBuffer);f.vertexAttribPointer(n.color,3,f.FLOAT,!1,0,0)}if(n.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLNormalBuffer);f.vertexAttribPointer(n.normal,3,f.FLOAT,!1,0,0)}if(n.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLTangentBuffer);
|
|
f.vertexAttribPointer(n.tangent,4,f.FLOAT,!1,0,0)}if(n.uv>=0)if(w.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUVBuffer);f.vertexAttribPointer(n.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(n.uv)}else f.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(w.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUV2Buffer);f.vertexAttribPointer(n.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(n.uv2)}else f.disableVertexAttribArray(n.uv2);if(o.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=
|
|
f.vertexAttribPointer(n.tangent,4,f.FLOAT,!1,0,0)}if(n.uv>=0)if(w.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUVBuffer);f.vertexAttribPointer(n.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(n.uv)}else f.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(w.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUV2Buffer);f.vertexAttribPointer(n.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(n.uv2)}else f.disableVertexAttribArray(n.uv2);if(o.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=
|
|
0&&n.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexABuffer);f.vertexAttribPointer(n.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexBBuffer);f.vertexAttribPointer(n.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinIndicesBuffer);f.vertexAttribPointer(n.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinWeightsBuffer);f.vertexAttribPointer(n.skinWeight,4,f.FLOAT,!1,0,0)}if(D instanceof THREE.Mesh)if(o.wireframe){f.lineWidth(o.wireframeLinewidth);
|
|
0&&n.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexABuffer);f.vertexAttribPointer(n.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexBBuffer);f.vertexAttribPointer(n.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinIndicesBuffer);f.vertexAttribPointer(n.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinWeightsBuffer);f.vertexAttribPointer(n.skinWeight,4,f.FLOAT,!1,0,0)}if(D instanceof THREE.Mesh)if(o.wireframe){f.lineWidth(o.wireframeLinewidth);
|
|
f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLLineBuffer);f.drawElements(f.LINES,w.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,w.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(D instanceof THREE.Line){D=D.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(o.linewidth);f.drawArrays(D,0,w.__webGLLineCount)}else if(D instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,0,w.__webGLParticleCount);else D instanceof THREE.Ribbon&&
|
|
f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLLineBuffer);f.drawElements(f.LINES,w.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,w.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(D instanceof THREE.Line){D=D.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(o.linewidth);f.drawArrays(D,0,w.__webGLLineCount)}else if(D instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,0,w.__webGLParticleCount);else D instanceof THREE.Ribbon&&
|
|
-f.drawArrays(f.TRIANGLE_STRIP,0,w.__webGLVertexCount)}}function h(n,C){if(!n.__webGLVertexBuffer)n.__webGLVertexBuffer=f.createBuffer();if(!n.__webGLNormalBuffer)n.__webGLNormalBuffer=f.createBuffer();if(n.hasPos){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,n.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(C.attributes.position);f.vertexAttribPointer(C.attributes.position,3,f.FLOAT,!1,0,0)}if(n.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLNormalBuffer);
|
|
|
|
-f.bufferData(f.ARRAY_BUFFER,n.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(C.attributes.normal);f.vertexAttribPointer(C.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,n.count);n.count=0}function g(n){if(Y!=n.doubleSided){n.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);Y=n.doubleSided}if(Da!=n.flipSided){n.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);Da=n.flipSided}}function k(n){if(Ea!=n){n?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);Ea=n}}function j(n){R[0].set(n.n41-
|
|
|
|
-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);R[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);R[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);R[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);R[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);R[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var C;for(n=0;n<6;n++){C=R[n];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function m(n){for(var C=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,
|
|
|
|
-Math.max(n.scale.y,n.scale.z)),o=0;o<6;o++){n=R[o].x*C.n14+R[o].y*C.n24+R[o].z*C.n34+R[o].w;if(n<=p)return!1}return!0}function t(n,C){n.list[n.count]=C;n.count+=1}function x(n){var C,p,o=n.object,w=n.opaque,D=n.transparent;D.count=0;n=w.count=0;for(C=o.materials.length;n<C;n++){p=o.materials[n];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?t(D,p):t(w,p)}}function y(n){var C,p,o,w,D=n.object,B=n.buffer,F=n.opaque,V=n.transparent;V.count=0;n=F.count=0;for(o=D.materials.length;n<o;n++){C=
|
|
|
|
-D.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(p=B.materials.length;C<p;C++)(w=B.materials[C])&&(w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(V,w):t(F,w))}else{w=C;w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(V,w):t(F,w)}}}function q(n,C){return C.z-n.z}function A(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function G(n){function C(Ca){var W=
|
|
|
|
-[];p=0;for(o=Ca.length;p<o;p++)Ca[p]==undefined?W.push("undefined"):W.push(Ca[p].id);return W.join("_")}var p,o,w,D,B,F,V,M,J={},qa=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};w=0;for(D=n.faces.length;w<D;w++){B=n.faces[w];F=B.materials;V=C(F);J[V]==undefined&&(J[V]={hash:V,counter:0});M=J[V].hash+"_"+J[V].counter;n.geometryGroups[M]==undefined&&(n.geometryGroups[M]={faces:[],materials:F,vertices:0,numMorphTargets:qa});B=B instanceof THREE.Face3?3:4;if(n.geometryGroups[M].vertices+
|
|
|
|
-B>65535){J[V].counter+=1;M=J[V].hash+"_"+J[V].counter;n.geometryGroups[M]==undefined&&(n.geometryGroups[M]={faces:[],materials:F,vertices:0,numMorphTargets:qa})}n.geometryGroups[M].faces.push(w);n.geometryGroups[M].vertices+=B}}function I(n,C,p){n.push({buffer:C,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function E(n){if(n!=ea){switch(n){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,
|
|
|
|
-f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ea=n}}function H(n,C,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(n,f.TEXTURE_WRAP_S,N(C.wrapS));f.texParameteri(n,f.TEXTURE_WRAP_T,N(C.wrapT));f.texParameteri(n,f.TEXTURE_MAG_FILTER,
|
|
|
|
-N(C.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,N(C.minFilter));f.generateMipmap(n)}else{f.texParameteri(n,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(n,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(n,f.TEXTURE_MAG_FILTER,Q(C.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,Q(C.minFilter))}}function z(n){if(n&&!n.__webGLFramebuffer){n.__webGLFramebuffer=f.createFramebuffer();n.__webGLRenderbuffer=f.createRenderbuffer();n.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,
|
|
|
|
-n.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,n.width,n.height);f.bindTexture(f.TEXTURE_2D,n.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,N(n.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,N(n.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,N(n.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,N(n.minFilter));f.texImage2D(f.TEXTURE_2D,0,N(n.format),n.width,n.height,0,N(n.format),N(n.type),null);f.bindFramebuffer(f.FRAMEBUFFER,
|
|
|
|
-n.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,n.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,n.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var C,p;if(n){C=n.__webGLFramebuffer;p=n.width;n=n.height}else{C=null;p=oa;n=$}if(C!=na){f.bindFramebuffer(f.FRAMEBUFFER,C);f.viewport(ia,ra,p,n);na=C}}function S(n,C){var p;if(n=="fragment")p=
|
|
|
|
-f.createShader(f.FRAGMENT_SHADER);else n=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,C);f.compileShader(p);if(!f.getShaderParameter(p,f.COMPILE_STATUS)){console.error(f.getShaderInfoLog(p));console.error(C);return null}return p}function Q(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}
|
|
|
|
-function N(n){switch(n){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;
|
|
|
|
|
|
+f.drawArrays(f.TRIANGLE_STRIP,0,w.__webGLVertexCount)}}function g(n,C){if(!n.__webGLVertexBuffer)n.__webGLVertexBuffer=f.createBuffer();if(!n.__webGLNormalBuffer)n.__webGLNormalBuffer=f.createBuffer();if(n.hasPos){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,n.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(C.attributes.position);f.vertexAttribPointer(C.attributes.position,3,f.FLOAT,!1,0,0)}if(n.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLNormalBuffer);
|
|
|
|
+f.bufferData(f.ARRAY_BUFFER,n.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(C.attributes.normal);f.vertexAttribPointer(C.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,n.count);n.count=0}function h(n){if(W!=n.doubleSided){n.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);W=n.doubleSided}if(Da!=n.flipSided){n.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);Da=n.flipSided}}function k(n){if(Fa!=n){n?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);Fa=n}}function j(n){Q[0].set(n.n41-
|
|
|
|
+n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);Q[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);Q[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);Q[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);Q[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);Q[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var C;for(n=0;n<6;n++){C=Q[n];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function m(n){for(var C=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,
|
|
|
|
+Math.max(n.scale.y,n.scale.z)),o=0;o<6;o++){n=Q[o].x*C.n14+Q[o].y*C.n24+Q[o].z*C.n34+Q[o].w;if(n<=p)return!1}return!0}function t(n,C){n.list[n.count]=C;n.count+=1}function x(n){var C,p,o=n.object,w=n.opaque,D=n.transparent;D.count=0;n=w.count=0;for(C=o.materials.length;n<C;n++){p=o.materials[n];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?t(D,p):t(w,p)}}function y(n){var C,p,o,w,D=n.object,B=n.buffer,F=n.opaque,X=n.transparent;X.count=0;n=F.count=0;for(o=D.materials.length;n<o;n++){C=
|
|
|
|
+D.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(p=B.materials.length;C<p;C++)(w=B.materials[C])&&(w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(X,w):t(F,w))}else{w=C;w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(X,w):t(F,w)}}}function q(n,C){return C.z-n.z}function A(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function G(n){function C(Ea){var Y=
|
|
|
|
+[];p=0;for(o=Ea.length;p<o;p++)Ea[p]==undefined?Y.push("undefined"):Y.push(Ea[p].id);return Y.join("_")}var p,o,w,D,B,F,X,N,J={},sa=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};w=0;for(D=n.faces.length;w<D;w++){B=n.faces[w];F=B.materials;X=C(F);J[X]==undefined&&(J[X]={hash:X,counter:0});N=J[X].hash+"_"+J[X].counter;n.geometryGroups[N]==undefined&&(n.geometryGroups[N]={faces:[],materials:F,vertices:0,numMorphTargets:sa});B=B instanceof THREE.Face3?3:4;if(n.geometryGroups[N].vertices+
|
|
|
|
+B>65535){J[X].counter+=1;N=J[X].hash+"_"+J[X].counter;n.geometryGroups[N]==undefined&&(n.geometryGroups[N]={faces:[],materials:F,vertices:0,numMorphTargets:sa})}n.geometryGroups[N].faces.push(w);n.geometryGroups[N].vertices+=B}}function H(n,C,p){n.push({buffer:C,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function E(n){if(n!=da){switch(n){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,
|
|
|
|
+f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}da=n}}function I(n,C,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(n,f.TEXTURE_WRAP_S,O(C.wrapS));f.texParameteri(n,f.TEXTURE_WRAP_T,O(C.wrapT));f.texParameteri(n,f.TEXTURE_MAG_FILTER,
|
|
|
|
+O(C.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,O(C.minFilter));f.generateMipmap(n)}else{f.texParameteri(n,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(n,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(n,f.TEXTURE_MAG_FILTER,P(C.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,P(C.minFilter))}}function z(n){if(n&&!n.__webGLFramebuffer){n.__webGLFramebuffer=f.createFramebuffer();n.__webGLRenderbuffer=f.createRenderbuffer();n.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,
|
|
|
|
+n.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,n.width,n.height);f.bindTexture(f.TEXTURE_2D,n.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,O(n.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,O(n.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,O(n.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,O(n.minFilter));f.texImage2D(f.TEXTURE_2D,0,O(n.format),n.width,n.height,0,O(n.format),O(n.type),null);f.bindFramebuffer(f.FRAMEBUFFER,
|
|
|
|
+n.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,n.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,n.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var C,p;if(n){C=n.__webGLFramebuffer;p=n.width;n=n.height}else{C=null;p=ma;n=Z}if(C!=oa){f.bindFramebuffer(f.FRAMEBUFFER,C);f.viewport(ja,qa,p,n);oa=C}}function S(n,C){var p;if(n=="fragment")p=
|
|
|
|
+f.createShader(f.FRAGMENT_SHADER);else n=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,C);f.compileShader(p);if(!f.getShaderParameter(p,f.COMPILE_STATUS)){console.error(f.getShaderInfoLog(p));console.error(C);return null}return p}function P(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}
|
|
|
|
+function O(n){switch(n){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;
|
|
case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}
|
|
case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}
|
|
-var da=document.createElement("canvas"),f,ja=null,na=null,aa=this,Y=null,Da=null,ea=null,Ea=null,ia=0,ra=0,oa=0,$=0,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],O=new THREE.Matrix4,ha=new Float32Array(16),va=new Float32Array(16),ka=new THREE.Vector4,ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},xa=!0,Ma=new THREE.Color(0),ab=0;if(a){if(a.antialias!==undefined)xa=a.antialias;
|
|
|
|
-a.clearColor!==undefined&&Ma.setHex(a.clearColor);if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=da;this.autoClear=!0;this.sortObjects=!0;(function(n,C,p){try{if(!(f=da.getContext("experimental-webgl",{antialias:n})))throw"Error creating WebGL context.";}catch(o){console.error(o)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);
|
|
|
|
-f.clearColor(C.r,C.g,C.b,p);_cullEnabled=!0})(xa,Ma,ab);this.context=f;this.setSize=function(n,C){da.width=n;da.height=C;this.setViewport(0,0,da.width,da.height)};this.setViewport=function(n,C,p,o){ia=n;ra=C;oa=p;$=o;f.viewport(ia,ra,oa,$)};this.setScissor=function(n,C,p,o){f.scissor(n,C,p,o)};this.enableScissorTest=function(n){n?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){f.depthMask(n)};this.setClearColorHex=function(n,C){var p=new THREE.Color(n);
|
|
|
|
|
|
+var aa=document.createElement("canvas"),f,ha=null,oa=null,$=this,W=null,Da=null,da=null,Fa=null,ja=0,qa=0,ma=0,Z=0,Q=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Matrix4,ea=new Float32Array(16),ua=new Float32Array(16),ka=new THREE.Vector4,va={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},za=!0,La=new THREE.Color(0),$a=0;if(a){if(a.antialias!==undefined)za=a.antialias;
|
|
|
|
+a.clearColor!==undefined&&La.setHex(a.clearColor);if(a.clearAlpha!==undefined)$a=a.clearAlpha}this.maxMorphTargets=8;this.domElement=aa;this.autoClear=!0;this.sortObjects=!0;(function(n,C,p){try{if(!(f=aa.getContext("experimental-webgl",{antialias:n})))throw"Error creating WebGL context.";}catch(o){console.error(o)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);
|
|
|
|
+f.clearColor(C.r,C.g,C.b,p);_cullEnabled=!0})(za,La,$a);this.context=f;this.setSize=function(n,C){aa.width=n;aa.height=C;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(n,C,p,o){ja=n;qa=C;ma=p;Z=o;f.viewport(ja,qa,ma,Z)};this.setScissor=function(n,C,p,o){f.scissor(n,C,p,o)};this.enableScissorTest=function(n){n?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){f.depthMask(n)};this.setClearColorHex=function(n,C){var p=new THREE.Color(n);
|
|
f.clearColor(p.r,p.g,p.b,C)};this.setClearColor=function(n,C){f.clearColor(n.r,n.g,n.b,C)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(n,C,p,o){var w,D,B;if(n instanceof THREE.MeshDepthMaterial)b(n,THREE.ShaderLib.depth);else if(n instanceof THREE.MeshNormalMaterial)b(n,THREE.ShaderLib.normal);else if(n instanceof THREE.MeshBasicMaterial)b(n,THREE.ShaderLib.basic);else if(n instanceof THREE.MeshLambertMaterial)b(n,THREE.ShaderLib.lambert);else if(n instanceof
|
|
f.clearColor(p.r,p.g,p.b,C)};this.setClearColor=function(n,C){f.clearColor(n.r,n.g,n.b,C)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(n,C,p,o){var w,D,B;if(n instanceof THREE.MeshDepthMaterial)b(n,THREE.ShaderLib.depth);else if(n instanceof THREE.MeshNormalMaterial)b(n,THREE.ShaderLib.normal);else if(n instanceof THREE.MeshBasicMaterial)b(n,THREE.ShaderLib.basic);else if(n instanceof THREE.MeshLambertMaterial)b(n,THREE.ShaderLib.lambert);else if(n instanceof
|
|
-THREE.MeshPhongMaterial)b(n,THREE.ShaderLib.phong);else if(n instanceof THREE.LineBasicMaterial)b(n,THREE.ShaderLib.basic);else n instanceof THREE.ParticleBasicMaterial&&b(n,THREE.ShaderLib.particle_basic);var F,V,M,J;B=M=J=0;for(F=C.length;B<F;B++){V=C[B];V instanceof THREE.DirectionalLight&&M++;V instanceof THREE.PointLight&&J++}if(J+M<=4)C=M;else{C=Math.ceil(4*M/(J+M));J=4-C}B={directional:C,point:J};F=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)F=o.bones.length;J=n.fragmentShader;C=n.vertexShader;
|
|
|
|
|
|
+THREE.MeshPhongMaterial)b(n,THREE.ShaderLib.phong);else if(n instanceof THREE.LineBasicMaterial)b(n,THREE.ShaderLib.basic);else n instanceof THREE.ParticleBasicMaterial&&b(n,THREE.ShaderLib.particle_basic);var F,X,N,J;B=N=J=0;for(F=C.length;B<F;B++){X=C[B];X instanceof THREE.DirectionalLight&&N++;X instanceof THREE.PointLight&&J++}if(J+N<=4)C=N;else{C=Math.ceil(4*N/(J+N));J=4-C}B={directional:C,point:J};F=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)F=o.bones.length;J=n.fragmentShader;C=n.vertexShader;
|
|
F={fog:p,map:n.map,envMap:n.envMap,lightMap:n.lightMap,vertexColors:n.vertexColors,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxDirLights:B.directional,maxPointLights:B.point,maxBones:F};p=f.createProgram();B=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,F.fog?"#define USE_FOG":"",F.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":
|
|
F={fog:p,map:n.map,envMap:n.envMap,lightMap:n.lightMap,vertexColors:n.vertexColors,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxDirLights:B.directional,maxPointLights:B.point,maxBones:F};p=f.createProgram();B=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,F.fog?"#define USE_FOG":"",F.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":
|
|
"",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");F=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,"#define MAX_BONES "+F.maxBones,F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":"",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":"",F.skinning?"#define USE_SKINNING":
|
|
"",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");F=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,"#define MAX_BONES "+F.maxBones,F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":"",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":"",F.skinning?"#define USE_SKINNING":
|
|
"",F.morphTargets?"#define USE_MORPHTARGETS":"",F.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
"",F.morphTargets?"#define USE_MORPHTARGETS":"",F.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
@@ -261,58 +262,59 @@ f.attachShader(p,S("fragment",B+J));f.attachShader(p,S("vertex",F+C));f.linkProg
|
|
w=n.program;J=0;for(C=p.length;J<C;J++){B=p[J];w.uniforms[B]=f.getUniformLocation(w,B)}p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<this.maxMorphTargets;w++)p.push("morphTarget"+w);for(D in n.attributes)p.push(D);D=n.program;w=p;p=0;for(J=w.length;p<J;p++){C=w[p];D.attributes[C]=f.getAttribLocation(D,C)}D=n.program.attributes;f.enableVertexAttribArray(D.position);D.color>=0&&f.enableVertexAttribArray(D.color);D.normal>=0&&f.enableVertexAttribArray(D.normal);
|
|
w=n.program;J=0;for(C=p.length;J<C;J++){B=p[J];w.uniforms[B]=f.getUniformLocation(w,B)}p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<this.maxMorphTargets;w++)p.push("morphTarget"+w);for(D in n.attributes)p.push(D);D=n.program;w=p;p=0;for(J=w.length;p<J;p++){C=w[p];D.attributes[C]=f.getAttribLocation(D,C)}D=n.program.attributes;f.enableVertexAttribArray(D.position);D.color>=0&&f.enableVertexAttribArray(D.color);D.normal>=0&&f.enableVertexAttribArray(D.normal);
|
|
D.tangent>=0&&f.enableVertexAttribArray(D.tangent);if(n.skinning&&D.skinVertexA>=0&&D.skinVertexB>=0&&D.skinIndex>=0&&D.skinWeight>=0){f.enableVertexAttribArray(D.skinVertexA);f.enableVertexAttribArray(D.skinVertexB);f.enableVertexAttribArray(D.skinIndex);f.enableVertexAttribArray(D.skinWeight)}if(n.morphTargets){n.numSupportedMorphTargets=0;if(D.morphTarget0>=0){f.enableVertexAttribArray(D.morphTarget0);n.numSupportedMorphTargets++}if(D.morphTarget1>=0){f.enableVertexAttribArray(D.morphTarget1);
|
|
D.tangent>=0&&f.enableVertexAttribArray(D.tangent);if(n.skinning&&D.skinVertexA>=0&&D.skinVertexB>=0&&D.skinIndex>=0&&D.skinWeight>=0){f.enableVertexAttribArray(D.skinVertexA);f.enableVertexAttribArray(D.skinVertexB);f.enableVertexAttribArray(D.skinIndex);f.enableVertexAttribArray(D.skinWeight)}if(n.morphTargets){n.numSupportedMorphTargets=0;if(D.morphTarget0>=0){f.enableVertexAttribArray(D.morphTarget0);n.numSupportedMorphTargets++}if(D.morphTarget1>=0){f.enableVertexAttribArray(D.morphTarget1);
|
|
n.numSupportedMorphTargets++}if(D.morphTarget2>=0){f.enableVertexAttribArray(D.morphTarget2);n.numSupportedMorphTargets++}if(D.morphTarget3>=0){f.enableVertexAttribArray(D.morphTarget3);n.numSupportedMorphTargets++}if(D.morphTarget4>=0){f.enableVertexAttribArray(D.morphTarget4);n.numSupportedMorphTargets++}if(D.morphTarget5>=0){f.enableVertexAttribArray(D.morphTarget5);n.numSupportedMorphTargets++}if(D.morphTarget6>=0){f.enableVertexAttribArray(D.morphTarget6);n.numSupportedMorphTargets++}if(D.morphTarget7>=
|
|
n.numSupportedMorphTargets++}if(D.morphTarget2>=0){f.enableVertexAttribArray(D.morphTarget2);n.numSupportedMorphTargets++}if(D.morphTarget3>=0){f.enableVertexAttribArray(D.morphTarget3);n.numSupportedMorphTargets++}if(D.morphTarget4>=0){f.enableVertexAttribArray(D.morphTarget4);n.numSupportedMorphTargets++}if(D.morphTarget5>=0){f.enableVertexAttribArray(D.morphTarget5);n.numSupportedMorphTargets++}if(D.morphTarget6>=0){f.enableVertexAttribArray(D.morphTarget6);n.numSupportedMorphTargets++}if(D.morphTarget7>=
|
|
-0){f.enableVertexAttribArray(D.morphTarget7);n.numSupportedMorphTargets++}o.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(w=0;w<this.maxMorphTargets;w++)o.__webGLMorphTargetInfluences[w]=0}};this.render=function(n,C,p,o){var w,D,B,F,V,M,J,qa,Ca=n.lights,W=n.fog;C.matrixAutoUpdate&&C.updateMatrix();n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(va);C.projectionMatrix.flattenToArray(ha);O.multiply(C.projectionMatrix,C.matrixWorldInverse);j(O);this.initWebGLObjects(n);
|
|
|
|
-z(p);(this.autoClear||o)&&this.clear();V=n.__webglObjects.length;for(o=0;o<V;o++){w=n.__webglObjects[o];J=w.object;if(J.visible)if(!(J instanceof THREE.Mesh)||m(J)){J.matrixWorld.flattenToArray(J._objectMatrixArray);A(J,C);y(w);w.render=!0;if(this.sortObjects){ka.copy(J.position);O.multiplyVector3(ka);w.z=ka.z}}else w.render=!1;else w.render=!1}this.sortObjects&&n.__webglObjects.sort(q);M=n.__webglObjectsImmediate.length;for(o=0;o<M;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){J.matrixAutoUpdate&&
|
|
|
|
-J.matrixWorld.flattenToArray(J._objectMatrixArray);A(J,C);x(w)}}E(THREE.NormalBlending);for(o=0;o<V;o++){w=n.__webglObjects[o];if(w.render){J=w.object;qa=w.buffer;B=w.opaque;g(J);for(w=0;w<B.count;w++){F=B.list[w];k(F.depthTest);e(C,Ca,W,F,qa,J)}}}for(o=0;o<M;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){B=w.opaque;g(J);for(w=0;w<B.count;w++){F=B.list[w];k(F.depthTest);D=d(C,Ca,W,F,J);J.render(function(wa){h(wa,D)})}}}for(o=0;o<V;o++){w=n.__webglObjects[o];if(w.render){J=w.object;qa=
|
|
|
|
-w.buffer;B=w.transparent;g(J);for(w=0;w<B.count;w++){F=B.list[w];E(F.blending);k(F.depthTest);e(C,Ca,W,F,qa,J)}}}for(o=0;o<M;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){B=w.transparent;g(J);for(w=0;w<B.count;w++){F=B.list[w];E(F.blending);k(F.depthTest);D=d(C,Ca,W,F,J);J.render(function(wa){h(wa,D)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};
|
|
|
|
|
|
+0){f.enableVertexAttribArray(D.morphTarget7);n.numSupportedMorphTargets++}o.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(w=0;w<this.maxMorphTargets;w++)o.__webGLMorphTargetInfluences[w]=0}};this.render=function(n,C,p,o){var w,D,B,F,X,N,J,sa,Ea=n.lights,Y=n.fog;C.matrixAutoUpdate&&C.updateMatrix();n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(ua);C.projectionMatrix.flattenToArray(ea);M.multiply(C.projectionMatrix,C.matrixWorldInverse);j(M);this.initWebGLObjects(n);
|
|
|
|
+z(p);(this.autoClear||o)&&this.clear();X=n.__webglObjects.length;for(o=0;o<X;o++){w=n.__webglObjects[o];J=w.object;if(J.visible)if(!(J instanceof THREE.Mesh)||m(J)){J.matrixWorld.flattenToArray(J._objectMatrixArray);A(J,C);y(w);w.render=!0;if(this.sortObjects){ka.copy(J.position);M.multiplyVector3(ka);w.z=ka.z}}else w.render=!1;else w.render=!1}this.sortObjects&&n.__webglObjects.sort(q);N=n.__webglObjectsImmediate.length;for(o=0;o<N;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){J.matrixAutoUpdate&&
|
|
|
|
+J.matrixWorld.flattenToArray(J._objectMatrixArray);A(J,C);x(w)}}E(THREE.NormalBlending);for(o=0;o<X;o++){w=n.__webglObjects[o];if(w.render){J=w.object;sa=w.buffer;B=w.opaque;h(J);for(w=0;w<B.count;w++){F=B.list[w];k(F.depthTest);e(C,Ea,Y,F,sa,J)}}}for(o=0;o<N;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){B=w.opaque;h(J);for(w=0;w<B.count;w++){F=B.list[w];k(F.depthTest);D=d(C,Ea,Y,F,J);J.render(function(ya){g(ya,D)})}}}for(o=0;o<X;o++){w=n.__webglObjects[o];if(w.render){J=w.object;sa=
|
|
|
|
+w.buffer;B=w.transparent;h(J);for(w=0;w<B.count;w++){F=B.list[w];E(F.blending);k(F.depthTest);e(C,Ea,Y,F,sa,J)}}}for(o=0;o<N;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){B=w.transparent;h(J);for(w=0;w<B.count;w++){F=B.list[w];E(F.blending);k(F.depthTest);D=d(C,Ea,Y,F,J);J.render(function(ya){g(ya,D)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};
|
|
this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[]}for(;n.__objectsAdded.length;){var C=n.__objectsAdded[0],p=n,o=void 0,w=void 0,D=void 0;if(C._modelViewMatrix==undefined){C._modelViewMatrix=new THREE.Matrix4;C._normalMatrixArray=new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){w=C.geometry;w.geometryGroups==
|
|
this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[]}for(;n.__objectsAdded.length;){var C=n.__objectsAdded[0],p=n,o=void 0,w=void 0,D=void 0;if(C._modelViewMatrix==undefined){C._modelViewMatrix=new THREE.Matrix4;C._normalMatrixArray=new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){w=C.geometry;w.geometryGroups==
|
|
undefined&&G(w);for(o in w.geometryGroups){D=w.geometryGroups[o];if(!D.__webGLVertexBuffer){var B=D;B.__webGLVertexBuffer=f.createBuffer();B.__webGLNormalBuffer=f.createBuffer();B.__webGLTangentBuffer=f.createBuffer();B.__webGLColorBuffer=f.createBuffer();B.__webGLUVBuffer=f.createBuffer();B.__webGLUV2Buffer=f.createBuffer();B.__webGLSkinVertexABuffer=f.createBuffer();B.__webGLSkinVertexBBuffer=f.createBuffer();B.__webGLSkinIndicesBuffer=f.createBuffer();B.__webGLSkinWeightsBuffer=f.createBuffer();
|
|
undefined&&G(w);for(o in w.geometryGroups){D=w.geometryGroups[o];if(!D.__webGLVertexBuffer){var B=D;B.__webGLVertexBuffer=f.createBuffer();B.__webGLNormalBuffer=f.createBuffer();B.__webGLTangentBuffer=f.createBuffer();B.__webGLColorBuffer=f.createBuffer();B.__webGLUVBuffer=f.createBuffer();B.__webGLUV2Buffer=f.createBuffer();B.__webGLSkinVertexABuffer=f.createBuffer();B.__webGLSkinVertexBBuffer=f.createBuffer();B.__webGLSkinIndicesBuffer=f.createBuffer();B.__webGLSkinWeightsBuffer=f.createBuffer();
|
|
-B.__webGLFaceBuffer=f.createBuffer();B.__webGLLineBuffer=f.createBuffer();if(B.numMorphTargets){var F=void 0,V=void 0;B.__webGLMorphTargetsBuffers=[];F=0;for(V=B.numMorphTargets;F<V;F++)B.__webGLMorphTargetsBuffers.push(f.createBuffer())}B=D;var M=C,J=void 0,qa=void 0,Ca=V=F=0;J=void 0;qa=void 0;var W=void 0;qa=void 0;var wa=M.geometry;W=wa.faces;var la=B.faces;J=0;for(qa=la.length;J<qa;J++){fi=la[J];face=W[fi];if(face instanceof THREE.Face3){F+=3;V+=1;Ca+=3}else if(face instanceof THREE.Face4){F+=
|
|
|
|
-4;V+=2;Ca+=4}}J=B;qa=M;W=void 0;la=void 0;var Ga=void 0,Na=void 0;Ga=void 0;var ua=[];W=0;for(la=qa.materials.length;W<la;W++){Ga=qa.materials[W];if(Ga instanceof THREE.MeshFaceMaterial){Ga=0;for(l=J.materials.length;Ga<l;Ga++)(Na=J.materials[Ga])&&ua.push(Na)}else(Na=Ga)&&ua.push(Na)}qa=ua;a:{J=void 0;W=void 0;la=qa.length;for(J=0;J<la;J++){W=qa[J];if(W.map||W.lightMap||W instanceof THREE.MeshShaderMaterial){J=!0;break a}}J=!1}a:{W=qa;la=void 0;ua=void 0;Ga=W.length;for(la=0;la<Ga;la++){ua=W[la];
|
|
|
|
-if(!(ua instanceof THREE.MeshBasicMaterial&&!ua.envMap||ua instanceof THREE.MeshDepthMaterial)){W=ua&&ua.shading!=undefined&&ua.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}W=!1}a:{la=void 0;ua=void 0;Ga=qa.length;for(la=0;la<Ga;la++){ua=qa[la];if(ua.vertexColors){qa=ua.vertexColors;break a}}qa=!1}B.__vertexArray=new Float32Array(F*3);if(W)B.__normalArray=new Float32Array(F*3);if(wa.hasTangents)B.__tangentArray=new Float32Array(F*4);if(qa)B.__colorArray=new Float32Array(F*
|
|
|
|
-3);if(J){if(wa.faceUvs.length>0||wa.faceVertexUvs.length>0)B.__uvArray=new Float32Array(F*2);if(wa.faceUvs.length>1||wa.faceVertexUvs.length>1)B.__uv2Array=new Float32Array(F*2)}if(M.geometry.skinWeights.length&&M.geometry.skinIndices.length){B.__skinVertexAArray=new Float32Array(F*4);B.__skinVertexBArray=new Float32Array(F*4);B.__skinIndexArray=new Float32Array(F*4);B.__skinWeightArray=new Float32Array(F*4)}B.__faceArray=new Uint16Array(V*3);B.__lineArray=new Uint16Array(Ca*2);if(B.numMorphTargets){M=
|
|
|
|
-void 0;wa=void 0;B.__morphTargetsArrays=[];M=0;for(wa=B.numMorphTargets;M<wa;M++)B.__morphTargetsArrays.push(new Float32Array(F*3))}B.__needsSmoothNormals=W==THREE.SmoothShading;B.__uvType=J;B.__vertexColorType=qa;B.__normalType=W;B.__webGLFaceCount=V*3;B.__webGLLineCount=Ca*2;w.__dirtyVertices=!0;w.__dirtyMorphTargets=!0;w.__dirtyElements=!0;w.__dirtyUvs=!0;w.__dirtyNormals=!0;w.__dirtyTangents=!0;w.__dirtyColors=!0}I(p.__webglObjects,D,C)}}else if(C instanceof THREE.Ribbon){w=C.geometry;if(!w.__webGLVertexBuffer){o=
|
|
|
|
-w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*3);o.__webGLVertexCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}I(p.__webglObjects,w,C)}else if(C instanceof THREE.Line){w=C.geometry;if(!w.__webGLVertexBuffer){o=w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*
|
|
|
|
-3);o.__webGLLineCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}I(p.__webglObjects,w,C)}else if(C instanceof THREE.ParticleSystem){w=C.geometry;if(!w.__webGLVertexBuffer){o=w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*3);o.__sortArray=[];o.__webGLParticleCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}I(p.__webglObjects,w,C)}else THREE.MarchingCubes!==undefined&&C instanceof
|
|
|
|
|
|
+B.__webGLFaceBuffer=f.createBuffer();B.__webGLLineBuffer=f.createBuffer();if(B.numMorphTargets){var F=void 0,X=void 0;B.__webGLMorphTargetsBuffers=[];F=0;for(X=B.numMorphTargets;F<X;F++)B.__webGLMorphTargetsBuffers.push(f.createBuffer())}B=D;var N=C,J=void 0,sa=void 0,Ea=X=F=0;J=void 0;sa=void 0;var Y=void 0;sa=void 0;var ya=N.geometry;Y=ya.faces;var la=B.faces;J=0;for(sa=la.length;J<sa;J++){fi=la[J];face=Y[fi];if(face instanceof THREE.Face3){F+=3;X+=1;Ea+=3}else if(face instanceof THREE.Face4){F+=
|
|
|
|
+4;X+=2;Ea+=4}}J=B;sa=N;Y=void 0;la=void 0;var Ha=void 0,Ma=void 0;Ha=void 0;var xa=[];Y=0;for(la=sa.materials.length;Y<la;Y++){Ha=sa.materials[Y];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=J.materials.length;Ha<l;Ha++)(Ma=J.materials[Ha])&&xa.push(Ma)}else(Ma=Ha)&&xa.push(Ma)}sa=xa;a:{J=void 0;Y=void 0;la=sa.length;for(J=0;J<la;J++){Y=sa[J];if(Y.map||Y.lightMap||Y instanceof THREE.MeshShaderMaterial){J=!0;break a}}J=!1}a:{Y=sa;la=void 0;xa=void 0;Ha=Y.length;for(la=0;la<Ha;la++){xa=Y[la];
|
|
|
|
+if(!(xa instanceof THREE.MeshBasicMaterial&&!xa.envMap||xa instanceof THREE.MeshDepthMaterial)){Y=xa&&xa.shading!=undefined&&xa.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}Y=!1}a:{la=void 0;xa=void 0;Ha=sa.length;for(la=0;la<Ha;la++){xa=sa[la];if(xa.vertexColors){sa=xa.vertexColors;break a}}sa=!1}B.__vertexArray=new Float32Array(F*3);if(Y)B.__normalArray=new Float32Array(F*3);if(ya.hasTangents)B.__tangentArray=new Float32Array(F*4);if(sa)B.__colorArray=new Float32Array(F*
|
|
|
|
+3);if(J){if(ya.faceUvs.length>0||ya.faceVertexUvs.length>0)B.__uvArray=new Float32Array(F*2);if(ya.faceUvs.length>1||ya.faceVertexUvs.length>1)B.__uv2Array=new Float32Array(F*2)}if(N.geometry.skinWeights.length&&N.geometry.skinIndices.length){B.__skinVertexAArray=new Float32Array(F*4);B.__skinVertexBArray=new Float32Array(F*4);B.__skinIndexArray=new Float32Array(F*4);B.__skinWeightArray=new Float32Array(F*4)}B.__faceArray=new Uint16Array(X*3);B.__lineArray=new Uint16Array(Ea*2);if(B.numMorphTargets){N=
|
|
|
|
+void 0;ya=void 0;B.__morphTargetsArrays=[];N=0;for(ya=B.numMorphTargets;N<ya;N++)B.__morphTargetsArrays.push(new Float32Array(F*3))}B.__needsSmoothNormals=Y==THREE.SmoothShading;B.__uvType=J;B.__vertexColorType=sa;B.__normalType=Y;B.__webGLFaceCount=X*3;B.__webGLLineCount=Ea*2;w.__dirtyVertices=!0;w.__dirtyMorphTargets=!0;w.__dirtyElements=!0;w.__dirtyUvs=!0;w.__dirtyNormals=!0;w.__dirtyTangents=!0;w.__dirtyColors=!0}H(p.__webglObjects,D,C)}}else if(C instanceof THREE.Ribbon){w=C.geometry;if(!w.__webGLVertexBuffer){o=
|
|
|
|
+w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*3);o.__webGLVertexCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}H(p.__webglObjects,w,C)}else if(C instanceof THREE.Line){w=C.geometry;if(!w.__webGLVertexBuffer){o=w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*
|
|
|
|
+3);o.__webGLLineCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}H(p.__webglObjects,w,C)}else if(C instanceof THREE.ParticleSystem){w=C.geometry;if(!w.__webGLVertexBuffer){o=w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*3);o.__sortArray=[];o.__webGLParticleCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}H(p.__webglObjects,w,C)}else THREE.MarchingCubes!==undefined&&C instanceof
|
|
THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];p=n;w=void 0;o=void 0;for(w=p.__webglObjects.length-1;w>=0;w--){o=p.__webglObjects[w].object;C==o&&p.__webglObjects.splice(w,1)}n.__objectsRemoved.splice(0,1)}C=0;for(p=n.__webglObjects.length;C<p;C++){o=n.__webglObjects[C].object;D=void 0;w=void 0;B=void 0;if(o instanceof THREE.Mesh){w=o.geometry;
|
|
THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];p=n;w=void 0;o=void 0;for(w=p.__webglObjects.length-1;w>=0;w--){o=p.__webglObjects[w].object;C==o&&p.__webglObjects.splice(w,1)}n.__objectsRemoved.splice(0,1)}C=0;for(p=n.__webglObjects.length;C<p;C++){o=n.__webglObjects[C].object;D=void 0;w=void 0;B=void 0;if(o instanceof THREE.Mesh){w=o.geometry;
|
|
-for(D in w.geometryGroups){B=w.geometryGroups[D];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){F=f.DYNAMIC_DRAW;V=void 0;Ca=void 0;var Ha=void 0,P=void 0;Ha=void 0;var za=void 0,Aa=void 0,Wa=void 0;M=void 0;wa=void 0;J=void 0;qa=void 0;W=void 0;var X=void 0,fa=void 0,ga=void 0,Ia=void 0;Aa=void 0;Wa=void 0;X=void 0;P=void 0;X=void 0;fa=void 0;ga=void 0;Aa=void 0;X=void 0;fa=void 0;ga=void 0;Ia=void 0;X=void 0;fa=
|
|
|
|
-void 0;ga=void 0;Ia=void 0;X=void 0;fa=void 0;ga=void 0;Ia=void 0;X=void 0;fa=void 0;ga=void 0;Ia=void 0;P=void 0;za=void 0;Ha=void 0;Ha=void 0;var Ra=void 0,cb=void 0,Oa=void 0,Za=Na=Ga=ua=la=0,Ua=0,Ja=0,Qa=0,La=0,L=0,Pa=0,pa=B.__vertexArray,Ya=B.__uvArray,db=B.__uv2Array,Va=B.__normalArray,Ka=B.__tangentArray,Ba=B.__colorArray,K=B.__skinVertexAArray,ca=B.__skinVertexBArray,U=B.__skinIndexArray,T=B.__skinWeightArray,Fa=B.__morphTargetsArrays,sa=B.__faceArray,ma=B.__lineArray,Z=B.__needsSmoothNormals;
|
|
|
|
-wa=B.__vertexColorType;M=B.__uvType;J=B.__normalType;var ya=o.geometry,Xa=ya.__dirtyVertices,Sa=ya.__dirtyElements,Ta=ya.__dirtyUvs,fb=ya.__dirtyNormals,$a=ya.__dirtyTangents,bb=ya.__dirtyColors,lb=ya.__dirtyMorphTargets,eb=ya.vertices,mb=B.faces,pb=ya.faces,nb=ya.faceVertexUvs[0],ob=ya.faceVertexUvs[1],ib=ya.skinVerticesA,jb=ya.skinVerticesB,kb=ya.skinIndices,hb=ya.skinWeights,gb=ya.morphTargets;V=0;for(Ca=mb.length;V<Ca;V++){Ha=mb[V];P=pb[Ha];nb&&(qa=nb[Ha]);ob&&(W=ob[Ha]);Ha=P.vertexNormals;za=
|
|
|
|
-P.normal;Aa=P.vertexColors;Wa=P.color;if(P instanceof THREE.Face3){if(Xa){X=eb[P.a].position;fa=eb[P.b].position;ga=eb[P.c].position;pa[ua]=X.x;pa[ua+1]=X.y;pa[ua+2]=X.z;pa[ua+3]=fa.x;pa[ua+4]=fa.y;pa[ua+5]=fa.z;pa[ua+6]=ga.x;pa[ua+7]=ga.y;pa[ua+8]=ga.z;ua+=9}if(lb){Ra=0;for(cb=gb.length;Ra<cb;Ra++){X=gb[Ra].vertices[P.a].position;fa=gb[Ra].vertices[P.b].position;ga=gb[Ra].vertices[P.c].position;Oa=Fa[Ra];Oa[Pa+0]=X.x;Oa[Pa+1]=X.y;Oa[Pa+2]=X.z;Oa[Pa+3]=fa.x;Oa[Pa+4]=fa.y;Oa[Pa+5]=fa.z;Oa[Pa+6]=ga.x;
|
|
|
|
-Oa[Pa+7]=ga.y;Oa[Pa+8]=ga.z}Pa+=9}if(hb.length){X=hb[P.a];fa=hb[P.b];ga=hb[P.c];T[L]=X.x;T[L+1]=X.y;T[L+2]=X.z;T[L+3]=X.w;T[L+4]=fa.x;T[L+5]=fa.y;T[L+6]=fa.z;T[L+7]=fa.w;T[L+8]=ga.x;T[L+9]=ga.y;T[L+10]=ga.z;T[L+11]=ga.w;X=kb[P.a];fa=kb[P.b];ga=kb[P.c];U[L]=X.x;U[L+1]=X.y;U[L+2]=X.z;U[L+3]=X.w;U[L+4]=fa.x;U[L+5]=fa.y;U[L+6]=fa.z;U[L+7]=fa.w;U[L+8]=ga.x;U[L+9]=ga.y;U[L+10]=ga.z;U[L+11]=ga.w;X=ib[P.a];fa=ib[P.b];ga=ib[P.c];K[L]=X.x;K[L+1]=X.y;K[L+2]=X.z;K[L+3]=1;K[L+4]=fa.x;K[L+5]=fa.y;K[L+6]=fa.z;K[L+
|
|
|
|
-7]=1;K[L+8]=ga.x;K[L+9]=ga.y;K[L+10]=ga.z;K[L+11]=1;X=jb[P.a];fa=jb[P.b];ga=jb[P.c];ca[L]=X.x;ca[L+1]=X.y;ca[L+2]=X.z;ca[L+3]=1;ca[L+4]=fa.x;ca[L+5]=fa.y;ca[L+6]=fa.z;ca[L+7]=1;ca[L+8]=ga.x;ca[L+9]=ga.y;ca[L+10]=ga.z;ca[L+11]=1;L+=12}if(bb&&wa){if(Aa.length==3&&wa==THREE.VertexColors){X=Aa[0];fa=Aa[1];ga=Aa[2]}else ga=fa=X=Wa;Ba[La]=X.r;Ba[La+1]=X.g;Ba[La+2]=X.b;Ba[La+3]=fa.r;Ba[La+4]=fa.g;Ba[La+5]=fa.b;Ba[La+6]=ga.r;Ba[La+7]=ga.g;Ba[La+8]=ga.b;La+=9}if($a&&ya.hasTangents){Aa=eb[P.a].tangent;Wa=eb[P.b].tangent;
|
|
|
|
-X=eb[P.c].tangent;Ka[Ja]=Aa.x;Ka[Ja+1]=Aa.y;Ka[Ja+2]=Aa.z;Ka[Ja+3]=Aa.w;Ka[Ja+4]=Wa.x;Ka[Ja+5]=Wa.y;Ka[Ja+6]=Wa.z;Ka[Ja+7]=Wa.w;Ka[Ja+8]=X.x;Ka[Ja+9]=X.y;Ka[Ja+10]=X.z;Ka[Ja+11]=X.w;Ja+=12}if(fb&&J)if(Ha.length==3&&Z)for(P=0;P<3;P++){za=Ha[P];Va[Ua]=za.x;Va[Ua+1]=za.y;Va[Ua+2]=za.z;Ua+=3}else for(P=0;P<3;P++){Va[Ua]=za.x;Va[Ua+1]=za.y;Va[Ua+2]=za.z;Ua+=3}if(Ta&&qa!==undefined&&M)for(P=0;P<3;P++){Ha=qa[P];Ya[Ga]=Ha.u;Ya[Ga+1]=Ha.v;Ga+=2}if(Ta&&W!==undefined&&M)for(P=0;P<3;P++){Ha=W[P];db[Na]=Ha.u;
|
|
|
|
-db[Na+1]=Ha.v;Na+=2}if(Sa){sa[Za]=la;sa[Za+1]=la+1;sa[Za+2]=la+2;Za+=3;ma[Qa]=la;ma[Qa+1]=la+1;ma[Qa+2]=la;ma[Qa+3]=la+2;ma[Qa+4]=la+1;ma[Qa+5]=la+2;Qa+=6;la+=3}}else if(P instanceof THREE.Face4){if(Xa){X=eb[P.a].position;fa=eb[P.b].position;ga=eb[P.c].position;Ia=eb[P.d].position;pa[ua]=X.x;pa[ua+1]=X.y;pa[ua+2]=X.z;pa[ua+3]=fa.x;pa[ua+4]=fa.y;pa[ua+5]=fa.z;pa[ua+6]=ga.x;pa[ua+7]=ga.y;pa[ua+8]=ga.z;pa[ua+9]=Ia.x;pa[ua+10]=Ia.y;pa[ua+11]=Ia.z;ua+=12}if(lb){Ra=0;for(cb=gb.length;Ra<cb;Ra++){X=gb[Ra].vertices[P.a].position;
|
|
|
|
-fa=gb[Ra].vertices[P.b].position;ga=gb[Ra].vertices[P.c].position;Ia=gb[Ra].vertices[P.d].position;Oa=Fa[Ra];Oa[Pa+0]=X.x;Oa[Pa+1]=X.y;Oa[Pa+2]=X.z;Oa[Pa+3]=fa.x;Oa[Pa+4]=fa.y;Oa[Pa+5]=fa.z;Oa[Pa+6]=ga.x;Oa[Pa+7]=ga.y;Oa[Pa+8]=ga.z;Oa[Pa+9]=Ia.x;Oa[Pa+10]=Ia.y;Oa[Pa+11]=Ia.z}Pa+=12}if(hb.length){X=hb[P.a];fa=hb[P.b];ga=hb[P.c];Ia=hb[P.d];T[L]=X.x;T[L+1]=X.y;T[L+2]=X.z;T[L+3]=X.w;T[L+4]=fa.x;T[L+5]=fa.y;T[L+6]=fa.z;T[L+7]=fa.w;T[L+8]=ga.x;T[L+9]=ga.y;T[L+10]=ga.z;T[L+11]=ga.w;T[L+12]=Ia.x;T[L+13]=
|
|
|
|
-Ia.y;T[L+14]=Ia.z;T[L+15]=Ia.w;X=kb[P.a];fa=kb[P.b];ga=kb[P.c];Ia=kb[P.d];U[L]=X.x;U[L+1]=X.y;U[L+2]=X.z;U[L+3]=X.w;U[L+4]=fa.x;U[L+5]=fa.y;U[L+6]=fa.z;U[L+7]=fa.w;U[L+8]=ga.x;U[L+9]=ga.y;U[L+10]=ga.z;U[L+11]=ga.w;U[L+12]=Ia.x;U[L+13]=Ia.y;U[L+14]=Ia.z;U[L+15]=Ia.w;X=ib[P.a];fa=ib[P.b];ga=ib[P.c];Ia=ib[P.d];K[L]=X.x;K[L+1]=X.y;K[L+2]=X.z;K[L+3]=1;K[L+4]=fa.x;K[L+5]=fa.y;K[L+6]=fa.z;K[L+7]=1;K[L+8]=ga.x;K[L+9]=ga.y;K[L+10]=ga.z;K[L+11]=1;K[L+12]=Ia.x;K[L+13]=Ia.y;K[L+14]=Ia.z;K[L+15]=1;X=jb[P.a];fa=
|
|
|
|
-jb[P.b];ga=jb[P.c];Ia=jb[P.d];ca[L]=X.x;ca[L+1]=X.y;ca[L+2]=X.z;ca[L+3]=1;ca[L+4]=fa.x;ca[L+5]=fa.y;ca[L+6]=fa.z;ca[L+7]=1;ca[L+8]=ga.x;ca[L+9]=ga.y;ca[L+10]=ga.z;ca[L+11]=1;ca[L+12]=Ia.x;ca[L+13]=Ia.y;ca[L+14]=Ia.z;ca[L+15]=1;L+=16}if(bb&&wa){if(Aa.length==4&&wa==THREE.VertexColors){X=Aa[0];fa=Aa[1];ga=Aa[2];Aa=Aa[3]}else Aa=ga=fa=X=Wa;Ba[La]=X.r;Ba[La+1]=X.g;Ba[La+2]=X.b;Ba[La+3]=fa.r;Ba[La+4]=fa.g;Ba[La+5]=fa.b;Ba[La+6]=ga.r;Ba[La+7]=ga.g;Ba[La+8]=ga.b;Ba[La+9]=Aa.r;Ba[La+10]=Aa.g;Ba[La+11]=Aa.b;
|
|
|
|
-La+=12}if($a&&ya.hasTangents){Aa=eb[P.a].tangent;Wa=eb[P.b].tangent;X=eb[P.c].tangent;P=eb[P.d].tangent;Ka[Ja]=Aa.x;Ka[Ja+1]=Aa.y;Ka[Ja+2]=Aa.z;Ka[Ja+3]=Aa.w;Ka[Ja+4]=Wa.x;Ka[Ja+5]=Wa.y;Ka[Ja+6]=Wa.z;Ka[Ja+7]=Wa.w;Ka[Ja+8]=X.x;Ka[Ja+9]=X.y;Ka[Ja+10]=X.z;Ka[Ja+11]=X.w;Ka[Ja+12]=P.x;Ka[Ja+13]=P.y;Ka[Ja+14]=P.z;Ka[Ja+15]=P.w;Ja+=16}if(fb&&J)if(Ha.length==4&&Z)for(P=0;P<4;P++){za=Ha[P];Va[Ua]=za.x;Va[Ua+1]=za.y;Va[Ua+2]=za.z;Ua+=3}else for(P=0;P<4;P++){Va[Ua]=za.x;Va[Ua+1]=za.y;Va[Ua+2]=za.z;Ua+=3}if(Ta&&
|
|
|
|
-qa!==undefined&&M)for(P=0;P<4;P++){Ha=qa[P];Ya[Ga]=Ha.u;Ya[Ga+1]=Ha.v;Ga+=2}if(Ta&&W!==undefined&&M)for(P=0;P<4;P++){Ha=W[P];db[Na]=Ha.u;db[Na+1]=Ha.v;Na+=2}if(Sa){sa[Za]=la;sa[Za+1]=la+1;sa[Za+2]=la+2;sa[Za+3]=la;sa[Za+4]=la+2;sa[Za+5]=la+3;Za+=6;ma[Qa]=la;ma[Qa+1]=la+1;ma[Qa+2]=la;ma[Qa+3]=la+3;ma[Qa+4]=la+1;ma[Qa+5]=la+2;ma[Qa+6]=la+2;ma[Qa+7]=la+3;Qa+=8;la+=4}}}if(Xa){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,pa,F)}if(lb){Ra=0;for(cb=gb.length;Ra<cb;Ra++){f.bindBuffer(f.ARRAY_BUFFER,
|
|
|
|
-B.__webGLMorphTargetsBuffers[Ra]);f.bufferData(f.ARRAY_BUFFER,Fa[Ra],F)}}if(bb&&La>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,F)}if(fb){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Va,F)}if($a&&ya.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ka,F)}if(Ta&&Ga>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Ya,F)}if(Ta&&Na>0){f.bindBuffer(f.ARRAY_BUFFER,
|
|
|
|
-B.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,db,F)}if(Sa){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,sa,F);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ma,F)}if(L>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,K,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,ca,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);
|
|
|
|
-f.bufferData(f.ARRAY_BUFFER,U,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,T,F)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Ribbon){w=o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;D=f.DYNAMIC_DRAW;M=void 0;M=void 0;wa=void 0;B=void 0;J=o.vertices;F=o.colors;qa=J.length;V=F.length;W=o.__vertexArray;Ca=o.__colorArray;la=o.__dirtyColors;
|
|
|
|
-if(o.__dirtyVertices){for(M=0;M<qa;M++){wa=J[M].position;B=M*3;W[B]=wa.x;W[B+1]=wa.y;W[B+2]=wa.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,W,D)}if(la){for(M=0;M<V;M++){color=F[M];B=M*3;Ca[B]=color.r;Ca[B+1]=color.g;Ca[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ca,D)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Line){w=o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;D=f.DYNAMIC_DRAW;M=
|
|
|
|
-void 0;M=void 0;wa=void 0;B=void 0;J=o.vertices;F=o.colors;qa=J.length;V=F.length;W=o.__vertexArray;Ca=o.__colorArray;la=o.__dirtyColors;if(o.__dirtyVertices){for(M=0;M<qa;M++){wa=J[M].position;B=M*3;W[B]=wa.x;W[B+1]=wa.y;W[B+2]=wa.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,W,D)}if(la){for(M=0;M<V;M++){color=F[M];B=M*3;Ca[B]=color.r;Ca[B+1]=color.g;Ca[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ca,D)}}w.__dirtyVertices=
|
|
|
|
-!1;w.__dirtyColors=!1}else if(o instanceof THREE.ParticleSystem){w=o.geometry;(w.__dirtyVertices||w.__dirtyColors||o.sortParticles)&&c(w,f.DYNAMIC_DRAW,o);w.__dirtyVertices=!1;w.__dirtyColors=!1}}};this.setFaceCulling=function(n,C){if(n){!C||C=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(n=="back")f.cullFace(f.BACK);else n=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
|
-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,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
|
|
|
|
|
+for(D in w.geometryGroups){B=w.geometryGroups[D];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){F=f.DYNAMIC_DRAW;X=void 0;Ea=void 0;var Ia=void 0,U=void 0;Ia=void 0;var Ba=void 0,Ca=void 0,Va=void 0,ta=void 0;N=void 0;ya=void 0;J=void 0;sa=void 0;Y=void 0;var fa=void 0,ga=void 0,na=void 0,Ra=void 0;Ca=void 0;Va=void 0;U=void 0;ta=void 0;U=void 0;fa=void 0;ga=void 0;Ca=void 0;fa=void 0;ga=void 0;na=void 0;Ra=void 0;
|
|
|
|
+fa=void 0;ga=void 0;na=void 0;Ra=void 0;fa=void 0;ga=void 0;na=void 0;Ra=void 0;fa=void 0;ga=void 0;na=void 0;U=void 0;ta=void 0;Ba=void 0;Ia=void 0;Ia=void 0;var Oa=void 0,bb=void 0,Na=void 0,cb=Ma=Ha=xa=la=0,Ua=0,Ga=0,Sa=0,Pa=0,L=0,pa=0,Ja=B.__vertexArray,db=B.__uvArray,eb=B.__uv2Array,Wa=B.__normalArray,wa=B.__tangentArray,K=B.__colorArray,ca=B.__skinVertexAArray,V=B.__skinVertexBArray,T=B.__skinIndexArray,ia=B.__skinWeightArray,Aa=B.__morphTargetsArrays,ra=B.__faceArray,R=B.__lineArray,Qa=B.__needsSmoothNormals;
|
|
|
|
+ya=B.__vertexColorType;N=B.__uvType;J=B.__normalType;var Ka=o.geometry,Ta=Ka.__dirtyVertices,Xa=Ka.__dirtyElements,Ya=Ka.__dirtyUvs,Za=Ka.__dirtyNormals,ab=Ka.__dirtyTangents,lb=Ka.__dirtyColors,mb=Ka.__dirtyMorphTargets,hb=Ka.vertices,nb=B.faces,qb=Ka.faces,ob=Ka.faceVertexUvs[0],pb=Ka.faceVertexUvs[1],ib=Ka.skinVerticesA,jb=Ka.skinVerticesB,kb=Ka.skinIndices,gb=Ka.skinWeights,fb=Ka.morphTargets;X=0;for(Ea=nb.length;X<Ea;X++){Ia=nb[X];U=qb[Ia];ob&&(sa=ob[Ia]);pb&&(Y=pb[Ia]);Ia=U.vertexNormals;Ba=
|
|
|
|
+U.normal;Ca=U.vertexColors;Va=U.color;ta=U.vertexTangents;if(U instanceof THREE.Face3){if(Ta){fa=hb[U.a].position;ga=hb[U.b].position;na=hb[U.c].position;Ja[xa]=fa.x;Ja[xa+1]=fa.y;Ja[xa+2]=fa.z;Ja[xa+3]=ga.x;Ja[xa+4]=ga.y;Ja[xa+5]=ga.z;Ja[xa+6]=na.x;Ja[xa+7]=na.y;Ja[xa+8]=na.z;xa+=9}if(mb){Oa=0;for(bb=fb.length;Oa<bb;Oa++){fa=fb[Oa].vertices[U.a].position;ga=fb[Oa].vertices[U.b].position;na=fb[Oa].vertices[U.c].position;Na=Aa[Oa];Na[pa+0]=fa.x;Na[pa+1]=fa.y;Na[pa+2]=fa.z;Na[pa+3]=ga.x;Na[pa+4]=ga.y;
|
|
|
|
+Na[pa+5]=ga.z;Na[pa+6]=na.x;Na[pa+7]=na.y;Na[pa+8]=na.z}pa+=9}if(gb.length){fa=gb[U.a];ga=gb[U.b];na=gb[U.c];ia[L]=fa.x;ia[L+1]=fa.y;ia[L+2]=fa.z;ia[L+3]=fa.w;ia[L+4]=ga.x;ia[L+5]=ga.y;ia[L+6]=ga.z;ia[L+7]=ga.w;ia[L+8]=na.x;ia[L+9]=na.y;ia[L+10]=na.z;ia[L+11]=na.w;fa=kb[U.a];ga=kb[U.b];na=kb[U.c];T[L]=fa.x;T[L+1]=fa.y;T[L+2]=fa.z;T[L+3]=fa.w;T[L+4]=ga.x;T[L+5]=ga.y;T[L+6]=ga.z;T[L+7]=ga.w;T[L+8]=na.x;T[L+9]=na.y;T[L+10]=na.z;T[L+11]=na.w;fa=ib[U.a];ga=ib[U.b];na=ib[U.c];ca[L]=fa.x;ca[L+1]=fa.y;ca[L+
|
|
|
|
+2]=fa.z;ca[L+3]=1;ca[L+4]=ga.x;ca[L+5]=ga.y;ca[L+6]=ga.z;ca[L+7]=1;ca[L+8]=na.x;ca[L+9]=na.y;ca[L+10]=na.z;ca[L+11]=1;fa=jb[U.a];ga=jb[U.b];na=jb[U.c];V[L]=fa.x;V[L+1]=fa.y;V[L+2]=fa.z;V[L+3]=1;V[L+4]=ga.x;V[L+5]=ga.y;V[L+6]=ga.z;V[L+7]=1;V[L+8]=na.x;V[L+9]=na.y;V[L+10]=na.z;V[L+11]=1;L+=12}if(lb&&ya){if(Ca.length==3&&ya==THREE.VertexColors){U=Ca[0];fa=Ca[1];ga=Ca[2]}else ga=fa=U=Va;K[Pa]=U.r;K[Pa+1]=U.g;K[Pa+2]=U.b;K[Pa+3]=fa.r;K[Pa+4]=fa.g;K[Pa+5]=fa.b;K[Pa+6]=ga.r;K[Pa+7]=ga.g;K[Pa+8]=ga.b;Pa+=
|
|
|
|
+9}if(ab&&Ka.hasTangents){Ca=ta[0];Va=ta[1];U=ta[2];wa[Ga]=Ca.x;wa[Ga+1]=Ca.y;wa[Ga+2]=Ca.z;wa[Ga+3]=Ca.w;wa[Ga+4]=Va.x;wa[Ga+5]=Va.y;wa[Ga+6]=Va.z;wa[Ga+7]=Va.w;wa[Ga+8]=U.x;wa[Ga+9]=U.y;wa[Ga+10]=U.z;wa[Ga+11]=U.w;Ga+=12}if(Za&&J)if(Ia.length==3&&Qa)for(ta=0;ta<3;ta++){Ba=Ia[ta];Wa[Ua]=Ba.x;Wa[Ua+1]=Ba.y;Wa[Ua+2]=Ba.z;Ua+=3}else for(ta=0;ta<3;ta++){Wa[Ua]=Ba.x;Wa[Ua+1]=Ba.y;Wa[Ua+2]=Ba.z;Ua+=3}if(Ya&&sa!==undefined&&N)for(ta=0;ta<3;ta++){Ia=sa[ta];db[Ha]=Ia.u;db[Ha+1]=Ia.v;Ha+=2}if(Ya&&Y!==undefined&&
|
|
|
|
+N)for(ta=0;ta<3;ta++){Ia=Y[ta];eb[Ma]=Ia.u;eb[Ma+1]=Ia.v;Ma+=2}if(Xa){ra[cb]=la;ra[cb+1]=la+1;ra[cb+2]=la+2;cb+=3;R[Sa]=la;R[Sa+1]=la+1;R[Sa+2]=la;R[Sa+3]=la+2;R[Sa+4]=la+1;R[Sa+5]=la+2;Sa+=6;la+=3}}else if(U instanceof THREE.Face4){if(Ta){fa=hb[U.a].position;ga=hb[U.b].position;na=hb[U.c].position;Ra=hb[U.d].position;Ja[xa]=fa.x;Ja[xa+1]=fa.y;Ja[xa+2]=fa.z;Ja[xa+3]=ga.x;Ja[xa+4]=ga.y;Ja[xa+5]=ga.z;Ja[xa+6]=na.x;Ja[xa+7]=na.y;Ja[xa+8]=na.z;Ja[xa+9]=Ra.x;Ja[xa+10]=Ra.y;Ja[xa+11]=Ra.z;xa+=12}if(mb){Oa=
|
|
|
|
+0;for(bb=fb.length;Oa<bb;Oa++){fa=fb[Oa].vertices[U.a].position;ga=fb[Oa].vertices[U.b].position;na=fb[Oa].vertices[U.c].position;Ra=fb[Oa].vertices[U.d].position;Na=Aa[Oa];Na[pa+0]=fa.x;Na[pa+1]=fa.y;Na[pa+2]=fa.z;Na[pa+3]=ga.x;Na[pa+4]=ga.y;Na[pa+5]=ga.z;Na[pa+6]=na.x;Na[pa+7]=na.y;Na[pa+8]=na.z;Na[pa+9]=Ra.x;Na[pa+10]=Ra.y;Na[pa+11]=Ra.z}pa+=12}if(gb.length){fa=gb[U.a];ga=gb[U.b];na=gb[U.c];Ra=gb[U.d];ia[L]=fa.x;ia[L+1]=fa.y;ia[L+2]=fa.z;ia[L+3]=fa.w;ia[L+4]=ga.x;ia[L+5]=ga.y;ia[L+6]=ga.z;ia[L+
|
|
|
|
+7]=ga.w;ia[L+8]=na.x;ia[L+9]=na.y;ia[L+10]=na.z;ia[L+11]=na.w;ia[L+12]=Ra.x;ia[L+13]=Ra.y;ia[L+14]=Ra.z;ia[L+15]=Ra.w;fa=kb[U.a];ga=kb[U.b];na=kb[U.c];Ra=kb[U.d];T[L]=fa.x;T[L+1]=fa.y;T[L+2]=fa.z;T[L+3]=fa.w;T[L+4]=ga.x;T[L+5]=ga.y;T[L+6]=ga.z;T[L+7]=ga.w;T[L+8]=na.x;T[L+9]=na.y;T[L+10]=na.z;T[L+11]=na.w;T[L+12]=Ra.x;T[L+13]=Ra.y;T[L+14]=Ra.z;T[L+15]=Ra.w;fa=ib[U.a];ga=ib[U.b];na=ib[U.c];Ra=ib[U.d];ca[L]=fa.x;ca[L+1]=fa.y;ca[L+2]=fa.z;ca[L+3]=1;ca[L+4]=ga.x;ca[L+5]=ga.y;ca[L+6]=ga.z;ca[L+7]=1;ca[L+
|
|
|
|
+8]=na.x;ca[L+9]=na.y;ca[L+10]=na.z;ca[L+11]=1;ca[L+12]=Ra.x;ca[L+13]=Ra.y;ca[L+14]=Ra.z;ca[L+15]=1;fa=jb[U.a];ga=jb[U.b];na=jb[U.c];U=jb[U.d];V[L]=fa.x;V[L+1]=fa.y;V[L+2]=fa.z;V[L+3]=1;V[L+4]=ga.x;V[L+5]=ga.y;V[L+6]=ga.z;V[L+7]=1;V[L+8]=na.x;V[L+9]=na.y;V[L+10]=na.z;V[L+11]=1;V[L+12]=U.x;V[L+13]=U.y;V[L+14]=U.z;V[L+15]=1;L+=16}if(lb&&ya){if(Ca.length==4&&ya==THREE.VertexColors){U=Ca[0];fa=Ca[1];ga=Ca[2];Ca=Ca[3]}else Ca=ga=fa=U=Va;K[Pa]=U.r;K[Pa+1]=U.g;K[Pa+2]=U.b;K[Pa+3]=fa.r;K[Pa+4]=fa.g;K[Pa+5]=
|
|
|
|
+fa.b;K[Pa+6]=ga.r;K[Pa+7]=ga.g;K[Pa+8]=ga.b;K[Pa+9]=Ca.r;K[Pa+10]=Ca.g;K[Pa+11]=Ca.b;Pa+=12}if(ab&&Ka.hasTangents){Ca=ta[0];Va=ta[1];U=ta[2];ta=ta[3];wa[Ga]=Ca.x;wa[Ga+1]=Ca.y;wa[Ga+2]=Ca.z;wa[Ga+3]=Ca.w;wa[Ga+4]=Va.x;wa[Ga+5]=Va.y;wa[Ga+6]=Va.z;wa[Ga+7]=Va.w;wa[Ga+8]=U.x;wa[Ga+9]=U.y;wa[Ga+10]=U.z;wa[Ga+11]=U.w;wa[Ga+12]=ta.x;wa[Ga+13]=ta.y;wa[Ga+14]=ta.z;wa[Ga+15]=ta.w;Ga+=16}if(Za&&J)if(Ia.length==4&&Qa)for(ta=0;ta<4;ta++){Ba=Ia[ta];Wa[Ua]=Ba.x;Wa[Ua+1]=Ba.y;Wa[Ua+2]=Ba.z;Ua+=3}else for(ta=0;ta<
|
|
|
|
+4;ta++){Wa[Ua]=Ba.x;Wa[Ua+1]=Ba.y;Wa[Ua+2]=Ba.z;Ua+=3}if(Ya&&sa!==undefined&&N)for(ta=0;ta<4;ta++){Ia=sa[ta];db[Ha]=Ia.u;db[Ha+1]=Ia.v;Ha+=2}if(Ya&&Y!==undefined&&N)for(ta=0;ta<4;ta++){Ia=Y[ta];eb[Ma]=Ia.u;eb[Ma+1]=Ia.v;Ma+=2}if(Xa){ra[cb]=la;ra[cb+1]=la+1;ra[cb+2]=la+2;ra[cb+3]=la;ra[cb+4]=la+2;ra[cb+5]=la+3;cb+=6;R[Sa]=la;R[Sa+1]=la+1;R[Sa+2]=la;R[Sa+3]=la+3;R[Sa+4]=la+1;R[Sa+5]=la+2;R[Sa+6]=la+2;R[Sa+7]=la+3;Sa+=8;la+=4}}}if(Ta){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,
|
|
|
|
+Ja,F)}if(mb){Oa=0;for(bb=fb.length;Oa<bb;Oa++){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLMorphTargetsBuffers[Oa]);f.bufferData(f.ARRAY_BUFFER,Aa[Oa],F)}}if(lb&&Pa>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,K,F)}if(Za){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Wa,F)}if(ab&&Ka.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,wa,F)}if(Ya&&Ha>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUVBuffer);
|
|
|
|
+f.bufferData(f.ARRAY_BUFFER,db,F)}if(Ya&&Ma>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,eb,F)}if(Xa){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ra,F);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,R,F)}if(L>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,ca,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,
|
|
|
|
+V,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,T,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,ia,F)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Ribbon){w=o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;D=f.DYNAMIC_DRAW;N=void 0;N=void 0;ya=void 0;B=void 0;J=o.vertices;F=o.colors;sa=
|
|
|
|
+J.length;X=F.length;Y=o.__vertexArray;Ea=o.__colorArray;la=o.__dirtyColors;if(o.__dirtyVertices){for(N=0;N<sa;N++){ya=J[N].position;B=N*3;Y[B]=ya.x;Y[B+1]=ya.y;Y[B+2]=ya.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Y,D)}if(la){for(N=0;N<X;N++){color=F[N];B=N*3;Ea[B]=color.r;Ea[B+1]=color.g;Ea[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ea,D)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Line){w=
|
|
|
|
+o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;D=f.DYNAMIC_DRAW;N=void 0;N=void 0;ya=void 0;B=void 0;J=o.vertices;F=o.colors;sa=J.length;X=F.length;Y=o.__vertexArray;Ea=o.__colorArray;la=o.__dirtyColors;if(o.__dirtyVertices){for(N=0;N<sa;N++){ya=J[N].position;B=N*3;Y[B]=ya.x;Y[B+1]=ya.y;Y[B+2]=ya.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Y,D)}if(la){for(N=0;N<X;N++){color=F[N];B=N*3;Ea[B]=color.r;Ea[B+1]=color.g;Ea[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,
|
|
|
|
+o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ea,D)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.ParticleSystem){w=o.geometry;(w.__dirtyVertices||w.__dirtyColors||o.sortParticles)&&c(w,f.DYNAMIC_DRAW,o);w.__dirtyVertices=!1;w.__dirtyColors=!1}}};this.setFaceCulling=function(n,C){if(n){!C||C=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(n=="back")f.cullFace(f.BACK);else n=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};
|
|
|
|
+this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>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,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.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.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};
|
|
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};
|
|
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=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};
|
|
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=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};
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
|
|
-var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,h=a.vertices,g=e.vertices,k=a.faces,j=e.faces,m=a.faceVertexUvs[0];e=e.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var t=0,x=g.length;t<x;t++){var y=new THREE.Vertex(g[t].position.clone());b&&c.matrix.multiplyVector3(y.position);h.push(y)}t=0;for(x=j.length;t<x;t++){g=j[t];var q,A=g.vertexNormals;if(g instanceof THREE.Face3)q=new THREE.Face3(g.a+d,g.b+d,g.c+d);else g instanceof
|
|
|
|
-THREE.Face4&&(q=new THREE.Face4(g.a+d,g.b+d,g.c+d,g.d+d));q.centroid.copy(g.centroid);q.normal.copy(g.normal);b=0;for(h=A.length;b<h;b++){y=A[b];q.vertexNormals.push(y.clone())}q.materials=g.materials.slice();k.push(q)}t=0;for(x=e.length;t<x;t++){d=e[t];k=[];b=0;for(h=d.length;b<h;b++)k.push(new THREE.UV(d[b].u,d[b].v));m.push(k)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,
|
|
|
|
-c,b){var d,e=[],h=new THREE.Texture(e,c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)h.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return h}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function h(){for(t in da.objects)if(!ea.objects[t]){G=da.objects[t];if(z=ea.geometries[G.geometry]){N=[];for(i=0;i<G.materials.length;i++)N[i]=ea.materials[G.materials[i]];I=G.position;r=G.rotation;
|
|
|
|
-s=G.scale;object=new THREE.Mesh(z,N);object.position.set(I[0],I[1],I[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;ea.scene.addObject(object);ea.objects[t]=object}}}function g(Ea){return function(ia){ea.geometries[Ea]=ia;h();na-=1;k()}}function k(){d({total_models:Y,total_textures:Da,loaded_models:Y-na,loaded_textures:Da-aa},ea);na==0&&aa==0&&b(ea)}var j,m,t,x,y,q,A,G,I,E,H,z,S,Q,N,da,f,ja,na,aa,Y,Da,ea;da=e.data;f=new THREE.BinaryLoader;ja=new THREE.JSONLoader;
|
|
|
|
-aa=na=0;ea={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};e=function(){aa-=1;k()};for(y in da.cameras){E=da.cameras[y];if(E.type=="perspective")S=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho"){S=new THREE.Camera;S.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far)}I=E.position;E=E.target;S.position.set(I[0],I[1],I[2]);S.target.position.set(E[0],E[1],E[2]);ea.cameras[y]=S}for(x in da.lights){y=
|
|
|
|
-da.lights[x];if(y.type=="directional"){I=y.direction;light=new THREE.DirectionalLight;light.position.set(I[0],I[1],I[2]);light.position.normalize()}else if(y.type=="point"){I=y.position;light=new THREE.PointLight;light.position.set(I[0],I[1],I[2])}E=y.color;i=y.intensity||1;light.color.setRGB(E[0]*i,E[1]*i,E[2]*i);ea.scene.addLight(light);ea.lights[x]=light}for(q in da.fogs){x=da.fogs[q];if(x.type=="linear")Q=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(Q=new THREE.FogExp2(0,x.density));E=
|
|
|
|
-x.color;Q.color.setRGB(E[0],E[1],E[2]);ea.fogs[q]=Q}if(ea.cameras&&da.defaults.camera)ea.currentCamera=ea.cameras[da.defaults.camera];if(ea.fogs&&da.defaults.fog)ea.scene.fog=ea.fogs[da.defaults.fog];E=da.defaults.bgcolor;ea.bgColor=new THREE.Color;ea.bgColor.setRGB(E[0],E[1],E[2]);ea.bgColorAlpha=da.defaults.bgalpha;for(j in da.geometries){q=da.geometries[j];if(q.type=="bin_mesh"||q.type=="ascii_mesh")na+=1}Y=na;for(j in da.geometries){q=da.geometries[j];if(q.type=="cube"){z=new Cube(q.width,q.height,
|
|
|
|
-q.depth,q.segmentsWidth,q.segmentsHeight,q.segmentsDepth,null,q.flipped,q.sides);ea.geometries[j]=z}else if(q.type=="plane"){z=new Plane(q.width,q.height,q.segmentsWidth,q.segmentsHeight);ea.geometries[j]=z}else if(q.type=="sphere"){z=new Sphere(q.radius,q.segmentsWidth,q.segmentsHeight);ea.geometries[j]=z}else if(q.type=="cylinder"){z=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);ea.geometries[j]=z}else if(q.type=="torus"){z=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);
|
|
|
|
-ea.geometries[j]=z}else if(q.type=="icosahedron"){z=new Icosahedron(q.subdivisions);ea.geometries[j]=z}else if(q.type=="bin_mesh")f.load({model:q.url,callback:g(j)});else q.type=="ascii_mesh"&&ja.load({model:q.url,callback:g(j)})}for(A in da.textures){j=da.textures[A];aa+=j.url instanceof Array?j.url.length:1}Da=aa;for(A in da.textures){j=da.textures[A];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)q=ImageUtils.loadTextureCube(j.url,
|
|
|
|
-j.mapping,e);else{q=ImageUtils.loadTexture(j.url,j.mapping,e);if(THREE[j.minFilter]!=undefined)q.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)q.magFilter=THREE[j.magFilter]}ea.textures[A]=q}for(m in da.materials){A=da.materials[m];for(H in A.parameters)if(H=="envMap"||H=="map"||H=="lightMap")A.parameters[H]=ea.textures[A.parameters[H]];else if(H=="shading")A.parameters[H]=A.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")A.parameters[H]=THREE[A.parameters[H]]?
|
|
|
|
-THREE[A.parameters[H]]:THREE.NormalBlending;else H=="combine"&&(A.parameters[H]=A.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);ea.materials[m]=A}h();c(ea)}},addMesh:function(a,c,b,d,e,h,g,k,j,m){c=new THREE.Mesh(c,m);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=h;c.rotation.x=g;c.rotation.y=k;c.rotation.z=j;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=
|
|
|
|
|
|
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,k=a.faces,j=e.faces,m=a.faceVertexUvs[0];e=e.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var t=0,x=h.length;t<x;t++){var y=new THREE.Vertex(h[t].position.clone());b&&c.matrix.multiplyVector3(y.position);g.push(y)}t=0;for(x=j.length;t<x;t++){h=j[t];var q,A=h.vertexNormals;if(h instanceof THREE.Face3)q=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof
|
|
|
|
+THREE.Face4&&(q=new THREE.Face4(h.a+d,h.b+d,h.c+d,h.d+d));q.centroid.copy(h.centroid);q.normal.copy(h.normal);b=0;for(g=A.length;b<g;b++){y=A[b];q.vertexNormals.push(y.clone())}q.materials=h.materials.slice();k.push(q)}t=0;for(x=e.length;t<x;t++){d=e[t];k=[];b=0;for(g=d.length;b<g;b++)k.push(new THREE.UV(d[b].u,d[b].v));m.push(k)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,
|
|
|
|
+c,b){var d,e=[],g=new THREE.Texture(e,c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(t in aa.objects)if(!da.objects[t]){G=aa.objects[t];if(z=da.geometries[G.geometry]){O=[];for(i=0;i<G.materials.length;i++)O[i]=da.materials[G.materials[i]];H=G.position;r=G.rotation;
|
|
|
|
+s=G.scale;object=new THREE.Mesh(z,O);object.position.set(H[0],H[1],H[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;da.scene.addObject(object);da.objects[t]=object}}}function h(Fa){return function(ja){da.geometries[Fa]=ja;g();oa-=1;k()}}function k(){d({total_models:W,total_textures:Da,loaded_models:W-oa,loaded_textures:Da-$},da);oa==0&&$==0&&b(da)}var j,m,t,x,y,q,A,G,H,E,I,z,S,P,O,aa,f,ha,oa,$,W,Da,da;aa=e.data;f=new THREE.BinaryLoader;ha=new THREE.JSONLoader;
|
|
|
|
+$=oa=0;da={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};e=function(){$-=1;k()};for(y in aa.cameras){E=aa.cameras[y];if(E.type=="perspective")S=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho"){S=new THREE.Camera;S.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far)}H=E.position;E=E.target;S.position.set(H[0],H[1],H[2]);S.target.position.set(E[0],E[1],E[2]);da.cameras[y]=S}for(x in aa.lights){y=
|
|
|
|
+aa.lights[x];if(y.type=="directional"){H=y.direction;light=new THREE.DirectionalLight;light.position.set(H[0],H[1],H[2]);light.position.normalize()}else if(y.type=="point"){H=y.position;light=new THREE.PointLight;light.position.set(H[0],H[1],H[2])}E=y.color;i=y.intensity||1;light.color.setRGB(E[0]*i,E[1]*i,E[2]*i);da.scene.addLight(light);da.lights[x]=light}for(q in aa.fogs){x=aa.fogs[q];if(x.type=="linear")P=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(P=new THREE.FogExp2(0,x.density));E=
|
|
|
|
+x.color;P.color.setRGB(E[0],E[1],E[2]);da.fogs[q]=P}if(da.cameras&&aa.defaults.camera)da.currentCamera=da.cameras[aa.defaults.camera];if(da.fogs&&aa.defaults.fog)da.scene.fog=da.fogs[aa.defaults.fog];E=aa.defaults.bgcolor;da.bgColor=new THREE.Color;da.bgColor.setRGB(E[0],E[1],E[2]);da.bgColorAlpha=aa.defaults.bgalpha;for(j in aa.geometries){q=aa.geometries[j];if(q.type=="bin_mesh"||q.type=="ascii_mesh")oa+=1}W=oa;for(j in aa.geometries){q=aa.geometries[j];if(q.type=="cube"){z=new Cube(q.width,q.height,
|
|
|
|
+q.depth,q.segmentsWidth,q.segmentsHeight,q.segmentsDepth,null,q.flipped,q.sides);da.geometries[j]=z}else if(q.type=="plane"){z=new Plane(q.width,q.height,q.segmentsWidth,q.segmentsHeight);da.geometries[j]=z}else if(q.type=="sphere"){z=new Sphere(q.radius,q.segmentsWidth,q.segmentsHeight);da.geometries[j]=z}else if(q.type=="cylinder"){z=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);da.geometries[j]=z}else if(q.type=="torus"){z=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);
|
|
|
|
+da.geometries[j]=z}else if(q.type=="icosahedron"){z=new Icosahedron(q.subdivisions);da.geometries[j]=z}else if(q.type=="bin_mesh")f.load({model:q.url,callback:h(j)});else q.type=="ascii_mesh"&&ha.load({model:q.url,callback:h(j)})}for(A in aa.textures){j=aa.textures[A];$+=j.url instanceof Array?j.url.length:1}Da=$;for(A in aa.textures){j=aa.textures[A];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)q=ImageUtils.loadTextureCube(j.url,j.mapping,
|
|
|
|
+e);else{q=ImageUtils.loadTexture(j.url,j.mapping,e);if(THREE[j.minFilter]!=undefined)q.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)q.magFilter=THREE[j.magFilter]}da.textures[A]=q}for(m in aa.materials){A=aa.materials[m];for(I in A.parameters)if(I=="envMap"||I=="map"||I=="lightMap")A.parameters[I]=da.textures[A.parameters[I]];else if(I=="shading")A.parameters[I]=A.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")A.parameters[I]=THREE[A.parameters[I]]?
|
|
|
|
+THREE[A.parameters[I]]:THREE.NormalBlending;else I=="combine"&&(A.parameters[I]=A.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);da.materials[m]=A}g();c(da)}},addMesh:function(a,c,b,d,e,g,h,k,j,m){c=new THREE.Mesh(c,m);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=k;c.rotation.z=j;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=
|
|
b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));
|
|
b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));
|
|
-d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,h=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));
|
|
|
|
-SceneUtils.addMesh(a,c,1,0,d,0,h,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-d,0,-h,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,d,e=a.children.length;for(d=0;d<e;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",
|
|
|
|
|
|
+d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));
|
|
|
|
+SceneUtils.addMesh(a,c,1,0,d,0,g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,d,e=a.children.length;for(d=0;d<e;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",
|
|
value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
|
|
normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
|
|
@@ -322,7 +324,7 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,h=2*Math.ceil(a*3)+1;h>25&&(h=25);e=(h-1)*0.5;b=Array(h);for(c=d=0;c<h;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<h;++c)b[c]/=d;return b}};
|
|
|
|
|
|
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}};
|
|
THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
|
|
THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
|
|
a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
|
|
a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
|
|
this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
|
|
this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
|
|
@@ -331,77 +333,77 @@ this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBack
|
|
var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
|
|
var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
|
|
!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
|
|
!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
|
|
THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
|
|
THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
|
|
-THREE.PathCamera=function(a){function c(m,t,x,y){var q={name:x,fps:0.6,length:y,hierarchy:[]},A,G=t.getControlPointsArray(),I=t.getLength(),E=G.length,H=0;A=E-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[A]={time:y,pos:G[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<E-1;A++){H=y*I.chunks[A]/I.total;t.keys[A]={time:H,pos:G[A]}}q.hierarchy[0]=t;THREE.AnimationHandler.add(q);return new THREE.Animation(m,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(m,t){var x,
|
|
|
|
|
|
+THREE.PathCamera=function(a){function c(m,t,x,y){var q={name:x,fps:0.6,length:y,hierarchy:[]},A,G=t.getControlPointsArray(),H=t.getLength(),E=G.length,I=0;A=E-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[A]={time:y,pos:G[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<E-1;A++){I=y*H.chunks[A]/H.total;t.keys[A]={time:I,pos:G[A]}}q.hierarchy[0]=t;THREE.AnimationHandler.add(q);return new THREE.Animation(m,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(m,t){var x,
|
|
y,q=new THREE.Geometry;for(x=0;x<m.points.length*t;x++){y=x/(m.points.length*t);y=m.getPoint(y);q.vertices[x]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return q}function d(m,t){var x=b(t,10),y=b(t,10),q=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,q);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);m.addChild(lineObj);particleObj.scale.set(1,1,1);m.addChild(particleObj);y=new Sphere(1,
|
|
y,q=new THREE.Geometry;for(x=0;x<m.points.length*t;x++){y=x/(m.points.length*t);y=m.getPoint(y);q.vertices[x]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return q}function d(m,t){var x=b(t,10),y=b(t,10),q=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,q);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);m.addChild(lineObj);particleObj.scale.set(1,1,1);m.addChild(particleObj);y=new Sphere(1,
|
|
16,8);q=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){x=new THREE.Mesh(y,q);x.position.copy(t.points[i]);x.updateMatrix();m.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
|
|
16,8);q=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){x=new THREE.Mesh(y,q);x.position.copy(t.points[i]);x.updateMatrix();m.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
|
|
!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
|
|
!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
|
|
if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
|
|
if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
|
|
-this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,h=Math.PI/180;this.update=function(m,t,x){var y,q;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;y=this.phi%e;this.phi=y>=0?y:y+e;y=this.verticalAngleMap.srcRange;q=this.verticalAngleMap.dstRange;
|
|
|
|
|
|
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.update=function(m,t,x){var y,q;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;y=this.phi%e;this.phi=y>=0?y:y+e;y=this.verticalAngleMap.srcRange;q=this.verticalAngleMap.dstRange;
|
|
this.phi=(this.phi-y[0])*(q[1]-q[0])/(y[1]-y[0])+q[0];y=this.horizontalAngleMap.srcRange;q=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(q[1]-q[0])/(y[1]-y[0])+q[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,m,t,x)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
|
|
this.phi=(this.phi-y[0])*(q[1]-q[0])/(y[1]-y[0])+q[0];y=this.horizontalAngleMap.srcRange;q=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(q[1]-q[0])/(y[1]-y[0])+q[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,m,t,x)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
|
|
-this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var g=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(j,g);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
|
|
|
|
|
|
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(j,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
|
|
c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(m,t){return function(){t.apply(m,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(m,t){return function(){t.apply(m,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
-var Cube=function(a,c,b,d,e,h,g,k,j){function m(I,E,H,z,S,Q,N,da){var f,ja,na=d||1,aa=e||1,Y=S/2,Da=Q/2,ea=t.vertices.length;if(I=="x"&&E=="y"||I=="y"&&E=="x")f="z";else if(I=="x"&&E=="z"||I=="z"&&E=="x"){f="y";aa=h||1}else if(I=="z"&&E=="y"||I=="y"&&E=="z"){f="x";na=h||1}var Ea=na+1,ia=aa+1;S/=na;var ra=Q/aa;for(ja=0;ja<ia;ja++)for(Q=0;Q<Ea;Q++){var oa=new THREE.Vector3;oa[I]=(Q*S-Y)*H;oa[E]=(ja*ra-Da)*z;oa[f]=N;t.vertices.push(new THREE.Vertex(oa))}for(ja=0;ja<aa;ja++)for(Q=0;Q<na;Q++){t.faces.push(new THREE.Face4(Q+
|
|
|
|
-Ea*ja+ea,Q+Ea*(ja+1)+ea,Q+1+Ea*(ja+1)+ea,Q+1+Ea*ja+ea,null,null,da));t.faceVertexUvs[0].push([new THREE.UV(Q/na,ja/aa),new THREE.UV(Q/na,(ja+1)/aa),new THREE.UV((Q+1)/na,(ja+1)/aa),new THREE.UV((Q+1)/na,ja/aa)])}}THREE.Geometry.call(this);var t=this,x=a/2,y=c/2,q=b/2;k=k?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var G in j)this.sides[G]!=
|
|
|
|
-undefined&&(this.sides[G]=j[G]);this.sides.px&&m("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,b,y,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,b,-y,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,c,q,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,c,-q,this.materials[5]);(function(){for(var I=[],E=[],H=0,z=t.vertices.length;H<z;H++){for(var S=t.vertices[H],Q=!1,N=0,da=I.length;N<da;N++){var f=
|
|
|
|
-I[N];if(S.position.x==f.position.x&&S.position.y==f.position.y&&S.position.z==f.position.z){E[H]=N;Q=!0;break}}if(!Q){E[H]=I.length;I.push(new THREE.Vertex(S.position.clone()))}}H=0;for(z=t.faces.length;H<z;H++){S=t.faces[H];S.a=E[S.a];S.b=E[S.b];S.c=E[S.c];S.d=E[S.d]}t.vertices=I})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
|
|
-var Cylinder=function(a,c,b,d,e,h){function g(t,x,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(t,x,y)))}THREE.Geometry.call(this);var k=this,j=Math.PI,m=d/2;for(d=0;d<a;d++)g(Math.sin(2*j*d/a)*c,Math.cos(2*j*d/a)*c,-m);for(d=0;d<a;d++)g(Math.sin(2*j*d/a)*b,Math.cos(2*j*d/a)*b,m);for(d=0;d<a;d++)k.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){g(0,0,-m-(h||0));for(d=a;d<a+a/2;d++)k.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){g(0,0,m+(e||0));
|
|
|
|
|
|
+var Cube=function(a,c,b,d,e,g,h,k,j){function m(H,E,I,z,S,P,O,aa){var f,ha,oa=d||1,$=e||1,W=S/2,Da=P/2,da=t.vertices.length;if(H=="x"&&E=="y"||H=="y"&&E=="x")f="z";else if(H=="x"&&E=="z"||H=="z"&&E=="x"){f="y";$=g||1}else if(H=="z"&&E=="y"||H=="y"&&E=="z"){f="x";oa=g||1}var Fa=oa+1,ja=$+1;S/=oa;var qa=P/$;for(ha=0;ha<ja;ha++)for(P=0;P<Fa;P++){var ma=new THREE.Vector3;ma[H]=(P*S-W)*I;ma[E]=(ha*qa-Da)*z;ma[f]=O;t.vertices.push(new THREE.Vertex(ma))}for(ha=0;ha<$;ha++)for(P=0;P<oa;P++){t.faces.push(new THREE.Face4(P+
|
|
|
|
+Fa*ha+da,P+Fa*(ha+1)+da,P+1+Fa*(ha+1)+da,P+1+Fa*ha+da,null,null,aa));t.faceVertexUvs[0].push([new THREE.UV(P/oa,ha/$),new THREE.UV(P/oa,(ha+1)/$),new THREE.UV((P+1)/oa,(ha+1)/$),new THREE.UV((P+1)/oa,ha/$)])}}THREE.Geometry.call(this);var t=this,x=a/2,y=c/2,q=b/2;k=k?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var G in j)this.sides[G]!=
|
|
|
|
+undefined&&(this.sides[G]=j[G]);this.sides.px&&m("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,b,y,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,b,-y,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,c,q,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,c,-q,this.materials[5]);(function(){for(var H=[],E=[],I=0,z=t.vertices.length;I<z;I++){for(var S=t.vertices[I],P=!1,O=0,aa=H.length;O<aa;O++){var f=
|
|
|
|
+H[O];if(S.position.x==f.position.x&&S.position.y==f.position.y&&S.position.z==f.position.z){E[I]=O;P=!0;break}}if(!P){E[I]=H.length;H.push(new THREE.Vertex(S.position.clone()))}}I=0;for(z=t.faces.length;I<z;I++){S=t.faces[I];S.a=E[S.a];S.b=E[S.b];S.c=E[S.c];S.d=E[S.d]}t.vertices=H})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
|
|
+var Cylinder=function(a,c,b,d,e,g){function h(t,x,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(t,x,y)))}THREE.Geometry.call(this);var k=this,j=Math.PI,m=d/2;for(d=0;d<a;d++)h(Math.sin(2*j*d/a)*c,Math.cos(2*j*d/a)*c,-m);for(d=0;d<a;d++)h(Math.sin(2*j*d/a)*b,Math.cos(2*j*d/a)*b,m);for(d=0;d<a;d++)k.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){h(0,0,-m-(g||0));for(d=a;d<a+a/2;d++)k.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){h(0,0,m+(e||0));
|
|
for(d=a+a/2;d<2*a;d++)k.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
for(d=a+a/2;d<2*a;d++)k.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
|
|
-var Icosahedron=function(a){function c(x,y,q){var A=Math.sqrt(x*x+y*y+q*q);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(x/A,y/A,q/A)))-1}function b(x,y,q,A){A.faces.push(new THREE.Face3(x,y,q))}function d(x,y){var q=e.vertices[x].position,A=e.vertices[y].position;return c((q.x+A.x)/2,(q.y+A.y)/2,(q.z+A.z)/2)}var e=this,h=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
|
|
|
|
-1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var k in h.faces){var j=d(h.faces[k].a,h.faces[k].b),m=d(h.faces[k].b,h.faces[k].c),t=d(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,j,t,g);b(h.faces[k].b,m,j,g);b(h.faces[k].c,
|
|
|
|
-t,m,g);b(j,m,t,g)}h.faces=g.faces}e.faces=h.faces;delete h;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
|
-function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],h=[],g=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));d[k]=a[k].clone();e[k]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(c),m=0;m<=this.angle+0.0010;m+=c){for(k=0;k<d.length;k++)if(m<this.angle){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));h[k]=this.vertices.length-1}else h=g;m==0&&(g=e);for(k=
|
|
|
|
-0;k<e.length-1;k++){this.faces.push(new THREE.Face4(h[k],h[k+1],e[k+1],e[k]));this.faceVertexUvs[0].push([new THREE.UV(m/b,k/a.length),new THREE.UV(m/b,(k+1)/a.length),new THREE.UV((m-c)/b,(k+1)/a.length),new THREE.UV((m-c)/b,k/a.length)])}e=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
|
|
|
|
-var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,h=a/2,g=c/2;b=b||1;d=d||1;var k=b+1,j=d+1;a/=b;var m=c/d;for(e=0;e<j;e++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(e*m-g),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+k*e,c+k*(e+1),c+1+k*(e+1),c+1+k*e));this.faceVertexUvs[0].push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
|
|
+var Icosahedron=function(a){function c(x,y,q){var A=Math.sqrt(x*x+y*y+q*q);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(x/A,y/A,q/A)))-1}function b(x,y,q,A){A.faces.push(new THREE.Face3(x,y,q))}function d(x,y){var q=e.vertices[x].position,A=e.vertices[y].position;return c((q.x+A.x)/2,(q.y+A.y)/2,(q.z+A.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
|
|
|
|
+1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),t=d(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,j,t,h);b(g.faces[k].b,m,j,h);b(g.faces[k].c,
|
|
|
|
+t,m,h);b(j,m,t,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
|
+function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));d[k]=a[k].clone();e[k]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(c),m=0;m<=this.angle+0.0010;m+=c){for(k=0;k<d.length;k++)if(m<this.angle){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=e);for(k=
|
|
|
|
+0;k<e.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k]));this.faceVertexUvs[0].push([new THREE.UV(m/b,k/a.length),new THREE.UV(m/b,(k+1)/a.length),new THREE.UV((m-c)/b,(k+1)/a.length),new THREE.UV((m-c)/b,k/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
|
|
|
|
+var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var k=b+1,j=d+1;a/=b;var m=c/d;for(e=0;e<j;e++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*m-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+k*e,c+k*(e+1),c+1+k*(e+1),c+1+k*e));this.faceVertexUvs[0].push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
-var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,h=Math.max(3,c||8),g=Math.max(2,b||6);c=[];for(b=0;b<g+1;b++){d=b/g;var k=a*Math.cos(d*e),j=a*Math.sin(d*e),m=[],t=0;for(d=0;d<h;d++){var x=2*d/h,y=j*Math.sin(x*e);x=j*Math.cos(x*e);(b==0||b==g)&&d>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,y)))-1);m.push(t)}c.push(m)}var q,A,G;e=c.length;for(b=0;b<e;b++){h=c[b].length;if(b>0)for(d=0;d<h;d++){m=d==h-1;g=c[b][m?0:d+1];k=c[b][m?h-1:d];j=c[b-1][m?h-1:d];m=c[b-1][m?
|
|
|
|
-0:d+1];y=b/(e-1);q=(b-1)/(e-1);A=(d+1)/h;x=d/h;t=new THREE.UV(1-A,y);y=new THREE.UV(1-x,y);x=new THREE.UV(1-x,q);var I=new THREE.UV(1-A,q);if(b<c.length-1){q=this.vertices[g].position.clone();A=this.vertices[k].position.clone();G=this.vertices[j].position.clone();q.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(g,k,j,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([t,y,x])}if(b>1){q=this.vertices[g].position.clone();
|
|
|
|
-A=this.vertices[j].position.clone();G=this.vertices[m].position.clone();q.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(g,j,m,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([t,x,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
|
|
|
|
+var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var k=a*Math.cos(d*e),j=a*Math.sin(d*e),m=[],t=0;for(d=0;d<g;d++){var x=2*d/g,y=j*Math.sin(x*e);x=j*Math.cos(x*e);(b==0||b==h)&&d>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,y)))-1);m.push(t)}c.push(m)}var q,A,G;e=c.length;for(b=0;b<e;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){m=d==g-1;h=c[b][m?0:d+1];k=c[b][m?g-1:d];j=c[b-1][m?g-1:d];m=c[b-1][m?
|
|
|
|
+0:d+1];y=b/(e-1);q=(b-1)/(e-1);A=(d+1)/g;x=d/g;t=new THREE.UV(1-A,y);y=new THREE.UV(1-x,y);x=new THREE.UV(1-x,q);var H=new THREE.UV(1-A,q);if(b<c.length-1){q=this.vertices[h].position.clone();A=this.vertices[k].position.clone();G=this.vertices[j].position.clone();q.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([t,y,x])}if(b>1){q=this.vertices[h].position.clone();
|
|
|
|
+A=this.vertices[j].position.clone();G=this.vertices[m].position.clone();q.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([t,x,H])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|
|
var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
|
|
var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
|
|
-1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var h=(this.segmentsT+1)*(c-1)+b-1,g=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,h,g));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
|
|
|
|
-var TorusKnot=function(a,c,b,d,e,h,g){function k(x,y,q,A,G,I){y=q/A*x;q=Math.cos(y);return new THREE.Vector3(G*(2+q)*0.5*Math.cos(x),G*(2+q)*Math.sin(x)*0.5,I*G*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=h||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var j=
|
|
|
|
-a/this.segmentsR*2*this.p*Math.PI;g=c/this.segmentsT*2*Math.PI;e=k(j,g,this.q,this.p,this.radius,this.heightScale);j=k(j+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=j.x-e.x;b.y=j.y-e.y;b.z=j.z-e.z;d.x=j.x+e.x;d.y=j.y+e.y;d.z=j.z+e.z;h.cross(b,d);d.cross(h,b);h.normalize();d.normalize();j=this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x+=j*d.x+g*h.x;e.y+=j*d.y+g*h.y;e.z+=j*d.z+g*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
|
|
|
|
-0;c<this.segmentsT;++c){h=(a+1)%this.segmentsR;g=(c+1)%this.segmentsT;e=this.grid[a][c];b=this.grid[h][c];d=this.grid[a][g];h=this.grid[h][g];g=new THREE.UV(a/this.segmentsR,c/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var m=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(e,b,d));this.faceVertexUvs[0].push([g,j,m]);this.faces.push(new THREE.Face3(h,d,b));this.faceVertexUvs[0].push([t,
|
|
|
|
|
|
+1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
|
|
|
|
+var TorusKnot=function(a,c,b,d,e,g,h){function k(x,y,q,A,G,H){y=q/A*x;q=Math.cos(y);return new THREE.Vector3(G*(2+q)*0.5*Math.cos(x),G*(2+q)*Math.sin(x)*0.5,H*G*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var j=
|
|
|
|
+a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;e=k(j,h,this.q,this.p,this.radius,this.heightScale);j=k(j+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=j.x-e.x;b.y=j.y-e.y;b.z=j.z-e.z;d.x=j.x+e.x;d.y=j.y+e.y;d.z=j.z+e.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();j=this.tube*Math.cos(h);h=this.tube*Math.sin(h);e.x+=j*d.x+h*g.x;e.y+=j*d.y+h*g.y;e.z+=j*d.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
|
|
|
|
+0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;e=this.grid[a][c];b=this.grid[g][c];d=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var m=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(e,b,d));this.faceVertexUvs[0].push([h,j,m]);this.faces.push(new THREE.Face3(g,d,b));this.faceVertexUvs[0].push([t,
|
|
m,j])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
|
|
m,j])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
|
|
THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
|
|
THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
|
|
c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!b(this.width)||!b(this.height)){var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
|
|
c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!b(this.width)||!b(this.height)){var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
|
|
-k.image.width=t;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,t,x)}else k.image=this;k.needsUpdate=!0};m.src=j}var e,h,g;e="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){g=document.createElement("canvas");h.map=new THREE.Texture(g);h.map.sourceFile=a.mapDiffuse;d(h.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*
|
|
|
|
-255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;h.color=g;h.opacity=a.transparency}else if(a.DbgColor)h.color=a.DbgColor;if(a.mapLightmap&&c){g=document.createElement("canvas");h.lightMap=new THREE.Texture(g);h.lightMap.sourceFile=a.mapLightmap;d(h.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](h)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
|
|
|
|
|
|
+k.image.width=t;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,t,x)}else k.image=this;k.needsUpdate=!0};m.src=j}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*
|
|
|
|
+255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
|
|
THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
-THREE.JSONLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.JSONLoader.prototype.createModel(e.data,b,d)};c.postMessage(a)},createModel:function(a,c,b){var d=function(e){var h=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(h,a.materials,e);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
|
|
|
|
-else{var g,k,j,m,t,x,y,q,A,G,I=a.faces;q=a.vertices;var E=a.normals,H=a.colors,z=0;for(g=0;g<a.uvs.length;g++)a.uvs[g].length&&z++;for(g=0;g<z;g++){h.faceUvs[g]=[];h.faceVertexUvs[g]=[]}j=0;for(m=q.length;j<m;){A=new THREE.Vertex;A.position.x=q[j++];A.position.y=q[j++];A.position.z=q[j++];h.vertices.push(A)}j=0;for(m=I.length;j<m;){t=I[j++];x=t&1;g=t&2;y=t&4;k=t&8;q=t&16;A=t&32;G=t&64;t&=128;if(x){x=new THREE.Face4;x.a=I[j++];x.b=I[j++];x.c=I[j++];x.d=I[j++];nVertices=4}else{x=new THREE.Face3;x.a=
|
|
|
|
-I[j++];x.b=I[j++];x.c=I[j++];nVertices=3}if(g){materialIndex=I[j++];x.materials=h.materials[materialIndex]}if(y)for(g=0;g<z;g++){uvLayer=a.uvs[g];uvIndex=I[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];h.faceUvs[g].push(new THREE.UV(u,v))}if(k)for(g=0;g<z;g++){uvLayer=a.uvs[g];uvs=[];for(k=0;k<nVertices;k++){uvIndex=I[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[k]=new THREE.UV(u,v)}h.faceVertexUvs[g].push(uvs)}if(q){normalIndex=I[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];
|
|
|
|
-normal.y=E[normalIndex++];normal.z=E[normalIndex];x.normal=normal}if(A)for(g=0;g<nVertices;g++){normalIndex=I[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];normal.y=E[normalIndex++];normal.z=E[normalIndex];x.vertexNormals.push(normal)}if(G){color=new THREE.Color(I[j++]);x.color=color}if(t)for(g=0;g<nVertices;g++){colorIndex=I[j++];color=new THREE.Color(H[colorIndex]);x.vertexColors.push(color)}h.faces.push(x)}}})();(function(){var g,k,j,m;if(a.skinWeights){g=0;for(k=a.skinWeights.length;g<
|
|
|
|
-k;g+=2){j=a.skinWeights[g];m=a.skinWeights[g+1];h.skinWeights.push(new THREE.Vector4(j,m,0,0))}}if(a.skinIndices){g=0;for(k=a.skinIndices.length;g<k;g+=2){j=a.skinIndices[g];m=a.skinIndices[g+1];h.skinIndices.push(new THREE.Vector4(j,m,0,0))}}h.bones=a.bones;h.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var g,k,j,m;g=0;for(k=a.morphTargets.length;g<k;g++){h.morphTargets[g]={};h.morphTargets[g].name=a.morphTargets[g].name;h.morphTargets[g].vertices=[];dstVertices=h.morphTargets[g].vertices;
|
|
|
|
-srcVertices=a.morphTargets[g].vertices;j=0;for(m=srcVertices.length;j<m;j+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[j],srcVertices[j+1],srcVertices[j+2])))}}})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
|
|
|
+THREE.JSONLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.JSONLoader.prototype.createModel(e.data,b,d)};c.postMessage(a)},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
|
|
|
|
+else{var h,k,j,m,t,x,y,q,A,G,H=a.faces;q=a.vertices;var E=a.normals,I=a.colors,z=0;for(h=0;h<a.uvs.length;h++)a.uvs[h].length&&z++;for(h=0;h<z;h++){g.faceUvs[h]=[];g.faceVertexUvs[h]=[]}j=0;for(m=q.length;j<m;){A=new THREE.Vertex;A.position.x=q[j++];A.position.y=q[j++];A.position.z=q[j++];g.vertices.push(A)}j=0;for(m=H.length;j<m;){t=H[j++];x=t&1;h=t&2;y=t&4;k=t&8;q=t&16;A=t&32;G=t&64;t&=128;if(x){x=new THREE.Face4;x.a=H[j++];x.b=H[j++];x.c=H[j++];x.d=H[j++];nVertices=4}else{x=new THREE.Face3;x.a=
|
|
|
|
+H[j++];x.b=H[j++];x.c=H[j++];nVertices=3}if(h){materialIndex=H[j++];x.materials=g.materials[materialIndex]}if(y)for(h=0;h<z;h++){uvLayer=a.uvs[h];uvIndex=H[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];g.faceUvs[h].push(new THREE.UV(u,v))}if(k)for(h=0;h<z;h++){uvLayer=a.uvs[h];uvs=[];for(k=0;k<nVertices;k++){uvIndex=H[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[k]=new THREE.UV(u,v)}g.faceVertexUvs[h].push(uvs)}if(q){normalIndex=H[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];
|
|
|
|
+normal.y=E[normalIndex++];normal.z=E[normalIndex];x.normal=normal}if(A)for(h=0;h<nVertices;h++){normalIndex=H[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];normal.y=E[normalIndex++];normal.z=E[normalIndex];x.vertexNormals.push(normal)}if(G){color=new THREE.Color(H[j++]);x.color=color}if(t)for(h=0;h<nVertices;h++){colorIndex=H[j++];color=new THREE.Color(I[colorIndex]);x.vertexColors.push(color)}g.faces.push(x)}}})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<
|
|
|
|
+k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];g.skinWeights.push(new THREE.Vector4(j,m,0,0))}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];g.skinIndices.push(new THREE.Vector4(j,m,0,0))}}g.bones=a.bones;g.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var h,k,j,m;h=0;for(k=a.morphTargets.length;h<k;h++){g.morphTargets[h]={};g.morphTargets[h].name=a.morphTargets[h].name;g.morphTargets[h].vertices=[];dstVertices=g.morphTargets[h].vertices;
|
|
|
|
+srcVertices=a.morphTargets[h].vertices;j=0;for(m=srcVertices.length;j<m;j+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[j],srcVertices[j+1],srcVertices[j+2])))}}})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
-THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,e,d,h)};c.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
|
|
|
|
-c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,h){var g=new XMLHttpRequest,k=d+"/"+a,j=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,e,c):alert("Couldn't load ["+k+"] ["+g.status+"]");else if(g.readyState==3){if(h){j==0&&(j=g.getResponseHeader("Content-Length"));h({total:j,loaded:g.responseText.length})}}else g.readyState==2&&(j=g.getResponseHeader("Content-Length"))};g.open("GET",k,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
|
-g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,c,b,d){var e=function(h){function g(p,o){var w=t(p,o),D=t(p,o+1),B=t(p,o+2),F=t(p,o+3),V=(F<<1&255|B>>7)-127;w|=(B&127)<<16|D<<8;if(w==0&&V==-127)return 0;return(1-2*(F>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,V)}function k(p,o){var w=t(p,o),D=t(p,o+1),B=t(p,o+2);return(t(p,o+3)<<24)+(B<<16)+(D<<8)+w}function j(p,o){var w=t(p,o);return(t(p,o+1)<<8)+w}function m(p,o){var w=t(p,o);return w>127?w-256:w}function t(p,
|
|
|
|
-o){return p.charCodeAt(o)&255}function x(p){var o,w,D;o=k(a,p);w=k(a,p+N);D=k(a,p+da);p=j(a,p+f);THREE.BinaryLoader.prototype.f3(E,o,w,D,p)}function y(p){var o,w,D,B,F,V;o=k(a,p);w=k(a,p+N);D=k(a,p+da);B=j(a,p+f);F=k(a,p+ja);V=k(a,p+na);p=k(a,p+aa);THREE.BinaryLoader.prototype.f3n(E,S,o,w,D,B,F,V,p)}function q(p){var o,w,D,B;o=k(a,p);w=k(a,p+Y);D=k(a,p+Da);B=k(a,p+ea);p=j(a,p+Ea);THREE.BinaryLoader.prototype.f4(E,o,w,D,B,p)}function A(p){var o,w,D,B,F,V,M,J;o=k(a,p);w=k(a,p+Y);D=k(a,p+Da);B=k(a,p+
|
|
|
|
-ea);F=j(a,p+Ea);V=k(a,p+ia);M=k(a,p+ra);J=k(a,p+oa);p=k(a,p+$);THREE.BinaryLoader.prototype.f4n(E,S,o,w,D,B,F,V,M,J,p)}function G(p){var o,w;o=k(a,p);w=k(a,p+R);p=k(a,p+O);THREE.BinaryLoader.prototype.uv3(E.faceVertexUvs[0],Q[o*2],Q[o*2+1],Q[w*2],Q[w*2+1],Q[p*2],Q[p*2+1])}function I(p){var o,w,D;o=k(a,p);w=k(a,p+ha);D=k(a,p+va);p=k(a,p+ka);THREE.BinaryLoader.prototype.uv4(E.faceVertexUvs[0],Q[o*2],Q[o*2+1],Q[w*2],Q[w*2+1],Q[D*2],Q[D*2+1],Q[p*2],Q[p*2+1])}var E=this,H=0,z,S=[],Q=[],N,da,f,ja,na,aa,
|
|
|
|
-Y,Da,ea,Ea,ia,ra,oa,$,R,O,ha,va,ka,ta,xa,Ma,ab,n,C;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,d,h);z={signature:a.substr(H,8),header_bytes:t(a,H+8),vertex_coordinate_bytes:t(a,H+9),normal_coordinate_bytes:t(a,H+10),uv_coordinate_bytes:t(a,H+11),vertex_index_bytes:t(a,H+12),normal_index_bytes:t(a,H+13),uv_index_bytes:t(a,H+14),material_index_bytes:t(a,H+15),nvertices:k(a,H+16),nnormals:k(a,H+16+4),nuvs:k(a,H+16+8),ntri_flat:k(a,H+16+12),ntri_smooth:k(a,H+16+16),ntri_flat_uv:k(a,
|
|
|
|
-H+16+20),ntri_smooth_uv:k(a,H+16+24),nquad_flat:k(a,H+16+28),nquad_smooth:k(a,H+16+32),nquad_flat_uv:k(a,H+16+36),nquad_smooth_uv:k(a,H+16+40)};H+=z.header_bytes;N=z.vertex_index_bytes;da=z.vertex_index_bytes*2;f=z.vertex_index_bytes*3;ja=z.vertex_index_bytes*3+z.material_index_bytes;na=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;aa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;Y=z.vertex_index_bytes;Da=z.vertex_index_bytes*2;ea=z.vertex_index_bytes*3;
|
|
|
|
-Ea=z.vertex_index_bytes*4;ia=z.vertex_index_bytes*4+z.material_index_bytes;ra=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;oa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;$=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;R=z.uv_index_bytes;O=z.uv_index_bytes*2;ha=z.uv_index_bytes;va=z.uv_index_bytes*2;ka=z.uv_index_bytes*3;h=z.vertex_index_bytes*3+z.material_index_bytes;C=z.vertex_index_bytes*4+z.material_index_bytes;ta=z.ntri_flat*
|
|
|
|
-h;xa=z.ntri_smooth*(h+z.normal_index_bytes*3);Ma=z.ntri_flat_uv*(h+z.uv_index_bytes*3);ab=z.ntri_smooth_uv*(h+z.normal_index_bytes*3+z.uv_index_bytes*3);n=z.nquad_flat*C;h=z.nquad_smooth*(C+z.normal_index_bytes*4);C=z.nquad_flat_uv*(C+z.uv_index_bytes*4);H+=function(p){for(var o,w,D,B=z.vertex_coordinate_bytes*3,F=p+z.nvertices*B;p<F;p+=B){o=g(a,p);w=g(a,p+z.vertex_coordinate_bytes);D=g(a,p+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(E,o,w,D)}return z.nvertices*B}(H);H+=function(p){for(var o,
|
|
|
|
-w,D,B=z.normal_coordinate_bytes*3,F=p+z.nnormals*B;p<F;p+=B){o=m(a,p);w=m(a,p+z.normal_coordinate_bytes);D=m(a,p+z.normal_coordinate_bytes*2);S.push(o/127,w/127,D/127)}return z.nnormals*B}(H);H+=function(p){for(var o,w,D=z.uv_coordinate_bytes*2,B=p+z.nuvs*D;p<B;p+=D){o=g(a,p);w=g(a,p+z.uv_coordinate_bytes);Q.push(o,w)}return z.nuvs*D}(H);ta=H+ta;xa=ta+xa;Ma=xa+Ma;ab=Ma+ab;n=ab+n;h=n+h;C=h+C;(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes,D=w+z.uv_index_bytes*3,B=p+z.ntri_flat_uv*
|
|
|
|
-D;for(o=p;o<B;o+=D){x(o);G(o+w)}return B-p})(xa);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,D=w+z.uv_index_bytes*3,B=p+z.ntri_smooth_uv*D;for(o=p;o<B;o+=D){y(o);G(o+w)}return B-p})(Ma);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes,D=w+z.uv_index_bytes*4,B=p+z.nquad_flat_uv*D;for(o=p;o<B;o+=D){q(o);I(o+w)}return B-p})(h);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,D=w+z.uv_index_bytes*
|
|
|
|
-4,B=p+z.nquad_smooth_uv*D;for(o=p;o<B;o+=D){A(o);I(o+w)}return B-p})(C);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes,D=p+z.ntri_flat*w;for(o=p;o<D;o+=w)x(o);return D-p})(H);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,D=p+z.ntri_smooth*w;for(o=p;o<D;o+=w)y(o);return D-p})(ta);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes,D=p+z.nquad_flat*w;for(o=p;o<D;o+=w)q(o);return D-p})(ab);(function(p){var o,w=z.vertex_index_bytes*
|
|
|
|
-4+z.material_index_bytes+z.normal_index_bytes*4,D=p+z.nquad_smooth*w;for(o=p;o<D;o+=w)A(o);return D-p})(n);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,null,a.materials[e]))},f4:function(a,c,b,d,e,h){a.faces.push(new THREE.Face4(c,b,d,e,null,null,a.materials[h]))},f3n:function(a,c,
|
|
|
|
-b,d,e,h,g,k,j){h=a.materials[h];var m=c[k*3],t=c[k*3+1];k=c[k*3+2];var x=c[j*3],y=c[j*3+1];j=c[j*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(m,t,k),new THREE.Vector3(x,y,j)],null,h))},f4n:function(a,c,b,d,e,h,g,k,j,m,t){g=a.materials[g];var x=c[j*3],y=c[j*3+1];j=c[j*3+2];var q=c[m*3],A=c[m*3+1];m=c[m*3+2];var G=c[t*3],I=c[t*3+1];t=c[t*3+2];a.faces.push(new THREE.Face4(b,d,e,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,
|
|
|
|
-y,j),new THREE.Vector3(q,A,m),new THREE.Vector3(G,I,t)],null,g))},uv3:function(a,c,b,d,e,h,g){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(d,e));k.push(new THREE.UV(h,g));a.push(k)},uv4:function(a,c,b,d,e,h,g,k,j){var m=[];m.push(new THREE.UV(c,b));m.push(new THREE.UV(d,e));m.push(new THREE.UV(h,g));m.push(new THREE.UV(k,j));a.push(m)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
|
|
|
|
+THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
|
|
|
|
+c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
|
+h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,d){var e=function(g){function h(p,o){var w=t(p,o),D=t(p,o+1),B=t(p,o+2),F=t(p,o+3),X=(F<<1&255|B>>7)-127;w|=(B&127)<<16|D<<8;if(w==0&&X==-127)return 0;return(1-2*(F>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,X)}function k(p,o){var w=t(p,o),D=t(p,o+1),B=t(p,o+2);return(t(p,o+3)<<24)+(B<<16)+(D<<8)+w}function j(p,o){var w=t(p,o);return(t(p,o+1)<<8)+w}function m(p,o){var w=t(p,o);return w>127?w-256:w}function t(p,
|
|
|
|
+o){return p.charCodeAt(o)&255}function x(p){var o,w,D;o=k(a,p);w=k(a,p+O);D=k(a,p+aa);p=j(a,p+f);THREE.BinaryLoader.prototype.f3(E,o,w,D,p)}function y(p){var o,w,D,B,F,X;o=k(a,p);w=k(a,p+O);D=k(a,p+aa);B=j(a,p+f);F=k(a,p+ha);X=k(a,p+oa);p=k(a,p+$);THREE.BinaryLoader.prototype.f3n(E,S,o,w,D,B,F,X,p)}function q(p){var o,w,D,B;o=k(a,p);w=k(a,p+W);D=k(a,p+Da);B=k(a,p+da);p=j(a,p+Fa);THREE.BinaryLoader.prototype.f4(E,o,w,D,B,p)}function A(p){var o,w,D,B,F,X,N,J;o=k(a,p);w=k(a,p+W);D=k(a,p+Da);B=k(a,p+
|
|
|
|
+da);F=j(a,p+Fa);X=k(a,p+ja);N=k(a,p+qa);J=k(a,p+ma);p=k(a,p+Z);THREE.BinaryLoader.prototype.f4n(E,S,o,w,D,B,F,X,N,J,p)}function G(p){var o,w;o=k(a,p);w=k(a,p+Q);p=k(a,p+M);THREE.BinaryLoader.prototype.uv3(E.faceVertexUvs[0],P[o*2],P[o*2+1],P[w*2],P[w*2+1],P[p*2],P[p*2+1])}function H(p){var o,w,D;o=k(a,p);w=k(a,p+ea);D=k(a,p+ua);p=k(a,p+ka);THREE.BinaryLoader.prototype.uv4(E.faceVertexUvs[0],P[o*2],P[o*2+1],P[w*2],P[w*2+1],P[D*2],P[D*2+1],P[p*2],P[p*2+1])}var E=this,I=0,z,S=[],P=[],O,aa,f,ha,oa,$,
|
|
|
|
+W,Da,da,Fa,ja,qa,ma,Z,Q,M,ea,ua,ka,va,za,La,$a,n,C;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,d,g);z={signature:a.substr(I,8),header_bytes:t(a,I+8),vertex_coordinate_bytes:t(a,I+9),normal_coordinate_bytes:t(a,I+10),uv_coordinate_bytes:t(a,I+11),vertex_index_bytes:t(a,I+12),normal_index_bytes:t(a,I+13),uv_index_bytes:t(a,I+14),material_index_bytes:t(a,I+15),nvertices:k(a,I+16),nnormals:k(a,I+16+4),nuvs:k(a,I+16+8),ntri_flat:k(a,I+16+12),ntri_smooth:k(a,I+16+16),ntri_flat_uv:k(a,
|
|
|
|
+I+16+20),ntri_smooth_uv:k(a,I+16+24),nquad_flat:k(a,I+16+28),nquad_smooth:k(a,I+16+32),nquad_flat_uv:k(a,I+16+36),nquad_smooth_uv:k(a,I+16+40)};I+=z.header_bytes;O=z.vertex_index_bytes;aa=z.vertex_index_bytes*2;f=z.vertex_index_bytes*3;ha=z.vertex_index_bytes*3+z.material_index_bytes;oa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;$=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;W=z.vertex_index_bytes;Da=z.vertex_index_bytes*2;da=z.vertex_index_bytes*3;
|
|
|
|
+Fa=z.vertex_index_bytes*4;ja=z.vertex_index_bytes*4+z.material_index_bytes;qa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;ma=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;Z=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;Q=z.uv_index_bytes;M=z.uv_index_bytes*2;ea=z.uv_index_bytes;ua=z.uv_index_bytes*2;ka=z.uv_index_bytes*3;g=z.vertex_index_bytes*3+z.material_index_bytes;C=z.vertex_index_bytes*4+z.material_index_bytes;va=z.ntri_flat*
|
|
|
|
+g;za=z.ntri_smooth*(g+z.normal_index_bytes*3);La=z.ntri_flat_uv*(g+z.uv_index_bytes*3);$a=z.ntri_smooth_uv*(g+z.normal_index_bytes*3+z.uv_index_bytes*3);n=z.nquad_flat*C;g=z.nquad_smooth*(C+z.normal_index_bytes*4);C=z.nquad_flat_uv*(C+z.uv_index_bytes*4);I+=function(p){for(var o,w,D,B=z.vertex_coordinate_bytes*3,F=p+z.nvertices*B;p<F;p+=B){o=h(a,p);w=h(a,p+z.vertex_coordinate_bytes);D=h(a,p+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(E,o,w,D)}return z.nvertices*B}(I);I+=function(p){for(var o,
|
|
|
|
+w,D,B=z.normal_coordinate_bytes*3,F=p+z.nnormals*B;p<F;p+=B){o=m(a,p);w=m(a,p+z.normal_coordinate_bytes);D=m(a,p+z.normal_coordinate_bytes*2);S.push(o/127,w/127,D/127)}return z.nnormals*B}(I);I+=function(p){for(var o,w,D=z.uv_coordinate_bytes*2,B=p+z.nuvs*D;p<B;p+=D){o=h(a,p);w=h(a,p+z.uv_coordinate_bytes);P.push(o,w)}return z.nuvs*D}(I);va=I+va;za=va+za;La=za+La;$a=La+$a;n=$a+n;g=n+g;C=g+C;(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes,D=w+z.uv_index_bytes*3,B=p+z.ntri_flat_uv*
|
|
|
|
+D;for(o=p;o<B;o+=D){x(o);G(o+w)}return B-p})(za);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,D=w+z.uv_index_bytes*3,B=p+z.ntri_smooth_uv*D;for(o=p;o<B;o+=D){y(o);G(o+w)}return B-p})(La);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes,D=w+z.uv_index_bytes*4,B=p+z.nquad_flat_uv*D;for(o=p;o<B;o+=D){q(o);H(o+w)}return B-p})(g);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,D=w+z.uv_index_bytes*
|
|
|
|
+4,B=p+z.nquad_smooth_uv*D;for(o=p;o<B;o+=D){A(o);H(o+w)}return B-p})(C);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes,D=p+z.ntri_flat*w;for(o=p;o<D;o+=w)x(o);return D-p})(I);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,D=p+z.ntri_smooth*w;for(o=p;o<D;o+=w)y(o);return D-p})(va);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes,D=p+z.nquad_flat*w;for(o=p;o<D;o+=w)q(o);return D-p})($a);(function(p){var o,w=z.vertex_index_bytes*
|
|
|
|
+4+z.material_index_bytes+z.normal_index_bytes*4,D=p+z.nquad_smooth*w;for(o=p;o<D;o+=w)A(o);return D-p})(n);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,null,a.materials[g]))},f3n:function(a,c,
|
|
|
|
+b,d,e,g,h,k,j){g=a.materials[g];var m=c[k*3],t=c[k*3+1];k=c[k*3+2];var x=c[j*3],y=c[j*3+1];j=c[j*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,t,k),new THREE.Vector3(x,y,j)],null,g))},f4n:function(a,c,b,d,e,g,h,k,j,m,t){h=a.materials[h];var x=c[j*3],y=c[j*3+1];j=c[j*3+2];var q=c[m*3],A=c[m*3+1];m=c[m*3+2];var G=c[t*3],H=c[t*3+1];t=c[t*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,
|
|
|
|
+y,j),new THREE.Vector3(q,A,m),new THREE.Vector3(G,H,t)],null,h))},uv3:function(a,c,b,d,e,g,h){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(d,e));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,c,b,d,e,g,h,k,j){var m=[];m.push(new THREE.UV(c,b));m.push(new THREE.UV(d,e));m.push(new THREE.UV(g,h));m.push(new THREE.UV(k,j));a.push(m)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,h,g,k,j,m,t,x){g=(g-t)/(x-t);t=this.normal_cache;d[h]=k+g*this.delta;d[h+1]=j;d[h+2]=m;e[h]=this.lerp(t[b],t[b+3],g);e[h+1]=this.lerp(t[b+1],t[b+4],g);e[h+2]=this.lerp(t[b+2],t[b+5],g)};this.VIntY=function(b,d,e,h,g,k,j,m,t,x){g=(g-t)/(x-t);t=this.normal_cache;d[h]=k;d[h+1]=j+g*this.delta;d[h+
|
|
|
|
-2]=m;d=b+this.yd*3;e[h]=this.lerp(t[b],t[d],g);e[h+1]=this.lerp(t[b+1],t[d+1],g);e[h+2]=this.lerp(t[b+2],t[d+2],g)};this.VIntZ=function(b,d,e,h,g,k,j,m,t,x){g=(g-t)/(x-t);t=this.normal_cache;d[h]=k;d[h+1]=j;d[h+2]=m+g*this.delta;d=b+this.zd*3;e[h]=this.lerp(t[b],t[d],g);e[h+1]=this.lerp(t[b+1],t[d+1],g);e[h+2]=this.lerp(t[b+2],t[d+2],g)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
|
|
|
|
-this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,h,g,k){var j=h+1,m=h+this.yd,t=h+this.zd,x=j+this.yd,y=j+this.zd,q=h+this.yd+this.zd,A=j+this.yd+this.zd,G=0,I=this.field[h],E=this.field[j],H=this.field[m],z=this.field[x],S=this.field[t],Q=this.field[y],N=this.field[q],da=this.field[A];I<g&&(G|=1);E<g&&(G|=2);H<g&&(G|=8);z<g&&(G|=4);S<g&&(G|=16);Q<g&&(G|=32);N<g&&(G|=128);da<g&&(G|=64);var f=THREE.edgeTable[G];if(f==0)return 0;
|
|
|
|
-var ja=this.delta,na=b+ja,aa=d+ja;ja=e+ja;if(f&1){this.compNorm(h);this.compNorm(j);this.VIntX(h*3,this.vlist,this.nlist,0,g,b,d,e,I,E)}if(f&2){this.compNorm(j);this.compNorm(x);this.VIntY(j*3,this.vlist,this.nlist,3,g,na,d,e,E,z)}if(f&4){this.compNorm(m);this.compNorm(x);this.VIntX(m*3,this.vlist,this.nlist,6,g,b,aa,e,H,z)}if(f&8){this.compNorm(h);this.compNorm(m);this.VIntY(h*3,this.vlist,this.nlist,9,g,b,d,e,I,H)}if(f&16){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,12,
|
|
|
|
-g,b,d,ja,S,Q)}if(f&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,g,na,d,ja,Q,da)}if(f&64){this.compNorm(q);this.compNorm(A);this.VIntX(q*3,this.vlist,this.nlist,18,g,b,aa,ja,N,da)}if(f&128){this.compNorm(t);this.compNorm(q);this.VIntY(t*3,this.vlist,this.nlist,21,g,b,d,ja,S,N)}if(f&256){this.compNorm(h);this.compNorm(t);this.VIntZ(h*3,this.vlist,this.nlist,24,g,b,d,e,I,S)}if(f&512){this.compNorm(j);this.compNorm(y);this.VIntZ(j*3,this.vlist,this.nlist,27,g,na,d,e,E,
|
|
|
|
-Q)}if(f&1024){this.compNorm(x);this.compNorm(A);this.VIntZ(x*3,this.vlist,this.nlist,30,g,na,aa,e,z,da)}if(f&2048){this.compNorm(m);this.compNorm(q);this.VIntZ(m*3,this.vlist,this.nlist,33,g,b,aa,e,H,N)}G<<=4;for(g=h=0;THREE.triTable[G+g]!=-1;){b=G+g;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],k);g+=3;h++}return h};this.posnormtriv=function(b,d,e,h,g,k){var j=this.count*3;this.positionArray[j]=b[e];this.positionArray[j+1]=b[e+1];this.positionArray[j+
|
|
|
|
-2]=b[e+2];this.positionArray[j+3]=b[h];this.positionArray[j+4]=b[h+1];this.positionArray[j+5]=b[h+2];this.positionArray[j+6]=b[g];this.positionArray[j+7]=b[g+1];this.positionArray[j+8]=b[g+2];this.normalArray[j]=d[e];this.normalArray[j+1]=d[e+1];this.normalArray[j+2]=d[e+2];this.normalArray[j+3]=d[h];this.normalArray[j+4]=d[h+1];this.normalArray[j+5]=d[h+2];this.normalArray[j+6]=d[g];this.normalArray[j+7]=d[g+1];this.normalArray[j+8]=d[g+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=
|
|
|
|
-this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,h,g){var k=this.size*Math.sqrt(h/g),j=e*this.size,m=d*this.size,t=b*this.size,x=Math.floor(j-k);x<1&&(x=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var y=Math.floor(m-k);y<1&&(y=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var q=Math.floor(t-
|
|
|
|
-k);q<1&&(q=1);k=Math.floor(t+k);k>this.size-1&&(k=this.size-1);for(var A,G,I,E,H,z;x<j;x++){t=this.size2*x;G=x/this.size-e;H=G*G;for(G=y;G<m;G++){I=t+this.size*G;A=G/this.size-d;z=A*A;for(A=q;A<k;A++){E=A/this.size-b;E=h/(1.0E-6+E*E+z+H)-g;E>0&&(this.field[I+A]+=E)}}}};this.addPlaneX=function(b,d){var e,h,g,k,j,m=this.size,t=this.yd,x=this.zd,y=this.field,q=m*Math.sqrt(b/d);q>m&&(q=m);for(e=0;e<q;e++){h=e/m;h*=h;k=b/(1.0E-4+h)-d;if(k>0)for(h=0;h<m;h++){j=e+h*t;for(g=0;g<m;g++)y[x*g+j]+=k}}};this.addPlaneY=
|
|
|
|
-function(b,d){var e,h,g,k,j,m,t=this.size,x=this.yd,y=this.zd,q=this.field,A=t*Math.sqrt(b/d);A>t&&(A=t);for(h=0;h<A;h++){e=h/t;e*=e;k=b/(1.0E-4+e)-d;if(k>0){j=h*x;for(e=0;e<t;e++){m=j+e;for(g=0;g<t;g++)q[y*g+m]+=k}}}};this.addPlaneZ=function(b,d){var e,h,g,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(g=0;g<dist;g++){e=g/size;e*=e;k=b/(1.0E-4+e)-d;if(k>0){j=zd*g;for(h=0;h<size;h++){m=j+h*yd;for(e=0;e<size;e++)field[m+e]+=k}}}};this.reset=
|
|
|
|
-function(){var b;for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var d,e,h,g,k,j,m,t,x,y=this.size-2;for(g=1;g<y;g++){x=this.size2*g;m=(g-this.halfsize)/this.halfsize;for(h=1;h<y;h++){t=x+this.size*h;j=(h-this.halfsize)/this.halfsize;for(e=1;e<y;e++){k=(e-this.halfsize)/this.halfsize;d=t+e;this.polygonize(k,j,m,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var h,g,k,
|
|
|
|
-j,m,t,x,y;for(h=0;h<e.count;h++){m=h*3;x=m+1;y=m+2;g=e.positionArray[m];k=e.positionArray[x];j=e.positionArray[y];t=new THREE.Vector3(g,k,j);g=e.normalArray[m];k=e.normalArray[x];j=e.normalArray[y];m=new THREE.Vector3(g,k,j);m.normalize();m=new THREE.Vertex(t,m);d.vertices.push(m)}nfaces=e.count/3;for(h=0;h<nfaces;h++){m=(b+h)*3;x=m+1;y=m+2;t=d.vertices[m].normal;g=d.vertices[x].normal;k=d.vertices[y].normal;m=new THREE.Face3(m,x,y,[t,g,k]);d.faces.push(m)}b+=nfaces;e.count=0});return d};this.init(a)};
|
|
|
|
|
|
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,k,j,m,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;e[g]=this.lerp(t[b],t[b+3],h);e[g+1]=this.lerp(t[b+1],t[b+4],h);e[g+2]=this.lerp(t[b+2],t[b+5],h)};this.VIntY=function(b,d,e,g,h,k,j,m,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
|
|
|
|
+2]=m;d=b+this.yd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.VIntZ=function(b,d,e,g,h,k,j,m,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
|
|
|
|
+this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,k){var j=g+1,m=g+this.yd,t=g+this.zd,x=j+this.yd,y=j+this.zd,q=g+this.yd+this.zd,A=j+this.yd+this.zd,G=0,H=this.field[g],E=this.field[j],I=this.field[m],z=this.field[x],S=this.field[t],P=this.field[y],O=this.field[q],aa=this.field[A];H<h&&(G|=1);E<h&&(G|=2);I<h&&(G|=8);z<h&&(G|=4);S<h&&(G|=16);P<h&&(G|=32);O<h&&(G|=128);aa<h&&(G|=64);var f=THREE.edgeTable[G];if(f==0)return 0;
|
|
|
|
+var ha=this.delta,oa=b+ha,$=d+ha;ha=e+ha;if(f&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,H,E)}if(f&2){this.compNorm(j);this.compNorm(x);this.VIntY(j*3,this.vlist,this.nlist,3,h,oa,d,e,E,z)}if(f&4){this.compNorm(m);this.compNorm(x);this.VIntX(m*3,this.vlist,this.nlist,6,h,b,$,e,I,z)}if(f&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,H,I)}if(f&16){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,12,
|
|
|
|
+h,b,d,ha,S,P)}if(f&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,h,oa,d,ha,P,aa)}if(f&64){this.compNorm(q);this.compNorm(A);this.VIntX(q*3,this.vlist,this.nlist,18,h,b,$,ha,O,aa)}if(f&128){this.compNorm(t);this.compNorm(q);this.VIntY(t*3,this.vlist,this.nlist,21,h,b,d,ha,S,O)}if(f&256){this.compNorm(g);this.compNorm(t);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,H,S)}if(f&512){this.compNorm(j);this.compNorm(y);this.VIntZ(j*3,this.vlist,this.nlist,27,h,oa,d,e,E,
|
|
|
|
+P)}if(f&1024){this.compNorm(x);this.compNorm(A);this.VIntZ(x*3,this.vlist,this.nlist,30,h,oa,$,e,z,aa)}if(f&2048){this.compNorm(m);this.compNorm(q);this.VIntZ(m*3,this.vlist,this.nlist,33,h,b,$,e,I,O)}G<<=4;for(h=g=0;THREE.triTable[G+h]!=-1;){b=G+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],k);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,k){var j=this.count*3;this.positionArray[j]=b[e];this.positionArray[j+1]=b[e+1];this.positionArray[j+
|
|
|
|
+2]=b[e+2];this.positionArray[j+3]=b[g];this.positionArray[j+4]=b[g+1];this.positionArray[j+5]=b[g+2];this.positionArray[j+6]=b[h];this.positionArray[j+7]=b[h+1];this.positionArray[j+8]=b[h+2];this.normalArray[j]=d[e];this.normalArray[j+1]=d[e+1];this.normalArray[j+2]=d[e+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=
|
|
|
|
+this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var k=this.size*Math.sqrt(g/h),j=e*this.size,m=d*this.size,t=b*this.size,x=Math.floor(j-k);x<1&&(x=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var y=Math.floor(m-k);y<1&&(y=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var q=Math.floor(t-
|
|
|
|
+k);q<1&&(q=1);k=Math.floor(t+k);k>this.size-1&&(k=this.size-1);for(var A,G,H,E,I,z;x<j;x++){t=this.size2*x;G=x/this.size-e;I=G*G;for(G=y;G<m;G++){H=t+this.size*G;A=G/this.size-d;z=A*A;for(A=q;A<k;A++){E=A/this.size-b;E=g/(1.0E-6+E*E+z+I)-h;E>0&&(this.field[H+A]+=E)}}}};this.addPlaneX=function(b,d){var e,g,h,k,j,m=this.size,t=this.yd,x=this.zd,y=this.field,q=m*Math.sqrt(b/d);q>m&&(q=m);for(e=0;e<q;e++){g=e/m;g*=g;k=b/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=e+g*t;for(h=0;h<m;h++)y[x*h+j]+=k}}};this.addPlaneY=
|
|
|
|
+function(b,d){var e,g,h,k,j,m,t=this.size,x=this.yd,y=this.zd,q=this.field,A=t*Math.sqrt(b/d);A>t&&(A=t);for(g=0;g<A;g++){e=g/t;e*=e;k=b/(1.0E-4+e)-d;if(k>0){j=g*x;for(e=0;e<t;e++){m=j+e;for(h=0;h<t;h++)q[y*h+m]+=k}}}};this.addPlaneZ=function(b,d){var e,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){e=h/size;e*=e;k=b/(1.0E-4+e)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(e=0;e<size;e++)field[m+e]+=k}}}};this.reset=
|
|
|
|
+function(){var b;for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var d,e,g,h,k,j,m,t,x,y=this.size-2;for(h=1;h<y;h++){x=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){t=x+this.size*g;j=(g-this.halfsize)/this.halfsize;for(e=1;e<y;e++){k=(e-this.halfsize)/this.halfsize;d=t+e;this.polygonize(k,j,m,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var g,h,k,
|
|
|
|
+j,m,t,x,y;for(g=0;g<e.count;g++){m=g*3;x=m+1;y=m+2;h=e.positionArray[m];k=e.positionArray[x];j=e.positionArray[y];t=new THREE.Vector3(h,k,j);h=e.normalArray[m];k=e.normalArray[x];j=e.normalArray[y];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(t,m);d.vertices.push(m)}nfaces=e.count/3;for(g=0;g<nfaces;g++){m=(b+g)*3;x=m+1;y=m+2;t=d.vertices[m].normal;h=d.vertices[x].normal;k=d.vertices[y].normal;m=new THREE.Face3(m,x,y,[t,h,k]);d.faces.push(m)}b+=nfaces;e.count=0});return d};this.init(a)};
|
|
THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|