提交 18f78599 编写于 作者: M Mr.doob

Ray now intersects with particles too. (thx @jaycrossler)

上级 4f0199fc
因为 它太大了无法显示 source diff 。你可以改为 查看blob
// ThreeCanvas.js r41/ROME - http://github.com/mrdoob/three.js // ThreeCanvas.js r41/ROME - http://github.com/mrdoob/three.js
var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){this.setHex(a)}; var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){this.setHex(a)};
THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,j;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),j=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=j;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=j;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=j;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d, THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,f,g,e,h,j;if(c==0)d=f=g=0;else switch(e=Math.floor(a*6),h=a*6-e,a=c*(1-b),j=c*(1-b*h),b=c*(1-b*(1-h)),e){case 1:d=j;f=c;g=a;break;case 2:d=a;f=c;g=b;break;case 3:d=a;f=j;g=c;break;case 4:d=b;f=a;g=c;break;case 5:d=c;f=a;g=j;break;case 6:case 0:d=c,f=b,g=a}this.setRGB(d,
e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)}; f,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)}; this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a, THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
...@@ -11,58 +11,59 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit ...@@ -11,58 +11,59 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)}; Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d,e=[];b=0;for(c=a.length;b<c;b++)d=a[b],d instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(d)));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c,d){var d=d.clone().subSelf(b),c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a* THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)d=d.concat(this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.position.clone().subSelf(a).dot(b);if(d<0)return!1;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.position.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),c=c.clone().subSelf(b),
c-b*d)*e;return f>0&&a>0&&f+a<1}var c,d,e,g,f,h,j,i,o,m,k,n=a.geometry,l=n.vertices,q=[];c=0;for(d=n.faces.length;c<d;c++)if(e=n.faces[c],m=this.origin.clone(),k=this.direction.clone(),j=a.matrixWorld,g=j.multiplyVector3(l[e.a].position.clone()),f=j.multiplyVector3(l[e.b].position.clone()),h=j.multiplyVector3(l[e.c].position.clone()),j=e instanceof THREE.Face4?j.multiplyVector3(l[e.d].position.clone()):null,i=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),o=k.dot(i),a.doubleSided||(a.flipSided? f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}if(a instanceof THREE.Particle){var d=[],f=b(this.origin,this.direction,a);f&&f<a.scale.x&&d.push({distance:f,point:a.position,object:a});return d}else if(a instanceof THREE.Mesh){var g,e,h,j,i,m,p,n,l,k,q=a.geometry,u=q.vertices,d=[],f=0;for(g=q.faces.length;f<g;f++)if(e=q.faces[f],l=this.origin.clone(),k=this.direction.clone(),m=a.matrixWorld,h=m.multiplyVector3(u[e.a].position.clone()),
o>0:o<0))if(i=i.dot((new THREE.Vector3).sub(g,m))/o,m=m.addSelf(k.multiplyScalar(i)),e instanceof THREE.Face3)b(m,g,f,h)&&(e={distance:this.origin.distanceTo(m),point:m,face:e,object:a},q.push(e));else if(e instanceof THREE.Face4&&(b(m,g,f,j)||b(m,f,h,j)))e={distance:this.origin.distanceTo(m),point:m,face:e,object:a},q.push(e);return q}}; j=m.multiplyVector3(u[e.b].position.clone()),i=m.multiplyVector3(u[e.c].position.clone()),m=e instanceof THREE.Face4?m.multiplyVector3(u[e.d].position.clone()):null,p=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),n=k.dot(p),a.doubleSided||(a.flipSided?n>0:n<0))if(p=p.dot((new THREE.Vector3).sub(h,l))/n,l=l.addSelf(k.multiplyScalar(p)),e instanceof THREE.Face3)c(l,h,j,i)&&(e={distance:this.origin.distanceTo(l),point:l,face:e,object:a},d.push(e));else if(e instanceof THREE.Face4&&(c(l,h,j,
THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,o,m){h=!1;b=f;c=g;d=o;e=m;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points= m)||c(l,j,i,m)))e={distance:this.origin.distanceTo(l),point:l,face:e,object:a},d.push(e);return d}}};
function(f,g,o,m,k,n){h?(h=!1,b=f<o?f<k?f:k:o<k?o:k,c=g<m?g<n?g:n:m<n?m:n,d=f>o?f>k?f:k:o>k?o:k,e=g>m?g>n?g:n:m>n?m:n):(b=f<o?f<k?f<b?f:b:k<b?k:b:o<k?o<b?o:b:k<b?k:b,c=g<m?g<n?g<c?g:c:n<c?n:c:m<n?m<c?m:c:n<c?n:c,d=f>o?f>k?f>d?f:d:k>d?k:d:o>k?o>d?o:d:k>d?k:d,e=g>m?g>n?g>e?g:e:n>e?n:e:m>n?m>e?m:e:n>e?n:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e> THREE.Rectangle=function(){function a(){g=d-b;e=f-c}var b,c,d,f,g,e,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return e};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,m,p){h=!1;b=e;c=g;d=m;f=p;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.instersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]}; function(e,g,m,p,n,l){h?(h=!1,b=e<m?e<n?e:n:m<n?m:n,c=g<p?g<l?g:l:p<l?p:l,d=e>m?e>n?e:n:m>n?m:n,f=g>p?g>l?g:l:p>l?p:l):(b=e<m?e<n?e<b?e:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b,c=g<p?g<l?g<c?g:c:l<c?l:c:p<l?p<c?p:c:l<c?l:c,d=e>m?e>n?e>d?e:d:n>d?n:d:m>n?m>d?m:d:n>d?n:d,f=g>p?g>l?g>f?g:f:l>f?l:f:p>l?p>f?p:f:l>f?l:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,j,i,o,m,k,n,l,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,j||0,i||0,o||1,m||0,k||0,n||0,l||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.instersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]};
THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,j,i,o,m,k,n,l,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=j;this.n32=i;this.n33=o;this.n34=m;this.n41=k;this.n42=n;this.n43=l;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1, THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,g,e,h,j,i,m,p,n,l,k,q){this.set(a||1,b||0,c||0,d||0,f||0,g||1,e||0,h||0,j||0,i||0,m||1,p||0,n||0,l||0,k||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23* THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,e,h,j,i,m,p,n,l,k,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=e;this.n24=h;this.n31=j;this.n32=i;this.n33=m;this.n34=p;this.n41=n;this.n42=l;this.n43=k;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize(); f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*
return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,j=a.n23,i=a.n24,o=a.n31,m=a.n32,k=a.n33,n=a.n34,l=a.n41,q=a.n42,x=a.n43,t=a.n44,H=b.n11,L=b.n12,y=b.n13,C=b.n14,p=b.n21,N=b.n22, d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
r=b.n23,v=b.n24,z=b.n31,R=b.n32,aa=b.n33,$=b.n34;this.n11=c*H+d*p+e*z;this.n12=c*L+d*N+e*R;this.n13=c*y+d*r+e*aa;this.n14=c*C+d*v+e*$+g;this.n21=f*H+h*p+j*z;this.n22=f*L+h*N+j*R;this.n23=f*y+h*r+j*aa;this.n24=f*C+h*v+j*$+i;this.n31=o*H+m*p+k*z;this.n32=o*L+m*N+k*R;this.n33=o*y+m*r+k*aa;this.n34=o*C+m*v+k*$+n;this.n41=l*H+q*p+x*z;this.n42=l*L+q*N+x*R;this.n43=l*y+q*r+x*aa;this.n44=l*C+q*v+x*$+t;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31; return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,e=a.n21,h=a.n22,j=a.n23,i=a.n24,m=a.n31,p=a.n32,n=a.n33,l=a.n34,k=a.n41,q=a.n42,u=a.n43,t=a.n44,G=b.n11,K=b.n12,x=b.n13,B=b.n14,o=b.n21,M=b.n22,
c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a= r=b.n23,v=b.n24,y=b.n31,Q=b.n32,$=b.n33,Z=b.n34;this.n11=c*G+d*o+f*y;this.n12=c*K+d*M+f*Q;this.n13=c*x+d*r+f*$;this.n14=c*B+d*v+f*Z+g;this.n21=e*G+h*o+j*y;this.n22=e*K+h*M+j*Q;this.n23=e*x+h*r+j*$;this.n24=e*B+h*v+j*Z+i;this.n31=m*G+p*o+n*y;this.n32=m*K+p*M+n*Q;this.n33=m*x+p*r+n*$;this.n34=m*B+p*v+n*Z+l;this.n41=k*G+q*o+u*y;this.n42=k*K+q*M+u*Q;this.n43=k*x+q*r+u*$;this.n44=k*B+q*v+u*Z+t;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,j=this.n31,i=this.n32,o=this.n33,m=this.n34,k=this.n41,n=this.n42,l=this.n43,q=this.n44;return d*f*i*k-c*h*i*k-d*g*o*k+b*h*o*k+c*g*m*k-b*f*m*k-d*f*j*n+c*h*j*n+d*e*o*n-a*h*o*n-c*e*m*n+a*f*m*n+d*g*j*l-b*h*j*l-d*e*i*l+a*h*i*l+b*e*m*l-a*g*m*l-c*g*j*q+b*f*j*q+c*e*i*q-a*f*i*q-b*e*o*q+a*g*o*q},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.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,e=this.n23,h=this.n24,j=this.n31,i=this.n32,m=this.n33,p=this.n34,n=this.n41,l=this.n42,k=this.n43,q=this.n44;return d*e*i*n-c*h*i*n-d*g*m*n+b*h*m*n+c*g*p*n-b*e*p*n-d*e*j*l+c*h*j*l+d*f*m*l-a*h*m*l-c*f*p*l+a*e*p*l+d*g*j*k-b*h*j*k-d*f*i*k+a*h*i*k+b*f*p*k-a*g*p*k-c*g*j*q+b*e*j*q+c*f*i*q-a*e*i*q-b*f*m*q+a*g*m*q},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21; this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]= this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a, this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,j=e*g,i=e*f;this.set(j* b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,e=a.y,h=a.z,j=f*g,i=f*e;this.set(j*
g+c,j*f-d*h,j*h+d*f,0,j*f+d*h,i*f+c,i*h-d*g,0,j*h-d*f,i*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3; g+c,j*e-d*h,j*h+d*e,0,j*e+d*h,i*e+c,i*h-d*g,0,j*h-d*e,i*h+d*g,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;return this}, this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),e=a*c,h=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*f;this.n31=-e*g+b*d;this.n32=e*d+b*g;this.n33=a*f;return this},
setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,j=b*f;b*=h;var i=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(i+d);this.n12=j-e;this.n13=b+f;this.n21=j+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14= setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,e=c+c,h=d+d,a=b*g,j=b*e;b*=h;var i=c*e;c*=h;d*=h;g*=f;e*=f;f*=h;this.n11=1-(i+d);this.n12=j-f;this.n13=b+e;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-e;this.n32=c+g;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}}; a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,j=a.n23,i=a.n24,o=a.n31,m=a.n32,k=a.n33,n=a.n34,l=a.n41,q=a.n42,x=a.n43,t=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*n*q-i*k*q+i*m*x-h*n*x-j*m*t+h*k*t;b.n12=g*k*q-e*n*q-g*m*x+d*n*x+e*m*t-d*k*t;b.n13=e*i*q-g*j*q+g*h*x-d*i*x-e*h*t+d*j*t;b.n14=g*j*m-e*i*m-g*h*k+d*i*k+e*h*n-d*j*n;b.n21=i*k*l-j*n*l-i*o*x+f*n*x+j*o*t-f*k*t;b.n22=e*n*l-g*k*l+g*o*x-c*n*x-e*o*t+c*k*t;b.n23=g*j*l-e*i*l-g*f*x+c*i*x+e*f*t-c*j*t;b.n24= THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,e=a.n21,h=a.n22,j=a.n23,i=a.n24,m=a.n31,p=a.n32,n=a.n33,l=a.n34,k=a.n41,q=a.n42,u=a.n43,t=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*l*q-i*n*q+i*p*u-h*l*u-j*p*t+h*n*t;b.n12=g*n*q-f*l*q-g*p*u+d*l*u+f*p*t-d*n*t;b.n13=f*i*q-g*j*q+g*h*u-d*i*u-f*h*t+d*j*t;b.n14=g*j*p-f*i*p-g*h*n+d*i*n+f*h*l-d*j*l;b.n21=i*n*k-j*l*k-i*m*u+e*l*u+j*m*t-e*n*t;b.n22=f*l*k-g*n*k+g*m*u-c*l*u-f*m*t+c*n*t;b.n23=g*j*k-f*i*k-g*e*u+c*i*u+f*e*t-c*j*t;b.n24=
e*i*o-g*j*o+g*f*k-c*i*k-e*f*n+c*j*n;b.n31=h*n*l-i*m*l+i*o*q-f*n*q-h*o*t+f*m*t;b.n32=g*m*l-d*n*l-g*o*q+c*n*q+d*o*t-c*m*t;b.n33=e*i*l-g*h*l+g*f*q-c*i*q-d*f*t+c*h*t;b.n34=g*h*o-d*i*o-g*f*m+c*i*m+d*f*n-c*h*n;b.n41=j*m*l-h*k*l-j*o*q+f*k*q+h*o*x-f*m*x;b.n42=d*k*l-e*m*l+e*o*q-c*k*q-d*o*x+c*m*x;b.n43=e*h*l-d*j*l-e*f*q+c*j*q+d*f*x-c*h*x;b.n44=d*j*o-e*h*o+e*f*m-c*j*m-d*f*k+c*h*k;b.multiplyScalar(1/a.determinant());return b}; f*i*m-g*j*m+g*e*n-c*i*n-f*e*l+c*j*l;b.n31=h*l*k-i*p*k+i*m*q-e*l*q-h*m*t+e*p*t;b.n32=g*p*k-d*l*k-g*m*q+c*l*q+d*m*t-c*p*t;b.n33=f*i*k-g*h*k+g*e*q-c*i*q-d*e*t+c*h*t;b.n34=g*h*m-d*i*m-g*e*p+c*i*p+d*e*l-c*h*l;b.n41=j*p*k-h*n*k-j*m*q+e*n*q+h*m*u-e*p*u;b.n42=d*n*k-f*p*k+f*m*q-c*n*q-d*m*u+c*p*u;b.n43=f*h*k-d*j*k-f*e*q+c*j*q+d*e*u-c*h*u;b.n44=d*j*m-f*h*m+f*e*p-c*j*p-d*e*n+c*h*n;b.multiplyScalar(1/a.determinant());return b};
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*j;c[6]=a*i;c[7]=a*o;c[8]=a*m;return b}; THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,e=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*e+a.n31*i;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*e;c[4]=a*h;c[5]=a*j;c[6]=a*i;c[7]=a*m;c[8]=a*p;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)}; THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var e;e=new THREE.Matrix4;e.n11=2*f/(b-a);e.n12=0;e.n13=(b+a)/(b-a);e.n14=0;e.n21=0;e.n22=2*f/(d-c);e.n23=(d+c)/(d-c);e.n24=0;e.n31=0;e.n32=0;e.n33=-(g+f)/(g-f);e.n34=-2*g*f/(g-f);e.n41=0;e.n42=0;e.n43=-1;e.n44=0;return e};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,j,i;f=new THREE.Matrix4;h=b-a;j=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/j;f.n23=0;f.n24=-((c+d)/j);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var e,h,j,i;e=new THREE.Matrix4;h=b-a;j=c-d;i=g-f;e.n11=2/h;e.n12=0;e.n13=0;e.n14=-((b+a)/h);e.n21=0;e.n22=2/j;e.n23=0;e.n24=-((c+d)/j);e.n31=0;e.n32=0;e.n33=-2/i;e.n34=-((g+f)/i);e.n41=0;e.n42=0;e.n43=0;e.n44=1;return e};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
THREE.Object3D=function(){this.parent=void 0;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.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1; THREE.Object3D=function(){this.parent=void 0;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.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
this.visible=!0;this._vector=new THREE.Vector3;this.name=""}; this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)=== THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
-1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position); -1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);
this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld, this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,
this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)}; this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y* THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),e=a*b,h=d*f;this.w=e*g-h*c;this.x=e*c+h*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this}, d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},
multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,j=this.w,i=j*c+f*e-h*d,o= multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,e=this.y,h=this.z,j=this.w,i=j*c+e*f-h*d,m=
j*d+h*c-g*e,m=j*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=i*j+c*-g+o*-h-m*-f;b.y=o*j+c*-f+m*-g-i*-h;b.z=m*j+c*-h+i*-f-o*-g;return b}}; j*d+h*c-g*f,p=j*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=i*j+c*-g+m*-h-p*-e;b.y=m*j+c*-e+p*-g-i*-h;b.z=p*j+c*-h+i*-e-m*-g;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)}; THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position), THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),
c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,c,d,e,g,f,h=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){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],f=this.vertices[g.c],h.sub(f.position,c.position),j.sub(b.position,c.position),h.crossSelf(j);h.isZero()|| c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,c,d,f,g,e,h=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],e=this.vertices[g.c],h.sub(e.position,c.position),j.sub(b.position,c.position),h.crossSelf(j);h.isZero()||
h.normalize();g.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d= h.normalize();g.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=
this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]), this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),
c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,g,r){h=a.vertices[b].position;j=a.vertices[c].position;i=a.vertices[d].position;o=f[e];m=f[g];k=f[r];n=j.x-h.x;l=i.x-h.x;q=j.y-h.y;x=i.y-h.y;t=j.z-h.z;H=i.z-h.z;L=m.u-o.u;y=k.u-o.u;C=m.v-o.v;p=k.v-o.v;N=1/(L*p-y*C);R.set((p*n-C*l)* c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,f,g,r){h=a.vertices[b].position;j=a.vertices[c].position;i=a.vertices[d].position;m=e[f];p=e[g];n=e[r];l=j.x-h.x;k=i.x-h.x;q=j.y-h.y;u=i.y-h.y;t=j.z-h.z;G=i.z-h.z;K=p.u-m.u;x=n.u-m.u;B=p.v-m.v;o=n.v-m.v;M=1/(K*o-x*B);Q.set((o*l-B*k)*
N,(p*q-C*x)*N,(p*t-C*H)*N);aa.set((L*l-y*n)*N,(L*x-y*q)*N,(L*H-y*t)*N);v[b].addSelf(R);v[c].addSelf(R);v[d].addSelf(R);z[b].addSelf(aa);z[c].addSelf(aa);z[d].addSelf(aa)}var b,c,d,e,g,f,h,j,i,o,m,k,n,l,q,x,t,H,L,y,C,p,N,r,v=[],z=[],R=new THREE.Vector3,aa=new THREE.Vector3,$=new THREE.Vector3,J=new THREE.Vector3,P=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)v[b]=new THREE.Vector3,z[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof M,(o*q-B*u)*M,(o*t-B*G)*M);$.set((K*k-x*l)*M,(K*u-x*q)*M,(K*G-x*t)*M);v[b].addSelf(Q);v[c].addSelf(Q);v[d].addSelf(Q);y[b].addSelf($);y[c].addSelf($);y[d].addSelf($)}var b,c,d,f,g,e,h,j,i,m,p,n,l,k,q,u,t,G,K,x,B,o,M,r,v=[],y=[],Q=new THREE.Vector3,$=new THREE.Vector3,Z=new THREE.Vector3,I=new THREE.Vector3,O=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)v[b]=new THREE.Vector3,y[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],e=this.faceVertexUvs[0][b],g instanceof
THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):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 S=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)P.copy(g.vertexNormals[d]),e=g[S[d]],r=v[e],$.copy(r),$.subSelf(P.multiplyScalar(P.dot(r))).normalize(),J.cross(g.vertexNormals[d],r),e=J.dot(z[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a; THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):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 R=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)O.copy(g.vertexNormals[d]),f=g[R[d]],r=v[f],Z.copy(r),Z.subSelf(O.multiplyScalar(O.dot(r))).normalize(),I.cross(g.vertexNormals[d],r),f=I.dot(y[f]),f=f<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;
if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y; if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;
else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},computeEdgeFaces:function(){function a(a,b){return Math.min(a, else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},computeEdgeFaces:function(){function a(a,b){return Math.min(a,
b)+"_"+Math.max(a,b)}function b(a,b,c){a[b]===void 0?(a[b]={set:{},array:[]},a[b].set[c]=1,a[b].array.push(c)):a[b].set[c]===void 0&&(a[b].set[c]=1,a[b].array.push(c))}var c,d,e,g,f,h={};c=0;for(d=this.faces.length;c<d;c++)f=this.faces[c],f instanceof THREE.Face3?(e=a(f.a,f.b),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.a,f.c),b(h,e,c)):f instanceof THREE.Face4&&(e=a(f.b,f.d),b(h,e,c),e=a(f.a,f.b),b(h,e,c),e=a(f.a,f.d),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.c,f.d),b(h,e,c));c=0;for(d=this.edges.length;c<d;c++){f= b)+"_"+Math.max(a,b)}function b(a,b,c){a[b]===void 0?(a[b]={set:{},array:[]},a[b].set[c]=1,a[b].array.push(c)):a[b].set[c]===void 0&&(a[b].set[c]=1,a[b].array.push(c))}var c,d,f,g,e,h={};c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e instanceof THREE.Face3?(f=a(e.a,e.b),b(h,f,c),f=a(e.b,e.c),b(h,f,c),f=a(e.a,e.c),b(h,f,c)):e instanceof THREE.Face4&&(f=a(e.b,e.d),b(h,f,c),f=a(e.a,e.b),b(h,f,c),f=a(e.a,e.d),b(h,f,c),f=a(e.b,e.c),b(h,f,c),f=a(e.c,e.d),b(h,f,c));c=0;for(d=this.edges.length;c<d;c++){e=
this.edges[c];e=f.vertexIndices[0];g=f.vertexIndices[1];f.faceIndices=h[a(e,g)].array;for(e=0;e<f.faceIndices.length;e++)g=f.faceIndices[e],f.faces.push(this.faces[g])}}};THREE.GeometryIdCounter=0;THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D; this.edges[c];f=e.vertexIndices[0];g=e.vertexIndices[1];e.faceIndices=h[a(f,g)].array;for(f=0;f<e.faceIndices.length;f++)g=e.faceIndices[f],e.faces.push(this.faces[g])}}};THREE.GeometryIdCounter=0;THREE.Camera=function(a,b,c,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)}; THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),b=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate= THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),b=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light; !1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
...@@ -83,17 +84,17 @@ THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.sha ...@@ -83,17 +84,17 @@ THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.sha
THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){}; THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial; THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial; THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;
THREE.Texture=function(a,b,c,d,e,g){this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=g!==void 0?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.Texture=function(a,b,c,d,f,g){this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;
THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18; THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;
THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D; THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
THREE.Line.prototype.constructor=THREE.Line; THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.overdraw=this.doubleSided=this.flipSided=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]= THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.overdraw=this.doubleSided=this.flipSided=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0}; c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
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,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!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,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix, THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0}; b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isPlaying=this.isAddedToDOM=this.isLoaded=!1;this.duration=-1;this.radius=b!==void 0?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==void 0?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==void 0?d:!0;this.sources=a instanceof Array?a:[a];for(var e,c=this.sources.length,a=0;a<c;a++)if(b=this.sources[a],b.toLowerCase(),b.indexOf(".mp3")!==-1?e="audio/mpeg": THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isPlaying=this.isAddedToDOM=this.isLoaded=!1;this.duration=-1;this.radius=b!==void 0?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==void 0?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==void 0?d:!0;this.sources=a instanceof Array?a:[a];for(var f,c=this.sources.length,a=0;a<c;a++)if(b=this.sources[a],b.toLowerCase(),b.indexOf(".mp3")!==-1?f="audio/mpeg":
b.indexOf(".ogg")!==-1?e="audio/ogg":b.indexOf(".wav")!==-1&&(e="audio/wav"),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; b.indexOf(".ogg")!==-1?f="audio/ogg":b.indexOf(".wav")!==-1&&(f="audio/wav"),this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);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;
THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded)this.removeEventListener("canplay",this.onLoad,!0),a.isLoaded=!0,a.duration=this.duration,a.isPlaying&&a.play()};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded&&(this.domElement.play(),a))this.domElement.currentTime=a%this.duration};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()}; THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded)this.removeEventListener("canplay",this.onLoad,!0),a.isLoaded=!0,a.duration=this.duration,a.isPlaying&&a.play()};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded&&(this.domElement.play(),a))this.domElement.currentTime=a%this.duration};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0}; THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
THREE.Sound.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(this.matrix.setPosition(this.position),b=!0);if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;for(var d=this.children.length,a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}; THREE.Sound.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(this.matrix.setPosition(this.position),b=!0);if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;for(var d=this.children.length,a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
...@@ -101,43 +102,43 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c ...@@ -101,43 +102,43 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])}; THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])}; THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild; THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
THREE.Projector=function(){function a(){var a=j[h]=j[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,j=[],i,o,m=[],k,n=[],l,q,x=[],t,H,L=[],y=new THREE.Vector4,C=new THREE.Vector4, THREE.Projector=function(){function a(){var a=j[h]=j[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,g=[],e,h,j=[],i,m,p=[],n,l=[],k,q,u=[],t,G,K=[],x=new THREE.Vector4,B=new THREE.Vector4,
p=new THREE.Matrix4,N=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],v=new THREE.Vector4,z=new THREE.Vector4;this.projectVector=function(a,b){p.multiply(b.projectionMatrix,b.matrixWorldInverse);p.multiplyVector3(a);return a};this.unprojectVector=function(a,b){p.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));p.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var c=[],h,l,j;e=0;l= o=new THREE.Matrix4,M=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],v=new THREE.Vector4,y=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.projectObjects=function(a,c,e){var c=[],h,k,l;f=0;k=
a.objects;a=0;for(h=l.length;a<h;a++){j=l[a];var i;if(!(i=!j.visible))if(i=j instanceof THREE.Mesh){a:{i=void 0;for(var k=j.matrixWorld,n=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),m=0;m<6;m++)if(i=r[m].x*k.n14+r[m].y*k.n24+r[m].z*k.n34+r[m].w,i<=n){i=!1;break a}i=!0}i=!i}if(!i)i=g[e]=g[e]||new THREE.RenderableObject,e++,d=i,y.copy(j.position),p.multiplyVector3(y),d.object=j,d.z=y.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var J=[], a.objects;a=0;for(h=k.length;a<h;a++){l=k[a];var i;if(!(i=!l.visible))if(i=l instanceof THREE.Mesh){a:{i=void 0;for(var j=l.matrixWorld,n=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),m=0;m<6;m++)if(i=r[m].x*j.n14+r[m].y*j.n24+r[m].z*j.n34+r[m].w,i<=n){i=!1;break a}i=!0}i=!i}if(!i)i=g[f]=g[f]||new THREE.RenderableObject,f++,d=i,x.copy(l.position),o.multiplyVector3(x),d.object=l,d.z=x.z,c.push(d)}e&&c.sort(b);return c};this.projectScene=function(d,f,g){var I=[],
P=e.near,S=e.far,M,E,A,O,w,K,I,T,y,s,F,D,G,U,X,da,Y;H=q=k=o=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);p.multiply(e.projectionMatrix,e.matrixWorldInverse);r[0].set(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);r[1].set(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);r[2].set(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);r[3].set(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);r[4].set(p.n41-p.n31,p.n42-p.n32,p.n43-p.n33,p.n44-p.n34);r[5].set(p.n41+p.n31,p.n42+p.n32,p.n43+ O=f.near,R=f.far,L,D,z,N,w,J,H,S,x,s,E,C,F,T,W,ca,X;G=q=n=m=0;f.matrixAutoUpdate&&f.update(void 0,!0);d.update(void 0,!1,f);o.multiply(f.projectionMatrix,f.matrixWorldInverse);r[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);r[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);r[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);r[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);r[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);r[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+
p.n33,p.n44+p.n34);for(M=0;M<6;M++)y=r[M],y.divideScalar(Math.sqrt(y.x*y.x+y.y*y.y+y.z*y.z));y=this.projectObjects(d,e,!0);d=0;for(M=y.length;d<M;d++)if(s=y[d].object,s.visible)if(F=s.matrixWorld,D=s.matrixRotationWorld,G=s.materials,U=s.overdraw,h=0,s instanceof THREE.Mesh){X=s.geometry;O=X.vertices;da=X.faces;X=X.faceVertexUvs;E=0;for(A=O.length;E<A;E++)f=a(),f.positionWorld.copy(O[E].position),F.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),p.multiplyVector4(f.positionScreen), o.n33,o.n44+o.n34);for(L=0;L<6;L++)x=r[L],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,f,!0);d=0;for(L=x.length;d<L;d++)if(s=x[d].object,s.visible)if(E=s.matrixWorld,C=s.matrixRotationWorld,F=s.materials,T=s.overdraw,h=0,s instanceof THREE.Mesh){W=s.geometry;N=W.vertices;ca=W.faces;W=W.faceVertexUvs;D=0;for(z=N.length;D<z;D++)e=a(),e.positionWorld.copy(N[D].position),E.multiplyVector3(e.positionWorld),e.positionScreen.copy(e.positionWorld),o.multiplyVector4(e.positionScreen),
f.positionScreen.x/=f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>P&&f.positionScreen.z<S;O=0;for(E=da.length;O<E;O++){A=da[O];if(A instanceof THREE.Face3)if(w=j[A.a],K=j[A.b],I=j[A.c],w.visible&&K.visible&&I.visible&&(s.doubleSided||s.flipSided!=(I.positionScreen.x-w.positionScreen.x)*(K.positionScreen.y-w.positionScreen.y)-(I.positionScreen.y-w.positionScreen.y)*(K.positionScreen.x-w.positionScreen.x)<0))T=m[o]=m[o]||new THREE.RenderableFace3,o++,i=T,i.v1.copy(w), e.positionScreen.x/=e.positionScreen.w,e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>O&&e.positionScreen.z<R;N=0;for(D=ca.length;N<D;N++){z=ca[N];if(z instanceof THREE.Face3)if(w=j[z.a],J=j[z.b],H=j[z.c],w.visible&&J.visible&&H.visible&&(s.doubleSided||s.flipSided!=(H.positionScreen.x-w.positionScreen.x)*(J.positionScreen.y-w.positionScreen.y)-(H.positionScreen.y-w.positionScreen.y)*(J.positionScreen.x-w.positionScreen.x)<0))S=p[m]=p[m]||new THREE.RenderableFace3,m++,i=S,i.v1.copy(w),
i.v2.copy(K),i.v3.copy(I);else continue;else if(A instanceof THREE.Face4)if(w=j[A.a],K=j[A.b],I=j[A.c],T=j[A.d],w.visible&&K.visible&&I.visible&&T.visible&&(s.doubleSided||s.flipSided!=((T.positionScreen.x-w.positionScreen.x)*(K.positionScreen.y-w.positionScreen.y)-(T.positionScreen.y-w.positionScreen.y)*(K.positionScreen.x-w.positionScreen.x)<0||(K.positionScreen.x-I.positionScreen.x)*(T.positionScreen.y-I.positionScreen.y)-(K.positionScreen.y-I.positionScreen.y)*(T.positionScreen.x-I.positionScreen.x)< i.v2.copy(J),i.v3.copy(H);else continue;else if(z instanceof THREE.Face4)if(w=j[z.a],J=j[z.b],H=j[z.c],S=j[z.d],w.visible&&J.visible&&H.visible&&S.visible&&(s.doubleSided||s.flipSided!=((S.positionScreen.x-w.positionScreen.x)*(J.positionScreen.y-w.positionScreen.y)-(S.positionScreen.y-w.positionScreen.y)*(J.positionScreen.x-w.positionScreen.x)<0||(J.positionScreen.x-H.positionScreen.x)*(S.positionScreen.y-H.positionScreen.y)-(J.positionScreen.y-H.positionScreen.y)*(S.positionScreen.x-H.positionScreen.x)<
0)))Y=n[k]=n[k]||new THREE.RenderableFace4,k++,i=Y,i.v1.copy(w),i.v2.copy(K),i.v3.copy(I),i.v4.copy(T);else continue;i.normalWorld.copy(A.normal);D.multiplyVector3(i.normalWorld);i.centroidWorld.copy(A.centroid);F.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);p.multiplyVector3(i.centroidScreen);I=A.vertexNormals;w=0;for(K=I.length;w<K;w++)T=i.vertexNormalsWorld[w],T.copy(I[w]),D.multiplyVector3(T);w=0;for(K=X.length;w<K;w++)if(Y=X[w][O]){I=0;for(T=Y.length;I<T;I++)i.uvs[w][I]= 0)))X=l[n]=l[n]||new THREE.RenderableFace4,n++,i=X,i.v1.copy(w),i.v2.copy(J),i.v3.copy(H),i.v4.copy(S);else continue;i.normalWorld.copy(z.normal);C.multiplyVector3(i.normalWorld);i.centroidWorld.copy(z.centroid);E.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);H=z.vertexNormals;w=0;for(J=H.length;w<J;w++)S=i.vertexNormalsWorld[w],S.copy(H[w]),C.multiplyVector3(S);w=0;for(J=W.length;w<J;w++)if(X=W[w][N]){H=0;for(S=X.length;H<S;H++)i.uvs[w][H]=
Y[I]}i.meshMaterials=G;i.faceMaterials=A.materials;i.overdraw=U;i.z=i.centroidScreen.z;J.push(i)}}else if(s instanceof THREE.Line){N.multiply(p,F);O=s.geometry.vertices;w=a();w.positionScreen.copy(O[0].position);N.multiplyVector4(w.positionScreen);E=1;for(A=O.length;E<A;E++)if(w=a(),w.positionScreen.copy(O[E].position),N.multiplyVector4(w.positionScreen),K=j[h-2],v.copy(w.positionScreen),z.copy(K.positionScreen),c(v,z))v.multiplyScalar(1/v.w),z.multiplyScalar(1/z.w),F=x[q]=x[q]||new THREE.RenderableLine, X[H]}i.meshMaterials=F;i.faceMaterials=z.materials;i.overdraw=T;i.z=i.centroidScreen.z;I.push(i)}}else if(s instanceof THREE.Line){M.multiply(o,E);N=s.geometry.vertices;w=a();w.positionScreen.copy(N[0].position);M.multiplyVector4(w.positionScreen);D=1;for(z=N.length;D<z;D++)if(w=a(),w.positionScreen.copy(N[D].position),M.multiplyVector4(w.positionScreen),J=j[h-2],v.copy(w.positionScreen),y.copy(J.positionScreen),c(v,y))v.multiplyScalar(1/v.w),y.multiplyScalar(1/y.w),E=u[q]=u[q]||new THREE.RenderableLine,
q++,l=F,l.v1.positionScreen.copy(v),l.v2.positionScreen.copy(z),l.z=Math.max(v.z,z.z),l.materials=s.materials,J.push(l)}else if(s instanceof THREE.Particle&&(C.set(s.matrixWorld.n14,s.matrixWorld.n24,s.matrixWorld.n34,1),p.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))F=L[H]=L[H]||new THREE.RenderableParticle,H++,t=F,t.x=C.x/C.w,t.y=C.y/C.w,t.z=C.z,t.rotation=s.rotation.z,t.scale.x=s.scale.x*Math.abs(t.x-(C.x+e.projectionMatrix.n11)/(C.w+e.projectionMatrix.n14)),t.scale.y=s.scale.y*Math.abs(t.y-(C.y+ q++,k=E,k.v1.positionScreen.copy(v),k.v2.positionScreen.copy(y),k.z=Math.max(v.z,y.z),k.materials=s.materials,I.push(k)}else if(s instanceof THREE.Particle&&(B.set(s.matrixWorld.n14,s.matrixWorld.n24,s.matrixWorld.n34,1),o.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))E=K[G]=K[G]||new THREE.RenderableParticle,G++,t=E,t.x=B.x/B.w,t.y=B.y/B.w,t.z=B.z,t.rotation=s.rotation.z,t.scale.x=s.scale.x*Math.abs(t.x-(B.x+f.projectionMatrix.n11)/(B.w+f.projectionMatrix.n14)),t.scale.y=s.scale.y*Math.abs(t.y-(B.y+
e.projectionMatrix.n22)/(C.w+e.projectionMatrix.n24)),t.materials=s.materials,J.push(t);g&&J.sort(b);return J}}; f.projectionMatrix.n22)/(B.w+f.projectionMatrix.n24)),t.materials=s.materials,I.push(t);g&&I.sort(b);return I}};
THREE.CanvasRenderer=function(a){function b(a){if(t!=a)l.globalAlpha=t=a}function c(a){if(H!=a){switch(a){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}H=a}}function d(a){if(L!=a.hex)L=a.hex,l.strokeStyle="#"+g(L.toString(16))}function e(a){if(y!=a.hex)y=a.hex,l.fillStyle="#"+g(y.toString(16))}function g(a){for(;a.length<6;)a="0"+a;return a} THREE.CanvasRenderer=function(a){function b(a){if(t!=a)k.globalAlpha=t=a}function c(a){if(G!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}G=a}}function d(a){if(K!=a.hex)K=a.hex,k.strokeStyle="#"+g(K.toString(16))}function f(a){if(x!=a.hex)x=a.hex,k.fillStyle="#"+g(x.toString(16))}function g(a){for(;a.length<6;)a="0"+a;return a}
var f=this,h=null,j=new THREE.Projector,a=a||{},i=a.canvas!==void 0?a.canvas:document.createElement("canvas"),o,m,k,n,l=i.getContext("2d"),q=new THREE.Color(0),x=0,t=1,H=0,L=null,y=null,C=null,p=null,N=null,r,v,z,R,aa=new THREE.RenderableVertex,$=new THREE.RenderableVertex,J,P,S,M,E,A,O,w,K,I,T,pa,s=new THREE.Color(0),F=new THREE.Color(0),D=new THREE.Color(0),G=new THREE.Color(0),U=new THREE.Color(0),X,da,Y,ba,Ba,Ca,Da,Ea,Fa,Ga,la=new THREE.Rectangle,ea=new THREE.Rectangle,W=new THREE.Rectangle,za= var e=this,h=null,j=new THREE.Projector,a=a||{},i=a.canvas!==void 0?a.canvas:document.createElement("canvas"),m,p,n,l,k=i.getContext("2d"),q=new THREE.Color(0),u=0,t=1,G=0,K=null,x=null,B=null,o=null,M=null,r,v,y,Q,$=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,I,O,R,L,D,z,N,w,J,H,S,oa,s=new THREE.Color(0),E=new THREE.Color(0),C=new THREE.Color(0),F=new THREE.Color(0),T=new THREE.Color(0),W,ca,X,aa,Ba,Ca,Da,Ea,Fa,Ga,ka=new THREE.Rectangle,da=new THREE.Rectangle,V=new THREE.Rectangle,ya=
!1,ca=new THREE.Color,Z=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,Q=new THREE.Vector3,qa,ra,Aa,fa,sa,va,a=16;qa=document.createElement("canvas");qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);Aa=ra.getImageData(0,0,2,2);fa=Aa.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0, !1,ba=new THREE.Color,Y=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,P=new THREE.Vector3,pa,qa,za,ea,ra,ua,a=16;pa=document.createElement("canvas");pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);za=qa.getImageData(0,0,2,2);ea=za.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
faces:0};this.setSize=function(a,b){o=a;m=b;k=o/2;n=m/2;i.width=o;i.height=m;la.set(-k,-n,k,n);t=1;H=0;N=p=C=y=L=null};this.setClearColor=function(a,b){q=a;x=b};this.setClearColorHex=function(a,b){q.setHex(a);x=b};this.clear=function(){l.setTransform(1,0,0,-1,k,n);if(!ea.isEmpty())ea.inflate(1),ea.minSelf(la),q.hex==0&&x==0?l.clearRect(ea.getX(),ea.getY(),ea.getWidth(),ea.getHeight()):(c(THREE.NormalBlending),b(1),l.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b* faces:0};this.setSize=function(a,b){m=a;p=b;n=m/2;l=p/2;i.width=m;i.height=p;ka.set(-n,-l,n,l);t=1;G=0;M=o=B=x=K=null};this.setClearColor=function(a,b){q=a;u=b};this.setClearColorHex=function(a,b){q.setHex(a);u=b};this.clear=function(){k.setTransform(1,0,0,-1,n,l);if(!da.isEmpty())da.inflate(1),da.minSelf(ka),q.hex==0&&u==0?k.clearRect(da.getX(),da.getY(),da.getWidth(),da.getHeight()):(c(THREE.NormalBlending),b(1),k.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*
255)+","+x+")",l.fillRect(ea.getX(),ea.getY(),ea.getWidth(),ea.getHeight())),ea.empty()};this.render=function(a,g){function i(a){var b,c,d,e=a.lights;Z.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);a=0;for(b=e.length;a<b;a++)c=e[a],d=c.color,c instanceof THREE.AmbientLight?(Z.r+=d.r,Z.g+=d.g,Z.b+=d.b):c instanceof THREE.DirectionalLight?(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b):c instanceof THREE.PointLight&&(ua.r+=d.r,ua.g+=d.g,ua.b+=d.b)}function m(a,b,c,d){var e,f,g,h,l=a.lights,a=0;for(e=l.length;a<e;a++)f= 255)+","+u+")",k.fillRect(da.getX(),da.getY(),da.getWidth(),da.getHeight())),da.empty()};this.render=function(a,g){function i(a){var b,c,d,f=a.lights;Y.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);a=0;for(b=f.length;a<b;a++)c=f[a],d=c.color,c instanceof THREE.AmbientLight?(Y.r+=d.r,Y.g+=d.g,Y.b+=d.b):c instanceof THREE.DirectionalLight?(sa.r+=d.r,sa.g+=d.g,sa.b+=d.b):c instanceof THREE.PointLight&&(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b)}function m(a,b,c,d){var f,e,g,h,k=a.lights,a=0;for(f=k.length;a<f;a++)e=
l[a],g=f.color,f instanceof THREE.DirectionalLight?(h=c.dot(f.position),h<=0||(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):f instanceof THREE.PointLight&&(h=c.dot(Q.sub(f.position,b).normalize()),h<=0||(h*=f.distance==0?1:1-Math.min(b.distanceTo(f.position)/f.distance,1),h!=0&&(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function o(a,f,g){b(g.opacity);c(g.blending);var h,i,j,m,u,p;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)m=g.map.image,u=m.width>>1,p=m.height>>1,g=f.scale.x* k[a],g=e.color,e instanceof THREE.DirectionalLight?(h=c.dot(e.position),h<=0||(h*=e.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):e instanceof THREE.PointLight&&(h=c.dot(P.sub(e.position,b).normalize()),h<=0||(h*=e.distance==0?1:1-Math.min(b.distanceTo(e.position)/e.distance,1),h!=0&&(h*=e.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function p(a,e,g){b(g.opacity);c(g.blending);var h,i,m,j,Aa,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)j=g.map.image,Aa=j.width>>1,o=j.height>>1,g=e.scale.x*
k,j=f.scale.y*n,h=g*u,i=j*p,W.set(a.x-h,a.y-i,a.x+h,a.y+i),la.instersects(W)&&(l.save(),l.translate(a.x,a.y),l.rotate(-f.rotation),l.scale(g,-j),l.translate(-u,-p),l.drawImage(m,0,0),l.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*k,i=f.scale.y*n,W.set(a.x-h,a.y-i,a.x+h,a.y+i),la.instersects(W)&&(d(g.color),e(g.color),l.save(),l.translate(a.x,a.y),l.rotate(-f.rotation),l.scale(h,i),g.program(l),l.restore()))}function q(a,e,f,g){b(g.opacity);c(g.blending);l.beginPath();l.moveTo(a.positionScreen.x, n,m=e.scale.y*l,h=g*Aa,i=m*o,V.set(a.x-h,a.y-i,a.x+h,a.y+i),ka.instersects(V)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-m),k.translate(-Aa,-o),k.drawImage(j,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*n,i=e.scale.y*l,V.set(a.x-h,a.y-i,a.x+h,a.y+i),ka.instersects(V)&&(d(g.color),f(g.color),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,i),g.program(k),k.restore()))}function q(a,e,f,g){b(g.opacity);c(g.blending);k.beginPath();
a.positionScreen.y);l.lineTo(e.positionScreen.x,e.positionScreen.y);l.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(C!=a)l.lineWidth=C=a;a=g.linecap;if(p!=a)l.lineCap=p=a;a=g.linejoin;if(N!=a)l.lineJoin=N=a;d(g.color);l.stroke();W.inflate(g.linewidth*2)}}function t(a,d,e,h,l,i,j,u,k){f.data.vertices+=3;f.data.faces++;b(u.opacity);c(u.blending);J=a.positionScreen.x;P=a.positionScreen.y;S=d.positionScreen.x;M=d.positionScreen.y;E=e.positionScreen.x;A=e.positionScreen.y;y(J,P, k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)k.lineWidth=B=a;a=g.linecap;if(o!=a)k.lineCap=o=a;a=g.linejoin;if(M!=a)k.lineJoin=M=a;d(g.color);k.stroke();V.inflate(g.linewidth*2)}}function t(a,d,f,h,k,i,l,j,n){e.data.vertices+=3;e.data.faces++;b(j.opacity);c(j.blending);I=a.positionScreen.x;O=a.positionScreen.y;R=d.positionScreen.x;L=d.positionScreen.y;D=f.positionScreen.x;
S,M,E,A);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(ba=j.uvs[0],ha(J,P,S,M,E,A,u.map.image,ba[h].u,ba[h].v,ba[l].u,ba[l].v,ba[i].u,ba[i].v));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=g.matrixWorldInverse,Q.copy(j.vertexNormalsWorld[0]),Ba=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ca=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(j.vertexNormalsWorld[1]),Da=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ea=-(Q.x*a.n21+ z=f.positionScreen.y;x(I,O,R,L,D,z);if(j instanceof THREE.MeshBasicMaterial)if(j.map)j.map.mapping instanceof THREE.UVMapping&&(aa=l.uvs[0],ga(I,O,R,L,D,z,j.map.image,aa[h].u,aa[h].v,aa[k].u,aa[k].v,aa[i].u,aa[i].v));else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=g.matrixWorldInverse,P.copy(l.vertexNormalsWorld[0]),Ba=(P.x*a.n11+P.y*a.n12+P.z*a.n13)*0.5+0.5,Ca=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,P.copy(l.vertexNormalsWorld[1]),Da=(P.x*a.n11+P.y*a.n12+P.z*
Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(j.vertexNormalsWorld[2]),Fa=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ga=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,ha(J,P,S,M,E,A,u.envMap.image,Ba,Ca,Da,Ea,Fa,Ga)}else u.wireframe?H(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):ia(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&(ba=j.uvs[0],ha(J,P,S,M,E,A,u.map.image,ba[h].u,ba[h].v,ba[l].u,ba[l].v,ba[i].u,ba[i].v)),c(THREE.SubtractiveBlending)), a.n13)*0.5+0.5,Ea=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,P.copy(l.vertexNormalsWorld[2]),Fa=(P.x*a.n11+P.y*a.n12+P.z*a.n13)*0.5+0.5,Ga=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,ga(I,O,R,L,D,z,j.envMap.image,Ba,Ca,Da,Ea,Fa,Ga)}else j.wireframe?G(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshLambertMaterial)j.map&&!j.wireframe&&(j.map.mapping instanceof THREE.UVMapping&&(aa=l.uvs[0],ga(I,O,R,L,D,z,j.map.image,aa[h].u,aa[h].v,aa[k].u,
za?!u.wireframe&&u.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3?(F.r=D.r=G.r=Z.r,F.g=D.g=G.g=Z.g,F.b=D.b=G.b=Z.b,m(k,j.v1.positionWorld,j.vertexNormalsWorld[0],F),m(k,j.v2.positionWorld,j.vertexNormalsWorld[1],D),m(k,j.v3.positionWorld,j.vertexNormalsWorld[2],G),U.r=(D.r+G.r)*0.5,U.g=(D.g+G.g)*0.5,U.b=(D.b+G.b)*0.5,Y=wa(F,D,G,U),ha(J,P,S,M,E,A,Y,0,0,1,0,0,1)):(ca.r=Z.r,ca.g=Z.g,ca.b=Z.b,m(k,j.centroidWorld,j.normalWorld,ca),s.r=Math.max(0,Math.min(u.color.r*ca.r,1)),s.g=Math.max(0, aa[k].v,aa[i].u,aa[i].v)),c(THREE.SubtractiveBlending)),ya?!j.wireframe&&j.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==3?(E.r=C.r=F.r=Y.r,E.g=C.g=F.g=Y.g,E.b=C.b=F.b=Y.b,m(n,l.v1.positionWorld,l.vertexNormalsWorld[0],E),m(n,l.v2.positionWorld,l.vertexNormalsWorld[1],C),m(n,l.v3.positionWorld,l.vertexNormalsWorld[2],F),T.r=(C.r+F.r)*0.5,T.g=(C.g+F.g)*0.5,T.b=(C.b+F.b)*0.5,X=va(E,C,F,T),ga(I,O,R,L,D,z,X,0,0,1,0,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,l.centroidWorld,l.normalWorld,ba),s.r=
Math.min(u.color.g*ca.g,1)),s.b=Math.max(0,Math.min(u.color.b*ca.b,1)),s.updateHex(),u.wireframe?H(s,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):ia(s)):u.wireframe?H(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):ia(u.color);else if(u instanceof THREE.MeshDepthMaterial)X=g.near,da=g.far,F.r=F.g=F.b=1-ma(a.positionScreen.z,X,da),D.r=D.g=D.b=1-ma(d.positionScreen.z,X,da),G.r=G.g=G.b=1-ma(e.positionScreen.z,X,da),U.r=(D.r+G.r)*0.5,U.g=(D.g+G.g)*0.5,U.b=(D.b+G.b)* Math.max(0,Math.min(j.color.r*ba.r,1)),s.g=Math.max(0,Math.min(j.color.g*ba.g,1)),s.b=Math.max(0,Math.min(j.color.b*ba.b,1)),s.updateHex(),j.wireframe?G(s,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(s)):j.wireframe?G(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshDepthMaterial)W=g.near,ca=g.far,E.r=E.g=E.b=1-la(a.positionScreen.z,W,ca),C.r=C.g=C.b=1-la(d.positionScreen.z,W,ca),F.r=F.g=F.b=1-la(f.positionScreen.z,
0.5,Y=wa(F,D,G,U),ha(J,P,S,M,E,A,Y,0,0,1,0,0,1);else if(u instanceof THREE.MeshNormalMaterial)s.r=na(j.normalWorld.x),s.g=na(j.normalWorld.y),s.b=na(j.normalWorld.z),s.updateHex(),u.wireframe?H(s,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):ia(s)}function x(a,d,e,h,j,l,i,k,n){f.data.vertices+=4;f.data.faces++;b(k.opacity);c(k.blending);if(k.map||k.envMap)t(a,d,h,0,1,3,i,k,n),t(j,e,l,1,2,3,i,k,n);else if(J=a.positionScreen.x,P=a.positionScreen.y,S=d.positionScreen.x,M=d.positionScreen.y, W,ca),T.r=(C.r+F.r)*0.5,T.g=(C.g+F.g)*0.5,T.b=(C.b+F.b)*0.5,X=va(E,C,F,T),ga(I,O,R,L,D,z,X,0,0,1,0,0,1);else if(j instanceof THREE.MeshNormalMaterial)s.r=ma(l.normalWorld.x),s.g=ma(l.normalWorld.y),s.b=ma(l.normalWorld.z),s.updateHex(),j.wireframe?G(s,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(s)}function u(a,d,f,h,j,l,k,i,n){e.data.vertices+=4;e.data.faces++;b(i.opacity);c(i.blending);if(i.map||i.envMap)t(a,d,h,0,1,3,k,i,n),t(j,f,l,1,2,3,k,i,n);else if(I=a.positionScreen.x,O=
E=e.positionScreen.x,A=e.positionScreen.y,O=h.positionScreen.x,w=h.positionScreen.y,K=j.positionScreen.x,I=j.positionScreen.y,T=l.positionScreen.x,pa=l.positionScreen.y,k instanceof THREE.MeshBasicMaterial)L(J,P,S,M,E,A,O,w),k.wireframe?H(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ia(k.color);else if(k instanceof THREE.MeshLambertMaterial)za?!k.wireframe&&k.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(F.r=D.r=G.r=U.r=Z.r,F.g=D.g=G.g=U.g=Z.g,F.b=D.b=G.b=U.b= a.positionScreen.y,R=d.positionScreen.x,L=d.positionScreen.y,D=f.positionScreen.x,z=f.positionScreen.y,N=h.positionScreen.x,w=h.positionScreen.y,J=j.positionScreen.x,H=j.positionScreen.y,S=l.positionScreen.x,oa=l.positionScreen.y,i instanceof THREE.MeshBasicMaterial)K(I,O,R,L,D,z,N,w),i.wireframe?G(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color);else if(i instanceof THREE.MeshLambertMaterial)ya?!i.wireframe&&i.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==
Z.b,m(n,i.v1.positionWorld,i.vertexNormalsWorld[0],F),m(n,i.v2.positionWorld,i.vertexNormalsWorld[1],D),m(n,i.v4.positionWorld,i.vertexNormalsWorld[3],G),m(n,i.v3.positionWorld,i.vertexNormalsWorld[2],U),Y=wa(F,D,G,U),y(J,P,S,M,O,w),ha(J,P,S,M,O,w,Y,0,0,1,0,0,1),y(K,I,E,A,T,pa),ha(K,I,E,A,T,pa,Y,1,0,1,1,0,1)):(ca.r=Z.r,ca.g=Z.g,ca.b=Z.b,m(n,i.centroidWorld,i.normalWorld,ca),s.r=Math.max(0,Math.min(k.color.r*ca.r,1)),s.g=Math.max(0,Math.min(k.color.g*ca.g,1)),s.b=Math.max(0,Math.min(k.color.b*ca.b, 4?(E.r=C.r=F.r=T.r=Y.r,E.g=C.g=F.g=T.g=Y.g,E.b=C.b=F.b=T.b=Y.b,m(n,k.v1.positionWorld,k.vertexNormalsWorld[0],E),m(n,k.v2.positionWorld,k.vertexNormalsWorld[1],C),m(n,k.v4.positionWorld,k.vertexNormalsWorld[3],F),m(n,k.v3.positionWorld,k.vertexNormalsWorld[2],T),X=va(E,C,F,T),x(I,O,R,L,N,w),ga(I,O,R,L,N,w,X,0,0,1,0,0,1),x(J,H,D,z,S,oa),ga(J,H,D,z,S,oa,X,1,0,1,1,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,k.centroidWorld,k.normalWorld,ba),s.r=Math.max(0,Math.min(i.color.r*ba.r,1)),s.g=Math.max(0,Math.min(i.color.g*
1)),s.updateHex(),L(J,P,S,M,E,A,O,w),k.wireframe?H(s,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ia(s)):(L(J,P,S,M,E,A,O,w),k.wireframe?H(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ia(k.color));else if(k instanceof THREE.MeshNormalMaterial)s.r=na(i.normalWorld.x),s.g=na(i.normalWorld.y),s.b=na(i.normalWorld.z),s.updateHex(),L(J,P,S,M,E,A,O,w),k.wireframe?H(s,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ia(s);else if(k instanceof THREE.MeshDepthMaterial)X= ba.g,1)),s.b=Math.max(0,Math.min(i.color.b*ba.b,1)),s.updateHex(),K(I,O,R,L,D,z,N,w),i.wireframe?G(s,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(s)):(K(I,O,R,L,D,z,N,w),i.wireframe?G(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color));else if(i instanceof THREE.MeshNormalMaterial)s.r=ma(k.normalWorld.x),s.g=ma(k.normalWorld.y),s.b=ma(k.normalWorld.z),s.updateHex(),K(I,O,R,L,D,z,N,w),i.wireframe?G(s,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):
g.near,da=g.far,F.r=F.g=F.b=1-ma(a.positionScreen.z,X,da),D.r=D.g=D.b=1-ma(d.positionScreen.z,X,da),G.r=G.g=G.b=1-ma(h.positionScreen.z,X,da),U.r=U.g=U.b=1-ma(e.positionScreen.z,X,da),Y=wa(F,D,G,U),y(J,P,S,M,O,w),ha(J,P,S,M,O,w,Y,0,0,1,0,0,1),y(K,I,E,A,T,pa),ha(K,I,E,A,T,pa,Y,1,0,1,1,0,1)}function y(a,b,c,d,e,f){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,f);l.lineTo(a,b);l.closePath()}function L(a,b,c,d,e,f,g,h){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,f);l.lineTo(g,h);l.lineTo(a, ha(s);else if(i instanceof THREE.MeshDepthMaterial)W=g.near,ca=g.far,E.r=E.g=E.b=1-la(a.positionScreen.z,W,ca),C.r=C.g=C.b=1-la(d.positionScreen.z,W,ca),F.r=F.g=F.b=1-la(h.positionScreen.z,W,ca),T.r=T.g=T.b=1-la(f.positionScreen.z,W,ca),X=va(E,C,F,T),x(I,O,R,L,N,w),ga(I,O,R,L,N,w,X,0,0,1,0,0,1),x(J,H,D,z,S,oa),ga(J,H,D,z,S,oa,X,1,0,1,1,0,1)}function x(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function K(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,
b);l.closePath()}function H(a,b,c,e){if(C!=b)l.lineWidth=C=b;if(p!=c)l.lineCap=p=c;if(N!=e)l.lineJoin=N=e;d(a);l.stroke();W.inflate(b*2)}function ia(a){e(a);l.fill()}function ha(a,b,c,d,e,f,g,h,i,k,j,m,n){var o,p;o=g.width-1;p=g.height-1;h*=o;i*=p;k*=o;j*=p;m*=o;n*=p;c-=a;d-=b;e-=a;f-=b;k-=h;j-=i;m-=h;n-=i;o=k*n-m*j;o!=0&&(p=1/o,o=(n*c-j*e)*p,j=(n*d-j*f)*p,c=(k*e-m*c)*p,d=(k*f-m*d)*p,a=a-o*h-c*i,b=b-j*h-d*i,l.save(),l.transform(o,j,c,d,a,b),l.clip(),l.drawImage(g,0,0),l.restore())}function wa(a,b, b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function G(a,b,c,e){if(B!=b)k.lineWidth=B=b;if(o!=c)k.lineCap=o=c;if(M!=e)k.lineJoin=M=e;d(a);k.stroke();V.inflate(b*2)}function ha(a){f(a);k.fill()}function ga(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,p;o=g.width-1;p=g.height-1;h*=o;i*=p;j*=o;l*=p;m*=o;n*=p;c-=a;d-=b;e-=a;f-=b;j-=h;l-=i;m-=h;n-=i;o=j*n-m*l;o!=0&&(p=1/o,o=(n*c-l*e)*p,l=(n*d-l*f)*p,c=(j*e-m*c)*p,d=(j*f-m*d)*p,a=a-o*h-c*i,b=b-l*h-d*i,k.save(),k.transform(o,l,c,d,a,b),
c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);fa[0]=e<0?0:e>255?255:e;fa[1]=f<0?0:f>255?255:f;fa[2]=a<0?0:a>255?255:a;fa[4]=g<0?0:g>255?255:g;fa[5]=h<0?0:h>255?255:h;fa[6]=b<0?0:b>255?255:b;fa[8]=i<0?0:i>255?255:i;fa[9]=j<0?0:j>255?255:j;fa[10]=c<0?0:c>255?255:c;fa[12]=k<0?0:k>255?255:k;fa[13]=l<0?0:l>255?255:l;fa[14]=d<0?0:d>255?255:d;ra.putImageData(Aa,0,0);va.drawImage(qa, k.clip(),k.drawImage(g,0,0),k.restore())}function va(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ea[0]=e<0?0:e>255?255:e;ea[1]=f<0?0:f>255?255:f;ea[2]=a<0?0:a>255?255:a;ea[4]=g<0?0:g>255?255:g;ea[5]=h<0?0:h>255?255:h;ea[6]=b<0?0:b>255?255:b;ea[8]=i<0?0:i>255?255:i;ea[9]=j<0?0:j>255?255:j;ea[10]=c<0?0:c>255?255:c;ea[12]=k<0?0:k>255?255:k;ea[13]=l<0?0:l>255?255:l;
0,0);return sa}function ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ja(a,b){var c=b.x-a.x,d=b.y-a.y,e=1/Math.sqrt(c*c+d*d);c*=e;d*=e;b.x+=c;b.y+=d;a.x-=c;a.y-=d}var xa,Ha,B,ga,ka,oa,ya,V;this.autoClear?this.clear():l.setTransform(1,0,0,-1,k,n);f.data.vertices=0;f.data.faces=0;h=j.projectScene(a,g,this.sortElements);(za=a.lights.length>0)&&i(a);xa=0;for(Ha=h.length;xa<Ha;xa++){B=h[xa];W.empty();if(B instanceof THREE.RenderableParticle){r=B;r.x*= ea[14]=d<0?0:d>255?255:d;qa.putImageData(za,0,0);ua.drawImage(pa,0,0);return ra}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ma(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=1/Math.sqrt(c*c+d*d);c*=e;d*=e;b.x+=c;b.y+=d;a.x-=c;a.y-=d}var wa,Ha,A,fa,ja,na,xa,U;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,l);e.data.vertices=0;e.data.faces=0;h=j.projectScene(a,g,this.sortElements);(ya=a.lights.length>0)&&i(a);wa=0;for(Ha=h.length;wa<Ha;wa++){A=
k;r.y*=n;ga=0;for(ka=B.materials.length;ga<ka;)V=B.materials[ga++],V.opacity!=0&&o(r,B,V,a)}else if(B instanceof THREE.RenderableLine){if(r=B.v1,v=B.v2,r.positionScreen.x*=k,r.positionScreen.y*=n,v.positionScreen.x*=k,v.positionScreen.y*=n,W.addPoint(r.positionScreen.x,r.positionScreen.y),W.addPoint(v.positionScreen.x,v.positionScreen.y),la.instersects(W)){ga=0;for(ka=B.materials.length;ga<ka;)V=B.materials[ga++],V.opacity!=0&&q(r,v,B,V,a)}}else if(B instanceof THREE.RenderableFace3){if(r=B.v1,v= h[wa];V.empty();if(A instanceof THREE.RenderableParticle){r=A;r.x*=n;r.y*=l;fa=0;for(ja=A.materials.length;fa<ja;)U=A.materials[fa++],U.opacity!=0&&p(r,A,U,a)}else if(A instanceof THREE.RenderableLine){if(r=A.v1,v=A.v2,r.positionScreen.x*=n,r.positionScreen.y*=l,v.positionScreen.x*=n,v.positionScreen.y*=l,V.addPoint(r.positionScreen.x,r.positionScreen.y),V.addPoint(v.positionScreen.x,v.positionScreen.y),ka.instersects(V)){fa=0;for(ja=A.materials.length;fa<ja;)U=A.materials[fa++],U.opacity!=0&&q(r,
B.v2,z=B.v3,r.positionScreen.x*=k,r.positionScreen.y*=n,v.positionScreen.x*=k,v.positionScreen.y*=n,z.positionScreen.x*=k,z.positionScreen.y*=n,B.overdraw&&(ja(r.positionScreen,v.positionScreen),ja(v.positionScreen,z.positionScreen),ja(z.positionScreen,r.positionScreen)),W.add3Points(r.positionScreen.x,r.positionScreen.y,v.positionScreen.x,v.positionScreen.y,z.positionScreen.x,z.positionScreen.y),la.instersects(W)){ga=0;for(ka=B.meshMaterials.length;ga<ka;)if(V=B.meshMaterials[ga++],V instanceof THREE.MeshFaceMaterial){oa= v,A,U,a)}}else if(A instanceof THREE.RenderableFace3){if(r=A.v1,v=A.v2,y=A.v3,r.positionScreen.x*=n,r.positionScreen.y*=l,v.positionScreen.x*=n,v.positionScreen.y*=l,y.positionScreen.x*=n,y.positionScreen.y*=l,A.overdraw&&(ia(r.positionScreen,v.positionScreen),ia(v.positionScreen,y.positionScreen),ia(y.positionScreen,r.positionScreen)),V.add3Points(r.positionScreen.x,r.positionScreen.y,v.positionScreen.x,v.positionScreen.y,y.positionScreen.x,y.positionScreen.y),ka.instersects(V)){fa=0;for(ja=A.meshMaterials.length;fa<
0;for(ya=B.faceMaterials.length;oa<ya;)(V=B.faceMaterials[oa++])&&V.opacity!=0&&t(r,v,z,0,1,2,B,V,a)}else V.opacity!=0&&t(r,v,z,0,1,2,B,V,a)}}else if(B instanceof THREE.RenderableFace4&&(r=B.v1,v=B.v2,z=B.v3,R=B.v4,r.positionScreen.x*=k,r.positionScreen.y*=n,v.positionScreen.x*=k,v.positionScreen.y*=n,z.positionScreen.x*=k,z.positionScreen.y*=n,R.positionScreen.x*=k,R.positionScreen.y*=n,aa.positionScreen.copy(v.positionScreen),$.positionScreen.copy(R.positionScreen),B.overdraw&&(ja(r.positionScreen, ja;)if(U=A.meshMaterials[fa++],U instanceof THREE.MeshFaceMaterial){na=0;for(xa=A.faceMaterials.length;na<xa;)(U=A.faceMaterials[na++])&&U.opacity!=0&&t(r,v,y,0,1,2,A,U,a)}else U.opacity!=0&&t(r,v,y,0,1,2,A,U,a)}}else if(A instanceof THREE.RenderableFace4&&(r=A.v1,v=A.v2,y=A.v3,Q=A.v4,r.positionScreen.x*=n,r.positionScreen.y*=l,v.positionScreen.x*=n,v.positionScreen.y*=l,y.positionScreen.x*=n,y.positionScreen.y*=l,Q.positionScreen.x*=n,Q.positionScreen.y*=l,$.positionScreen.copy(v.positionScreen),
v.positionScreen),ja(v.positionScreen,R.positionScreen),ja(R.positionScreen,r.positionScreen),ja(z.positionScreen,aa.positionScreen),ja(z.positionScreen,$.positionScreen)),W.addPoint(r.positionScreen.x,r.positionScreen.y),W.addPoint(v.positionScreen.x,v.positionScreen.y),W.addPoint(z.positionScreen.x,z.positionScreen.y),W.addPoint(R.positionScreen.x,R.positionScreen.y),la.instersects(W))){ga=0;for(ka=B.meshMaterials.length;ga<ka;)if(V=B.meshMaterials[ga++],V instanceof THREE.MeshFaceMaterial){oa= Z.positionScreen.copy(Q.positionScreen),A.overdraw&&(ia(r.positionScreen,v.positionScreen),ia(v.positionScreen,Q.positionScreen),ia(Q.positionScreen,r.positionScreen),ia(y.positionScreen,$.positionScreen),ia(y.positionScreen,Z.positionScreen)),V.addPoint(r.positionScreen.x,r.positionScreen.y),V.addPoint(v.positionScreen.x,v.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),V.addPoint(Q.positionScreen.x,Q.positionScreen.y),ka.instersects(V))){fa=0;for(ja=A.meshMaterials.length;fa<
0;for(ya=B.faceMaterials.length;oa<ya;)(V=B.faceMaterials[oa++])&&V.opacity!=0&&x(r,v,z,R,aa,$,B,V,a)}else V.opacity!=0&&x(r,v,z,R,aa,$,B,V,a)}ea.addRectangle(W)}l.setTransform(1,0,0,1,0,0)}}; ja;)if(U=A.meshMaterials[fa++],U instanceof THREE.MeshFaceMaterial){na=0;for(xa=A.faceMaterials.length;na<xa;)(U=A.faceMaterials[na++])&&U.opacity!=0&&u(r,v,y,Q,$,Z,A,U,a)}else U.opacity!=0&&u(r,v,y,Q,$,Z,A,U,a)}da.addRectangle(V)}k.setTransform(1,0,0,1,0,0)}};
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(void 0,!1,b);var c=a.sounds,d,e=c.length;for(d=0;d<e;d++)a=c[d],this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34),this.soundPosition.subSelf(b.position),a.isPlaying&&a.isLoaded&&(a.isAddedToDOM||a.addToDOM(this.domElement),a.calculateVolumeAndPan(this.soundPosition))}}; THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(void 0,!1,b);var c=a.sounds,d,f=c.length;for(d=0;d<f;d++)a=c[d],this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34),this.soundPosition.subSelf(b.position),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,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,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
......
// ThreeDOM.js r41/ROME - http://github.com/mrdoob/three.js // ThreeDOM.js r41/ROME - http://github.com/mrdoob/three.js
var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){this.setHex(a)}; var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){this.setHex(a)};
THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,j;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),j=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=j;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=j;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=j;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d, THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,k;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),k=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=k;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=k;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=k;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d,
e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)}; e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)}; this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
...@@ -11,33 +11,34 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit ...@@ -11,33 +11,34 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)}; Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d,e=[];b=0;for(c=a.length;b<c;b++)d=a[b],d instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(d)));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c,d){var d=d.clone().subSelf(b),c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a* THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)d=d.concat(this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.position.clone().subSelf(a).dot(b);if(d<0)return!1;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.position.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),c=c.clone().subSelf(b),
c-b*d)*e;return f>0&&a>0&&f+a<1}var c,d,e,g,f,h,j,i,l,k,m,n=a.geometry,p=n.vertices,q=[];c=0;for(d=n.faces.length;c<d;c++)if(e=n.faces[c],k=this.origin.clone(),m=this.direction.clone(),j=a.matrixWorld,g=j.multiplyVector3(p[e.a].position.clone()),f=j.multiplyVector3(p[e.b].position.clone()),h=j.multiplyVector3(p[e.c].position.clone()),j=e instanceof THREE.Face4?j.multiplyVector3(p[e.d].position.clone()):null,i=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),l=m.dot(i),a.doubleSided||(a.flipSided? e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a*c-b*d)*e;return f>0&&a>0&&f+a<1}if(a instanceof THREE.Particle){var d=[],e=b(this.origin,this.direction,a);e&&e<a.scale.x&&d.push({distance:e,point:a.position,object:a});return d}else if(a instanceof THREE.Mesh){var g,f,h,k,i,j,m,n,l,p,q=a.geometry,s=q.vertices,d=[],e=0;for(g=q.faces.length;e<g;e++)if(f=q.faces[e],l=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(s[f.a].position.clone()),
l>0:l<0))if(i=i.dot((new THREE.Vector3).sub(g,k))/l,k=k.addSelf(m.multiplyScalar(i)),e instanceof THREE.Face3)b(k,g,f,h)&&(e={distance:this.origin.distanceTo(k),point:k,face:e,object:a},q.push(e));else if(e instanceof THREE.Face4&&(b(k,g,f,j)||b(k,f,h,j)))e={distance:this.origin.distanceTo(k),point:k,face:e,object:a},q.push(e);return q}}; k=j.multiplyVector3(s[f.b].position.clone()),i=j.multiplyVector3(s[f.c].position.clone()),j=f instanceof THREE.Face4?j.multiplyVector3(s[f.d].position.clone()):null,m=a.matrixRotationWorld.multiplyVector3(f.normal.clone()),n=p.dot(m),a.doubleSided||(a.flipSided?n>0:n<0))if(m=m.dot((new THREE.Vector3).sub(h,l))/n,l=l.addSelf(p.multiplyScalar(m)),f instanceof THREE.Face3)c(l,h,k,i)&&(f={distance:this.origin.distanceTo(l),point:l,face:f,object:a},d.push(f));else if(f instanceof THREE.Face4&&(c(l,h,k,
THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,k){h=!1;b=f;c=g;d=l;e=k;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points= j)||c(l,k,i,j)))f={distance:this.origin.distanceTo(l),point:l,face:f,object:a},d.push(f);return d}}};
function(f,g,l,k,m,n){h?(h=!1,b=f<l?f<m?f:m:l<m?l:m,c=g<k?g<n?g:n:k<n?k:n,d=f>l?f>m?f:m:l>m?l:m,e=g>k?g>n?g:n:k>n?k:n):(b=f<l?f<m?f<b?f:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b,c=g<k?g<n?g<c?g:c:n<c?n:c:k<n?k<c?k:c:n<c?n:c,d=f>l?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d,e=g>k?g>n?g>e?g:e:n>e?n:e:k>n?k>e?k:e:n>e?n:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e> THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,m){h=!1;b=f;c=g;d=j;e=m;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
function(f,g,j,m,n,l){h?(h=!1,b=f<j?f<n?f:n:j<n?j:n,c=g<m?g<l?g:l:m<l?m:l,d=f>j?f>n?f:n:j>n?j:n,e=g>m?g>l?g:l:m>l?m:l):(b=f<j?f<n?f<b?f:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<m?g<l?g<c?g:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c,d=f>j?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>m?g>l?g>e?g:e:l>e?l:e:m>l?m>e?m:e:l>e?l:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.instersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]}; f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.instersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]};
THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,j,i,l,k,m,n,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,j||0,i||0,l||1,k||0,m||0,n||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,k,i,j,m,n,l,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,k||0,i||0,j||1,m||0,n||0,l||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,j,i,l,k,m,n,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=j;this.n32=i;this.n33=l;this.n34=k;this.n41=m;this.n42=n;this.n43=p;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1, THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,k,i,j,m,n,l,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=k;this.n32=i;this.n33=j;this.n34=m;this.n41=n;this.n42=l;this.n43=p;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23* e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize(); d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,j=a.n23,i=a.n24,l=a.n31,k=a.n32,m=a.n33,n=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44,H=b.n11,K=b.n12,A=b.n13,v=b.n14,o=b.n21,I=b.n22, return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44,H=b.n11,K=b.n12,A=b.n13,v=b.n14,o=b.n21,I=b.n22,
z=b.n23,D=b.n24,E=b.n31,O=b.n32,P=b.n33,Q=b.n34;this.n11=c*H+d*o+e*E;this.n12=c*K+d*I+e*O;this.n13=c*A+d*z+e*P;this.n14=c*v+d*D+e*Q+g;this.n21=f*H+h*o+j*E;this.n22=f*K+h*I+j*O;this.n23=f*A+h*z+j*P;this.n24=f*v+h*D+j*Q+i;this.n31=l*H+k*o+m*E;this.n32=l*K+k*I+m*O;this.n33=l*A+k*z+m*P;this.n34=l*v+k*D+m*Q+n;this.n41=p*H+q*o+t*E;this.n42=p*K+q*I+t*O;this.n43=p*A+q*z+t*P;this.n44=p*v+q*D+t*Q+r;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]= z=b.n23,D=b.n24,E=b.n31,O=b.n32,P=b.n33,Q=b.n34;this.n11=c*H+d*o+e*E;this.n12=c*K+d*I+e*O;this.n13=c*A+d*z+e*P;this.n14=c*v+d*D+e*Q+g;this.n21=f*H+h*o+k*E;this.n22=f*K+h*I+k*O;this.n23=f*A+h*z+k*P;this.n24=f*v+h*D+k*Q+i;this.n31=j*H+m*o+n*E;this.n32=j*K+m*I+n*O;this.n33=j*A+m*z+n*P;this.n34=j*v+m*D+n*Q+l;this.n41=p*H+q*o+s*E;this.n42=p*K+q*I+s*O;this.n43=p*A+q*z+s*P;this.n44=p*v+q*D+s*Q+r;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a= this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,j=this.n31,i=this.n32,l=this.n33,k=this.n34,m=this.n41,n=this.n42,p=this.n43,q=this.n44;return d*f*i*m-c*h*i*m-d*g*l*m+b*h*l*m+c*g*k*m-b*f*k*m-d*f*j*n+c*h*j*n+d*e*l*n-a*h*l*n-c*e*k*n+a*f*k*n+d*g*j*p-b*h*j*p-d*e*i*p+a*h*i*p+b*e*k*p-a*g*k*p-c*g*j*q+b*f*j*q+c*e*i*q-a*f*i*q-b*e*l*q+a*g*l*q},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32= this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,k=this.n31,i=this.n32,j=this.n33,m=this.n34,n=this.n41,l=this.n42,p=this.n43,q=this.n44;return d*f*i*n-c*h*i*n-d*g*j*n+b*h*j*n+c*g*m*n-b*f*m*n-d*f*k*l+c*h*k*l+d*e*j*l-a*h*j*l-c*e*m*l+a*f*m*l+d*g*k*p-b*h*k*p-d*e*i*p+a*h*i*p+b*e*m*p-a*g*m*p-c*g*k*q+b*f*k*q+c*e*i*q-a*f*i*q-b*e*j*q+a*g*j*q},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21; this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]= this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a, this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,j=e*g,i=e*f;this.set(j* b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,k=e*g,i=e*f;this.set(k*
g+c,j*f-d*h,j*h+d*f,0,j*f+d*h,i*f+c,i*h-d*g,0,j*h-d*f,i*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3; g+c,k*f-d*h,k*h+d*f,0,k*f+d*h,i*f+c,i*h-d*g,0,k*h-d*f,i*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;return this}, this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;return this},
setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,j=b*f;b*=h;var i=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(i+d);this.n12=j-e;this.n13=b+f;this.n21=j+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14= setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,k=b*f;b*=h;var i=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(i+d);this.n12=k-e;this.n13=b+f;this.n21=k+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}}; a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,j=a.n23,i=a.n24,l=a.n31,k=a.n32,m=a.n33,n=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*n*q-i*m*q+i*k*t-h*n*t-j*k*r+h*m*r;b.n12=g*m*q-e*n*q-g*k*t+d*n*t+e*k*r-d*m*r;b.n13=e*i*q-g*j*q+g*h*t-d*i*t-e*h*r+d*j*r;b.n14=g*j*k-e*i*k-g*h*m+d*i*m+e*h*n-d*j*n;b.n21=i*m*p-j*n*p-i*l*t+f*n*t+j*l*r-f*m*r;b.n22=e*n*p-g*m*p+g*l*t-c*n*t-e*l*r+c*m*r;b.n23=g*j*p-e*i*p-g*f*t+c*i*t+e*f*r-c*j*r;b.n24= THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*l*q-i*n*q+i*m*s-h*l*s-k*m*r+h*n*r;b.n12=g*n*q-e*l*q-g*m*s+d*l*s+e*m*r-d*n*r;b.n13=e*i*q-g*k*q+g*h*s-d*i*s-e*h*r+d*k*r;b.n14=g*k*m-e*i*m-g*h*n+d*i*n+e*h*l-d*k*l;b.n21=i*n*p-k*l*p-i*j*s+f*l*s+k*j*r-f*n*r;b.n22=e*l*p-g*n*p+g*j*s-c*l*s-e*j*r+c*n*r;b.n23=g*k*p-e*i*p-g*f*s+c*i*s+e*f*r-c*k*r;b.n24=
e*i*l-g*j*l+g*f*m-c*i*m-e*f*n+c*j*n;b.n31=h*n*p-i*k*p+i*l*q-f*n*q-h*l*r+f*k*r;b.n32=g*k*p-d*n*p-g*l*q+c*n*q+d*l*r-c*k*r;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*r+c*h*r;b.n34=g*h*l-d*i*l-g*f*k+c*i*k+d*f*n-c*h*n;b.n41=j*k*p-h*m*p-j*l*q+f*m*q+h*l*t-f*k*t;b.n42=d*m*p-e*k*p+e*l*q-c*m*q-d*l*t+c*k*t;b.n43=e*h*p-d*j*p-e*f*q+c*j*q+d*f*t-c*h*t;b.n44=d*j*l-e*h*l+e*f*k-c*j*k-d*f*m+c*h*m;b.multiplyScalar(1/a.determinant());return b}; e*i*j-g*k*j+g*f*n-c*i*n-e*f*l+c*k*l;b.n31=h*l*p-i*m*p+i*j*q-f*l*q-h*j*r+f*m*r;b.n32=g*m*p-d*l*p-g*j*q+c*l*q+d*j*r-c*m*r;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*r+c*h*r;b.n34=g*h*j-d*i*j-g*f*m+c*i*m+d*f*l-c*h*l;b.n41=k*m*p-h*n*p-k*j*q+f*n*q+h*j*s-f*m*s;b.n42=d*n*p-e*m*p+e*j*q-c*n*q-d*j*s+c*m*s;b.n43=e*h*p-d*k*p-e*f*q+c*k*q+d*f*s-c*h*s;b.n44=d*k*j-e*h*j+e*f*m-c*k*m-d*f*n+c*h*n;b.multiplyScalar(1/a.determinant());return b};
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*j;c[6]=a*i;c[7]=a*l;c[8]=a*k;return b}; THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*j;c[8]=a*m;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)}; THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,j,i;f=new THREE.Matrix4;h=b-a;j=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/j;f.n23=0;f.n24=-((c+d)/j);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,k,i;f=new THREE.Matrix4;h=b-a;k=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
THREE.Object3D=function(){this.parent=void 0;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.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1; THREE.Object3D=function(){this.parent=void 0;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.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
this.visible=!0;this._vector=new THREE.Vector3;this.name=""}; this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)=== THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
...@@ -46,8 +47,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m ...@@ -46,8 +47,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)}; this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y* THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this}, d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},
multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,j=this.w,i=j*c+f*e-h*d,l= multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,i=k*c+f*e-h*d,j=
j*d+h*c-g*e,k=j*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=i*j+c*-g+l*-h-k*-f;b.y=l*j+c*-f+k*-g-i*-h;b.z=k*j+c*-h+i*-f-l*-g;return b}}; k*d+h*c-g*e,m=k*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=i*k+c*-g+j*-h-m*-f;b.y=j*k+c*-f+m*-g-i*-h;b.z=m*k+c*-h+i*-f-j*-g;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)}; THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
...@@ -67,17 +68,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c ...@@ -67,17 +68,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])}; THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])}; THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild; THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
THREE.Projector=function(){function a(){var a=j[h]=j[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,j=[],i,l,k=[],m,n=[],p,q,t=[],r,H,K=[],A=new THREE.Vector4,v=new THREE.Vector4, THREE.Projector=function(){function a(){var a=k[h]=k[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,k=[],i,j,m=[],n,l=[],p,q,s=[],r,H,K=[],A=new THREE.Vector4,v=new THREE.Vector4,
o=new THREE.Matrix4,I=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var c=[],h,j,i;e=0;j= o=new THREE.Matrix4,I=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var c=[],h,k,i;e=0;k=
a.objects;a=0;for(h=j.length;a<h;a++){i=j[a];var k;if(!(k=!i.visible))if(k=i instanceof THREE.Mesh){a:{k=void 0;for(var l=i.matrixWorld,m=-i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)),n=0;n<6;n++)if(k=z[n].x*l.n14+z[n].y*l.n24+z[n].z*l.n34+z[n].w,k<=m){k=!1;break a}k=!0}k=!k}if(!k)k=g[e]=g[e]||new THREE.RenderableObject,e++,d=k,A.copy(i.position),o.multiplyVector3(A),d.object=i,d.z=A.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var A=[], a.objects;a=0;for(h=k.length;a<h;a++){i=k[a];var j;if(!(j=!i.visible))if(j=i instanceof THREE.Mesh){a:{j=void 0;for(var l=i.matrixWorld,n=-i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)),m=0;m<6;m++)if(j=z[m].x*l.n14+z[m].y*l.n24+z[m].z*l.n34+z[m].w,j<=n){j=!1;break a}j=!0}j=!j}if(!j)j=g[e]=g[e]||new THREE.RenderableObject,e++,d=j,A.copy(i.position),o.multiplyVector3(A),d.object=i,d.z=A.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var A=[],
V=e.near,W=e.far,M,G,x,C,s,y,w,B,F,u,J,R,T,U,L,S,N;H=q=m=l=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);z[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);z[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);z[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);z[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);z[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);z[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+ V=e.near,W=e.far,M,G,x,C,t,y,w,B,F,u,J,R,T,U,L,S,N;H=q=n=j=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);z[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);z[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);z[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);z[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);z[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);z[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+
o.n33,o.n44+o.n34);for(M=0;M<6;M++)F=z[M],F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z));F=this.projectObjects(d,e,!0);d=0;for(M=F.length;d<M;d++)if(u=F[d].object,u.visible)if(J=u.matrixWorld,R=u.matrixRotationWorld,T=u.materials,U=u.overdraw,h=0,u instanceof THREE.Mesh){L=u.geometry;C=L.vertices;S=L.faces;L=L.faceVertexUvs;G=0;for(x=C.length;G<x;G++)f=a(),f.positionWorld.copy(C[G].position),J.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),o.multiplyVector4(f.positionScreen), o.n33,o.n44+o.n34);for(M=0;M<6;M++)F=z[M],F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z));F=this.projectObjects(d,e,!0);d=0;for(M=F.length;d<M;d++)if(u=F[d].object,u.visible)if(J=u.matrixWorld,R=u.matrixRotationWorld,T=u.materials,U=u.overdraw,h=0,u instanceof THREE.Mesh){L=u.geometry;C=L.vertices;S=L.faces;L=L.faceVertexUvs;G=0;for(x=C.length;G<x;G++)f=a(),f.positionWorld.copy(C[G].position),J.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),o.multiplyVector4(f.positionScreen),
f.positionScreen.x/=f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>V&&f.positionScreen.z<W;C=0;for(G=S.length;C<G;C++){x=S[C];if(x instanceof THREE.Face3)if(s=j[x.a],y=j[x.b],w=j[x.c],s.visible&&y.visible&&w.visible&&(u.doubleSided||u.flipSided!=(w.positionScreen.x-s.positionScreen.x)*(y.positionScreen.y-s.positionScreen.y)-(w.positionScreen.y-s.positionScreen.y)*(y.positionScreen.x-s.positionScreen.x)<0))B=k[l]=k[l]||new THREE.RenderableFace3,l++,i=B,i.v1.copy(s), f.positionScreen.x/=f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>V&&f.positionScreen.z<W;C=0;for(G=S.length;C<G;C++){x=S[C];if(x instanceof THREE.Face3)if(t=k[x.a],y=k[x.b],w=k[x.c],t.visible&&y.visible&&w.visible&&(u.doubleSided||u.flipSided!=(w.positionScreen.x-t.positionScreen.x)*(y.positionScreen.y-t.positionScreen.y)-(w.positionScreen.y-t.positionScreen.y)*(y.positionScreen.x-t.positionScreen.x)<0))B=m[j]=m[j]||new THREE.RenderableFace3,j++,i=B,i.v1.copy(t),
i.v2.copy(y),i.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(s=j[x.a],y=j[x.b],w=j[x.c],B=j[x.d],s.visible&&y.visible&&w.visible&&B.visible&&(u.doubleSided||u.flipSided!=((B.positionScreen.x-s.positionScreen.x)*(y.positionScreen.y-s.positionScreen.y)-(B.positionScreen.y-s.positionScreen.y)*(y.positionScreen.x-s.positionScreen.x)<0||(y.positionScreen.x-w.positionScreen.x)*(B.positionScreen.y-w.positionScreen.y)-(y.positionScreen.y-w.positionScreen.y)*(B.positionScreen.x-w.positionScreen.x)< i.v2.copy(y),i.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(t=k[x.a],y=k[x.b],w=k[x.c],B=k[x.d],t.visible&&y.visible&&w.visible&&B.visible&&(u.doubleSided||u.flipSided!=((B.positionScreen.x-t.positionScreen.x)*(y.positionScreen.y-t.positionScreen.y)-(B.positionScreen.y-t.positionScreen.y)*(y.positionScreen.x-t.positionScreen.x)<0||(y.positionScreen.x-w.positionScreen.x)*(B.positionScreen.y-w.positionScreen.y)-(y.positionScreen.y-w.positionScreen.y)*(B.positionScreen.x-w.positionScreen.x)<
0)))N=n[m]=n[m]||new THREE.RenderableFace4,m++,i=N,i.v1.copy(s),i.v2.copy(y),i.v3.copy(w),i.v4.copy(B);else continue;i.normalWorld.copy(x.normal);R.multiplyVector3(i.normalWorld);i.centroidWorld.copy(x.centroid);J.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);w=x.vertexNormals;s=0;for(y=w.length;s<y;s++)B=i.vertexNormalsWorld[s],B.copy(w[s]),R.multiplyVector3(B);s=0;for(y=L.length;s<y;s++)if(N=L[s][C]){w=0;for(B=N.length;w<B;w++)i.uvs[s][w]= 0)))N=l[n]=l[n]||new THREE.RenderableFace4,n++,i=N,i.v1.copy(t),i.v2.copy(y),i.v3.copy(w),i.v4.copy(B);else continue;i.normalWorld.copy(x.normal);R.multiplyVector3(i.normalWorld);i.centroidWorld.copy(x.centroid);J.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);w=x.vertexNormals;t=0;for(y=w.length;t<y;t++)B=i.vertexNormalsWorld[t],B.copy(w[t]),R.multiplyVector3(B);t=0;for(y=L.length;t<y;t++)if(N=L[t][C]){w=0;for(B=N.length;w<B;w++)i.uvs[t][w]=
N[w]}i.meshMaterials=T;i.faceMaterials=x.materials;i.overdraw=U;i.z=i.centroidScreen.z;A.push(i)}}else if(u instanceof THREE.Line){I.multiply(o,J);C=u.geometry.vertices;s=a();s.positionScreen.copy(C[0].position);I.multiplyVector4(s.positionScreen);G=1;for(x=C.length;G<x;G++)if(s=a(),s.positionScreen.copy(C[G].position),I.multiplyVector4(s.positionScreen),y=j[h-2],D.copy(s.positionScreen),E.copy(y.positionScreen),c(D,E))D.multiplyScalar(1/D.w),E.multiplyScalar(1/E.w),J=t[q]=t[q]||new THREE.RenderableLine, N[w]}i.meshMaterials=T;i.faceMaterials=x.materials;i.overdraw=U;i.z=i.centroidScreen.z;A.push(i)}}else if(u instanceof THREE.Line){I.multiply(o,J);C=u.geometry.vertices;t=a();t.positionScreen.copy(C[0].position);I.multiplyVector4(t.positionScreen);G=1;for(x=C.length;G<x;G++)if(t=a(),t.positionScreen.copy(C[G].position),I.multiplyVector4(t.positionScreen),y=k[h-2],D.copy(t.positionScreen),E.copy(y.positionScreen),c(D,E))D.multiplyScalar(1/D.w),E.multiplyScalar(1/E.w),J=s[q]=s[q]||new THREE.RenderableLine,
q++,p=J,p.v1.positionScreen.copy(D),p.v2.positionScreen.copy(E),p.z=Math.max(D.z,E.z),p.materials=u.materials,A.push(p)}else if(u instanceof THREE.Particle&&(v.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,1),o.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))J=K[H]=K[H]||new THREE.RenderableParticle,H++,r=J,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+ q++,p=J,p.v1.positionScreen.copy(D),p.v2.positionScreen.copy(E),p.z=Math.max(D.z,E.z),p.materials=u.materials,A.push(p)}else if(u instanceof THREE.Particle&&(v.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,1),o.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))J=K[H]=K[H]||new THREE.RenderableParticle,H++,r=J,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+
e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,A.push(r);g&&A.sort(b);return A}}; e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,A.push(r);g&&A.sort(b);return A}};
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var j,i,l,k,m,n,p,q;a=b.projectScene(c,d);j=0;for(i=a.length;j<i;j++)if(m=a[j],m instanceof THREE.RenderableParticle){p=m.x*e+e;q=m.y*g+g;l=0;for(k=m.material.length;l<k;l++)if(n=m.material[l],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=p+"px",n.style.top=q+"px"}}}; THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var k,i,j,m,n,l,p,q;a=b.projectScene(c,d);k=0;for(i=a.length;k<i;k++)if(n=a[k],n instanceof THREE.RenderableParticle){p=n.x*e+e;q=n.y*g+g;j=0;for(m=n.material.length;j<m;j++)if(l=n.material[j],l instanceof THREE.ParticleDOMMaterial)l=l.domElement,l.style.left=p+"px",l.style.top=q+"px"}}};
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(void 0,!1,b);var c=a.sounds,d,e=c.length;for(d=0;d<e;d++)a=c[d],this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34),this.soundPosition.subSelf(b.position),a.isPlaying&&a.isLoaded&&(a.isAddedToDOM||a.addToDOM(this.domElement),a.calculateVolumeAndPan(this.soundPosition))}}; THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(void 0,!1,b);var c=a.sounds,d,e=c.length;for(d=0;d<e;d++)a=c[d],this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34),this.soundPosition.subSelf(b.position),a.isPlaying&&a.isLoaded&&(a.isAddedToDOM||a.addToDOM(this.domElement),a.calculateVolumeAndPan(this.soundPosition))}};
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null}; THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};
// ThreeSVG.js r41/ROME - http://github.com/mrdoob/three.js // ThreeSVG.js r41/ROME - http://github.com/mrdoob/three.js
var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){this.setHex(a)}; var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){this.setHex(a)};
THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,j;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),j=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=j;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=j;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=j;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d, THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,i;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),i=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=i;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=i;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=i;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d,
e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)}; e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)}; this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
...@@ -11,33 +11,34 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit ...@@ -11,33 +11,34 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)}; Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d,e=[];b=0;for(c=a.length;b<c;b++)d=a[b],d instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(d)));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c,d){var d=d.clone().subSelf(b),c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a* THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)d=d.concat(this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.position.clone().subSelf(a).dot(b);if(d<0)return!1;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.position.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),c=c.clone().subSelf(b),
c-b*d)*e;return f>0&&a>0&&f+a<1}var c,d,e,g,f,h,j,m,n,k,i,o=a.geometry,p=o.vertices,q=[];c=0;for(d=o.faces.length;c<d;c++)if(e=o.faces[c],k=this.origin.clone(),i=this.direction.clone(),j=a.matrixWorld,g=j.multiplyVector3(p[e.a].position.clone()),f=j.multiplyVector3(p[e.b].position.clone()),h=j.multiplyVector3(p[e.c].position.clone()),j=e instanceof THREE.Face4?j.multiplyVector3(p[e.d].position.clone()):null,m=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),n=i.dot(m),a.doubleSided||(a.flipSided? e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a*c-b*d)*e;return f>0&&a>0&&f+a<1}if(a instanceof THREE.Particle){var d=[],e=b(this.origin,this.direction,a);e&&e<a.scale.x&&d.push({distance:e,point:a.position,object:a});return d}else if(a instanceof THREE.Mesh){var g,f,h,i,n,o,m,k,j,p,q=a.geometry,t=q.vertices,d=[],e=0;for(g=q.faces.length;e<g;e++)if(f=q.faces[e],j=this.origin.clone(),p=this.direction.clone(),o=a.matrixWorld,h=o.multiplyVector3(t[f.a].position.clone()),
n>0:n<0))if(m=m.dot((new THREE.Vector3).sub(g,k))/n,k=k.addSelf(i.multiplyScalar(m)),e instanceof THREE.Face3)b(k,g,f,h)&&(e={distance:this.origin.distanceTo(k),point:k,face:e,object:a},q.push(e));else if(e instanceof THREE.Face4&&(b(k,g,f,j)||b(k,f,h,j)))e={distance:this.origin.distanceTo(k),point:k,face:e,object:a},q.push(e);return q}}; i=o.multiplyVector3(t[f.b].position.clone()),n=o.multiplyVector3(t[f.c].position.clone()),o=f instanceof THREE.Face4?o.multiplyVector3(t[f.d].position.clone()):null,m=a.matrixRotationWorld.multiplyVector3(f.normal.clone()),k=p.dot(m),a.doubleSided||(a.flipSided?k>0:k<0))if(m=m.dot((new THREE.Vector3).sub(h,j))/k,j=j.addSelf(p.multiplyScalar(m)),f instanceof THREE.Face3)c(j,h,i,n)&&(f={distance:this.origin.distanceTo(j),point:j,face:f,object:a},d.push(f));else if(f instanceof THREE.Face4&&(c(j,h,i,
THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,n,k){h=!1;b=f;c=g;d=n;e=k;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points= o)||c(j,i,n,o)))f={distance:this.origin.distanceTo(j),point:j,face:f,object:a},d.push(f);return d}}};
function(f,g,n,k,i,o){h?(h=!1,b=f<n?f<i?f:i:n<i?n:i,c=g<k?g<o?g:o:k<o?k:o,d=f>n?f>i?f:i:n>i?n:i,e=g>k?g>o?g:o:k>o?k:o):(b=f<n?f<i?f<b?f:b:i<b?i:b:n<i?n<b?n:b:i<b?i:b,c=g<k?g<o?g<c?g:c:o<c?o:c:k<o?k<c?k:c:o<c?o:c,d=f>n?f>i?f>d?f:d:i>d?i:d:n>i?n>d?n:d:i>d?i:d,e=g>k?g>o?g>e?g:e:o>e?o:e:k>o?k>e?k:e:o>e?o:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e> THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,o,m){h=!1;b=f;c=g;d=o;e=m;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
function(f,g,o,m,k,j){h?(h=!1,b=f<o?f<k?f:k:o<k?o:k,c=g<m?g<j?g:j:m<j?m:j,d=f>o?f>k?f:k:o>k?o:k,e=g>m?g>j?g:j:m>j?m:j):(b=f<o?f<k?f<b?f:b:k<b?k:b:o<k?o<b?o:b:k<b?k:b,c=g<m?g<j?g<c?g:c:j<c?j:c:m<j?m<c?m:c:j<c?j:c,d=f>o?f>k?f>d?f:d:k>d?k:d:o>k?o>d?o:d:k>d?k:d,e=g>m?g>j?g>e?g:e:j>e?j:e:m>j?m>e?m:e:j>e?j:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.instersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]}; f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.instersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]};
THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,j,m,n,k,i,o,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,j||0,m||0,n||1,k||0,i||0,o||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,n,o,m,k,j,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,i||0,n||0,o||1,m||0,k||0,j||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,j,m,n,k,i,o,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=j;this.n32=m;this.n33=n;this.n34=k;this.n41=i;this.n42=o;this.n43=p;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1, THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,i,n,o,m,k,j,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=n;this.n33=o;this.n34=m;this.n41=k;this.n42=j;this.n43=p;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23* e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize(); d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,j=a.n23,m=a.n24,n=a.n31,k=a.n32,i=a.n33,o=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44,G=b.n11,y=b.n12,E=b.n13,r=b.n14,l=b.n21,z=b.n22, return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,n=a.n24,o=a.n31,m=a.n32,k=a.n33,j=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44,G=b.n11,y=b.n12,E=b.n13,r=b.n14,l=b.n21,z=b.n22,
A=b.n23,C=b.n24,v=b.n31,L=b.n32,F=b.n33,J=b.n34;this.n11=c*G+d*l+e*v;this.n12=c*y+d*z+e*L;this.n13=c*E+d*A+e*F;this.n14=c*r+d*C+e*J+g;this.n21=f*G+h*l+j*v;this.n22=f*y+h*z+j*L;this.n23=f*E+h*A+j*F;this.n24=f*r+h*C+j*J+m;this.n31=n*G+k*l+i*v;this.n32=n*y+k*z+i*L;this.n33=n*E+k*A+i*F;this.n34=n*r+k*C+i*J+o;this.n41=p*G+q*l+t*v;this.n42=p*y+q*z+t*L;this.n43=p*E+q*A+t*F;this.n44=p*r+q*C+t*J+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]= A=b.n23,C=b.n24,v=b.n31,L=b.n32,F=b.n33,J=b.n34;this.n11=c*G+d*l+e*v;this.n12=c*y+d*z+e*L;this.n13=c*E+d*A+e*F;this.n14=c*r+d*C+e*J+g;this.n21=f*G+h*l+i*v;this.n22=f*y+h*z+i*L;this.n23=f*E+h*A+i*F;this.n24=f*r+h*C+i*J+n;this.n31=o*G+m*l+k*v;this.n32=o*y+m*z+k*L;this.n33=o*E+m*A+k*F;this.n34=o*r+m*C+k*J+j;this.n41=p*G+q*l+t*v;this.n42=p*y+q*z+t*L;this.n43=p*E+q*A+t*F;this.n44=p*r+q*C+t*J+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a= this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,j=this.n31,m=this.n32,n=this.n33,k=this.n34,i=this.n41,o=this.n42,p=this.n43,q=this.n44;return d*f*m*i-c*h*m*i-d*g*n*i+b*h*n*i+c*g*k*i-b*f*k*i-d*f*j*o+c*h*j*o+d*e*n*o-a*h*n*o-c*e*k*o+a*f*k*o+d*g*j*p-b*h*j*p-d*e*m*p+a*h*m*p+b*e*k*p-a*g*k*p-c*g*j*q+b*f*j*q+c*e*m*q-a*f*m*q-b*e*n*q+a*g*n*q},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32= this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,i=this.n31,n=this.n32,o=this.n33,m=this.n34,k=this.n41,j=this.n42,p=this.n43,q=this.n44;return d*f*n*k-c*h*n*k-d*g*o*k+b*h*o*k+c*g*m*k-b*f*m*k-d*f*i*j+c*h*i*j+d*e*o*j-a*h*o*j-c*e*m*j+a*f*m*j+d*g*i*p-b*h*i*p-d*e*n*p+a*h*n*p+b*e*m*p-a*g*m*p-c*g*i*q+b*f*i*q+c*e*n*q-a*f*n*q-b*e*o*q+a*g*o*q},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21; this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]= this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a, this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,j=e*g,m=e*f;this.set(j* b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,n=e*f;this.set(i*
g+c,j*f-d*h,j*h+d*f,0,j*f+d*h,m*f+c,m*h-d*g,0,j*h-d*f,m*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3; g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,n*f+c,n*h-d*g,0,i*h-d*f,n*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;return this}, this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;return this},
setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,j=b*f;b*=h;var m=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(m+d);this.n12=j-e;this.n13=b+f;this.n21=j+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+m);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14= setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f;b*=h;var n=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(n+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+n);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}}; a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,j=a.n23,m=a.n24,n=a.n31,k=a.n32,i=a.n33,o=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*o*q-m*i*q+m*k*t-h*o*t-j*k*u+h*i*u;b.n12=g*i*q-e*o*q-g*k*t+d*o*t+e*k*u-d*i*u;b.n13=e*m*q-g*j*q+g*h*t-d*m*t-e*h*u+d*j*u;b.n14=g*j*k-e*m*k-g*h*i+d*m*i+e*h*o-d*j*o;b.n21=m*i*p-j*o*p-m*n*t+f*o*t+j*n*u-f*i*u;b.n22=e*o*p-g*i*p+g*n*t-c*o*t-e*n*u+c*i*u;b.n23=g*j*p-e*m*p-g*f*t+c*m*t+e*f*u-c*j*u;b.n24= THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,n=a.n24,o=a.n31,m=a.n32,k=a.n33,j=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=i*j*q-n*k*q+n*m*t-h*j*t-i*m*u+h*k*u;b.n12=g*k*q-e*j*q-g*m*t+d*j*t+e*m*u-d*k*u;b.n13=e*n*q-g*i*q+g*h*t-d*n*t-e*h*u+d*i*u;b.n14=g*i*m-e*n*m-g*h*k+d*n*k+e*h*j-d*i*j;b.n21=n*k*p-i*j*p-n*o*t+f*j*t+i*o*u-f*k*u;b.n22=e*j*p-g*k*p+g*o*t-c*j*t-e*o*u+c*k*u;b.n23=g*i*p-e*n*p-g*f*t+c*n*t+e*f*u-c*i*u;b.n24=
e*m*n-g*j*n+g*f*i-c*m*i-e*f*o+c*j*o;b.n31=h*o*p-m*k*p+m*n*q-f*o*q-h*n*u+f*k*u;b.n32=g*k*p-d*o*p-g*n*q+c*o*q+d*n*u-c*k*u;b.n33=e*m*p-g*h*p+g*f*q-c*m*q-d*f*u+c*h*u;b.n34=g*h*n-d*m*n-g*f*k+c*m*k+d*f*o-c*h*o;b.n41=j*k*p-h*i*p-j*n*q+f*i*q+h*n*t-f*k*t;b.n42=d*i*p-e*k*p+e*n*q-c*i*q-d*n*t+c*k*t;b.n43=e*h*p-d*j*p-e*f*q+c*j*q+d*f*t-c*h*t;b.n44=d*j*n-e*h*n+e*f*k-c*j*k-d*f*i+c*h*i;b.multiplyScalar(1/a.determinant());return b}; e*n*o-g*i*o+g*f*k-c*n*k-e*f*j+c*i*j;b.n31=h*j*p-n*m*p+n*o*q-f*j*q-h*o*u+f*m*u;b.n32=g*m*p-d*j*p-g*o*q+c*j*q+d*o*u-c*m*u;b.n33=e*n*p-g*h*p+g*f*q-c*n*q-d*f*u+c*h*u;b.n34=g*h*o-d*n*o-g*f*m+c*n*m+d*f*j-c*h*j;b.n41=i*m*p-h*k*p-i*o*q+f*k*q+h*o*t-f*m*t;b.n42=d*k*p-e*m*p+e*o*q-c*k*q-d*o*t+c*m*t;b.n43=e*h*p-d*i*p-e*f*q+c*i*q+d*f*t-c*h*t;b.n44=d*i*o-e*h*o+e*f*m-c*i*m-d*f*k+c*h*k;b.multiplyScalar(1/a.determinant());return b};
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=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,n=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*j;c[6]=a*m;c[7]=a*n;c[8]=a*k;return b}; THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*n;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*n;c[7]=a*o;c[8]=a*m;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)}; THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,j,m;f=new THREE.Matrix4;h=b-a;j=c-d;m=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/j;f.n23=0;f.n24=-((c+d)/j);f.n31=0;f.n32=0;f.n33=-2/m;f.n34=-((g+e)/m);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,i,n;f=new THREE.Matrix4;h=b-a;i=c-d;n=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/n;f.n34=-((g+e)/n);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
THREE.Object3D=function(){this.parent=void 0;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.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1; THREE.Object3D=function(){this.parent=void 0;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.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
this.visible=!0;this._vector=new THREE.Vector3;this.name=""}; this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)=== THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
...@@ -46,18 +47,18 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m ...@@ -46,18 +47,18 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)}; this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y* THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*
d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this}, d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},
multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,j=this.w,m=j*c+f*e-h*d,n= multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,i=this.w,n=i*c+f*e-h*d,o=
j*d+h*c-g*e,k=j*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=m*j+c*-g+n*-h-k*-f;b.y=n*j+c*-f+k*-g-m*-h;b.z=k*j+c*-h+m*-f-n*-g;return b}}; i*d+h*c-g*e,m=i*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=n*i+c*-g+o*-h-m*-f;b.y=o*i+c*-f+m*-g-n*-h;b.z=m*i+c*-h+n*-f-o*-g;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)}; THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position), THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),
c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,c,d,e,g,f,h=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){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],f=this.vertices[g.c],h.sub(f.position,c.position),j.sub(b.position,c.position),h.crossSelf(j);h.isZero()|| c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,c,d,e,g,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],f=this.vertices[g.c],h.sub(f.position,c.position),i.sub(b.position,c.position),h.crossSelf(i);h.isZero()||
h.normalize();g.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d= h.normalize();g.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=
this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]), this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),
c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,g,D){h=a.vertices[b].position;j=a.vertices[c].position;m=a.vertices[d].position;n=f[e];k=f[g];i=f[D];o=j.x-h.x;p=m.x-h.x;q=j.y-h.y;t=m.y-h.y;u=j.z-h.z;G=m.z-h.z;y=k.u-n.u;E=i.u-n.u;r=k.v-n.v;l=i.v-n.v;z=1/(y*l-E*r);L.set((l*o-r*p)* c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,g,D){h=a.vertices[b].position;i=a.vertices[c].position;n=a.vertices[d].position;o=f[e];m=f[g];k=f[D];j=i.x-h.x;p=n.x-h.x;q=i.y-h.y;t=n.y-h.y;u=i.z-h.z;G=n.z-h.z;y=m.u-o.u;E=k.u-o.u;r=m.v-o.v;l=k.v-o.v;z=1/(y*l-E*r);L.set((l*j-r*p)*
z,(l*q-r*t)*z,(l*u-r*G)*z);F.set((y*p-E*o)*z,(y*t-E*q)*z,(y*G-E*u)*z);C[b].addSelf(L);C[c].addSelf(L);C[d].addSelf(L);v[b].addSelf(F);v[c].addSelf(F);v[d].addSelf(F)}var b,c,d,e,g,f,h,j,m,n,k,i,o,p,q,t,u,G,y,E,r,l,z,A,C=[],v=[],L=new THREE.Vector3,F=new THREE.Vector3,J=new THREE.Vector3,B=new THREE.Vector3,Q=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,v[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof z,(l*q-r*t)*z,(l*u-r*G)*z);F.set((y*p-E*j)*z,(y*t-E*q)*z,(y*G-E*u)*z);C[b].addSelf(L);C[c].addSelf(L);C[d].addSelf(L);v[b].addSelf(F);v[c].addSelf(F);v[d].addSelf(F)}var b,c,d,e,g,f,h,i,n,o,m,k,j,p,q,t,u,G,y,E,r,l,z,A,C=[],v=[],L=new THREE.Vector3,F=new THREE.Vector3,J=new THREE.Vector3,B=new THREE.Vector3,Q=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,v[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof
THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):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 S=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)Q.copy(g.vertexNormals[d]),e=g[S[d]],A=C[e],J.copy(A),J.subSelf(Q.multiplyScalar(Q.dot(A))).normalize(),B.cross(g.vertexNormals[d],A),e=B.dot(v[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(J.x,J.y,J.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a; THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):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 S=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)Q.copy(g.vertexNormals[d]),e=g[S[d]],A=C[e],J.copy(A),J.subSelf(Q.multiplyScalar(Q.dot(A))).normalize(),B.cross(g.vertexNormals[d],A),e=B.dot(v[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(J.x,J.y,J.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;
if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y; if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;
else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},computeEdgeFaces:function(){function a(a,b){return Math.min(a, else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},computeEdgeFaces:function(){function a(a,b){return Math.min(a,
...@@ -97,30 +98,30 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c ...@@ -97,30 +98,30 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])}; THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])}; THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild; THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
THREE.Projector=function(){function a(){var a=j[h]=j[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,j=[],m,n,k=[],i,o=[],p,q,t=[],u,G,y=[],E=new THREE.Vector4,r=new THREE.Vector4, THREE.Projector=function(){function a(){var a=i[h]=i[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,i=[],n,o,m=[],k,j=[],p,q,t=[],u,G,y=[],E=new THREE.Vector4,r=new THREE.Vector4,
l=new THREE.Matrix4,z=new THREE.Matrix4,A=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,v=new THREE.Vector4;this.projectVector=function(a,b){l.multiply(b.projectionMatrix,b.matrixWorldInverse);l.multiplyVector3(a);return a};this.unprojectVector=function(a,b){l.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));l.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var c=[],h,m,j;e=0;m= l=new THREE.Matrix4,z=new THREE.Matrix4,A=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,v=new THREE.Vector4;this.projectVector=function(a,b){l.multiply(b.projectionMatrix,b.matrixWorldInverse);l.multiplyVector3(a);return a};this.unprojectVector=function(a,b){l.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));l.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var c=[],h,n,i;e=0;n=
a.objects;a=0;for(h=m.length;a<h;a++){j=m[a];var i;if(!(i=!j.visible))if(i=j instanceof THREE.Mesh){a:{i=void 0;for(var k=j.matrixWorld,n=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),o=0;o<6;o++)if(i=A[o].x*k.n14+A[o].y*k.n24+A[o].z*k.n34+A[o].w,i<=n){i=!1;break a}i=!0}i=!i}if(!i)i=g[e]=g[e]||new THREE.RenderableObject,e++,d=i,E.copy(j.position),l.multiplyVector3(E),d.object=j,d.z=E.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var B=[], a.objects;a=0;for(h=n.length;a<h;a++){i=n[a];var j;if(!(j=!i.visible))if(j=i instanceof THREE.Mesh){a:{j=void 0;for(var k=i.matrixWorld,o=-i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)),m=0;m<6;m++)if(j=A[m].x*k.n14+A[m].y*k.n24+A[m].z*k.n34+A[m].w,j<=o){j=!1;break a}j=!0}j=!j}if(!j)j=g[e]=g[e]||new THREE.RenderableObject,e++,d=j,E.copy(i.position),l.multiplyVector3(E),d.object=i,d.z=E.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var B=[],
E=e.near,S=e.far,N,P,H,M,x,I,D,K,O,s,w,U,W,X,R,V,T;G=q=i=n=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);l.multiply(e.projectionMatrix,e.matrixWorldInverse);A[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);A[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);A[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);A[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);A[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);A[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+ E=e.near,S=e.far,N,P,H,M,x,I,D,K,O,s,w,U,W,X,R,V,T;G=q=k=o=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);l.multiply(e.projectionMatrix,e.matrixWorldInverse);A[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);A[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);A[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);A[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);A[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);A[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+
l.n33,l.n44+l.n34);for(N=0;N<6;N++)O=A[N],O.divideScalar(Math.sqrt(O.x*O.x+O.y*O.y+O.z*O.z));O=this.projectObjects(d,e,!0);d=0;for(N=O.length;d<N;d++)if(s=O[d].object,s.visible)if(w=s.matrixWorld,U=s.matrixRotationWorld,W=s.materials,X=s.overdraw,h=0,s instanceof THREE.Mesh){R=s.geometry;M=R.vertices;V=R.faces;R=R.faceVertexUvs;P=0;for(H=M.length;P<H;P++)f=a(),f.positionWorld.copy(M[P].position),w.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),l.multiplyVector4(f.positionScreen), l.n33,l.n44+l.n34);for(N=0;N<6;N++)O=A[N],O.divideScalar(Math.sqrt(O.x*O.x+O.y*O.y+O.z*O.z));O=this.projectObjects(d,e,!0);d=0;for(N=O.length;d<N;d++)if(s=O[d].object,s.visible)if(w=s.matrixWorld,U=s.matrixRotationWorld,W=s.materials,X=s.overdraw,h=0,s instanceof THREE.Mesh){R=s.geometry;M=R.vertices;V=R.faces;R=R.faceVertexUvs;P=0;for(H=M.length;P<H;P++)f=a(),f.positionWorld.copy(M[P].position),w.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),l.multiplyVector4(f.positionScreen),
f.positionScreen.x/=f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>E&&f.positionScreen.z<S;M=0;for(P=V.length;M<P;M++){H=V[M];if(H instanceof THREE.Face3)if(x=j[H.a],I=j[H.b],D=j[H.c],x.visible&&I.visible&&D.visible&&(s.doubleSided||s.flipSided!=(D.positionScreen.x-x.positionScreen.x)*(I.positionScreen.y-x.positionScreen.y)-(D.positionScreen.y-x.positionScreen.y)*(I.positionScreen.x-x.positionScreen.x)<0))K=k[n]=k[n]||new THREE.RenderableFace3,n++,m=K,m.v1.copy(x), f.positionScreen.x/=f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>E&&f.positionScreen.z<S;M=0;for(P=V.length;M<P;M++){H=V[M];if(H instanceof THREE.Face3)if(x=i[H.a],I=i[H.b],D=i[H.c],x.visible&&I.visible&&D.visible&&(s.doubleSided||s.flipSided!=(D.positionScreen.x-x.positionScreen.x)*(I.positionScreen.y-x.positionScreen.y)-(D.positionScreen.y-x.positionScreen.y)*(I.positionScreen.x-x.positionScreen.x)<0))K=m[o]=m[o]||new THREE.RenderableFace3,o++,n=K,n.v1.copy(x),
m.v2.copy(I),m.v3.copy(D);else continue;else if(H instanceof THREE.Face4)if(x=j[H.a],I=j[H.b],D=j[H.c],K=j[H.d],x.visible&&I.visible&&D.visible&&K.visible&&(s.doubleSided||s.flipSided!=((K.positionScreen.x-x.positionScreen.x)*(I.positionScreen.y-x.positionScreen.y)-(K.positionScreen.y-x.positionScreen.y)*(I.positionScreen.x-x.positionScreen.x)<0||(I.positionScreen.x-D.positionScreen.x)*(K.positionScreen.y-D.positionScreen.y)-(I.positionScreen.y-D.positionScreen.y)*(K.positionScreen.x-D.positionScreen.x)< n.v2.copy(I),n.v3.copy(D);else continue;else if(H instanceof THREE.Face4)if(x=i[H.a],I=i[H.b],D=i[H.c],K=i[H.d],x.visible&&I.visible&&D.visible&&K.visible&&(s.doubleSided||s.flipSided!=((K.positionScreen.x-x.positionScreen.x)*(I.positionScreen.y-x.positionScreen.y)-(K.positionScreen.y-x.positionScreen.y)*(I.positionScreen.x-x.positionScreen.x)<0||(I.positionScreen.x-D.positionScreen.x)*(K.positionScreen.y-D.positionScreen.y)-(I.positionScreen.y-D.positionScreen.y)*(K.positionScreen.x-D.positionScreen.x)<
0)))T=o[i]=o[i]||new THREE.RenderableFace4,i++,m=T,m.v1.copy(x),m.v2.copy(I),m.v3.copy(D),m.v4.copy(K);else continue;m.normalWorld.copy(H.normal);U.multiplyVector3(m.normalWorld);m.centroidWorld.copy(H.centroid);w.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);l.multiplyVector3(m.centroidScreen);D=H.vertexNormals;x=0;for(I=D.length;x<I;x++)K=m.vertexNormalsWorld[x],K.copy(D[x]),U.multiplyVector3(K);x=0;for(I=R.length;x<I;x++)if(T=R[x][M]){D=0;for(K=T.length;D<K;D++)m.uvs[x][D]= 0)))T=j[k]=j[k]||new THREE.RenderableFace4,k++,n=T,n.v1.copy(x),n.v2.copy(I),n.v3.copy(D),n.v4.copy(K);else continue;n.normalWorld.copy(H.normal);U.multiplyVector3(n.normalWorld);n.centroidWorld.copy(H.centroid);w.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);l.multiplyVector3(n.centroidScreen);D=H.vertexNormals;x=0;for(I=D.length;x<I;x++)K=n.vertexNormalsWorld[x],K.copy(D[x]),U.multiplyVector3(K);x=0;for(I=R.length;x<I;x++)if(T=R[x][M]){D=0;for(K=T.length;D<K;D++)n.uvs[x][D]=
T[D]}m.meshMaterials=W;m.faceMaterials=H.materials;m.overdraw=X;m.z=m.centroidScreen.z;B.push(m)}}else if(s instanceof THREE.Line){z.multiply(l,w);M=s.geometry.vertices;x=a();x.positionScreen.copy(M[0].position);z.multiplyVector4(x.positionScreen);P=1;for(H=M.length;P<H;P++)if(x=a(),x.positionScreen.copy(M[P].position),z.multiplyVector4(x.positionScreen),I=j[h-2],C.copy(x.positionScreen),v.copy(I.positionScreen),c(C,v))C.multiplyScalar(1/C.w),v.multiplyScalar(1/v.w),w=t[q]=t[q]||new THREE.RenderableLine, T[D]}n.meshMaterials=W;n.faceMaterials=H.materials;n.overdraw=X;n.z=n.centroidScreen.z;B.push(n)}}else if(s instanceof THREE.Line){z.multiply(l,w);M=s.geometry.vertices;x=a();x.positionScreen.copy(M[0].position);z.multiplyVector4(x.positionScreen);P=1;for(H=M.length;P<H;P++)if(x=a(),x.positionScreen.copy(M[P].position),z.multiplyVector4(x.positionScreen),I=i[h-2],C.copy(x.positionScreen),v.copy(I.positionScreen),c(C,v))C.multiplyScalar(1/C.w),v.multiplyScalar(1/v.w),w=t[q]=t[q]||new THREE.RenderableLine,
q++,p=w,p.v1.positionScreen.copy(C),p.v2.positionScreen.copy(v),p.z=Math.max(C.z,v.z),p.materials=s.materials,B.push(p)}else if(s instanceof THREE.Particle&&(r.set(s.matrixWorld.n14,s.matrixWorld.n24,s.matrixWorld.n34,1),l.multiplyVector4(r),r.z/=r.w,r.z>0&&r.z<1))w=y[G]=y[G]||new THREE.RenderableParticle,G++,u=w,u.x=r.x/r.w,u.y=r.y/r.w,u.z=r.z,u.rotation=s.rotation.z,u.scale.x=s.scale.x*Math.abs(u.x-(r.x+e.projectionMatrix.n11)/(r.w+e.projectionMatrix.n14)),u.scale.y=s.scale.y*Math.abs(u.y-(r.y+ q++,p=w,p.v1.positionScreen.copy(C),p.v2.positionScreen.copy(v),p.z=Math.max(C.z,v.z),p.materials=s.materials,B.push(p)}else if(s instanceof THREE.Particle&&(r.set(s.matrixWorld.n14,s.matrixWorld.n24,s.matrixWorld.n34,1),l.multiplyVector4(r),r.z/=r.w,r.z>0&&r.z<1))w=y[G]=y[G]||new THREE.RenderableParticle,G++,u=w,u.x=r.x/r.w,u.y=r.y/r.w,u.z=r.z,u.rotation=s.rotation.z,u.scale.x=s.scale.x*Math.abs(u.x-(r.x+e.projectionMatrix.n11)/(r.w+e.projectionMatrix.n14)),u.scale.y=s.scale.y*Math.abs(u.y-(r.y+
e.projectionMatrix.n22)/(r.w+e.projectionMatrix.n24)),u.materials=s.materials,B.push(u);g&&B.sort(b);return B}}; e.projectionMatrix.n22)/(r.w+e.projectionMatrix.n24)),u.materials=s.materials,B.push(u);g&&B.sort(b);return B}};
THREE.SVGRenderer=function(){function a(a,b,c){var d,e,f,g;d=0;for(e=a.lights.length;d<e;d++)f=a.lights[d],f instanceof THREE.DirectionalLight?(g=b.normalWorld.dot(f.position)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(L.sub(f.position,b.centroidWorld),L.normalize(),g=b.normalWorld.dot(L)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function b(b,c,h,j,i,k){f.data.vertices+=3;f.data.faces++;B=d(Q++);B.setAttribute("d", THREE.SVGRenderer=function(){function a(a,b,c){var d,e,f,g;d=0;for(e=a.lights.length;d<e;d++)f=a.lights[d],f instanceof THREE.DirectionalLight?(g=b.normalWorld.dot(f.position)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(L.sub(f.position,b.centroidWorld),L.normalize(),g=b.normalWorld.dot(L)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function b(b,c,h,j,i,k){f.data.vertices+=3;f.data.faces++;B=d(Q++);B.setAttribute("d",
"M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?r.hex=i.color.hex:i instanceof THREE.MeshLambertMaterial?E?(l.r=z.r,l.g=z.g,l.b=z.b,a(k,j,l),r.r=Math.max(0,Math.min(i.color.r*l.r,1)),r.g=Math.max(0,Math.min(i.color.g*l.g,1)),r.b=Math.max(0,Math.min(i.color.b*l.b,1)),r.updateHex()):r.hex=i.color.hex:i instanceof THREE.MeshDepthMaterial?(v=1-i.__2near/(i.__farPlusNear- "M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?r.hex=i.color.hex:i instanceof THREE.MeshLambertMaterial?E?(l.r=z.r,l.g=z.g,l.b=z.b,a(k,j,l),r.r=Math.max(0,Math.min(i.color.r*l.r,1)),r.g=Math.max(0,Math.min(i.color.g*l.g,1)),r.b=Math.max(0,Math.min(i.color.b*l.b,1)),r.updateHex()):r.hex=i.color.hex:i instanceof THREE.MeshDepthMaterial?(v=1-i.__2near/(i.__farPlusNear-
j.z*i.__farMinusNear),r.setRGB(v,v,v)):i instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));i.wireframe?B.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):B.setAttribute("style","fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+i.opacity);m.appendChild(B)}function c(b,c,h,i, j.z*i.__farMinusNear),r.setRGB(v,v,v)):i instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));i.wireframe?B.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):B.setAttribute("style","fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+i.opacity);n.appendChild(B)}function c(b,c,h,i,
j,k,o){f.data.vertices+=4;f.data.faces++;B=d(Q++);B.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");k instanceof THREE.MeshBasicMaterial?r.hex=k.color.hex:k instanceof THREE.MeshLambertMaterial?E?(l.r=z.r,l.g=z.g,l.b=z.b,a(o,j,l),r.r=Math.max(0,Math.min(k.color.r*l.r,1)),r.g=Math.max(0,Math.min(k.color.g*l.g,1)),r.b=Math.max(0,Math.min(k.color.b* j,k,o){f.data.vertices+=4;f.data.faces++;B=d(Q++);B.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");k instanceof THREE.MeshBasicMaterial?r.hex=k.color.hex:k instanceof THREE.MeshLambertMaterial?E?(l.r=z.r,l.g=z.g,l.b=z.b,a(o,j,l),r.r=Math.max(0,Math.min(k.color.r*l.r,1)),r.g=Math.max(0,Math.min(k.color.g*l.g,1)),r.b=Math.max(0,Math.min(k.color.b*
l.b,1)),r.updateHex()):r.hex=k.color.hex:k instanceof THREE.MeshDepthMaterial?(v=1-k.__2near/(k.__farPlusNear-j.z*k.__farMinusNear),r.setRGB(v,v,v)):k instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));k.wireframe?B.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+k.wireframeLinewidth+"; stroke-opacity: "+k.opacity+"; stroke-linecap: "+k.wireframeLinecap+"; stroke-linejoin: "+k.wireframeLinejoin):B.setAttribute("style", l.b,1)),r.updateHex()):r.hex=k.color.hex:k instanceof THREE.MeshDepthMaterial?(v=1-k.__2near/(k.__farPlusNear-j.z*k.__farMinusNear),r.setRGB(v,v,v)):k instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));k.wireframe?B.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+k.wireframeLinewidth+"; stroke-opacity: "+k.opacity+"; stroke-linecap: "+k.wireframeLinecap+"; stroke-linejoin: "+k.wireframeLinejoin):B.setAttribute("style",
"fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+k.opacity);m.appendChild(B)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),N==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function e(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function g(a){for(;a.length<6;)a="0"+a;return a}var f=this,h=null,j=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,k,i,o,p,q,t,u,G=new THREE.Rectangle,y=new THREE.Rectangle,E= "fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+k.opacity);n.appendChild(B)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),N==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function e(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function g(a){for(;a.length<6;)a="0"+a;return a}var f=this,h=null,i=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,m,k,j,p,q,t,u,G=new THREE.Rectangle,y=new THREE.Rectangle,E=
!1,r=new THREE.Color(16777215),l=new THREE.Color(16777215),z=new THREE.Color(0),A=new THREE.Color(0),C=new THREE.Color(0),v,L=new THREE.Vector3,F=[],J=[],B,Q,S,N=1;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(a){switch(a){case "high":N=1;break;case "low":N=0}};this.setSize=function(a,b){n=a;k=b;i=n/2;o=k/2;m.setAttribute("viewBox",-i+" "+-o+" "+n+" "+k);m.setAttribute("width",n);m.setAttribute("height",k);G.set(-i,-o, !1,r=new THREE.Color(16777215),l=new THREE.Color(16777215),z=new THREE.Color(0),A=new THREE.Color(0),C=new THREE.Color(0),v,L=new THREE.Vector3,F=[],J=[],B,Q,S,N=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(a){switch(a){case "high":N=1;break;case "low":N=0}};this.setSize=function(a,b){o=a;m=b;k=o/2;j=m/2;n.setAttribute("viewBox",-k+" "+-j+" "+o+" "+m);n.setAttribute("width",o);n.setAttribute("height",m);G.set(-k,-j,
i,o)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(a,d){var e,k,l,n,r,v,s,w;this.autoClear&&this.clear();f.data.vertices=0;f.data.faces=0;h=j.projectScene(a,d,this.sortElements);S=Q=0;if(E=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);A.setRGB(0,0,0);C.setRGB(0,0,0);e=0;for(k=s.length;e<k;e++)l=s[e],n=l.color,l instanceof THREE.AmbientLight?(z.r+=n.r,z.g+=n.g,z.b+=n.b):l instanceof THREE.DirectionalLight?(A.r+=n.r,A.g+=n.g,A.b+=n.b):l instanceof k,j)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(a,d){var e,o,l,m,r,v,s,w;this.autoClear&&this.clear();f.data.vertices=0;f.data.faces=0;h=i.projectScene(a,d,this.sortElements);S=Q=0;if(E=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);A.setRGB(0,0,0);C.setRGB(0,0,0);e=0;for(o=s.length;e<o;e++)l=s[e],m=l.color,l instanceof THREE.AmbientLight?(z.r+=m.r,z.g+=m.g,z.b+=m.b):l instanceof THREE.DirectionalLight?(A.r+=m.r,A.g+=m.g,A.b+=m.b):l instanceof
THREE.PointLight&&(C.r+=n.r,C.g+=n.g,C.b+=n.b)}e=0;for(k=h.length;e<k;e++)if(s=h[e],y.empty(),s instanceof THREE.RenderableParticle){p=s;p.x*=i;p.y*=-o;l=0;for(n=s.materials.length;l<n;)l++}else if(s instanceof THREE.RenderableLine){if(p=s.v1,q=s.v2,p.positionScreen.x*=i,p.positionScreen.y*=-o,q.positionScreen.x*=i,q.positionScreen.y*=-o,y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(q.positionScreen.x,q.positionScreen.y),G.instersects(y)){l=0;for(n=s.materials.length;l<n;)if((w=s.materials[l++])&& THREE.PointLight&&(C.r+=m.r,C.g+=m.g,C.b+=m.b)}e=0;for(o=h.length;e<o;e++)if(s=h[e],y.empty(),s instanceof THREE.RenderableParticle){p=s;p.x*=k;p.y*=-j;l=0;for(m=s.materials.length;l<m;)l++}else if(s instanceof THREE.RenderableLine){if(p=s.v1,q=s.v2,p.positionScreen.x*=k,p.positionScreen.y*=-j,q.positionScreen.x*=k,q.positionScreen.y*=-j,y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(q.positionScreen.x,q.positionScreen.y),G.instersects(y)){l=0;for(m=s.materials.length;l<m;)if((w=s.materials[l++])&&
w.opacity!=0){r=p;v=q;var F=S++;J[F]==null&&(J[F]=document.createElementNS("http://www.w3.org/2000/svg","line"),N==0&&J[F].setAttribute("shape-rendering","crispEdges"));B=J[F];B.setAttribute("x1",r.positionScreen.x);B.setAttribute("y1",r.positionScreen.y);B.setAttribute("x2",v.positionScreen.x);B.setAttribute("y2",v.positionScreen.y);w instanceof THREE.LineBasicMaterial&&(B.setAttribute("style","fill: none; stroke: ##"+g(w.color.hex.toString(16))+"; stroke-width: "+w.linewidth+"; stroke-opacity: "+ w.opacity!=0){r=p;v=q;var F=S++;J[F]==null&&(J[F]=document.createElementNS("http://www.w3.org/2000/svg","line"),N==0&&J[F].setAttribute("shape-rendering","crispEdges"));B=J[F];B.setAttribute("x1",r.positionScreen.x);B.setAttribute("y1",r.positionScreen.y);B.setAttribute("x2",v.positionScreen.x);B.setAttribute("y2",v.positionScreen.y);w instanceof THREE.LineBasicMaterial&&(B.setAttribute("style","fill: none; stroke: ##"+g(w.color.hex.toString(16))+"; stroke-width: "+w.linewidth+"; stroke-opacity: "+
w.opacity+"; stroke-linecap: "+w.linecap+"; stroke-linejoin: "+w.linejoin),m.appendChild(B))}}}else if(s instanceof THREE.RenderableFace3){if(p=s.v1,q=s.v2,t=s.v3,p.positionScreen.x*=i,p.positionScreen.y*=-o,q.positionScreen.x*=i,q.positionScreen.y*=-o,t.positionScreen.x*=i,t.positionScreen.y*=-o,y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(q.positionScreen.x,q.positionScreen.y),y.addPoint(t.positionScreen.x,t.positionScreen.y),G.instersects(y)){l=0;for(n=s.meshMaterials.length;l< w.opacity+"; stroke-linecap: "+w.linecap+"; stroke-linejoin: "+w.linejoin),n.appendChild(B))}}}else if(s instanceof THREE.RenderableFace3){if(p=s.v1,q=s.v2,t=s.v3,p.positionScreen.x*=k,p.positionScreen.y*=-j,q.positionScreen.x*=k,q.positionScreen.y*=-j,t.positionScreen.x*=k,t.positionScreen.y*=-j,y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(q.positionScreen.x,q.positionScreen.y),y.addPoint(t.positionScreen.x,t.positionScreen.y),G.instersects(y)){l=0;for(m=s.meshMaterials.length;l<
n;)if(w=s.meshMaterials[l++],w instanceof THREE.MeshFaceMaterial){r=0;for(v=s.faceMaterials.length;r<v;)(w=s.faceMaterials[r++])&&w.opacity!=0&&b(p,q,t,s,w,a)}else w&&w.opacity!=0&&b(p,q,t,s,w,a)}}else if(s instanceof THREE.RenderableFace4&&(p=s.v1,q=s.v2,t=s.v3,u=s.v4,p.positionScreen.x*=i,p.positionScreen.y*=-o,q.positionScreen.x*=i,q.positionScreen.y*=-o,t.positionScreen.x*=i,t.positionScreen.y*=-o,u.positionScreen.x*=i,u.positionScreen.y*=-o,y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(q.positionScreen.x, m;)if(w=s.meshMaterials[l++],w instanceof THREE.MeshFaceMaterial){r=0;for(v=s.faceMaterials.length;r<v;)(w=s.faceMaterials[r++])&&w.opacity!=0&&b(p,q,t,s,w,a)}else w&&w.opacity!=0&&b(p,q,t,s,w,a)}}else if(s instanceof THREE.RenderableFace4&&(p=s.v1,q=s.v2,t=s.v3,u=s.v4,p.positionScreen.x*=k,p.positionScreen.y*=-j,q.positionScreen.x*=k,q.positionScreen.y*=-j,t.positionScreen.x*=k,t.positionScreen.y*=-j,u.positionScreen.x*=k,u.positionScreen.y*=-j,y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(q.positionScreen.x,
q.positionScreen.y),y.addPoint(t.positionScreen.x,t.positionScreen.y),y.addPoint(u.positionScreen.x,u.positionScreen.y),G.instersects(y))){l=0;for(n=s.meshMaterials.length;l<n;)if(w=s.meshMaterials[l++],w instanceof THREE.MeshFaceMaterial){r=0;for(v=s.faceMaterials.length;r<v;)(w=s.faceMaterials[r++])&&w.opacity!=0&&c(p,q,t,u,s,w,a)}else w&&w.opacity!=0&&c(p,q,t,u,s,w,a)}}}; q.positionScreen.y),y.addPoint(t.positionScreen.x,t.positionScreen.y),y.addPoint(u.positionScreen.x,u.positionScreen.y),G.instersects(y))){l=0;for(m=s.meshMaterials.length;l<m;)if(w=s.meshMaterials[l++],w instanceof THREE.MeshFaceMaterial){r=0;for(v=s.faceMaterials.length;r<v;)(w=s.faceMaterials[r++])&&w.opacity!=0&&c(p,q,t,u,s,w,a)}else w&&w.opacity!=0&&c(p,q,t,u,s,w,a)}}};
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(void 0,!1,b);var c=a.sounds,d,e=c.length;for(d=0;d<e;d++)a=c[d],this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34),this.soundPosition.subSelf(b.position),a.isPlaying&&a.isLoaded&&(a.isAddedToDOM||a.addToDOM(this.domElement),a.calculateVolumeAndPan(this.soundPosition))}}; THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(void 0,!1,b);var c=a.sounds,d,e=c.length;for(d=0;d<e;d++)a=c[d],this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34),this.soundPosition.subSelf(b.position),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};
......
...@@ -11,20 +11,21 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit ...@@ -11,20 +11,21 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit
Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,e,f){this.set(b||0,d||0,e||0,f||1)}; Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,e,f){this.set(b||0,d||0,e||0,f||1)};
THREE.Vector4.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x* THREE.Vector4.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3}; b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f,g=[];d=0;for(e=b.length;d<e;d++)f=b[d],f instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(f)));g.sort(function(b,d){return b.distance-d.distance});return g},intersectObject:function(b){function d(b,d,e,f){var f=f.clone().subSelf(d),e=e.clone().subSelf(d),g=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-d*d),h=(h*f-d*e)*g,b=(b* THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f=[];d=0;for(e=b.length;d<e;d++)f=f.concat(this.intersectObject(b[d]));f.sort(function(b,d){return b.distance-d.distance});return f},intersectObject:function(b){function d(b,d,e){var f;f=e.position.clone().subSelf(b).dot(d);if(f<0)return!1;b=b.clone().addSelf(d.clone().multiplyScalar(f));return e.position.distanceTo(b)}function e(b,d,e,f){var f=f.clone().subSelf(d),e=e.clone().subSelf(d),
e-d*f)*g;return h>0&&b>0&&h+b<1}var e,f,g,i,h,j,k,o,r,n,v,q=b.geometry,z=q.vertices,C=[];e=0;for(f=q.faces.length;e<f;e++)if(g=q.faces[e],n=this.origin.clone(),v=this.direction.clone(),k=b.matrixWorld,i=k.multiplyVector3(z[g.a].position.clone()),h=k.multiplyVector3(z[g.b].position.clone()),j=k.multiplyVector3(z[g.c].position.clone()),k=g instanceof THREE.Face4?k.multiplyVector3(z[g.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(g.normal.clone()),r=v.dot(o),b.doubleSided||(b.flipSided? g=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-d*d),h=(h*f-d*e)*g,b=(b*e-d*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=[],g=d(this.origin,this.direction,b);g&&g<b.scale.x&&f.push({distance:g,point:b.position,object:b});return f}else if(b instanceof THREE.Mesh){var i,h,j,k,o,n,q,r,v,z,C=b.geometry,D=C.vertices,f=[],g=0;for(i=C.faces.length;g<i;g++)if(h=C.faces[g],v=this.origin.clone(),z=this.direction.clone(),n=b.matrixWorld,j=n.multiplyVector3(D[h.a].position.clone()),
r>0:r<0))if(o=o.dot((new THREE.Vector3).sub(i,n))/r,n=n.addSelf(v.multiplyScalar(o)),g instanceof THREE.Face3)d(n,i,h,j)&&(g={distance:this.origin.distanceTo(n),point:n,face:g,object:b},C.push(g));else if(g instanceof THREE.Face4&&(d(n,i,h,k)||d(n,h,j,k)))g={distance:this.origin.distanceTo(n),point:n,face:g,object:b},C.push(g);return C}}; k=n.multiplyVector3(D[h.b].position.clone()),o=n.multiplyVector3(D[h.c].position.clone()),n=h instanceof THREE.Face4?n.multiplyVector3(D[h.d].position.clone()):null,q=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),r=z.dot(q),b.doubleSided||(b.flipSided?r>0:r<0))if(q=q.dot((new THREE.Vector3).sub(j,v))/r,v=v.addSelf(z.multiplyScalar(q)),h instanceof THREE.Face3)e(v,j,k,o)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},f.push(h));else if(h instanceof THREE.Face4&&(e(v,j,k,
THREE.Rectangle=function(){function b(){i=f-d;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,r,n){j=!1;d=h;e=i;f=r;g=n;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=d<h?d:h,e=e<i?e:i,f=f>h?f:h,g=g>i?g:i);b()};this.add3Points= n)||e(v,k,o,n)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},f.push(h);return f}}};
function(h,i,r,n,v,q){j?(j=!1,d=h<r?h<v?h:v:r<v?r:v,e=i<n?i<q?i:q:n<q?n:q,f=h>r?h>v?h:v:r>v?r:v,g=i>n?i>q?i:q:n>q?n:q):(d=h<r?h<v?h<d?h:d:v<d?v:d:r<v?r<d?r:d:v<d?v:d,e=i<n?i<q?i<e?i:e:q<e?q:e:n<q?n<e?n:e:q<e?q:e,f=h>r?h>v?h>f?h:f:v>f?v:f:r>v?r>f?r:f:v>f?v:f,g=i>n?i>q?i>g?i:g:q>g?q:g:n>q?n>g?n:g:q>g?q:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=d<h.getLeft()?d:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g> THREE.Rectangle=function(){function b(){i=f-d;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,n,q){j=!1;d=h;e=i;f=n;g=q;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=d<h?d:h,e=e<i?e:i,f=f>h?f:h,g=g>i?g:i);b()};this.add3Points=
function(h,i,n,q,r,v){j?(j=!1,d=h<n?h<r?h:r:n<r?n:r,e=i<q?i<v?i:v:q<v?q:v,f=h>n?h>r?h:r:n>r?n:r,g=i>q?i>v?i:v:q>v?q:v):(d=h<n?h<r?h<d?h:d:r<d?r:d:n<r?n<d?n:d:r<d?r:d,e=i<q?i<v?i<e?i:e:v<e?v:e:q<v?q<e?q:e:v<e?v:e,f=h>n?h>r?h>f?h:f:r>f?r:f:n>r?n>f?n:f:r>f?r:f,g=i>q?i>v?i>g?i:g:v>g?v:g:q>v?q>g?q:g:v>g?v:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=d<h.getLeft()?d:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){d-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){d=d>h.getLeft()?d:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(d,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;g=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]}; h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){d-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){d=d>h.getLeft()?d:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(d,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;g=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,g,i,h,j,k,o,r,n,v,q,z,C){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,k||0,o||0,r||1,n||0,v||0,q||0,z||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,g,i,h,j,k,o,n,q,r,v,z,C){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,k||0,o||0,n||1,q||0,r||0,v||0,z||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,k,o,r,n,v,q,z,C){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=k;this.n32=o;this.n33=r;this.n34=n;this.n41=v;this.n42=q;this.n43=z;this.n44=C;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1, THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,k,o,n,q,r,v,z,C){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=k;this.n32=o;this.n33=n;this.n34=q;this.n41=r;this.n42=v;this.n43=z;this.n44=C;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1,
g=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());g.cross(i,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=i.x;this.n21=f.y;this.n22=g.y;this.n23=i.y;this.n31=f.z;this.n32=g.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,g=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23* g=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());g.cross(i,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=i.x;this.n21=f.y;this.n22=g.y;this.n23=i.y;this.n31=f.z;this.n32=g.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,g=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23*
f+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+e*this.n32+f*this.n33;b.normalize(); f+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+e*this.n32+f*this.n33;b.normalize();
return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,r=b.n31,n=b.n32,v=b.n33,q=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44,S=d.n11,Q=d.n12,L=d.n13,B=d.n14,x=d.n21,R=d.n22, return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,n=b.n31,q=b.n32,r=b.n33,v=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44,S=d.n11,Q=d.n12,L=d.n13,B=d.n14,x=d.n21,R=d.n22,
J=d.n23,aa=d.n24,E=d.n31,$=d.n32,c=d.n33,ja=d.n34;this.n11=e*S+f*x+g*E;this.n12=e*Q+f*R+g*$;this.n13=e*L+f*J+g*c;this.n14=e*B+f*aa+g*ja+i;this.n21=h*S+j*x+k*E;this.n22=h*Q+j*R+k*$;this.n23=h*L+j*J+k*c;this.n24=h*B+j*aa+k*ja+o;this.n31=r*S+n*x+v*E;this.n32=r*Q+n*R+v*$;this.n33=r*L+n*J+v*c;this.n34=r*B+n*aa+v*ja+q;this.n41=z*S+C*x+D*E;this.n42=z*Q+C*R+D*$;this.n43=z*L+C*J+D*c;this.n44=z*B+C*aa+D*ja+y;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31; J=d.n23,aa=d.n24,E=d.n31,$=d.n32,c=d.n33,ja=d.n34;this.n11=e*S+f*x+g*E;this.n12=e*Q+f*R+g*$;this.n13=e*L+f*J+g*c;this.n14=e*B+f*aa+g*ja+i;this.n21=h*S+j*x+k*E;this.n22=h*Q+j*R+k*$;this.n23=h*L+j*J+k*c;this.n24=h*B+j*aa+k*ja+o;this.n31=n*S+q*x+r*E;this.n32=n*Q+q*R+r*$;this.n33=n*L+q*J+r*c;this.n34=n*B+q*aa+r*ja+v;this.n41=z*S+C*x+D*E;this.n42=z*Q+C*R+D*$;this.n43=z*L+C*J+D*c;this.n44=z*B+C*aa+D*ja+y;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;
e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b= e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=
this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,r=this.n33,n=this.n34,v=this.n41,q=this.n42,z=this.n43,C=this.n44;return f*h*o*v-e*j*o*v-f*i*r*v+d*j*r*v+e*i*n*v-d*h*n*v-f*h*k*q+e*j*k*q+f*g*r*q-b*j*r*q-e*g*n*q+b*h*n*q+f*i*k*z-d*j*k*z-f*g*o*z+b*j*o*z+d*g*n*z-b*i*n*z-e*i*k*C+d*h*k*C+e*g*o*C-b*h*o*C-d*g*r*C+b*i*r*C},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32= this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,n=this.n33,q=this.n34,r=this.n41,v=this.n42,z=this.n43,C=this.n44;return f*h*o*r-e*j*o*r-f*i*n*r+d*j*n*r+e*i*q*r-d*h*q*r-f*h*k*v+e*j*k*v+f*g*n*v-b*j*n*v-e*g*q*v+b*h*q*v+f*i*k*z-d*j*k*z-f*g*o*z+b*j*o*z+d*g*q*z-b*i*q*z-e*i*k*C+d*h*k*C+e*g*o*C-b*h*o*C-d*g*n*C+b*i*n*C},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=
this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21; this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},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(b){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.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(b){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 b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(b, this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(b,
...@@ -33,9 +34,9 @@ i+e,k*h-f*j,k*j+f*h,0,k*h+f*j,o*h+e,o*j-f*i,0,k*j-f*h,o*j+f*i,g*j*j+e,0,0,0,0,1) ...@@ -33,9 +34,9 @@ i+e,k*h-f*j,k*j+f*h,0,k*h+f*j,o*h+e,o*j-f*i,0,k*j-f*h,o*j+f*i,g*j*j+e,0,0,0,0,1)
this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,e=b.y,f=b.z,b=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),h=b*e,j=d*e;this.n11=g*i;this.n12=-g*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*g;this.n31=-h*i+d*f;this.n32=h*f+d*i;this.n33=b*g;return this}, this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,e=b.y,f=b.z,b=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),h=b*e,j=d*e;this.n11=g*i;this.n12=-g*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*g;this.n31=-h*i+d*f;this.n32=h*f+d*i;this.n33=b*g;return this},
setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,k=d*h;d*=j;var o=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(o+f);this.n12=k-g;this.n13=d+h;this.n21=k+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;this.n32=e+i;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14= setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,k=d*h;d*=j;var o=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(o+f);this.n12=k-g;this.n13=d+h;this.n21=k+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;this.n32=e+i;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,r=b.n31,n=b.n32,v=b.n33,q=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=k*q*C-o*v*C+o*n*D-j*q*D-k*n*y+j*v*y;d.n12=i*v*C-g*q*C-i*n*D+f*q*D+g*n*y-f*v*y;d.n13=g*o*C-i*k*C+i*j*D-f*o*D-g*j*y+f*k*y;d.n14=i*k*n-g*o*n-i*j*v+f*o*v+g*j*q-f*k*q;d.n21=o*v*z-k*q*z-o*r*D+h*q*D+k*r*y-h*v*y;d.n22=g*q*z-i*v*z+i*r*D-e*q*D-g*r*y+e*v*y;d.n23=i*k*z-g*o*z-i*h*D+e*o*D+g*h*y-e*k*y;d.n24= THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,n=b.n31,q=b.n32,r=b.n33,v=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=k*v*C-o*r*C+o*q*D-j*v*D-k*q*y+j*r*y;d.n12=i*r*C-g*v*C-i*q*D+f*v*D+g*q*y-f*r*y;d.n13=g*o*C-i*k*C+i*j*D-f*o*D-g*j*y+f*k*y;d.n14=i*k*q-g*o*q-i*j*r+f*o*r+g*j*v-f*k*v;d.n21=o*r*z-k*v*z-o*n*D+h*v*D+k*n*y-h*r*y;d.n22=g*v*z-i*r*z+i*n*D-e*v*D-g*n*y+e*r*y;d.n23=i*k*z-g*o*z-i*h*D+e*o*D+g*h*y-e*k*y;d.n24=
g*o*r-i*k*r+i*h*v-e*o*v-g*h*q+e*k*q;d.n31=j*q*z-o*n*z+o*r*C-h*q*C-j*r*y+h*n*y;d.n32=i*n*z-f*q*z-i*r*C+e*q*C+f*r*y-e*n*y;d.n33=g*o*z-i*j*z+i*h*C-e*o*C-f*h*y+e*j*y;d.n34=i*j*r-f*o*r-i*h*n+e*o*n+f*h*q-e*j*q;d.n41=k*n*z-j*v*z-k*r*C+h*v*C+j*r*D-h*n*D;d.n42=f*v*z-g*n*z+g*r*C-e*v*C-f*r*D+e*n*D;d.n43=g*j*z-f*k*z-g*h*C+e*k*C+f*h*D-e*j*D;d.n44=f*k*r-g*j*r+g*h*n-e*k*n-f*h*v+e*j*v;d.multiplyScalar(1/b.determinant());return d}; g*o*n-i*k*n+i*h*r-e*o*r-g*h*v+e*k*v;d.n31=j*v*z-o*q*z+o*n*C-h*v*C-j*n*y+h*q*y;d.n32=i*q*z-f*v*z-i*n*C+e*v*C+f*n*y-e*q*y;d.n33=g*o*z-i*j*z+i*h*C-e*o*C-f*h*y+e*j*y;d.n34=i*j*n-f*o*n-i*h*q+e*o*q+f*h*v-e*j*v;d.n41=k*q*z-j*r*z-k*n*C+h*r*C+j*n*D-h*q*D;d.n42=f*r*z-g*q*z+g*n*C-e*r*C-f*n*D+e*q*D;d.n43=g*j*z-f*k*z-g*h*C+e*k*C+f*h*D-e*j*D;d.n44=f*k*n-g*j*n+g*h*q-e*k*q-f*h*r+e*j*r;d.multiplyScalar(1/b.determinant());return d};
THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,k=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,r=-b.n23*b.n11+b.n21*b.n13,n=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*o;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*k;e[6]=b*o;e[7]=b*r;e[8]=b*n;return d}; THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,k=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,q=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*k;e[6]=b*o;e[7]=b*n;e[8]=b*q;return d};
THREE.Matrix4.makeFrustum=function(b,d,e,f,g,i){var h;h=new THREE.Matrix4;h.n11=2*g/(d-b);h.n12=0;h.n13=(d+b)/(d-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(i+g)/(i-g);h.n34=-2*i*g/(i-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,d,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,f)}; THREE.Matrix4.makeFrustum=function(b,d,e,f,g,i){var h;h=new THREE.Matrix4;h.n11=2*g/(d-b);h.n12=0;h.n13=(d+b)/(d-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(i+g)/(i-g);h.n34=-2*i*g/(i-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,d,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,f)};
THREE.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,k,o;h=new THREE.Matrix4;j=d-b;k=e-f;o=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((e+f)/k);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((i+g)/o);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.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,k,o;h=new THREE.Matrix4;j=d-b;k=e-f;o=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((e+f)/k);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((i+g)/o);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=void 0;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.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1; THREE.Object3D=function(){this.parent=void 0;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.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
...@@ -46,8 +47,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m ...@@ -46,8 +47,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
this.scale),this.matrixWorldNeedsUpdate=!1,d=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,d,e)}};THREE.Quaternion=function(b,d,e,f){this.set(b||0,d||0,e||0,f!==void 0?f:1)}; this.scale),this.matrixWorldNeedsUpdate=!1,d=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,d,e)}};THREE.Quaternion=function(b,d,e,f){this.set(b||0,d||0,e||0,f!==void 0?f:1)};
THREE.Quaternion.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,f=b.y*d,g=b.z*d,b=Math.cos(f),f=Math.sin(f),d=Math.cos(-g),g=Math.sin(-g),i=Math.cos(e),e=Math.sin(e),h=b*d,j=f*g;this.w=h*i-j*e;this.x=h*e+j*i;this.y=f*d*i+b*g*e;this.z=b*g*i-f*d*e;return this},setFromAxisAngle:function(b,d){var e=d/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y* THREE.Quaternion.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,f=b.y*d,g=b.z*d,b=Math.cos(f),f=Math.sin(f),d=Math.cos(-g),g=Math.sin(-g),i=Math.cos(e),e=Math.sin(e),h=b*d,j=f*g;this.w=h*i-j*e;this.x=h*e+j*i;this.y=f*d*i+b*g*e;this.z=b*g*i-f*d*e;return this},setFromAxisAngle:function(b,d){var e=d/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
f;this.z=b.z*f;this.w=Math.cos(e);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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this}, f;this.z=b.z*f;this.w=Math.cos(e);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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,g=this.w,i=b.x,h=b.y,j=b.z,b=b.w;this.x=d*b+g*i+e*j-f*h;this.y=e*b+g*h+f*i-d*j;this.z=f*b+g*j+d*h-e*i;this.w=g*b-d*i-e*h-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,g=b.z,i=this.x,h=this.y,j=this.z,k=this.w,o=k*e+h*g-j*f,r= multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,g=this.w,i=b.x,h=b.y,j=b.z,b=b.w;this.x=d*b+g*i+e*j-f*h;this.y=e*b+g*h+f*i-d*j;this.z=f*b+g*j+d*h-e*i;this.w=g*b-d*i-e*h-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,g=b.z,i=this.x,h=this.y,j=this.z,k=this.w,o=k*e+h*g-j*f,n=
k*f+j*e-i*g,n=k*g+i*f-h*e,e=-i*e-h*f-j*g;d.x=o*k+e*-i+r*-j-n*-h;d.y=r*k+e*-h+n*-i-o*-j;d.z=n*k+e*-j+o*-h-r*-i;return d}}; k*f+j*e-i*g,q=k*g+i*f-h*e,e=-i*e-h*f-j*g;d.x=o*k+e*-i+n*-j-q*-h;d.y=n*k+e*-h+q*-i-o*-j;d.z=q*k+e*-j+o*-h-n*-i;return d}};
THREE.Quaternion.slerp=function(b,d,e,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;g=Math.sin((1-f)*i)/h;f=Math.sin(f*i)/h;e.w=b.w*g+d.w*f;e.x=b.x*g+d.x*f;e.y=b.y*g+d.y*f;e.z=b.z*g+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; THREE.Quaternion.slerp=function(b,d,e,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;g=Math.sin((1-f)*i)/h;f=Math.sin(f*i)/h;e.w=b.w*g+d.w*f;e.x=b.x*g+d.x*f;e.y=b.y*g+d.y*f;e.z=b.z*g+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
THREE.Face3=function(b,d,e,f,g,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3}; THREE.Face3=function(b,d,e,f,g,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
THREE.Face4=function(b,d,e,f,g,i,h){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; THREE.Face4=function(b,d,e,f,g,i,h){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
...@@ -56,15 +57,15 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.f ...@@ -56,15 +57,15 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.f
e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,g,i,h,j=new THREE.Vector3,k=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);d=0;for(e=i.vertexNormals.length;d<e;d++)j.addSelf(i.vertexNormals[d]);j.divideScalar(3)}else d=this.vertices[i.a],e=this.vertices[i.b],h=this.vertices[i.c],j.sub(h.position,e.position),k.sub(d.position,e.position),j.crossSelf(k);j.isZero()|| e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,g,i,h,j=new THREE.Vector3,k=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);d=0;for(e=i.vertexNormals.length;d<e;d++)j.addSelf(i.vertexNormals[d]);j.divideScalar(3)}else d=this.vertices[i.a],e=this.vertices[i.b],h=this.vertices[i.c],j.sub(h.position,e.position),k.sub(d.position,e.position),j.crossSelf(k);j.isZero()||
j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,d,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f= j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,d,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]), this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,d,e,f,g,i,J){j=b.vertices[d].position;k=b.vertices[e].position;o=b.vertices[f].position;r=h[g];n=h[i];v=h[J];q=k.x-j.x;z=o.x-j.x;C=k.y-j.y;D=o.y-j.y;y=k.z-j.z;S=o.z-j.z;Q=n.u-r.u;L=v.u-r.u;B=n.v-r.v;x=v.v-r.v;R=1/(Q*x-L*B);$.set((x*q-B*z)* e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,d,e,f,g,i,J){j=b.vertices[d].position;k=b.vertices[e].position;o=b.vertices[f].position;n=h[g];q=h[i];r=h[J];v=k.x-j.x;z=o.x-j.x;C=k.y-j.y;D=o.y-j.y;y=k.z-j.z;S=o.z-j.z;Q=q.u-n.u;L=r.u-n.u;B=q.v-n.v;x=r.v-n.v;R=1/(Q*x-L*B);$.set((x*v-B*z)*
R,(x*C-B*D)*R,(x*y-B*S)*R);c.set((Q*z-L*q)*R,(Q*D-L*C)*R,(Q*S-L*y)*R);aa[d].addSelf($);aa[e].addSelf($);aa[f].addSelf($);E[d].addSelf(c);E[e].addSelf(c);E[f].addSelf(c)}var d,e,f,g,i,h,j,k,o,r,n,v,q,z,C,D,y,S,Q,L,B,x,R,J,aa=[],E=[],$=new THREE.Vector3,c=new THREE.Vector3,ja=new THREE.Vector3,oa=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)aa[d]=new THREE.Vector3,E[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],h=this.faceVertexUvs[0][d],i instanceof R,(x*C-B*D)*R,(x*y-B*S)*R);c.set((Q*z-L*v)*R,(Q*D-L*C)*R,(Q*S-L*y)*R);aa[d].addSelf($);aa[e].addSelf($);aa[f].addSelf($);E[d].addSelf(c);E[e].addSelf(c);E[f].addSelf(c)}var d,e,f,g,i,h,j,k,o,n,q,r,v,z,C,D,y,S,Q,L,B,x,R,J,aa=[],E=[],$=new THREE.Vector3,c=new THREE.Vector3,ja=new THREE.Vector3,oa=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)aa[d]=new THREE.Vector3,E[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],h=this.faceVertexUvs[0][d],i instanceof
THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var ra=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)Aa.copy(i.vertexNormals[f]),g=i[ra[f]],J=aa[g],ja.copy(J),ja.subSelf(Aa.multiplyScalar(Aa.dot(J))).normalize(),oa.cross(i.vertexNormals[f],J),g=oa.dot(E[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(ja.x,ja.y,ja.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b; THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var ra=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)Aa.copy(i.vertexNormals[f]),g=i[ra[f]],J=aa[g],ja.copy(J),ja.subSelf(Aa.multiplyScalar(Aa.dot(J))).normalize(),oa.cross(i.vertexNormals[f],J),g=oa.dot(E[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(ja.x,ja.y,ja.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
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 d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y; 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 d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b, else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,
d)+"_"+Math.max(b,d)}function d(b,d,e){b[d]===void 0?(b[d]={set:{},array:[]},b[d].set[e]=1,b[d].array.push(e)):b[d].set[e]===void 0&&(b[d].set[e]=1,b[d].array.push(e))}var e,f,g,i,h,j={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.a,h.c),d(j,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),d(j,g,e),g=b(h.a,h.b),d(j,g,e),g=b(h.a,h.d),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.c,h.d),d(j,g,e));e=0;for(f=this.edges.length;e<f;e++){h= d)+"_"+Math.max(b,d)}function d(b,d,e){b[d]===void 0?(b[d]={set:{},array:[]},b[d].set[e]=1,b[d].array.push(e)):b[d].set[e]===void 0&&(b[d].set[e]=1,b[d].array.push(e))}var e,f,g,i,h,j={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.a,h.c),d(j,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),d(j,g,e),g=b(h.a,h.b),d(j,g,e),g=b(h.a,h.d),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.c,h.d),d(j,g,e));e=0;for(f=this.edges.length;e<f;e++){h=
this.edges[e];g=h.vertexIndices[0];i=h.vertexIndices[1];h.faceIndices=j[b(g,i)].array;for(g=0;g<h.faceIndices.length;g++)i=h.faceIndices[g],h.faces.push(this.faces[i])}}};THREE.GeometryIdCounter=0; this.edges[e];g=h.vertexIndices[0];i=h.vertexIndices[1];h.faceIndices=j[b(g,i)].array;for(g=0;g<h.faceIndices.length;g++)i=h.faceIndices[g],h.faces.push(this.faces[i])}}};THREE.GeometryIdCounter=0;
THREE.Spline=function(b){function d(b,d,e,f,g,h,i){b=(e-b)*0.5;f=(f-d)*0.5;return(2*(d-e)+b+f)*i+(-3*(d-e)-2*b-f)*h+b*g+d}this.points=b;var e=[],f={x:0,y:0,z:0},g,i,h,j,k,o,r,n,v;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;i=Math.floor(g);h=g-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;o=this.points[e[0]];r=this.points[e[1]]; THREE.Spline=function(b){function d(b,d,e,f,g,h,i){b=(e-b)*0.5;f=(f-d)*0.5;return(2*(d-e)+b+f)*i+(-3*(d-e)-2*b-f)*h+b*g+d}this.points=b;var e=[],f={x:0,y:0,z:0},g,i,h,j,k,o,n,q,r;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;i=Math.floor(g);h=g-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;o=this.points[e[0]];n=this.points[e[1]];
n=this.points[e[2]];v=this.points[e[3]];j=h*h;k=h*j;f.x=d(o.x,r.x,n.x,v.x,h,j,k);f.y=d(o.y,r.y,n.y,v.y,h,j,k);f.z=d(o.z,r.z,n.z,v.z,h,j,k);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;g.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),h.copy(position), q=this.points[e[2]];r=this.points[e[3]];j=h*h;k=h*j;f.x=d(o.x,n.x,q.x,r.x,h,j,k);f.y=d(o.y,n.y,q.y,r.y,h,j,k);f.z=d(o.z,n.z,q.z,r.z,h,j,k);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;g.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),h.copy(position),
j+=h.distanceTo(g),g.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=f&&(i[d]=j,f=d);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(b){var d,e,f,g,h,i,j=[],k=new THREE.Vector3,o=this.getLength();j.push(k.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){e=o.chunks[d]-o.chunks[d-1];i=Math.ceil(b*e/o.total);g=(d-1)/(this.points.length-1);h=d/(this.points.length-1);for(e=1;e<i-1;e++)f=g+e*(1/i)*(h-g),position=this.getPoint(f),j.push(k.copy(position).clone()); j+=h.distanceTo(g),g.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=f&&(i[d]=j,f=d);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(b){var d,e,f,g,h,i,j=[],k=new THREE.Vector3,o=this.getLength();j.push(k.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){e=o.chunks[d]-o.chunks[d-1];i=Math.ceil(b*e/o.total);g=(d-1)/(this.points.length-1);h=d/(this.points.length-1);for(e=1;e<i-1;e++)f=g+e*(1/i)*(h-g),position=this.getPoint(f),j.push(k.copy(position).clone());
j.push(k.copy(this.points[d]).clone())}this.points=j}};THREE.Edge=function(b,d,e,f){this.vertices=[b,d];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D; j.push(k.copy(this.points[d]).clone())}this.points=j}};THREE.Edge=function(b,d,e,f){this.vertices=[b,d];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=f||2E3;this.target=g||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(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)}; THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
...@@ -118,13 +119,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi ...@@ -118,13 +119,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1, THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()}; this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype; THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,g,i,h,j,k,o,r,n,v,q,z=new THREE.Geometry;z.vertices=this.geometry.vertices;f=z.faces=this.geometry.faces;var C=z.egdes=this.geometry.edges,D=z.edgeFaces=[];g=0;var y=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],y.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]= THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,g,i,h,j,k,o,n,q,r,v,z=new THREE.Geometry;z.vertices=this.geometry.vertices;f=z.faces=this.geometry.faces;var C=z.egdes=this.geometry.edges,D=z.edgeFaces=[];g=0;var y=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],y.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
e.normal;b=0;for(d=C.length;b<d;b++)j=C[b],e=j.faces[0],f=j.faces[1],g=j.faceIndices[0],i=j.faceIndices[1],h=j.vertexIndices[0],j=j.vertexIndices[1],e.a===h?(k="a",r=y[g]+0):e.b===h?(k="b",r=y[g]+1):e.c===h?(k="c",r=y[g]+2):e.d===h&&(k="d",r=y[g]+3),e.a===j?(k+="a",n=y[g]+0):e.b===j?(k+="b",n=y[g]+1):e.c===j?(k+="c",n=y[g]+2):e.d===j&&(k+="d",n=y[g]+3),f.a===h?(o="a",v=y[i]+0):f.b===h?(o="b",v=y[i]+1):f.c===h?(o="c",v=y[i]+2):f.d===h&&(o="d",v=y[i]+3),f.a===j?(o+="a",q=y[i]+0):f.b===j?(o+="b",q=y[i]+ e.normal;b=0;for(d=C.length;b<d;b++)j=C[b],e=j.faces[0],f=j.faces[1],g=j.faceIndices[0],i=j.faceIndices[1],h=j.vertexIndices[0],j=j.vertexIndices[1],e.a===h?(k="a",n=y[g]+0):e.b===h?(k="b",n=y[g]+1):e.c===h?(k="c",n=y[g]+2):e.d===h&&(k="d",n=y[g]+3),e.a===j?(k+="a",q=y[g]+0):e.b===j?(k+="b",q=y[g]+1):e.c===j?(k+="c",q=y[g]+2):e.d===j&&(k+="d",q=y[g]+3),f.a===h?(o="a",r=y[i]+0):f.b===h?(o="b",r=y[i]+1):f.c===h?(o="c",r=y[i]+2):f.d===h&&(o="d",r=y[i]+3),f.a===j?(o+="a",v=y[i]+0):f.b===j?(o+="b",v=y[i]+
1):f.c===j?(o+="c",q=y[i]+2):f.d===j&&(o+="d",q=y[i]+3),k==="ac"||k==="ad"||k==="ca"||k==="da"?r>n&&(e=r,r=n,n=e):r<n&&(e=r,r=n,n=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?v>q&&(e=v,v=q,q=e):v<q&&(e=v,v=q,q=e),e=new THREE.Face4(r,n,v,q),e.normal.set(1,0,0),D.push(e);this.geometry=z}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)}; 1):f.c===j?(o+="c",v=y[i]+2):f.d===j&&(o+="d",v=y[i]+3),k==="ac"||k==="ad"||k==="ca"||k==="da"?n>q&&(e=n,n=q,q=e):n<q&&(e=n,n=q,q=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?r>v&&(e=r,r=v,v=e):r<v&&(e=r,r=v,v=e),e=new THREE.Face4(n,q,r,v),e.normal.set(1,0,0),D.push(e);this.geometry=z}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,i=g.length,h,j,k,o,r,n=["a","b","c","d"];for(k=0;k<i;k++){j=d.length;h=g[k];h instanceof THREE.Face4?(o=4,j=new THREE.Face4(j,j+1,j+2,j+3)):(o=3,j=new THREE.Face3(j,j+1,j+2));j.normal.copy(h.normal);e.push(j); THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,i=g.length,h,j,k,o,n,q=["a","b","c","d"];for(k=0;k<i;k++){j=d.length;h=g[k];h instanceof THREE.Face4?(o=4,j=new THREE.Face4(j,j+1,j+2,j+3)):(o=3,j=new THREE.Face3(j,j+1,j+2));j.normal.copy(h.normal);e.push(j);
for(j=0;j<o;j++)r=b[h[n[j]]],d.push(new THREE.Vertex(r.position.clone()))}for(i=0;i<g.length-1;i++){b=e[i];for(h=i+1;h<g.length;h++)j=e[h],j=this.facesShareEdge(d,b,j),j!==void 0&&(j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]),j.normal.set(1,0,0),f.push(j))}}; for(j=0;j<o;j++)n=b[h[q[j]]],d.push(new THREE.Vertex(n.position.clone()))}for(i=0;i<g.length-1;i++){b=e[i];for(h=i+1;h<g.length;h++)j=e[h],j=this.facesShareEdge(d,b,j),j!==void 0&&(j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]),j.normal.set(1,0,0),f.push(j))}};
THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,g,i,h,j,k,o,r,n,v,q,z,C,D=0,y=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(z=0;z<f;z++){i=d[y[z]];j=b[i];for(C=0;C<g;C++)if(h=e[y[C]],k=b[h],Math.abs(j.position.x-k.position.x)<1.0E-4&&Math.abs(j.position.y-k.position.y)<1.0E-4&&Math.abs(j.position.z-k.position.z)<1.0E-4&&(D++,D===1&&(o=j,r=k,n=i,v=h,q=y[z]),D===2))return q+=y[z],q==="ad"||q==="ac"?{faces:[d,e],vertices:[o,r,k,j],indices:[n,v, THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,g,i,h,j,k,o,n,q,r,v,z,C,D=0,y=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(z=0;z<f;z++){i=d[y[z]];j=b[i];for(C=0;C<g;C++)if(h=e[y[C]],k=b[h],Math.abs(j.position.x-k.position.x)<1.0E-4&&Math.abs(j.position.y-k.position.y)<1.0E-4&&Math.abs(j.position.z-k.position.z)<1.0E-4&&(D++,D===1&&(o=j,n=k,q=i,r=h,v=y[z]),D===2))return v+=y[z],v==="ad"||v==="ac"?{faces:[d,e],vertices:[o,n,k,j],indices:[q,r,
h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[o,j,k,r],indices:[n,i,h,v],vertexTypes:[1,1,2,2],extrudable:!0}}}; h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[o,j,k,n],indices:[q,i,h,r],vertexTypes:[1,1,2,2],extrudable:!0}}};
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance= THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=
b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype; b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1); THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
...@@ -133,14 +134,14 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c ...@@ -133,14 +134,14 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])}; THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else b instanceof THREE.Sound?(d=this.sounds.indexOf(b),d!==-1&&this.sounds.splice(d,1)):b instanceof THREE.Camera||(d=this.objects.indexOf(b),d!==-1&&(this.objects.splice(d,1),this.__objectsRemoved.push(b)));for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])}; THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else b instanceof THREE.Sound?(d=this.sounds.indexOf(b),d!==-1&&this.sounds.splice(d,1)):b instanceof THREE.Camera||(d=this.objects.indexOf(b),d!==-1&&(this.objects.splice(d,1),this.__objectsRemoved.push(b)));for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
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(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==void 0?d: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(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==void 0?d:2.5E-4};
THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function d(b,c){return c.z-b.z}function e(b,c){var d=0,e=1,f=b.z+b.w,g=c.z+c.w,h=-b.z+b.w,i=-c.z+c.w;return f>=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?d=Math.max(d,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),h<0?d=Math.max(d,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,g,i=[],h,j,k=[],o,r,n=[],v,q=[],z,C,D=[],y,S,Q=[],L=new THREE.Vector4,B=new THREE.Vector4, THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function d(b,c){return c.z-b.z}function e(b,c){var d=0,e=1,f=b.z+b.w,g=c.z+c.w,h=-b.z+b.w,i=-c.z+c.w;return f>=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?d=Math.max(d,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),h<0?d=Math.max(d,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,g,i=[],h,j,k=[],o,n,q=[],r,v=[],z,C,D=[],y,S,Q=[],L=new THREE.Vector4,B=new THREE.Vector4,
x=new THREE.Matrix4,R=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],aa=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(b,c){x.multiply(c.projectionMatrix,c.matrixWorldInverse);x.multiplyVector3(b);return b};this.unprojectVector=function(b,c){x.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));x.multiplyVector3(b);return b};this.projectObjects=function(b,c,e){var c=[],h,j,k;g=0; x=new THREE.Matrix4,R=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],aa=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(b,c){x.multiply(c.projectionMatrix,c.matrixWorldInverse);x.multiplyVector3(b);return b};this.unprojectVector=function(b,c){x.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));x.multiplyVector3(b);return b};this.projectObjects=function(b,c,e){var c=[],h,j,k;g=0;
j=b.objects;b=0;for(h=j.length;b<h;b++){k=j[b];var o;if(!(o=!k.visible))if(o=k instanceof THREE.Mesh){a:{o=void 0;for(var n=k.matrixWorld,r=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),v=0;v<6;v++)if(o=J[v].x*n.n14+J[v].y*n.n24+J[v].z*n.n34+J[v].w,o<=r){o=!1;break a}o=!0}o=!o}if(!o)o=i[g]=i[g]||new THREE.RenderableObject,g++,f=o,L.copy(k.position),x.multiplyVector3(L),f.object=k,f.z=L.z,c.push(f)}e&&c.sort(d);return c};this.projectScene=function(f,c,g){var i= j=b.objects;b=0;for(h=j.length;b<h;b++){k=j[b];var o;if(!(o=!k.visible))if(o=k instanceof THREE.Mesh){a:{o=void 0;for(var n=k.matrixWorld,q=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),r=0;r<6;r++)if(o=J[r].x*n.n14+J[r].y*n.n24+J[r].z*n.n34+J[r].w,o<=q){o=!1;break a}o=!0}o=!o}if(!o)o=i[g]=i[g]||new THREE.RenderableObject,g++,f=o,L.copy(k.position),x.multiplyVector3(L),f.object=k,f.z=L.z,c.push(f)}e&&c.sort(d);return c};this.projectScene=function(f,c,g){var i=
[],L=c.near,ra=c.far,pa,ka,M,ha,F,Z,O,H,N,P,fa,la,qa,Ba,ia,sa,ta;S=C=v=r=0;c.matrixAutoUpdate&&c.update(void 0,!0);f.update(void 0,!1,c);x.multiply(c.projectionMatrix,c.matrixWorldInverse);J[0].set(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);J[1].set(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);J[2].set(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);J[3].set(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);J[4].set(x.n41-x.n31,x.n42-x.n32,x.n43-x.n33,x.n44-x.n34);J[5].set(x.n41+x.n31,x.n42+ [],L=c.near,ra=c.far,pa,ka,M,ha,F,Z,O,H,N,P,fa,la,qa,Ba,ia,sa,ta;S=C=r=n=0;c.matrixAutoUpdate&&c.update(void 0,!0);f.update(void 0,!1,c);x.multiply(c.projectionMatrix,c.matrixWorldInverse);J[0].set(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);J[1].set(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);J[2].set(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);J[3].set(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);J[4].set(x.n41-x.n31,x.n42-x.n32,x.n43-x.n33,x.n44-x.n34);J[5].set(x.n41+x.n31,x.n42+
x.n32,x.n43+x.n33,x.n44+x.n34);for(pa=0;pa<6;pa++)N=J[pa],N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z));N=this.projectObjects(f,c,!0);f=0;for(pa=N.length;f<pa;f++)if(P=N[f].object,P.visible)if(fa=P.matrixWorld,la=P.matrixRotationWorld,qa=P.materials,Ba=P.overdraw,j=0,P instanceof THREE.Mesh){ia=P.geometry;ha=ia.vertices;sa=ia.faces;ia=ia.faceVertexUvs;ka=0;for(M=ha.length;ka<M;ka++)h=b(),h.positionWorld.copy(ha[ka].position),fa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld), x.n32,x.n43+x.n33,x.n44+x.n34);for(pa=0;pa<6;pa++)N=J[pa],N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z));N=this.projectObjects(f,c,!0);f=0;for(pa=N.length;f<pa;f++)if(P=N[f].object,P.visible)if(fa=P.matrixWorld,la=P.matrixRotationWorld,qa=P.materials,Ba=P.overdraw,j=0,P instanceof THREE.Mesh){ia=P.geometry;ha=ia.vertices;sa=ia.faces;ia=ia.faceVertexUvs;ka=0;for(M=ha.length;ka<M;ka++)h=b(),h.positionWorld.copy(ha[ka].position),fa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
x.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>L&&h.positionScreen.z<ra;ha=0;for(ka=sa.length;ha<ka;ha++){M=sa[ha];if(M instanceof THREE.Face3)if(F=k[M.a],Z=k[M.b],O=k[M.c],F.visible&&Z.visible&&O.visible&&(P.doubleSided||P.flipSided!=(O.positionScreen.x-F.positionScreen.x)*(Z.positionScreen.y-F.positionScreen.y)-(O.positionScreen.y-F.positionScreen.y)*(Z.positionScreen.x-F.positionScreen.x)<0))H=n[r]= x.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>L&&h.positionScreen.z<ra;ha=0;for(ka=sa.length;ha<ka;ha++){M=sa[ha];if(M instanceof THREE.Face3)if(F=k[M.a],Z=k[M.b],O=k[M.c],F.visible&&Z.visible&&O.visible&&(P.doubleSided||P.flipSided!=(O.positionScreen.x-F.positionScreen.x)*(Z.positionScreen.y-F.positionScreen.y)-(O.positionScreen.y-F.positionScreen.y)*(Z.positionScreen.x-F.positionScreen.x)<0))H=q[n]=
n[r]||new THREE.RenderableFace3,r++,o=H,o.v1.copy(F),o.v2.copy(Z),o.v3.copy(O);else continue;else if(M instanceof THREE.Face4)if(F=k[M.a],Z=k[M.b],O=k[M.c],H=k[M.d],F.visible&&Z.visible&&O.visible&&H.visible&&(P.doubleSided||P.flipSided!=((H.positionScreen.x-F.positionScreen.x)*(Z.positionScreen.y-F.positionScreen.y)-(H.positionScreen.y-F.positionScreen.y)*(Z.positionScreen.x-F.positionScreen.x)<0||(Z.positionScreen.x-O.positionScreen.x)*(H.positionScreen.y-O.positionScreen.y)-(Z.positionScreen.y- q[n]||new THREE.RenderableFace3,n++,o=H,o.v1.copy(F),o.v2.copy(Z),o.v3.copy(O);else continue;else if(M instanceof THREE.Face4)if(F=k[M.a],Z=k[M.b],O=k[M.c],H=k[M.d],F.visible&&Z.visible&&O.visible&&H.visible&&(P.doubleSided||P.flipSided!=((H.positionScreen.x-F.positionScreen.x)*(Z.positionScreen.y-F.positionScreen.y)-(H.positionScreen.y-F.positionScreen.y)*(Z.positionScreen.x-F.positionScreen.x)<0||(Z.positionScreen.x-O.positionScreen.x)*(H.positionScreen.y-O.positionScreen.y)-(Z.positionScreen.y-
O.positionScreen.y)*(H.positionScreen.x-O.positionScreen.x)<0)))ta=q[v]=q[v]||new THREE.RenderableFace4,v++,o=ta,o.v1.copy(F),o.v2.copy(Z),o.v3.copy(O),o.v4.copy(H);else continue;o.normalWorld.copy(M.normal);la.multiplyVector3(o.normalWorld);o.centroidWorld.copy(M.centroid);fa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);x.multiplyVector3(o.centroidScreen);O=M.vertexNormals;F=0;for(Z=O.length;F<Z;F++)H=o.vertexNormalsWorld[F],H.copy(O[F]),la.multiplyVector3(H);F=0;for(Z= O.positionScreen.y)*(H.positionScreen.x-O.positionScreen.x)<0)))ta=v[r]=v[r]||new THREE.RenderableFace4,r++,o=ta,o.v1.copy(F),o.v2.copy(Z),o.v3.copy(O),o.v4.copy(H);else continue;o.normalWorld.copy(M.normal);la.multiplyVector3(o.normalWorld);o.centroidWorld.copy(M.centroid);fa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);x.multiplyVector3(o.centroidScreen);O=M.vertexNormals;F=0;for(Z=O.length;F<Z;F++)H=o.vertexNormalsWorld[F],H.copy(O[F]),la.multiplyVector3(H);F=0;for(Z=
ia.length;F<Z;F++)if(ta=ia[F][ha]){O=0;for(H=ta.length;O<H;O++)o.uvs[F][O]=ta[O]}o.meshMaterials=qa;o.faceMaterials=M.materials;o.overdraw=Ba;o.z=o.centroidScreen.z;i.push(o)}}else if(P instanceof THREE.Line){R.multiply(x,fa);ha=P.geometry.vertices;F=b();F.positionScreen.copy(ha[0].position);R.multiplyVector4(F.positionScreen);ka=1;for(M=ha.length;ka<M;ka++)if(F=b(),F.positionScreen.copy(ha[ka].position),R.multiplyVector4(F.positionScreen),Z=k[j-2],aa.copy(F.positionScreen),E.copy(Z.positionScreen), ia.length;F<Z;F++)if(ta=ia[F][ha]){O=0;for(H=ta.length;O<H;O++)o.uvs[F][O]=ta[O]}o.meshMaterials=qa;o.faceMaterials=M.materials;o.overdraw=Ba;o.z=o.centroidScreen.z;i.push(o)}}else if(P instanceof THREE.Line){R.multiply(x,fa);ha=P.geometry.vertices;F=b();F.positionScreen.copy(ha[0].position);R.multiplyVector4(F.positionScreen);ka=1;for(M=ha.length;ka<M;ka++)if(F=b(),F.positionScreen.copy(ha[ka].position),R.multiplyVector4(F.positionScreen),Z=k[j-2],aa.copy(F.positionScreen),E.copy(Z.positionScreen),
e(aa,E))aa.multiplyScalar(1/aa.w),E.multiplyScalar(1/E.w),fa=D[C]=D[C]||new THREE.RenderableLine,C++,z=fa,z.v1.positionScreen.copy(aa),z.v2.positionScreen.copy(E),z.z=Math.max(aa.z,E.z),z.materials=P.materials,i.push(z)}else if(P instanceof THREE.Particle&&(B.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),x.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))fa=Q[S]=Q[S]||new THREE.RenderableParticle,S++,y=fa,y.x=B.x/B.w,y.y=B.y/B.w,y.z=B.z,y.rotation=P.rotation.z,y.scale.x=P.scale.x*Math.abs(y.x- e(aa,E))aa.multiplyScalar(1/aa.w),E.multiplyScalar(1/E.w),fa=D[C]=D[C]||new THREE.RenderableLine,C++,z=fa,z.v1.positionScreen.copy(aa),z.v2.positionScreen.copy(E),z.z=Math.max(aa.z,E.z),z.materials=P.materials,i.push(z)}else if(P instanceof THREE.Particle&&(B.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),x.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))fa=Q[S]=Q[S]||new THREE.RenderableParticle,S++,y=fa,y.x=B.x/B.w,y.y=B.y/B.w,y.z=B.z,y.rotation=P.rotation.z,y.scale.x=P.scale.x*Math.abs(y.x-
(B.x+c.projectionMatrix.n11)/(B.w+c.projectionMatrix.n14)),y.scale.y=P.scale.y*Math.abs(y.y-(B.y+c.projectionMatrix.n22)/(B.w+c.projectionMatrix.n24)),y.materials=P.materials,i.push(y);g&&i.sort(d);return i}}; (B.x+c.projectionMatrix.n11)/(B.w+c.projectionMatrix.n14)),y.scale.y=P.scale.y*Math.abs(y.y-(B.y+c.projectionMatrix.n22)/(B.w+c.projectionMatrix.n24)),y.materials=P.materials,i.push(y);g&&i.sort(d);return i}};
...@@ -177,40 +178,40 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade ...@@ -177,40 +178,40 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
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.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_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(b){function d(b,d,e){var f,g,h,i=b.vertices,j=i.length,k=b.colors,o=k.length,p=b.__vertexArray,G=b.__colorArray,ua=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){P.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,qa.copy(g),P.multiplyVector3(qa),ua[f]=[qa.z,f];ua.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[ua[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<o;f++)h=f*3,color=k[ua[f][1]],G[h]=color.r,G[h+1]= THREE.WebGLRenderer=function(b){function d(b,d,e){var f,g,h,i=b.vertices,j=i.length,k=b.colors,o=k.length,p=b.__vertexArray,G=b.__colorArray,ua=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){P.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,qa.copy(g),P.multiplyVector3(qa),ua[f]=[qa.z,f];ua.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[ua[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<o;f++)h=f*3,color=k[ua[f][1]],G[h]=color.r,G[h+1]=
color.g,G[h+2]=color.b}else{if(n)for(f=0;f<j;f++)g=i[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(r)for(f=0;f<o;f++)color=k[f],h=f*3,G[h]=color.r,G[h+1]=color.g,G[h+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,p,d);if(r||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,G,d)}function e(b,d,e,f,g){f.program||$.initMaterial(f,d,e,g);var h=f.program,i=h.uniforms,j=f.uniforms;h!=oa&&(c.useProgram(h), color.g,G[h+2]=color.b}else{if(n)for(f=0;f<j;f++)g=i[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(r)for(f=0;f<o;f++)color=k[f],h=f*3,G[h]=color.r,G[h+1]=color.g,G[h+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,p,d);if(r||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,G,d)}function e(b,d,e,f,h){f.program||$.initMaterial(f,d,e,h);var g=f.program,i=g.uniforms,j=f.uniforms;g!=oa&&(c.useProgram(g),
oa=h);c.uniformMatrix4fv(i.projectionMatrix,!1,fa);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial|| oa=g);c.uniformMatrix4fv(i.projectionMatrix,!1,fa);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||
f.lights){var k,o,p=0,G=0,ua=0,n,r,v,q,t=Ba,z=t.directional.colors,y=t.directional.positions,C=t.point.colors,I=t.point.positions,K=t.point.distances,u=0,s=0,e=o=q=0;for(k=d.length;e<k;e++)if(o=d[e],n=o.color,r=o.position,v=o.intensity,q=o.distance,o instanceof THREE.AmbientLight)p+=n.r,G+=n.g,ua+=n.b;else if(o instanceof THREE.DirectionalLight)q=u*3,z[q]=n.r*v,z[q+1]=n.g*v,z[q+2]=n.b*v,y[q]=r.x,y[q+1]=r.y,y[q+2]=r.z,u+=1;else if(o instanceof THREE.PointLight)o=s*3,C[o]=n.r*v,C[o+1]=n.g*v,C[o+2]= f.lights){var k,o,p=0,G=0,ua=0,n,r,q,v,t=Ba,z=t.directional.colors,y=t.directional.positions,C=t.point.colors,I=t.point.positions,K=t.point.distances,u=0,s=0,e=o=v=0;for(k=d.length;e<k;e++)if(o=d[e],n=o.color,r=o.position,q=o.intensity,v=o.distance,o instanceof THREE.AmbientLight)p+=n.r,G+=n.g,ua+=n.b;else if(o instanceof THREE.DirectionalLight)v=u*3,z[v]=n.r*q,z[v+1]=n.g*q,z[v+2]=n.b*q,y[v]=r.x,y[v+1]=r.y,y[v+2]=r.z,u+=1;else if(o instanceof THREE.PointLight)o=s*3,C[o]=n.r*q,C[o+1]=n.g*q,C[o+2]=
n.b*v,I[o]=r.x,I[o+1]=r.y,I[o+2]=r.z,K[s]=q,s+=1;for(e=u*3;e<z.length;e++)z[e]=0;for(e=s*3;e<C.length;e++)C[e]=0;t.point.length=s;t.directional.length=u;t.ambient[0]=p;t.ambient[1]=G;t.ambient[2]=ua;e=Ba;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value= n.b*q,I[o]=r.x,I[o+1]=r.y,I[o+2]=r.z,K[s]=v,s+=1;for(e=u*3;e<z.length;e++)z[e]=0;for(e=s*3;e<C.length;e++)C[e]=0;t.point.length=s;t.directional.length=u;t.ambient[0]=p;t.ambient[1]=G;t.ambient[2]=ua;e=Ba;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,j.map.texture=f.map,j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value= e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,j.map.texture=f.map,j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=
f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=ia.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value= f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=ia.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=
f.opacity;for(var A in j)if(G=h.uniforms[A])if(k=j[A],p=k.type,e=k.value,p=="i")c.uniform1i(G,e);else if(p=="f")c.uniform1f(G,e);else if(p=="fv1")c.uniform1fv(G,e);else if(p=="fv")c.uniform3fv(G,e);else if(p=="v2")c.uniform2f(G,e.x,e.y);else if(p=="v3")c.uniform3f(G,e.x,e.y,e.z);else if(p=="v4")c.uniform4f(G,e.x,e.y,e.z,e.w);else if(p=="c")c.uniform3f(G,e.r,e.g,e.b);else if(p=="t"&&(c.uniform1i(G,e),k=k.texture))if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP, f.opacity;for(var A in j)if(G=g.uniforms[A])if(k=j[A],p=k.type,e=k.value,p=="i")c.uniform1i(G,e);else if(p=="f")c.uniform1f(G,e);else if(p=="fv1")c.uniform1fv(G,e);else if(p=="fv")c.uniform3fv(G,e);else if(p=="v2")c.uniform2f(G,e.x,e.y);else if(p=="v3")c.uniform3f(G,e.x,e.y,e.z);else if(p=="v4")c.uniform4f(G,e.x,e.y,e.z,e.w);else if(p=="c")c.uniform3f(G,e.r,e.g,e.b);else if(p=="t"&&(c.uniform1i(G,e),k=k.texture))if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,
k.image.__webglTextureCube);for(p=0;p<6;++p)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[p])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(p=0;p<6;++p)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[p]);k.__webglInit=!0}B(c.TEXTURE_CUBE_MAP,k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP, k.image.__webglTextureCube);for(p=0;p<6;++p)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[p])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(p=0;p<6;++p)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[p]);k.__webglInit=!0}B(c.TEXTURE_CUBE_MAP,k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,
k.image.__webglTextureCube)}}else x(k,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,g._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,g._objectMatrixArray);(f instanceof k.image.__webglTextureCube)}}else x(k,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);(f instanceof
THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,la);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,g._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,la);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix, THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,la);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,la);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,
!1,la),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,d,f,g,h,i){if(g.opacity!=0){var j,b=e(b,d,f,g,i).attributes;if(!g.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=g.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER, !1,la),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,d,f,h,g,i){if(h.opacity!=0){var j,b=e(b,d,f,h,i).attributes;if(!h.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,
h.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=o[k[f]],f++;else{var k=[],n=-1,p=0,o=i.morphTargetInfluences,G,ua=o.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]= g.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=o[k[f]],f++;else{var k=[],n=-1,p=0,o=i.morphTargetInfluences,G,ua=o.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=
!0);f<g.numSupportedMorphTargets;){for(G=0;G<ua;G++)!k[G]&&o[G]>n&&(p=G,n=o[p]);c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[p]=1;n=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(g.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.attributes)for(j in g.attributes)b[j]!==void 0&&b[j]>=0&&(d=g.attributes[j],d.buffer&&(c.bindBuffer(c.ARRAY_BUFFER, !0);f<h.numSupportedMorphTargets;){for(G=0;G<ua;G++)!k[G]&&o[G]>n&&(p=G,n=o[p]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[p]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[p]=1;n=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(h.attributes)for(j in h.attributes)b[j]!==void 0&&b[j]>=0&&(d=h.attributes[j],d.buffer&&(c.bindBuffer(c.ARRAY_BUFFER,
d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0)));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.vertexAttribPointer(b.uv, d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0)));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.vertexAttribPointer(b.uv,
2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer), 2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),
c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(g.wireframe?(c.lineWidth(g.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.drawElements(c.LINES,h.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),$.data.vertices+=h.__webglFaceCount,$.data.faces+=h.__webglFaceCount/3,$.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(g.linewidth),c.drawArrays(i,0,h.__webglLineCount),$.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),$.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount), g.__webglFaceBuffer),c.drawElements(c.TRIANGLES,g.__webglFaceCount,c.UNSIGNED_SHORT,0)),$.data.vertices+=g.__webglFaceCount,$.data.faces+=g.__webglFaceCount/3,$.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(h.linewidth),c.drawArrays(i,0,g.__webglLineCount),$.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,g.__webglParticleCount),$.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,g.__webglVertexCount),
$.data.drawCalls++)}}function g(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f, $.data.drawCalls++)}}function g(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,
g,h,i,j,k,o,p,G,n,r=b.count*3;for(n=0;n<r;n+=9)e=b.normalArray,f=e[n],g=e[n+1],h=e[n+2],i=e[n+3],k=e[n+4],p=e[n+5],j=e[n+6],o=e[n+7],G=e[n+8],f=(f+i+j)/3,g=(g+k+o)/3,h=(h+p+G)/3,e[n]=f,e[n+1]=g,e[n+2]=h,e[n+3]=f,e[n+4]=g,e[n+5]=h,e[n+6]=f,e[n+7]=g,e[n+8]=h}c.bufferData(c.ARRAY_BUFFER,b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,b.count);b.count=0}function i(b){if(pa!=b.doubleSided)b.doubleSided? g,h,i,j,k,o,p,G,n,r=b.count*3;for(n=0;n<r;n+=9)e=b.normalArray,f=e[n],g=e[n+1],h=e[n+2],i=e[n+3],k=e[n+4],p=e[n+5],j=e[n+6],o=e[n+7],G=e[n+8],f=(f+i+j)/3,g=(g+k+o)/3,h=(h+p+G)/3,e[n]=f,e[n+1]=g,e[n+2]=h,e[n+3]=f,e[n+4]=g,e[n+5]=h,e[n+6]=f,e[n+7]=g,e[n+8]=h}c.bufferData(c.ARRAY_BUFFER,b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,b.count);b.count=0}function i(b){if(pa!=b.doubleSided)b.doubleSided?
c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),pa=b.doubleSided;if(ka!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),ka=b.flipSided}function h(b){ha!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),ha=b)}function j(b){N[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);N[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);N[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);N[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);N[4].set(b.n41-b.n31,b.n42-b.n32, c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),pa=b.doubleSided;if(ka!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),ka=b.flipSided}function h(b){ha!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),ha=b)}function j(b){N[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);N[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);N[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);N[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);N[4].set(b.n41-b.n31,b.n42-b.n32,
b.n43-b.n33,b.n44-b.n34);N[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=N[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function k(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=N[e].x*c.n14+N[e].y*c.n24+N[e].z*c.n34+N[e].w,b<=d)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function r(b){var c,d,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=f.count=0;for(c= b.n43-b.n33,b.n44-b.n34);N[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=N[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function k(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=N[e].x*c.n14+N[e].y*c.n24+N[e].z*c.n34+N[e].w,b<=d)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function n(b){var c,d,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=f.count=0;for(c=
e.materials.length;b<c;b++)d=e.materials[b],d.transparent?o(g,d):o(f,d)}function n(b){var c,d,e,f,g=b.object,h=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=g.materials.length;b<e;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<d;c++)(f=h.materials[c])&&(f.transparent?o(j,f):o(i,f))}else(f=c)&&(f.transparent?o(j,f):o(i,f))}function v(b,c){return c.z-b.z}function q(b){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST); e.materials.length;b<c;b++)d=e.materials[b],d.transparent?o(g,d):o(f,d)}function q(b){var c,d,e,f,g=b.object,h=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=g.materials.length;b<e;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<d;c++)(f=h.materials[c])&&(f.transparent?o(j,f):o(i,f))}else(f=c)&&(f.transparent?o(j,f):o(i,f))}function r(b,c){return c.z-b.z}function v(b){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);
c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var d,e=b.lights.length,f,g=b.lights,h=[],i,j,k,o,p,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(p=0;p<n;p++)f=b.__webglShadowVolumes[p].object,i=b.__webglShadowVolumes[p].buffer, c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var d,e=b.lights.length,f,g=b.lights,h=[],i,j,k,o,p,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(p=0;p<n;p++)f=b.__webglShadowVolumes[p].object,i=b.__webglShadowVolumes[p].buffer,
j=f.materials[0],j.program||$.initMaterial(j,g,void 0,f),j=j.program,k=j.uniforms,o=j.attributes,oa!==j&&(c.useProgram(j),oa=j,c.uniformMatrix4fv(k.projectionMatrix,!1,fa),c.uniformMatrix4fv(k.viewMatrix,!1,la),c.uniform3fv(k.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(o.position,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer), j=f.materials[0],j.program||$.initMaterial(j,g,void 0,f),j=j.program,k=j.uniforms,o=j.attributes,oa!==j&&(c.useProgram(j),oa=j,c.uniformMatrix4fv(k.projectionMatrix,!1,fa),c.uniformMatrix4fv(k.viewMatrix,!1,la),c.uniform3fv(k.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(o.position,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),
c.vertexAttribPointer(o.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);M=-1;oa=u.program;c.useProgram(u.program);c.uniformMatrix4fv(u.projectionLocation, c.vertexAttribPointer(o.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);M=-1;oa=u.program;c.useProgram(u.program);c.uniformMatrix4fv(u.projectionLocation,
!1,fa);c.uniform1f(u.darknessLocation,u.darkness);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(u.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(u.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function z(b,d){var e,f,g;e=_sprite.attributes;var h=_sprite.uniforms, !1,fa);c.uniform1f(u.darknessLocation,u.darkness);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(u.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(u.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function z(b,d){var e,f,g;e=_sprite.attributes;var h=_sprite.uniforms,
i=H/O,j,k=[],o=O*0.5,p=H*0.5,n=!0;c.useProgram(_sprite.program);oa=_sprite.program;M=-1;Da||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Da=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix, i=H/O,j,k=[],o=O*0.5,p=H*0.5,n=!0;c.useProgram(_sprite.program);oa=_sprite.program;M=-1;Da||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Da=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix,
!1,fa);c.activeTexture(c.TEXTURE0);c.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(v);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(c.uniform1i(h.useScreenCoordinates,1),c.uniform3f(h.screenPosition, !1,fa);c.activeTexture(c.TEXTURE0);c.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(r);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(c.uniform1i(h.useScreenCoordinates,1),c.uniform3f(h.screenPosition,
(g.position.x-o)/o,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(c.uniform1i(h.useScreenCoordinates,0),c.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),c.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),j=g.map.image.width/(g.affectedByDistance?1:H),k[0]=j*i*g.scale.x,k[1]=j*g.scale.y,c.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),c.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),c.uniform2f(h.alignment,g.alignment.x,g.alignment.y),c.uniform1f(h.opacity,g.opacity), (g.position.x-o)/o,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(c.uniform1i(h.useScreenCoordinates,0),c.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),c.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),j=g.map.image.width/(g.affectedByDistance?1:H),k[0]=j*i*g.scale.x,k[1]=j*g.scale.y,c.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),c.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),c.uniform2f(h.alignment,g.alignment.x,g.alignment.y),c.uniform1f(h.opacity,g.opacity),
c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),L(g.blending),x(g.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function C(b,d){var e,f,g=b.__webglLensFlares.length,h,i,j,k=new THREE.Vector3,o=H/O,p=O*0.5,n=H*0.5,r=16/H,v=[r*o,r],q=[1,1,0],z=[1,1],y=t.uniforms;e=t.attributes;c.useProgram(t.program);oa=t.program;M=-1;Ea|| c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),L(g.blending),x(g.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function C(b,d){var e,f,g=b.__webglLensFlares.length,h,i,j,k=new THREE.Vector3,o=H/O,p=O*0.5,n=H*0.5,r=16/H,q=[r*o,r],v=[1,1,0],z=[1,1],y=t.uniforms;e=t.attributes;c.useProgram(t.program);oa=t.program;M=-1;Ea||
(c.enableVertexAttribArray(t.attributes.vertex),c.enableVertexAttribArray(t.attributes.uv),Ea=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(e= (c.enableVertexAttribArray(t.attributes.vertex),c.enableVertexAttribArray(t.attributes.uv),Ea=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(e=
b.__webglLensFlares[f].object,k.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(k),d.projectionMatrix.multiplyVector3(k),q[0]=k.x,q[1]=k.y,q[2]=k.z,z[0]=q[0]*p+p,z[1]=q[1]*n+n,t.hasVertexTexture||z[0]>0&&z[0]<O&&z[1]>0&&z[1]<H){c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,v);c.uniform3fv(y.screenPosition,q);c.disable(c.BLEND);c.enable(c.DEPTH_TEST); b.__webglLensFlares[f].object,k.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(k),d.projectionMatrix.multiplyVector3(k),v[0]=k.x,v[1]=k.y,v[2]=k.z,z[0]=v[0]*p+p,z[1]=v[1]*n+n,t.hasVertexTexture||z[0]>0&&z[0]<O&&z[1]>0&&z[1]<H){c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,q);c.uniform3fv(y.screenPosition,v);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);
c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);e.positionScreen.x=q[0];e.positionScreen.y=q[1];e.positionScreen.z=q[2];e.customUpdateCallback?e.customUpdateCallback(e):e.updateLensFlares();c.uniform1i(y.renderType,2);c.enable(c.BLEND);h=0;for(i=e.lensFlares.length;h< c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);e.positionScreen.x=v[0];e.positionScreen.y=v[1];e.positionScreen.z=v[2];e.customUpdateCallback?e.customUpdateCallback(e):e.updateLensFlares();c.uniform1i(y.renderType,2);c.enable(c.BLEND);h=0;for(i=e.lensFlares.length;h<
i;h++)if(j=e.lensFlares[h],j.opacity>0.001&&j.scale>0.001)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/H,v[0]=r*o,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)} i;h++)if(j=e.lensFlares[h],j.opacity>0.001&&j.scale>0.001)v[0]=j.x,v[1]=j.y,v[2]=j.z,r=j.size*j.scale/H,q[0]=r*o,q[1]=r,c.uniform3fv(y.screenPosition,v),c.uniform2fv(y.scale,q),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
function y(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,o=void 0,n=void 0,p=void 0,G=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,z=void 0,y=void 0, function y(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,o=void 0,n=void 0,p=void 0,G=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,z=void 0,y=void 0,
x=void 0,C=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=p=q=p=v=r=void 0,A=void 0,m=A=s=r=void 0,F=void 0,J=m=A=s=n=n=G=q=p=m=A=s=F=m=A=s=F=m=A=s=void 0,B=0,E=0,O=0,P=0,H=0,M=0,T=0,N=0,ca=0,w=0,da=0,A=s=0,L=g.__vertexArray,Z=g.__uvArray,$=g.__uv2Array,Q=g.__normalArray,U=g.__tangentArray,ea=g.__colorArray,V=g.__skinVertexAArray,W=g.__skinVertexBArray,X=g.__skinIndexArray,Y=g.__skinWeightArray,aa=g.__morphTargetsArrays,R=g.__webglCustomAttributes,m=void 0,ma=g.__faceArray,S=g.__lineArray,ja=g.__needsSmoothNormals, x=void 0,C=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=p=q=p=v=r=void 0,A=void 0,m=A=s=r=void 0,F=void 0,J=m=A=s=n=n=G=q=p=m=A=s=F=m=A=s=F=m=A=s=void 0,B=0,E=0,O=0,P=0,H=0,M=0,T=0,N=0,ca=0,w=0,da=0,A=s=0,L=g.__vertexArray,Z=g.__uvArray,$=g.__uv2Array,Q=g.__normalArray,U=g.__tangentArray,ea=g.__colorArray,V=g.__skinVertexAArray,W=g.__skinVertexBArray,X=g.__skinIndexArray,Y=g.__skinWeightArray,aa=g.__morphTargetsArrays,R=g.__webglCustomAttributes,m=void 0,ma=g.__faceArray,S=g.__lineArray,ja=g.__needsSmoothNormals,
z=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ha=ga.__dirtyVertices,ia=ga.__dirtyElements,fa=ga.__dirtyUvs,ka=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,ra=ga.faces,sa=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],xa=ga.skinVerticesA,ya=ga.skinVerticesB,za=ga.skinIndices,va=ga.skinWeights,wa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0;morphTargets=ga.morphTargets;if(R)for(J in R)R[J].offset=0,R[J].offsetSrc= z=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ha=ga.__dirtyVertices,ia=ga.__dirtyElements,fa=ga.__dirtyUvs,ka=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,ra=ga.faces,sa=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],xa=ga.skinVerticesA,ya=ga.skinVerticesB,za=ga.skinIndices,va=ga.skinWeights,wa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0;morphTargets=ga.morphTargets;if(R)for(J in R)R[J].offset=0,R[J].offsetSrc=
...@@ -272,10 +273,10 @@ r=k;j=0;for(k=r.length;j<k;j++)o=r[j],q.uniforms[o]=c.getUniformLocation(q,o);k= ...@@ -272,10 +273,10 @@ r=k;j=0;for(k=r.length;j<k;j++)o=r[j],q.uniforms[o]=c.getUniformLocation(q,o);k=
n.normal>=0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>= n.normal>=0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=
0&&(c.enableVertexAttribArray(n.morphTarget0),b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5), 0&&(c.enableVertexAttribArray(n.morphTarget0),b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),
b.numSupportedMorphTargets++);n.morphTarget6>=0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,o,u){var t,y,x,B,E,F,p,G,H=b.lights,J=b.fog;$.data.vertices=0;$.data.faces=0;$.data.drawCalls=0;d.matrixAutoUpdate&& b.numSupportedMorphTargets++);n.morphTarget6>=0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,o,u){var t,y,x,B,E,F,p,G,H=b.lights,J=b.fog;$.data.vertices=0;$.data.faces=0;$.data.drawCalls=0;d.matrixAutoUpdate&&
d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(la);d.projectionMatrix.flattenToArray(fa);P.multiply(d.projectionMatrix,d.matrixWorldInverse);j(P);this.initWebGLObjects(b);R(o);(this.autoClear||u)&&this.clear();E=b.__webglObjects.length;for(u=0;u<E;u++)if(t=b.__webglObjects[u],p=t.object,p.visible)if(!(p instanceof THREE.Mesh)||k(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),n(t),t.render=!0,this.sortObjects)qa.copy(p.position),P.multiplyVector3(qa), d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(la);d.projectionMatrix.flattenToArray(fa);P.multiply(d.projectionMatrix,d.matrixWorldInverse);j(P);this.initWebGLObjects(b);R(o);(this.autoClear||u)&&this.clear();E=b.__webglObjects.length;for(u=0;u<E;u++)if(t=b.__webglObjects[u],p=t.object,p.visible)if(!(p instanceof THREE.Mesh)||k(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),q(t),t.render=!0,this.sortObjects)qa.copy(p.position),P.multiplyVector3(qa),
t.z=qa.z}else t.render=!1;else t.render=!1;this.sortObjects&&b.__webglObjects.sort(v);F=b.__webglObjectsImmediate.length;for(u=0;u<F;u++)t=b.__webglObjectsImmediate[u],p=t.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),r(t));L(THREE.NormalBlending);for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){p=t.object;G=t.buffer;x=t.opaque;i(p);for(t=0;t<x.count;t++)B=x.list[t],h(B.depthTest),f(d,H,J,B,G,p)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u], t.z=qa.z}else t.render=!1;else t.render=!1;this.sortObjects&&b.__webglObjects.sort(r);F=b.__webglObjectsImmediate.length;for(u=0;u<F;u++)t=b.__webglObjectsImmediate[u],p=t.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),n(t));L(THREE.NormalBlending);for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){p=t.object;G=t.buffer;x=t.opaque;i(p);for(t=0;t<x.count;t++)B=x.list[t],h(B.depthTest),f(d,H,J,B,G,p)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],
p=t.object,p.visible){x=t.opaque;i(p);for(t=0;t<x.count;t++)B=x.list[t],h(B.depthTest),y=e(d,H,J,B,p),p.render(function(b){g(b,y,B.shading)})}for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){p=t.object;G=t.buffer;x=t.transparent;i(p);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),h(B.depthTest),f(d,H,J,B,G,p)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],p=t.object,p.visible){x=t.transparent;i(p);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),h(B.depthTest),y=e(d,H,J,B,p),p.render(function(b){g(b, p=t.object,p.visible){x=t.opaque;i(p);for(t=0;t<x.count;t++)B=x.list[t],h(B.depthTest),y=e(d,H,J,B,p),p.render(function(b){g(b,y,B.shading)})}for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){p=t.object;G=t.buffer;x=t.transparent;i(p);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),h(B.depthTest),f(d,H,J,B,G,p)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],p=t.object,p.visible){x=t.transparent;i(p);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),h(B.depthTest),y=e(d,H,J,B,p),p.render(function(b){g(b,
y,B.shading)})}b.__webglSprites.length&&z(b,d);sa&&b.__webglShadowVolumes.length&&b.lights.length&&q(b);b.__webglLensFlares.length&&C(b,d);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,o.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null));c.finish()};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites= y,B.shading)})}b.__webglSprites.length&&z(b,d);sa&&b.__webglShadowVolumes.length&&b.lights.length&&v(b);b.__webglLensFlares.length&&C(b,d);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,o.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null));c.finish()};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=
[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&S(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer= [];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&S(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=
c.createBuffer();i.__webglNormalBuffer=c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers= c.createBuffer();i.__webglNormalBuffer=c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=
[];j=0;for(k=i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,p=void 0,o=void 0,q=o=void 0,r=void 0,t=void 0,v=t=k=0,u=o=p=void 0,p=n=void 0,q=j.geometry,u=q.faces,r=i.faces,n=0,p=r.length;n<p;n++)o=r[n],o=u[o],o instanceof THREE.Face3?(k+=3,t+=1,v+=3):o instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,p=j,x=r=u=void 0,z=void 0,x=void 0,o=[],u=0,r=p.materials.length;u<r;u++)if(x=p.materials[u],x instanceof THREE.MeshFaceMaterial){x=0;for(l= [];j=0;for(k=i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,p=void 0,o=void 0,q=o=void 0,r=void 0,t=void 0,v=t=k=0,u=o=p=void 0,p=n=void 0,q=j.geometry,u=q.faces,r=i.faces,n=0,p=r.length;n<p;n++)o=r[n],o=u[o],o instanceof THREE.Face3?(k+=3,t+=1,v+=3):o instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,p=j,x=r=u=void 0,z=void 0,x=void 0,o=[],u=0,r=p.materials.length;u<r;u++)if(x=p.materials[u],x instanceof THREE.MeshFaceMaterial){x=0;for(l=
......
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>three.js canvas - interactive particles</title>
<meta charset="utf-8">
<style type="text/css">
body {
font-family: Monospace;
background-color: #f0f0f0;
margin: 0px;
overflow: hidden;
}
</style>
</head>
<body>
<script type="text/javascript" src="../build/Three.js"></script>
<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
<script type="text/javascript" src="js/Stats.js"></script>
<script type="text/javascript">
var container, stats;
var camera, scene, projector, renderer;
var PI2 = Math.PI * 2;
var programFill = function ( context ) {
context.beginPath();
context.arc( 0, 0, 1, 0, PI2, true );
context.closePath();
context.fill();
}
var programStroke = function ( context ) {
context.beginPath();
context.arc( 0, 0, 1, 0, PI2, true );
context.closePath();
context.stroke();
}
var mouse = { x: 0, y: 0 }, INTERSECTED;
init();
animate();
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
var info = document.createElement( 'div' );
info.style.position = 'absolute';
info.style.top = '10px';
info.style.width = '100%';
info.style.textAlign = 'center';
info.innerHTML = '<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> canvas - interactive particles';
container.appendChild( info );
camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.y = 300;
camera.position.z = 500;
scene = new THREE.Scene();
for ( var i = 0; i < 500; i ++ ) {
var particle = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: Math.random() * 0x808008 + 0x808080, program: programStroke } ) );
particle.position.x = Math.random() * 2000 - 1000;
particle.position.y = Math.random() * 2000 - 1000;
particle.position.z = Math.random() * 2000 - 1000;
particle.scale.x = particle.scale.y = Math.random() * 10 + 10;
scene.addObject( particle );
}
projector = new THREE.Projector();
renderer = new THREE.CanvasRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild(renderer.domElement);
stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
container.appendChild( stats.domElement );
document.addEventListener( 'mousemove', onDocumentMouseMove, false );
}
function onDocumentMouseMove( event ) {
event.preventDefault();
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
}
//
function animate() {
requestAnimationFrame( animate );
render();
stats.update();
}
var radius = 600;
var theta = 0;
function render() {
// rotate camera
theta += 0.2;
camera.position.x = radius * Math.sin( theta * Math.PI / 360 );
camera.position.y = radius * Math.sin( theta * Math.PI / 360 );
camera.position.z = radius * Math.cos( theta * Math.PI / 360 );
// find intersections
camera.update();
var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 );
projector.unprojectVector( vector, camera );
var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
var intersects = ray.intersectScene( scene );
if ( intersects.length > 0 ) {
if ( INTERSECTED != intersects[ 0 ].object ) {
if ( INTERSECTED ) INTERSECTED.materials[ 0 ].program = programStroke;
INTERSECTED = intersects[ 0 ].object;
INTERSECTED.materials[ 0 ].program = programFill;
}
} else {
if ( INTERSECTED ) INTERSECTED.materials[ 0 ].program = programStroke;
INTERSECTED = null;
}
renderer.render( scene, camera );
}
</script>
</body>
</html>
// stats.js r5 - http://github.com/mrdoob/stats.js // stats.js r6 - http://github.com/mrdoob/stats.js
var Stats=function(){function w(d,K,n){var u,f,c;for(f=0;f<30;f++)for(u=0;u<73;u++){c=(u+f*74)*4;d[c]=d[c+4];d[c+1]=d[c+5];d[c+2]=d[c+6]}for(f=0;f<30;f++){c=(73+f*74)*4;if(f<K){d[c]=b[n].bg.r;d[c+1]=b[n].bg.g;d[c+2]=b[n].bg.b}else{d[c]=b[n].fg.r;d[c+1]=b[n].fg.g;d[c+2]=b[n].fg.b}}}var v=0,x=2,e,y=0,l=(new Date).getTime(),J=l,z=l,o=0,A=1E3,B=0,m,g,a,p,C,q=0,D=1E3,E=0,h,i,r,F,s=0,G=1E3,H=0,j,k,t,I,b={fps:{bg:{r:16,g:16,b:48},fg:{r:0,g:255,b:255}},ms:{bg:{r:16,g:48,b:16},fg:{r:0,g:255,b:0}},mem:{bg:{r:48, var Stats=function(){function s(a,g,d){var f,c,e;for(c=0;c<30;c++)for(f=0;f<73;f++)e=(f+c*74)*4,a[e]=a[e+4],a[e+1]=a[e+5],a[e+2]=a[e+6];for(c=0;c<30;c++)e=(73+c*74)*4,c<g?(a[e]=b[d].bg.r,a[e+1]=b[d].bg.g,a[e+2]=b[d].bg.b):(a[e]=b[d].fg.r,a[e+1]=b[d].fg.g,a[e+2]=b[d].fg.b)}var r=0,t=2,g,u=0,j=(new Date).getTime(),F=j,v=j,l=0,w=1E3,x=0,k,d,a,m,y,n=0,z=1E3,A=0,f,c,o,B,p=0,C=1E3,D=0,h,i,q,E,b={fps:{bg:{r:16,g:16,b:48},fg:{r:0,g:255,b:255}},ms:{bg:{r:16,g:48,b:16},fg:{r:0,g:255,b:0}},mb:{bg:{r:48,g:16,
g:16,b:26},fg:{r:255,g:0,b:128}}};e=document.createElement("div");e.style.cursor="pointer";e.style.width="80px";e.style.opacity="0.9";e.style.zIndex="10001";e.addEventListener("click",function(){v++;v==x&&(v=0);m.style.display="none";h.style.display="none";j.style.display="none";switch(v){case 0:m.style.display="block";break;case 1:h.style.display="block";break;case 2:j.style.display="block"}},false);m=document.createElement("div");m.style.backgroundColor="rgb("+Math.floor(b.fps.bg.r/2)+","+Math.floor(b.fps.bg.g/ b:26},fg:{r:255,g:0,b:128}}};g=document.createElement("div");g.style.cursor="pointer";g.style.width="80px";g.style.opacity="0.9";g.style.zIndex="10001";g.addEventListener("click",function(){r++;r==t&&(r=0);k.style.display="none";f.style.display="none";h.style.display="none";switch(r){case 0:k.style.display="block";break;case 1:f.style.display="block";break;case 2:h.style.display="block"}},!1);k=document.createElement("div");k.style.backgroundColor="rgb("+Math.floor(b.fps.bg.r/2)+","+Math.floor(b.fps.bg.g/
2)+","+Math.floor(b.fps.bg.b/2)+")";m.style.padding="2px 0px 3px 0px";e.appendChild(m);g=document.createElement("div");g.style.fontFamily="Helvetica, Arial, sans-serif";g.style.textAlign="left";g.style.fontSize="9px";g.style.color="rgb("+b.fps.fg.r+","+b.fps.fg.g+","+b.fps.fg.b+")";g.style.margin="0px 0px 1px 3px";g.innerHTML='<span style="font-weight:bold">FPS</span>';m.appendChild(g);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";m.appendChild(a); 2)+","+Math.floor(b.fps.bg.b/2)+")";k.style.padding="2px 0px 3px 0px";g.appendChild(k);d=document.createElement("div");d.style.fontFamily="Helvetica, Arial, sans-serif";d.style.textAlign="left";d.style.fontSize="9px";d.style.color="rgb("+b.fps.fg.r+","+b.fps.fg.g+","+b.fps.fg.b+")";d.style.margin="0px 0px 1px 3px";d.innerHTML='<span style="font-weight:bold">FPS</span>';k.appendChild(d);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";k.appendChild(a);
p=a.getContext("2d");p.fillStyle="rgb("+b.fps.bg.r+","+b.fps.bg.g+","+b.fps.bg.b+")";p.fillRect(0,0,a.width,a.height);C=p.getImageData(0,0,a.width,a.height);h=document.createElement("div");h.style.backgroundColor="rgb("+Math.floor(b.ms.bg.r/2)+","+Math.floor(b.ms.bg.g/2)+","+Math.floor(b.ms.bg.b/2)+")";h.style.padding="2px 0px 3px 0px";h.style.display="none";e.appendChild(h);i=document.createElement("div");i.style.fontFamily="Helvetica, Arial, sans-serif";i.style.textAlign="left";i.style.fontSize= m=a.getContext("2d");m.fillStyle="rgb("+b.fps.bg.r+","+b.fps.bg.g+","+b.fps.bg.b+")";m.fillRect(0,0,a.width,a.height);y=m.getImageData(0,0,a.width,a.height);f=document.createElement("div");f.style.backgroundColor="rgb("+Math.floor(b.ms.bg.r/2)+","+Math.floor(b.ms.bg.g/2)+","+Math.floor(b.ms.bg.b/2)+")";f.style.padding="2px 0px 3px 0px";f.style.display="none";g.appendChild(f);c=document.createElement("div");c.style.fontFamily="Helvetica, Arial, sans-serif";c.style.textAlign="left";c.style.fontSize=
"9px";i.style.color="rgb("+b.ms.fg.r+","+b.ms.fg.g+","+b.ms.fg.b+")";i.style.margin="0px 0px 1px 3px";i.innerHTML='<span style="font-weight:bold">MS</span>';h.appendChild(i);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";h.appendChild(a);r=a.getContext("2d");r.fillStyle="rgb("+b.ms.bg.r+","+b.ms.bg.g+","+b.ms.bg.b+")";r.fillRect(0,0,a.width,a.height);F=r.getImageData(0,0,a.width,a.height);try{if(performance&&performance.memory&&performance.memory.totalJSHeapSize)x= "9px";c.style.color="rgb("+b.ms.fg.r+","+b.ms.fg.g+","+b.ms.fg.b+")";c.style.margin="0px 0px 1px 3px";c.innerHTML='<span style="font-weight:bold">MS</span>';f.appendChild(c);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";f.appendChild(a);o=a.getContext("2d");o.fillStyle="rgb("+b.ms.bg.r+","+b.ms.bg.g+","+b.ms.bg.b+")";o.fillRect(0,0,a.width,a.height);B=o.getImageData(0,0,a.width,a.height);try{performance&&performance.memory&&performance.memory.totalJSHeapSize&&
3}catch(L){}j=document.createElement("div");j.style.backgroundColor="rgb("+Math.floor(b.mem.bg.r/2)+","+Math.floor(b.mem.bg.g/2)+","+Math.floor(b.mem.bg.b/2)+")";j.style.padding="2px 0px 3px 0px";j.style.display="none";e.appendChild(j);k=document.createElement("div");k.style.fontFamily="Helvetica, Arial, sans-serif";k.style.textAlign="left";k.style.fontSize="9px";k.style.color="rgb("+b.mem.fg.r+","+b.mem.fg.g+","+b.mem.fg.b+")";k.style.margin="0px 0px 1px 3px";k.innerHTML='<span style="font-weight:bold">MEM</span>'; (t=3)}catch(G){}h=document.createElement("div");h.style.backgroundColor="rgb("+Math.floor(b.mb.bg.r/2)+","+Math.floor(b.mb.bg.g/2)+","+Math.floor(b.mb.bg.b/2)+")";h.style.padding="2px 0px 3px 0px";h.style.display="none";g.appendChild(h);i=document.createElement("div");i.style.fontFamily="Helvetica, Arial, sans-serif";i.style.textAlign="left";i.style.fontSize="9px";i.style.color="rgb("+b.mb.fg.r+","+b.mb.fg.g+","+b.mb.fg.b+")";i.style.margin="0px 0px 1px 3px";i.innerHTML='<span style="font-weight:bold">MB</span>';
j.appendChild(k);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";j.appendChild(a);t=a.getContext("2d");t.fillStyle="#301010";t.fillRect(0,0,a.width,a.height);I=t.getImageData(0,0,a.width,a.height);return{domElement:e,update:function(){y++;l=(new Date).getTime();q=l-J;D=Math.min(D,q);E=Math.max(E,q);w(F.data,Math.min(30,30-q/200*30),"ms");i.innerHTML='<span style="font-weight:bold">'+q+" MS</span> ("+D+"-"+E+")";r.putImageData(F,0,0);J=l;if(l> h.appendChild(i);a=document.createElement("canvas");a.width=74;a.height=30;a.style.display="block";a.style.marginLeft="3px";h.appendChild(a);q=a.getContext("2d");q.fillStyle="#301010";q.fillRect(0,0,a.width,a.height);E=q.getImageData(0,0,a.width,a.height);return{domElement:g,update:function(){u++;j=(new Date).getTime();n=j-F;z=Math.min(z,n);A=Math.max(A,n);s(B.data,Math.min(30,30-n/200*30),"ms");c.innerHTML='<span style="font-weight:bold">'+n+" MS</span> ("+z+"-"+A+")";o.putImageData(B,0,0);F=j;if(j>
z+1E3){o=Math.round(y*1E3/(l-z));A=Math.min(A,o);B=Math.max(B,o);w(C.data,Math.min(30,30-o/100*30),"fps");g.innerHTML='<span style="font-weight:bold">'+o+" FPS</span> ("+A+"-"+B+")";p.putImageData(C,0,0);if(x==3){s=performance.memory.usedJSHeapSize*9.54E-7;G=Math.min(G,s);H=Math.max(H,s);w(I.data,Math.min(30,30-s/2),"mem");k.innerHTML='<span style="font-weight:bold">'+Math.round(s)+" MEM</span> ("+Math.round(G)+"-"+Math.round(H)+")";t.putImageData(I,0,0)}z=l;y=0}}}}; v+1E3){l=Math.round(u*1E3/(j-v));w=Math.min(w,l);x=Math.max(x,l);s(y.data,Math.min(30,30-l/100*30),"fps");d.innerHTML='<span style="font-weight:bold">'+l+" FPS</span> ("+w+"-"+x+")";m.putImageData(y,0,0);if(t==3)p=performance.memory.usedJSHeapSize*9.54E-7,C=Math.min(C,p),D=Math.max(D,p),s(E.data,Math.min(30,30-p/2),"mb"),i.innerHTML='<span style="font-weight:bold">'+Math.round(p)+" MB</span> ("+Math.round(C)+"-"+Math.round(D)+")",q.putImageData(E,0,0);v=j;u=0}}}};
// Tween.js - http://github.com/sole/tween.js // tween.js r1 - http://github.com/sole/tween.js
var TWEEN=TWEEN||function(){var a,e,d,b=[];this.add=function(h){b.push(h)};this.remove=function(h){a=b.indexOf(h);a!==-1&&b.splice(a,1)};this.update=function(){a=0;e=b.length;for(d=(new Date).getTime();a<e;)if(b[a].update(d))a++;else{b.splice(a,1);e--}};return this}(); var TWEEN=TWEEN||function(){var a,e,c,d,f=[];return{start:function(g){c=setInterval(this.update,1E3/(g||60))},stop:function(){clearInterval(c)},add:function(g){f.push(g)},remove:function(g){a=f.indexOf(g);a!==-1&&f.splice(a,1)},update:function(){a=0;e=f.length;for(d=(new Date).getTime();a<e;)if(f[a].update(d))a++;else{f.splice(a,1);e--}}}}();
TWEEN.Tween=function(a){var e={},d={},b={},h=1E3,m=0,i=null,n=TWEEN.Easing.Linear.EaseNone,j=null,k=null,l=null;this.to=function(c,f){if(f!==null)h=f;for(var g in c)if(a[g]!==null)b[g]=c[g];return this};this.start=function(){TWEEN.add(this);i=(new Date).getTime()+m;for(var c in b)if(a[c]!==null){e[c]=a[c];d[c]=b[c]-a[c]}return this};this.stop=function(){TWEEN.remove(this);return this};this.delay=function(c){m=c;return this};this.easing=function(c){n=c;return this};this.chain=function(c){j=c};this.onUpdate= TWEEN.Tween=function(a){var e={},c={},d={},f=1E3,g=0,j=null,n=TWEEN.Easing.Linear.EaseNone,k=null,l=null,m=null;this.to=function(b,h){if(h!==null)f=h;for(var i in b)if(a[i]!==null)d[i]=b[i];return this};this.start=function(){TWEEN.add(this);j=(new Date).getTime()+g;for(var b in d)if(a[b]!==null){e[b]=a[b];c[b]=d[b]-a[b]}return this};this.stop=function(){TWEEN.remove(this);return this};this.delay=function(b){g=b;return this};this.easing=function(b){n=b;return this};this.chain=function(b){k=b};this.onUpdate=
function(c){k=c;return this};this.onComplete=function(c){l=c;return this};this.update=function(c){var f,g;if(c<i)return true;c=(c-i)/h;c=c>1?1:c;g=n(c);for(f in d)a[f]=e[f]+d[f]*g;k!==null&&k.call(a,g);if(c==1){l!==null&&l.call(a);j!==null&&j.start();return false}return true}};TWEEN.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}};TWEEN.Easing.Linear.EaseNone=function(a){return a}; function(b){l=b;return this};this.onComplete=function(b){m=b;return this};this.update=function(b){var h,i;if(b<j)return true;b=(b-j)/f;b=b>1?1:b;i=n(b);for(h in c)a[h]=e[h]+c[h]*i;l!==null&&l.call(a,i);if(b==1){m!==null&&m.call(a);k!==null&&k.start();return false}return true}};TWEEN.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}};TWEEN.Easing.Linear.EaseNone=function(a){return a};
TWEEN.Easing.Quadratic.EaseIn=function(a){return a*a};TWEEN.Easing.Quadratic.EaseOut=function(a){return-a*(a-2)};TWEEN.Easing.Quadratic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)};TWEEN.Easing.Cubic.EaseIn=function(a){return a*a*a};TWEEN.Easing.Cubic.EaseOut=function(a){return--a*a*a+1};TWEEN.Easing.Cubic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a;return 0.5*((a-=2)*a*a+2)};TWEEN.Easing.Quartic.EaseIn=function(a){return a*a*a*a}; TWEEN.Easing.Quadratic.EaseIn=function(a){return a*a};TWEEN.Easing.Quadratic.EaseOut=function(a){return-a*(a-2)};TWEEN.Easing.Quadratic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)};TWEEN.Easing.Cubic.EaseIn=function(a){return a*a*a};TWEEN.Easing.Cubic.EaseOut=function(a){return--a*a*a+1};TWEEN.Easing.Cubic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a;return 0.5*((a-=2)*a*a+2)};TWEEN.Easing.Quartic.EaseIn=function(a){return a*a*a*a};
TWEEN.Easing.Quartic.EaseOut=function(a){return-(--a*a*a*a-1)};TWEEN.Easing.Quartic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a*a;return-0.5*((a-=2)*a*a*a-2)};TWEEN.Easing.Quintic.EaseIn=function(a){return a*a*a*a*a};TWEEN.Easing.Quintic.EaseOut=function(a){return(a-=1)*a*a*a*a+1};TWEEN.Easing.Quintic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a*a*a;return 0.5*((a-=2)*a*a*a*a+2)};TWEEN.Easing.Sinusoidal.EaseIn=function(a){return-Math.cos(a*Math.PI/2)+1}; TWEEN.Easing.Quartic.EaseOut=function(a){return-(--a*a*a*a-1)};TWEEN.Easing.Quartic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a*a;return-0.5*((a-=2)*a*a*a-2)};TWEEN.Easing.Quintic.EaseIn=function(a){return a*a*a*a*a};TWEEN.Easing.Quintic.EaseOut=function(a){return(a-=1)*a*a*a*a+1};TWEEN.Easing.Quintic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a*a*a;return 0.5*((a-=2)*a*a*a*a+2)};TWEEN.Easing.Sinusoidal.EaseIn=function(a){return-Math.cos(a*Math.PI/2)+1};
TWEEN.Easing.Sinusoidal.EaseOut=function(a){return Math.sin(a*Math.PI/2)};TWEEN.Easing.Sinusoidal.EaseInOut=function(a){return-0.5*(Math.cos(Math.PI*a)-1)};TWEEN.Easing.Exponential.EaseIn=function(a){return a==0?0:Math.pow(2,10*(a-1))};TWEEN.Easing.Exponential.EaseOut=function(a){return a==1?1:-Math.pow(2,-10*a)+1};TWEEN.Easing.Exponential.EaseInOut=function(a){if(a==0)return 0;if(a==1)return 1;if((a*=2)<1)return 0.5*Math.pow(2,10*(a-1));return 0.5*(-Math.pow(2,-10*(a-1))+2)}; TWEEN.Easing.Sinusoidal.EaseOut=function(a){return Math.sin(a*Math.PI/2)};TWEEN.Easing.Sinusoidal.EaseInOut=function(a){return-0.5*(Math.cos(Math.PI*a)-1)};TWEEN.Easing.Exponential.EaseIn=function(a){return a==0?0:Math.pow(2,10*(a-1))};TWEEN.Easing.Exponential.EaseOut=function(a){return a==1?1:-Math.pow(2,-10*a)+1};TWEEN.Easing.Exponential.EaseInOut=function(a){if(a==0)return 0;if(a==1)return 1;if((a*=2)<1)return 0.5*Math.pow(2,10*(a-1));return 0.5*(-Math.pow(2,-10*(a-1))+2)};
TWEEN.Easing.Circular.EaseIn=function(a){return-(Math.sqrt(1-a*a)-1)};TWEEN.Easing.Circular.EaseOut=function(a){return Math.sqrt(1- --a*a)};TWEEN.Easing.Circular.EaseInOut=function(a){if((a/=0.5)<1)return-0.5*(Math.sqrt(1-a*a)-1);return 0.5*(Math.sqrt(1-(a-=2)*a)+1)};TWEEN.Easing.Elastic.EaseIn=function(a){var e,d=0.1,b=0.4;if(a==0)return 0;if(a==1)return 1;b||(b=0.3);if(!d||d<1){d=1;e=b/4}else e=b/(2*Math.PI)*Math.asin(1/d);return-(d*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/b))}; TWEEN.Easing.Circular.EaseIn=function(a){return-(Math.sqrt(1-a*a)-1)};TWEEN.Easing.Circular.EaseOut=function(a){return Math.sqrt(1- --a*a)};TWEEN.Easing.Circular.EaseInOut=function(a){if((a/=0.5)<1)return-0.5*(Math.sqrt(1-a*a)-1);return 0.5*(Math.sqrt(1-(a-=2)*a)+1)};TWEEN.Easing.Elastic.EaseIn=function(a){var e,c=0.1,d=0.4;if(a==0)return 0;if(a==1)return 1;d||(d=0.3);if(!c||c<1){c=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/c);return-(c*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/d))};
TWEEN.Easing.Elastic.EaseOut=function(a){var e,d=0.1,b=0.4;if(a==0)return 0;if(a==1)return 1;b||(b=0.3);if(!d||d<1){d=1;e=b/4}else e=b/(2*Math.PI)*Math.asin(1/d);return d*Math.pow(2,-10*a)*Math.sin((a-e)*2*Math.PI/b)+1}; TWEEN.Easing.Elastic.EaseOut=function(a){var e,c=0.1,d=0.4;if(a==0)return 0;if(a==1)return 1;d||(d=0.3);if(!c||c<1){c=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/c);return c*Math.pow(2,-10*a)*Math.sin((a-e)*2*Math.PI/d)+1};
TWEEN.Easing.Elastic.EaseInOut=function(a){var e,d=0.1,b=0.4;if(a==0)return 0;if(a==1)return 1;b||(b=0.3);if(!d||d<1){d=1;e=b/4}else e=b/(2*Math.PI)*Math.asin(1/d);if((a*=2)<1)return-0.5*d*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/b);return d*Math.pow(2,-10*(a-=1))*Math.sin((a-e)*2*Math.PI/b)*0.5+1};TWEEN.Easing.Back.EaseIn=function(a){return a*a*(2.70158*a-1.70158)};TWEEN.Easing.Back.EaseOut=function(a){return(a-=1)*a*(2.70158*a+1.70158)+1}; TWEEN.Easing.Elastic.EaseInOut=function(a){var e,c=0.1,d=0.4;if(a==0)return 0;if(a==1)return 1;d||(d=0.3);if(!c||c<1){c=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/c);if((a*=2)<1)return-0.5*c*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/d);return c*Math.pow(2,-10*(a-=1))*Math.sin((a-e)*2*Math.PI/d)*0.5+1};TWEEN.Easing.Back.EaseIn=function(a){return a*a*(2.70158*a-1.70158)};TWEEN.Easing.Back.EaseOut=function(a){return(a-=1)*a*(2.70158*a+1.70158)+1};
TWEEN.Easing.Back.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*(3.5949095*a-2.5949095);return 0.5*((a-=2)*a*(3.5949095*a+2.5949095)+2)};TWEEN.Easing.Bounce.EaseIn=function(a){return 1-TWEEN.Easing.Bounce.EaseOut(1-a)};TWEEN.Easing.Bounce.EaseOut=function(a){return(a/=1)<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}; TWEEN.Easing.Back.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*(3.5949095*a-2.5949095);return 0.5*((a-=2)*a*(3.5949095*a+2.5949095)+2)};TWEEN.Easing.Bounce.EaseIn=function(a){return 1-TWEEN.Easing.Bounce.EaseOut(1-a)};TWEEN.Easing.Bounce.EaseOut=function(a){return(a/=1)<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375};
TWEEN.Easing.Bounce.EaseInOut=function(a){if(a<0.5)return TWEEN.Easing.Bounce.EaseIn(a*2)*0.5;return TWEEN.Easing.Bounce.EaseOut(a*2-1)*0.5+0.5}; TWEEN.Easing.Bounce.EaseInOut=function(a){if(a<0.5)return TWEEN.Easing.Bounce.EaseIn(a*2)*0.5;return TWEEN.Easing.Bounce.EaseOut(a*2-1)*0.5+0.5};
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>three.js webgl - interactive cubes</title>
<meta charset="utf-8">
<style type="text/css">
body {
font-family: Monospace;
background-color: #f0f0f0;
margin: 0px;
overflow: hidden;
}
</style>
</head>
<body>
<script type="text/javascript" src="../build/Three.js"></script>
<script type="text/javascript" src="js/Tween.js"></script>
<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
<script type="text/javascript" src="js/Stats.js"></script>
<script type="text/javascript">
var container, stats;
var camera, scene, projector, renderer;
init();
animate();
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
var info = document.createElement( 'div' );
info.style.position = 'absolute';
info.style.top = '10px';
info.style.width = '100%';
info.style.textAlign = 'center';
info.innerHTML = '<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> webgl - interactive cubes';
container.appendChild( info );
camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.y = 300;
camera.position.z = 500;
scene = new THREE.Scene();
var light = new THREE.DirectionalLight( 0xffffff, 2 );
light.position.x = 1;
light.position.y = 1;
light.position.z = 1;
light.position.normalize();
scene.addLight( light );
var light = new THREE.DirectionalLight( 0xffffff );
light.position.x = - 1;
light.position.y = - 1;
light.position.z = - 1;
light.position.normalize();
scene.addLight( light );
var geometry = new THREE.Cube( 100, 100, 100 );
for ( var i = 0; i < 20; i ++ ) {
var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) );
object.position.x = Math.random() * 800 - 400;
object.position.y = Math.random() * 800 - 400;
object.position.z = Math.random() * 800 - 400;
object.scale.x = Math.random() * 2 + 1;
object.scale.y = Math.random() * 2 + 1;
object.scale.z = Math.random() * 2 + 1;
object.rotation.x = ( Math.random() * 360 ) * Math.PI / 180;
object.rotation.y = ( Math.random() * 360 ) * Math.PI / 180;
object.rotation.z = ( Math.random() * 360 ) * Math.PI / 180;
scene.addObject( object );
}
projector = new THREE.Projector();
renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild(renderer.domElement);
stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
container.appendChild( stats.domElement );
document.addEventListener( 'mousedown', onDocumentMouseDown, false );
}
function onDocumentMouseDown( event ) {
event.preventDefault();
var vector = new THREE.Vector3( ( event.clientX / window.innerWidth ) * 2 - 1, - ( event.clientY / window.innerHeight ) * 2 + 1, 0.5 );
projector.unprojectVector( vector, camera );
var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
var intersects = ray.intersectScene( scene );
if ( intersects.length > 0 ) {
new TWEEN.Tween( intersects[ 0 ].object.position ).to( {
x: Math.random() * 800 - 400,
y: Math.random() * 800 - 400,
z: Math.random() * 800 - 400 }, 2000 )
.easing( TWEEN.Easing.Elastic.EaseOut).start();
new TWEEN.Tween( intersects[ 0 ].object.rotation ).to( {
x: ( Math.random() * 360 ) * Math.PI / 180,
y: ( Math.random() * 360 ) * Math.PI / 180,
z: ( Math.random() * 360 ) * Math.PI / 180 }, 2000 )
.easing( TWEEN.Easing.Elastic.EaseOut).start();
}
/*
// Parse all the faces
for ( var i in intersects ) {
intersects[ i ].face.material[ 0 ].color.setHex( Math.random() * 0xffffff | 0x80000000 );
}
*/
}
//
function animate() {
requestAnimationFrame( animate );
render();
stats.update();
}
var radius = 600;
var theta = 0;
function render() {
TWEEN.update();
theta += 0.2;
camera.position.x = radius * Math.sin( theta * Math.PI / 360 );
camera.position.y = radius * Math.sin( theta * Math.PI / 360 );
camera.position.z = radius * Math.cos( theta * Math.PI / 360 );
renderer.render( scene, camera );
}
</script>
</body>
</html>
...@@ -476,61 +476,63 @@ THREE.Matrix4.prototype = { ...@@ -476,61 +476,63 @@ THREE.Matrix4.prototype = {
return this; return this;
}, },
getPosition : function() { getPosition: function() {
if( !this.position ) { if ( ! this.position ) {
this.position = new THREE.Vector3(); this.position = new THREE.Vector3();
} }
this.position.set( this.n14, this.n24, this.n34 ); this.position.set( this.n14, this.n24, this.n34 );
return this.position; return this.position;
}, },
getColumnX : function() { getColumnX: function() {
if( !this.columnX ) { if ( ! this.columnX ) {
this.columnX = new THREE.Vector3(); this.columnX = new THREE.Vector3();
} }
this.columnX.set( this.n11, this.n21, this.n31 ); this.columnX.set( this.n11, this.n21, this.n31 );
return this.columnX; return this.columnX;
}, },
getColumnY : function() { getColumnY: function() {
if( !this.columnY ) { if ( ! this.columnY ) {
this.columnY = new THREE.Vector3(); this.columnY = new THREE.Vector3();
} }
this.columnY.set( this.n12, this.n22, this.n32 ); this.columnY.set( this.n12, this.n22, this.n32 );
return this.columnY; return this.columnY;
}, },
getColumnZ : function() { getColumnZ: function() {
if( !this.columnZ ) { if ( ! this.columnZ ) {
this.columnZ = new THREE.Vector3(); this.columnZ = new THREE.Vector3();
} }
this.columnZ.set( this.n13, this.n23, this.n33 ); this.columnZ.set( this.n13, this.n23, this.n33 );
return this.columnZ; return this.columnZ;
}, },
setRotationFromEuler : function( v ) { setRotationFromEuler: function( v ) {
var x = v.x, y = v.y, z = v.z, var x = v.x, y = v.y, z = v.z,
a = Math.cos( x ), b = Math.sin( x ), a = Math.cos( x ), b = Math.sin( x ),
...@@ -554,7 +556,7 @@ THREE.Matrix4.prototype = { ...@@ -554,7 +556,7 @@ THREE.Matrix4.prototype = {
}, },
setRotationFromQuaternion : function( q ) { setRotationFromQuaternion: function( q ) {
var x = q.x, y = q.y, z = q.z, w = q.w, var x = q.x, y = q.y, z = q.z, w = q.w,
x2 = x + x, y2 = y + y, z2 = z + z, x2 = x + x, y2 = y + y, z2 = z + z,
...@@ -578,7 +580,7 @@ THREE.Matrix4.prototype = { ...@@ -578,7 +580,7 @@ THREE.Matrix4.prototype = {
}, },
scale : function ( v ) { scale: function ( v ) {
var x = v.x, y = v.y, z = v.z; var x = v.x, y = v.y, z = v.z;
...@@ -591,7 +593,7 @@ THREE.Matrix4.prototype = { ...@@ -591,7 +593,7 @@ THREE.Matrix4.prototype = {
}, },
extractPosition : function ( m ) { extractPosition: function ( m ) {
this.n14 = m.n14; this.n14 = m.n14;
this.n24 = m.n24; this.n24 = m.n24;
...@@ -599,7 +601,7 @@ THREE.Matrix4.prototype = { ...@@ -599,7 +601,7 @@ THREE.Matrix4.prototype = {
}, },
extractRotation : function ( m, s ) { extractRotation: function ( m, s ) {
var invScaleX = 1 / s.x, invScaleY = 1 / s.y, invScaleZ = 1 / s.z; var invScaleX = 1 / s.x, invScaleY = 1 / s.y, invScaleZ = 1 / s.z;
...@@ -628,7 +630,7 @@ THREE.Matrix4.makeInvert = function ( m1, m2 ) { ...@@ -628,7 +630,7 @@ THREE.Matrix4.makeInvert = function ( m1, m2 ) {
n31 = m1.n31, n32 = m1.n32, n33 = m1.n33, n34 = m1.n34, n31 = m1.n31, n32 = m1.n32, n33 = m1.n33, n34 = m1.n34,
n41 = m1.n41, n42 = m1.n42, n43 = m1.n43, n44 = m1.n44; n41 = m1.n41, n42 = m1.n42, n43 = m1.n43, n44 = m1.n44;
if( m2 === undefined ) m2 = new THREE.Matrix4(); if ( m2 === undefined ) m2 = new THREE.Matrix4();
m2.n11 = n23*n34*n42 - n24*n33*n42 + n24*n32*n43 - n22*n34*n43 - n23*n32*n44 + n22*n33*n44; m2.n11 = n23*n34*n42 - n24*n33*n42 + n24*n32*n43 - n22*n34*n43 - n23*n32*n44 + n22*n33*n44;
m2.n12 = n14*n33*n42 - n13*n34*n42 - n14*n32*n43 + n12*n34*n43 + n13*n32*n44 - n12*n33*n44; m2.n12 = n14*n33*n42 - n13*n34*n42 - n14*n32*n43 + n12*n34*n43 + n13*n32*n44 - n12*n33*n44;
...@@ -673,10 +675,12 @@ THREE.Matrix4.makeInvert3x3 = function ( m1 ) { ...@@ -673,10 +675,12 @@ THREE.Matrix4.makeInvert3x3 = function ( m1 ) {
idet; idet;
// no inverse // no inverse
if (det == 0) { if ( det == 0 ) {
throw "matrix not invertible";
console.error( 'THREE.Matrix4.makeInvert3x3: Matrix not invertible.' );
} }
idet = 1.0 / det; idet = 1.0 / det;
m33m[ 0 ] = idet * a11; m33m[ 1 ] = idet * a21; m33m[ 2 ] = idet * a31; m33m[ 0 ] = idet * a11; m33m[ 1 ] = idet * a21; m33m[ 2 ] = idet * a31;
......
...@@ -11,26 +11,20 @@ THREE.Ray = function ( origin, direction ) { ...@@ -11,26 +11,20 @@ THREE.Ray = function ( origin, direction ) {
THREE.Ray.prototype = { THREE.Ray.prototype = {
intersectScene : function ( scene ) { intersectScene: function ( scene ) {
return this.intersectObjects( scene.objects ); return this.intersectObjects( scene.objects );
}, },
intersectObjects : function ( objects ) { intersectObjects: function ( objects ) {
var i, l, object, var i, l, object,
intersects = []; intersects = [];
for ( i = 0, l = objects.length; i < l; i ++ ) { for ( i = 0, l = objects.length; i < l; i ++ ) {
object = objects[ i ]; intersects = intersects.concat( this.intersectObject( objects[ i ] ) );
if ( object instanceof THREE.Mesh ) {
intersects = intersects.concat( this.intersectObject( object ) );
}
} }
...@@ -40,70 +34,93 @@ THREE.Ray.prototype = { ...@@ -40,70 +34,93 @@ THREE.Ray.prototype = {
}, },
intersectObject : function ( object ) { intersectObject: function ( object ) {
var f, fl, face, a, b, c, d, normal, if ( object instanceof THREE.Particle ) {
dot, scalar,
origin, direction,
geometry = object.geometry,
vertices = geometry.vertices,
objMatrix,
intersect, intersects = [],
intersectPoint;
for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) { var intersects = [],
distance = distanceFromIntersection( this.origin, this.direction, object );
face = geometry.faces[ f ]; if ( distance && distance < object.scale.x ) {
origin = this.origin.clone(); intersects.push( {
direction = this.direction.clone();
objMatrix = object.matrixWorld; distance: distance,
point: object.position,
object: object
a = objMatrix.multiplyVector3( vertices[ face.a ].position.clone() ); } );
b = objMatrix.multiplyVector3( vertices[ face.b ].position.clone() );
c = objMatrix.multiplyVector3( vertices[ face.c ].position.clone() );
d = face instanceof THREE.Face4 ? objMatrix.multiplyVector3( vertices[ face.d ].position.clone() ) : null;
normal = object.matrixRotationWorld.multiplyVector3( face.normal.clone() ); }
dot = direction.dot( normal );
if ( object.doubleSided || ( object.flipSided ? dot > 0 : dot < 0 ) ) { // Math.abs( dot ) > 0.0001 return intersects;
scalar = normal.dot( new THREE.Vector3().sub( a, origin ) ) / dot; } else if ( object instanceof THREE.Mesh ) {
intersectPoint = origin.addSelf( direction.multiplyScalar( scalar ) );
if ( face instanceof THREE.Face3 ) { var f, fl, face, a, b, c, d, normal,
dot, scalar,
origin, direction,
geometry = object.geometry,
vertices = geometry.vertices,
objMatrix,
intersect, intersects = [],
intersectPoint;
if ( pointInFace3( intersectPoint, a, b, c ) ) { for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
intersect = { face = geometry.faces[ f ];
distance: this.origin.distanceTo( intersectPoint ), origin = this.origin.clone();
point: intersectPoint, direction = this.direction.clone();
face: face,
object: object
}; objMatrix = object.matrixWorld;
intersects.push( intersect ); a = objMatrix.multiplyVector3( vertices[ face.a ].position.clone() );
b = objMatrix.multiplyVector3( vertices[ face.b ].position.clone() );
c = objMatrix.multiplyVector3( vertices[ face.c ].position.clone() );
d = face instanceof THREE.Face4 ? objMatrix.multiplyVector3( vertices[ face.d ].position.clone() ) : null;
} normal = object.matrixRotationWorld.multiplyVector3( face.normal.clone() );
dot = direction.dot( normal );
if ( object.doubleSided || ( object.flipSided ? dot > 0 : dot < 0 ) ) { // Math.abs( dot ) > 0.0001
scalar = normal.dot( new THREE.Vector3().sub( a, origin ) ) / dot;
intersectPoint = origin.addSelf( direction.multiplyScalar( scalar ) );
if ( face instanceof THREE.Face3 ) {
if ( pointInFace3( intersectPoint, a, b, c ) ) {
intersect = {
distance: this.origin.distanceTo( intersectPoint ),
point: intersectPoint,
face: face,
object: object
};
} else if ( face instanceof THREE.Face4 ) { intersects.push( intersect );
if ( pointInFace3( intersectPoint, a, b, d ) || pointInFace3( intersectPoint, b, c, d ) ) { }
intersect = { } else if ( face instanceof THREE.Face4 ) {
distance: this.origin.distanceTo( intersectPoint ), if ( pointInFace3( intersectPoint, a, b, d ) || pointInFace3( intersectPoint, b, c, d ) ) {
point: intersectPoint,
face: face,
object: object
}; intersect = {
intersects.push( intersect ); distance: this.origin.distanceTo( intersectPoint ),
point: intersectPoint,
face: face,
object: object
};
intersects.push( intersect );
}
} }
...@@ -111,9 +128,25 @@ THREE.Ray.prototype = { ...@@ -111,9 +128,25 @@ THREE.Ray.prototype = {
} }
return intersects;
} }
return intersects; function distanceFromIntersection( origin, direction, object ) {
var vector, dot, intersect, distance;
vector = object.position.clone().subSelf( origin );
dot = vector.dot( direction );
if ( dot < 0 ) return false; // Object is behind origin
intersect = origin.clone().addSelf( direction.clone().multiplyScalar( dot ) );
distance = object.position.distanceTo( intersect );
return distance;
}
// http://www.blackpawn.com/texts/pointinpoly/default.html // http://www.blackpawn.com/texts/pointinpoly/default.html
......
...@@ -98,7 +98,7 @@ THREE.Projector = function() { ...@@ -98,7 +98,7 @@ THREE.Projector = function() {
_face4Count = 0; _face4Count = 0;
_lineCount = 0; _lineCount = 0;
_particleCount = 0; _particleCount = 0;
camera.matrixAutoUpdate && camera.update( undefined, true ); camera.matrixAutoUpdate && camera.update( undefined, true );
scene.update( undefined, false, camera ); scene.update( undefined, false, camera );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册