From e151ff394b140ba63a02a50af2c58e5460e750ba Mon Sep 17 00:00:00 2001 From: alteredq Date: Sat, 19 Feb 2011 16:21:23 +0100 Subject: [PATCH] Added Ribbon object. It provides a lean way how to render TRIANGLE_STRIP primitives: needs just n+2 vertices for n triangles (one Ribbon = one strip). There are no faces, no indices, everything is rendered in one simple drawArray call. Vertex colors are supported, normals not yet. --- build/Three.js | 377 ++++++++++++++++---------------- build/ThreeDebug.js | 379 +++++++++++++++++---------------- build/ThreeExtras.js | 275 ++++++++++++------------ examples/ribbons_gl.html | 342 +++++++++++++++++++++++++++++ examples/uqbiquity_test.html | 1 + src/objects/Object3D.js | 2 +- src/renderers/WebGLRenderer.js | 105 ++++++++- utils/build.py | 1 + 8 files changed, 968 insertions(+), 514 deletions(-) create mode 100644 examples/ribbons_gl.html diff --git a/build/Three.js b/build/Three.js index f23b65c67a..ba40dad4cd 100755 --- a/build/Three.js +++ b/build/Three.js @@ -1,103 +1,104 @@ // Three.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,g,i,l,n,k;if(c==0)e=g=i=0;else{l=Math.floor(a*6);n=a*6-l;a=c*(1-b);k=c*(1-b*n);b=c*(1-b*(1-n));switch(l){case 1:e=k;g=c;i=a;break;case 2:e=a;g=c;i=b;break;case 3:e=a;g=k;i=c;break;case 4:e=b;g=a;i=c;break;case 5:e=c;g=a;i=k;break;case 6:case 0:e=c;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,i,l,n,k;if(d==0)e=g=i=0;else{l=Math.floor(a*6);n=a*6-l;a=d*(1-b);k=d*(1-b*n);b=d*(1-b*(1-n));switch(l){case 1:e=k;g=d;i=a;break;case 2:e=a;g=d;i=b;break;case 3:e=a;g=k;i=d;break;case 4:e=b;g=a;i=d;break;case 5:e=d;g=a;i=k;break;case 6:case 0:e=d;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* -this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=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.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, -cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.x=c*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= -a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+c*c+a*a)},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+ +this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0}; +THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-d*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= +a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+d*d+a*a)},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+ this.y+this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+ -this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e||1}; -THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; +this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1}; +THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a0&&G>0&&d+G<1}var c,e,g,i,l,n,k,o,s,w, -t,x=a.geometry,F=x.vertices,H=[];c=0;for(e=x.faces.length;ck?e:k;g=g>o?g:o}a()}; -this.add3Points=function(k,o,s,w,t,x){if(n){n=!1;b=ks?k>t?k:t:s>t?s:t;g=o>w?o>x?o:x:w>x?w:x}else{b=ks?k>t?k>e?k:e:t>e?t:e:s>t?s>e?s:e:t>e?t:e;g=o>w?o>x?o>g?o:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(n){n=!1;b=k.getLeft();c=k.getTop();e=k.getRight();g=k.getBottom()}else{b=bk.getRight()? -e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e=0&&Math.min(g,k.getBottom())-Math.max(c,k.getTop())>=0};this.empty=function(){n=!0;g=e=c=b=0;a()};this.isEmpty=function(){return n};this.toString=function(){return"THREE.Rectangle ( left: "+ -b+", right: "+e+", top: "+c+", bottom: "+g+", width: "+i+", height: "+l+" )"}};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,e,g,i,l,n,k,o,s,w,t,x,F,H){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=i||1;this.n23=l||0;this.n24=n||0;this.n31=k||0;this.n32=o||0;this.n33=s||1;this.n34=w||0;this.n41=t||0;this.n42=x||0;this.n43=F||0;this.n44=H||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,e,g,i,l,n,k,o,s,w,t,x,F,H){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=i;this.n23=l;this.n24=n;this.n31=k;this.n32=o;this.n33=s;this.n34=w;this.n41=t;this.n42=x;this.n43=F;this.n44=H;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,b).normalize();e.cross(c,i).normalize();g.cross(i,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); -this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,g=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43* -a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*g;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,e=a.n12,g=a.n13,i=a.n14,l=a.n21,n=a.n22,k=a.n23,o=a.n24,s=a.n31,w=a.n32,t=a.n33,x=a.n34,F=a.n41,H=a.n42,G=a.n43,r=a.n44,Z=b.n11,D=b.n12,K=b.n13,d=b.n14,ga=b.n21,T=b.n22,N=b.n23,ba=b.n24,R=b.n31,aa=b.n32,V=b.n33,B=b.n34,I=b.n41,ka=b.n42,P=b.n43,ja=b.n44;this.n11=c*Z+e*ga+g*R+i*I;this.n12=c*D+e*T+g*aa+i*ka;this.n13=c*K+e*N+g*V+i*P;this.n14=c*d+e*ba+g*B+i*ja;this.n21=l*Z+n*ga+k*R+o*I;this.n22=l*D+n*T+k*aa+o*ka; -this.n23=l*K+n*N+k*V+o*P;this.n24=l*d+n*ba+k*B+o*ja;this.n31=s*Z+w*ga+t*R+x*I;this.n32=s*D+w*T+t*aa+x*ka;this.n33=s*K+w*N+t*V+x*P;this.n34=s*d+w*ba+t*B+x*ja;this.n41=F*Z+H*ga+G*R+r*I;this.n42=F*D+H*T+G*aa+r*ka;this.n43=F*K+H*N+G*V+r*P;this.n44=F*d+H*ba+G*B+r*ja;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,i=a.n13,l=a.n14,n=a.n21,k=a.n22,o=a.n23,s=a.n24,w=a.n31,t=a.n32,x=a.n33,F=a.n34,H=a.n41,G=a.n42,r=a.n43;a=a.n44;var Z=b.n11,D=b.n12,K=b.n13,d=b.n14,ga=b.n21,T=b.n22,N=b.n23,ba= -b.n24,R=b.n31,aa=b.n32,V=b.n33,B=b.n34,I=b.n41,ka=b.n42,P=b.n43;b=b.n44;this.n11=e*Z+g*ga+i*R+l*I;this.n12=e*D+g*T+i*aa+l*ka;this.n13=e*K+g*N+i*V+l*P;this.n14=e*d+g*ba+i*B+l*b;this.n21=n*Z+k*ga+o*R+s*I;this.n22=n*D+k*T+o*aa+s*ka;this.n23=n*K+k*N+o*V+s*P;this.n24=n*d+k*ba+o*B+s*b;this.n31=w*Z+t*ga+x*R+F*I;this.n32=w*D+t*T+x*aa+F*ka;this.n33=w*K+t*N+x*V+F*P;this.n34=w*d+t*ba+x*B+F*b;this.n41=H*Z+G*ga+r*R+a*I;this.n42=H*D+G*T+r*aa+a*ka;this.n43=H*K+G*N+r*V+a*P;this.n44=H*d+G*ba+r*B+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){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,i=this.n21,l=this.n22,n=this.n23,k=this.n24,o=this.n31,s=this.n32,w=this.n33,t=this.n34,x=this.n41,F=this.n42,H=this.n43,G=this.n44,r=a.n11,Z=a.n21,D=a.n31,K=a.n41,d=a.n12,ga=a.n22,T=a.n32,N=a.n42,ba= -a.n13,R=a.n23,aa=a.n33,V=a.n43,B=a.n14,I=a.n24,ka=a.n34;a=a.n44;this.n11=b*r+c*Z+e*D+g*K;this.n12=b*d+c*ga+e*T+g*N;this.n13=b*ba+c*R+e*aa+g*V;this.n14=b*B+c*I+e*ka+g*a;this.n21=i*r+l*Z+n*D+k*K;this.n22=i*d+l*ga+n*T+k*N;this.n23=i*ba+l*R+n*aa+k*V;this.n24=i*B+l*I+n*ka+k*a;this.n31=o*r+s*Z+w*D+t*K;this.n32=o*d+s*ga+w*T+t*N;this.n33=o*ba+s*R+w*aa+t*V;this.n34=o*B+s*I+w*ka+t*a;this.n41=x*r+F*Z+H*D+G*K;this.n42=x*d+F*ga+H*T+G*N;this.n43=x*ba+F*R+H*aa+G*V;this.n44=x*B+F*I+H*ka+G*a;return this},multiplyScalar:function(a){this.n11*= -a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,g=this.n21,i=this.n22,l=this.n23,n=this.n24,k=this.n31,o=this.n32,s=this.n33,w=this.n34,t=this.n41,x=this.n42,F=this.n43,H=this.n44;return e*l*o*t-c*n*o*t-e*i*s*t+b*n*s*t+c*i*w*t-b*l*w*t-e*l*k*x+c*n*k*x+e*g*s*x-a*n*s*x-c*g*w*x+a*l*w*x+ -e*i*k*F-b*n*k*F-e*g*o*F+a*n*o*F+b*g*w*F-a*i*w*F-c*i*k*H+b*l*k*H+c*g*o*H-a*l*o*H-b*g*s*H+a*i*s*H},transpose:function(){function a(b,c,e){var g=b[c];b[c]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33; +THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a0&&H>0&&c+H<1}var d,e,g,i,l,n,k,o,s,w, +u,x=a.geometry,F=x.vertices,I=[];d=0;for(e=x.faces.length;dk?e:k;g=g>o?g:o}a()}; +this.add3Points=function(k,o,s,w,u,x){if(n){n=!1;b=ks?k>u?k:u:s>u?s:u;g=o>w?o>x?o:x:w>x?w:x}else{b=ks?k>u?k>e?k:e:u>e?u:e:s>u?s>e?s:e:u>e?u:e;g=o>w?o>x?o>g?o:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(n){n=!1;b=k.getLeft();d=k.getTop();e=k.getRight();g=k.getBottom()}else{b=bk.getRight()? +e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;d-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e=0&&Math.min(g,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){n=!0;g=e=d=b=0;a()};this.isEmpty=function(){return n};this.toString=function(){return"THREE.Rectangle ( left: "+ +b+", right: "+e+", top: "+d+", bottom: "+g+", width: "+i+", height: "+l+" )"}};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,d,e,g,i,l,n,k,o,s,w,u,x,F,I){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=i||1;this.n23=l||0;this.n24=n||0;this.n31=k||0;this.n32=o||0;this.n33=s||1;this.n34=w||0;this.n41=u||0;this.n42=x||0;this.n43=F||0;this.n44=I||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,g,i,l,n,k,o,s,w,u,x,F,I){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=i;this.n23=l;this.n24=n;this.n31=k;this.n32=o;this.n33=s;this.n34=w;this.n41=u;this.n42=x;this.n43=F;this.n44=I;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,b).normalize();e.cross(d,i).normalize();g.cross(i,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); +this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,d=a.y;a=a.z;return(this.n31*b+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*d+this.n43* +a+this.n44))},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41* +a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,n=a.n22,k=a.n23,o=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44,Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca=b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43,ja=b.n44;this.n11=d*Z+e*ia+g*S+i*J;this.n12=d*E+e*T+g*ba+i*la;this.n13=d*L+e*O+g*V+i*Q;this.n14=d*c+e*ca+g*D+i*ja;this.n21=l*Z+n*ia+k*S+o*J;this.n22=l*E+n*T+k*ba+o*la; +this.n23=l*L+n*O+k*V+o*Q;this.n24=l*c+n*ca+k*D+o*ja;this.n31=s*Z+w*ia+u*S+x*J;this.n32=s*E+w*T+u*ba+x*la;this.n33=s*L+w*O+u*V+x*Q;this.n34=s*c+w*ca+u*D+x*ja;this.n41=F*Z+I*ia+H*S+r*J;this.n42=F*E+I*T+H*ba+r*la;this.n43=F*L+I*O+H*V+r*Q;this.n44=F*c+I*ca+H*D+r*ja;return this},multiplyToArray:function(a,b,d){var e=a.n11,g=a.n12,i=a.n13,l=a.n14,n=a.n21,k=a.n22,o=a.n23,s=a.n24,w=a.n31,u=a.n32,x=a.n33,F=a.n34,I=a.n41,H=a.n42,r=a.n43;a=a.n44;var Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca= +b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43;b=b.n44;this.n11=e*Z+g*ia+i*S+l*J;this.n12=e*E+g*T+i*ba+l*la;this.n13=e*L+g*O+i*V+l*Q;this.n14=e*c+g*ca+i*D+l*b;this.n21=n*Z+k*ia+o*S+s*J;this.n22=n*E+k*T+o*ba+s*la;this.n23=n*L+k*O+o*V+s*Q;this.n24=n*c+k*ca+o*D+s*b;this.n31=w*Z+u*ia+x*S+F*J;this.n32=w*E+u*T+x*ba+F*la;this.n33=w*L+u*O+x*V+F*Q;this.n34=w*c+u*ca+x*D+F*b;this.n41=I*Z+H*ia+r*S+a*J;this.n42=I*E+H*T+r*ba+a*la;this.n43=I*L+H*O+r*V+a*Q;this.n44=I*c+H*ca+r*D+a*b;d[0]=this.n11; +d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,i=this.n21,l=this.n22,n=this.n23,k=this.n24,o=this.n31,s=this.n32,w=this.n33,u=this.n34,x=this.n41,F=this.n42,I=this.n43,H=this.n44,r=a.n11,Z=a.n21,E=a.n31,L=a.n41,c=a.n12,ia=a.n22,T=a.n32,O=a.n42,ca= +a.n13,S=a.n23,ba=a.n33,V=a.n43,D=a.n14,J=a.n24,la=a.n34;a=a.n44;this.n11=b*r+d*Z+e*E+g*L;this.n12=b*c+d*ia+e*T+g*O;this.n13=b*ca+d*S+e*ba+g*V;this.n14=b*D+d*J+e*la+g*a;this.n21=i*r+l*Z+n*E+k*L;this.n22=i*c+l*ia+n*T+k*O;this.n23=i*ca+l*S+n*ba+k*V;this.n24=i*D+l*J+n*la+k*a;this.n31=o*r+s*Z+w*E+u*L;this.n32=o*c+s*ia+w*T+u*O;this.n33=o*ca+s*S+w*ba+u*V;this.n34=o*D+s*J+w*la+u*a;this.n41=x*r+F*Z+I*E+H*L;this.n42=x*c+F*ia+I*T+H*O;this.n43=x*ca+F*S+I*ba+H*V;this.n44=x*D+F*J+I*la+H*a;return this},multiplyScalar:function(a){this.n11*= +a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,g=this.n21,i=this.n22,l=this.n23,n=this.n24,k=this.n31,o=this.n32,s=this.n33,w=this.n34,u=this.n41,x=this.n42,F=this.n43,I=this.n44;return e*l*o*u-d*n*o*u-e*i*s*u+b*n*s*u+d*i*w*u-b*l*w*u-e*l*k*x+d*n*k*x+e*g*s*x-a*n*s*x-d*g*w*x+a*l*w*x+ +e*i*k*F-b*n*k*F-e*g*o*F+a*n*o*F+b*g*w*F-a*i*w*F-d*i*k*I+b*l*k*I+d*g*o*I-a*l*o*I-b*g*s*I+a*i*s*I},transpose:function(){function a(b,d,e){var g=b[d];b[d]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33; a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]= -this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1); -return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),g=1-c,i=a.x,l=a.y,n=a.z,k=g* -i,o=g*l;this.set(k*i+c,k*l-e*n,k*n+e*l,0,k*l+e*n,o*l+c,o*n-e*i,0,k*n-e*l,o*n+e*i,g*n*n+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},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(-e);e=Math.sin(-e);var i=Math.cos(b);b=Math.sin(b);var l=a*e,n=c*e;this.n11=a*g;this.n12=c*b-l*i;this.n13=l*b+c*i;this.n21=e;this.n22=g*i;this.n23=-g*b;this.n31=-c*g;this.n32=n*i+a*b;this.n33=-n*b+a*i},setRotationFromQuaternion:function(a){var b= -a.x,c=a.y,e=a.z,g=a.w,i=b+b,l=c+c,n=e+e;a=b*i;var k=b*l;b*=n;var o=c*l;c*=n;e*=n;i*=g;l*=g;g*=n;this.n11=1-(o+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=c-i;this.n31=b-l;this.n32=c+i;this.n33=1-(a+o)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22; -a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e}; -THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c}; -THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,n=a.n22,k=a.n23,o=a.n24,s=a.n31,w=a.n32,t=a.n33,x=a.n34,F=a.n41,H=a.n42,G=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*x*H-o*t*H+o*w*G-n*x*G-k*w*r+n*t*r;b.n12=i*t*H-g*x*H-i*w*G+e*x*G+g*w*r-e*t*r;b.n13=g*o*H-i*k*H+i*n*G-e*o*G-g*n*r+e*k*r;b.n14=i*k*w-g*o*w-i*n*t+e*o*t+g*n*x-e*k*x;b.n21=o*t*F-k*x*F-o*s*G+l*x*G+k*s*r-l*t*r;b.n22=g*x*F-i*t*F+i*s*G-c*x*G-g*s*r+c*t*r;b.n23=i*k*F-g*o*F-i*l*G+c*o*G+g*l*r-c*k*r; -b.n24=g*o*s-i*k*s+i*l*t-c*o*t-g*l*x+c*k*x;b.n31=n*x*F-o*w*F+o*s*H-l*x*H-n*s*r+l*w*r;b.n32=i*w*F-e*x*F-i*s*H+c*x*H+e*s*r-c*w*r;b.n33=g*o*F-i*n*F+i*l*H-c*o*H-e*l*r+c*n*r;b.n34=i*n*s-e*o*s-i*l*w+c*o*w+e*l*x-c*n*x;b.n41=k*w*F-n*t*F-k*s*H+l*t*H+n*s*G-l*w*G;b.n42=e*t*F-g*w*F+g*s*H-c*t*H-e*s*G+c*w*G;b.n43=g*n*F-e*k*F-g*l*H+c*k*H+e*l*G-c*n*G;b.n44=e*k*s-g*n*s+g*l*w-c*k*w-e*l*t+c*n*t;b.multiplyScalar(1/a.determinant());return b}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,n=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,s=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*i;c[3]=a*l;c[4]=a*n;c[5]=a*k;c[6]=a*o;c[7]=a*s;c[8]=a*w;return b}; -THREE.Matrix4.makeFrustum=function(a,b,c,e,g,i){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-c);l.n23=(e+c)/(e-c);l.n24=0;l.n31=0;l.n32=0;l.n33=-(i+g)/(i-g);l.n34=-2*i*g/(i-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,c,e){var g;a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,e)}; -THREE.Matrix4.makeOrtho=function(a,b,c,e,g,i){var l,n,k,o;l=new THREE.Matrix4;n=b-a;k=c-e;o=i-g;l.n11=2/n;l.n12=0;l.n13=0;l.n14=-((b+a)/n);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((c+e)/k);l.n31=0;l.n32=0;l.n33=-2/o;l.n34=-((i+g)/o);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; -THREE.Quaternion=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api}; -THREE.Quaternion.prototype.set=function(a,b,c,e){var g=this.that;g.x=a;g.y=b;g.z=c;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(c);c=Math.sin(c);var l=a*b,n=e*g,k=this.that;k.w=l*i-n*c;k.x=l*c+n*i;k.y=e*b*i+a*g*c;k.z=a*g*i-e*b*c;this.isDirty=!0;return this}; -THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,c=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-c*c-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)}; -THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,c=a.y,e=a.z,g=a.w,i=Math.sqrt(b*b+c*c+e*e+g*g);if(i==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}i=1/i;a.x=b*i;a.y=c*i;a.z=e*i;a.w=g*i;this.isDirty=!0;return this}; +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,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1); +return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),g=1-d,i=a.x,l=a.y,n=a.z,k=g* +i,o=g*l;this.set(k*i+d,k*l-e*n,k*n+e*l,0,k*l+e*n,o*l+d,o*n-e*i,0,k*n-e*l,o*n+e*i,g*n*n+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(d);d=Math.sin(d);var g=Math.cos(-e);e=Math.sin(-e);var i=Math.cos(b);b=Math.sin(b);var l=a*e,n=d*e;this.n11=a*g;this.n12=d*b-l*i;this.n13=l*b+d*i;this.n21=e;this.n22=g*i;this.n23=-g*b;this.n31=-d*g;this.n32=n*i+a*b;this.n33=-n*b+a*i},setRotationFromQuaternion:function(a){var b= +a.x,d=a.y,e=a.z,g=a.w,i=b+b,l=d+d,n=e+e;a=b*i;var k=b*l;b*=n;var o=d*l;d*=n;e*=n;i*=g;l*=g;g*=n;this.n11=1-(o+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=d-i;this.n31=b-l;this.n32=d+i;this.n33=1-(a+o)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=d;this.n22*=d;this.n23*=d;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22; +a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e}; +THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var d=new THREE.Matrix4;d.setRotAxis(a,b);return d}; +THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,n=a.n22,k=a.n23,o=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*x*I-o*u*I+o*w*H-n*x*H-k*w*r+n*u*r;b.n12=i*u*I-g*x*I-i*w*H+e*x*H+g*w*r-e*u*r;b.n13=g*o*I-i*k*I+i*n*H-e*o*H-g*n*r+e*k*r;b.n14=i*k*w-g*o*w-i*n*u+e*o*u+g*n*x-e*k*x;b.n21=o*u*F-k*x*F-o*s*H+l*x*H+k*s*r-l*u*r;b.n22=g*x*F-i*u*F+i*s*H-d*x*H-g*s*r+d*u*r;b.n23=i*k*F-g*o*F-i*l*H+d*o*H+g*l*r-d*k*r; +b.n24=g*o*s-i*k*s+i*l*u-d*o*u-g*l*x+d*k*x;b.n31=n*x*F-o*w*F+o*s*I-l*x*I-n*s*r+l*w*r;b.n32=i*w*F-e*x*F-i*s*I+d*x*I+e*s*r-d*w*r;b.n33=g*o*F-i*n*F+i*l*I-d*o*I-e*l*r+d*n*r;b.n34=i*n*s-e*o*s-i*l*w+d*o*w+e*l*x-d*n*x;b.n41=k*w*F-n*u*F-k*s*I+l*u*I+n*s*H-l*w*H;b.n42=e*u*F-g*w*F+g*s*I-d*u*I-e*s*H+d*w*H;b.n43=g*n*F-e*k*F-g*l*I+d*k*I+e*l*H-d*n*H;b.n44=e*k*s-g*n*s+g*l*w-d*k*w-e*l*u+d*n*u;b.multiplyScalar(1/a.determinant());return b}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,n=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,s=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*i;d[3]=a*l;d[4]=a*n;d[5]=a*k;d[6]=a*o;d[7]=a*s;d[8]=a*w;return b}; +THREE.Matrix4.makeFrustum=function(a,b,d,e,g,i){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-d);l.n23=(e+d)/(e-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(i+g)/(i-g);l.n34=-2*i*g/(i-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,b,d,e,g,i){var l,n,k,o;l=new THREE.Matrix4;n=b-a;k=d-e;o=i-g;l.n11=2/n;l.n12=0;l.n13=0;l.n14=-((b+a)/n);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((d+e)/k);l.n31=0;l.n32=0;l.n33=-2/o;l.n34=-((i+g)/o);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Quaternion=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api}; +THREE.Quaternion.prototype.set=function(a,b,d,e){var g=this.that;g.x=a;g.y=b;g.z=d;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(d);d=Math.sin(d);var l=a*b,n=e*g,k=this.that;k.w=l*i-n*d;k.x=l*d+n*i;k.y=e*b*i+a*g*d;k.z=a*g*i-e*b*d;this.isDirty=!0;return this}; +THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,d=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-d*d-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)}; +THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,d=a.y,e=a.z,g=a.w,i=Math.sqrt(b*b+d*d+e*e+g*g);if(i==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}i=1/i;a.x=b*i;a.y=d*i;a.z=e*i;a.w=g*i;this.isDirty=!0;return this}; THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this}; -THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=this.that,e=a.x,g=a.y,i=a.z,l=c.x,n=c.y,k=c.z;c=c.w;var o=c*e+n*i-k*g,s=c*g+k*e-l*i,w=c*i+l*g-n*e;e=-l*e-n*g-k*i;b.x=o*c+e*-l+s*-k-w*-n;b.y=s*c+e*-n+w*-l-o*-k;b.z=w*c+e*-k+o*-n-s*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){}; -THREE.Quaternion.slerp=function(a,b,c,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var i=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}g=Math.sin((1-e)*i)/l;e=Math.sin(e*i)/l;c.w=a.w*g+b.w*e;c.x=a.x*g+b.x*e;c.y=a.y*g+b.y*e;c.z=a.z*g+b.z*e;return c}; +THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var d=this.that,e=a.x,g=a.y,i=a.z,l=d.x,n=d.y,k=d.z;d=d.w;var o=d*e+n*i-k*g,s=d*g+k*e-l*i,w=d*i+l*g-n*e;e=-l*e-n*g-k*i;b.x=o*d+e*-l+s*-k-w*-n;b.y=s*d+e*-n+w*-l-o*-k;b.z=w*d+e*-k+o*-n-s*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){}; +THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var i=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*i)/l;e=Math.sin(e*i)/l;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,b,c,e,g){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,b,c,e,g,i){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; +THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,b,d,e,g,i){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1}; -THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a0){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;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;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;b0){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,d=this.vertices.length;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;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,d=this.vertices.length;b65535){o[n].counter+=1;k=o[n].hash+"_"+o[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix= -new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e=this.children.length;for(a=0;athis.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{c=c==="pos"?i.position:i.scale;c.x=e[0]+(g[0]-e[0])*b;c.y=e[1]+(g[1]-e[1])*b;c.z=e[2]+(g[2]-e[2])*b}}}if(n[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;sthis.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{d=d==="pos"?i.position:i.scale;d.x=e[0]+(g[0]-e[0])*b;d.y=e[1]+(g[1]-e[1])*b;d.z=e[2]+(g[2]-e[2])*b}}}if(n[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;s-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var n=this.projectionMatrix,k=1/(n.n43*l),o=k*this.screenCenterX,s=(g.n11*b+g.n12*c+g.n13*e+g.n14)*n.n11*o;i=n.n11*i*o;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*c+g.n23*e+g.n24)*n.n22*k*this.screenCenterY; +THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix, +this.inverseMatrix)}}for(a=0;a-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var n=this.projectionMatrix,k=1/(n.n43*l),o=k*this.screenCenterX,s=(g.n11*b+g.n12*d+g.n13*e+g.n14)*n.n11*o;i=n.n11*i*o;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*d+g.n23*e+g.n24)*n.n22*k*this.screenCenterY; if(b+i<-this.screenCenterY)return!1;if(b-i>this.screenCenterY)return!1;a.screenPosition.set(s,b,l,i);return!0};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;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight; THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1; THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0}; @@ -132,124 +133,126 @@ THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;th undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}}; THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}}; -THREE.Texture=function(a,b,c,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter}; +THREE.Texture=function(a,b,d,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; -THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var b,c,e,g={};for(b in a){g[b]={};for(c in a[b]){e=a[b][c];g[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,c,e,g={};for(b=0;b=0&&V>=0&&B>=0&&I>=0)return!0;else if(aa<0&&V<0||B<0&&I<0)return!1;else{if(aa<0)ba=Math.max(ba,aa/(aa-V));else V<0&&(R=Math.min(R,aa/(aa-V)));if(B<0)ba=Math.max(ba,B/(B-I));else I<0&&(R=Math.min(R,B/(B-I)));if(Raa&&P.z0&&G.z<1){t=F[x]=F[x]||new THREE.RenderableParticle;t.x=G.x/G.w;t.y=G.y/G.w;t.z=G.z;t.rotation=Q.rotation.z;t.scale.x=Q.scale.x*Math.abs(t.x- -(G.x+N.projectionMatrix.n11)/(G.w+N.projectionMatrix.n14));t.scale.y=Q.scale.y*Math.abs(t.y-(G.y+N.projectionMatrix.n22)/(G.w+N.projectionMatrix.n24));t.materials=Q.materials;R.push(t);x++}}}}ba&&R.sort(a);return R};this.unprojectVector=function(T,N){var ba=THREE.Matrix4.makeInvert(N.globalMatrix);ba.multiplySelf(THREE.Matrix4.makeInvert(N.projectionMatrix));ba.multiplyVector3(T);return T}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,i;this.domElement=document.createElement("div");this.setSize=function(l,n){c=l;e=n;g=c/2;i=e/2};this.render=function(l,n){var k,o,s,w,t,x,F,H;a=b.projectScene(l,n);k=0;for(o=a.length;k0){A.r+=xa.r*ma;A.g+=xa.g*ma;A.b+=xa.b*ma}}else if(ma instanceof THREE.PointLight){E.sub(ma.position,X);E.normalize();ma=Y.dot(E)* -Da;if(ma>0){A.r+=xa.r*ma;A.g+=xa.g*ma;A.b+=xa.b*ma}}}}function Ga(z,X,Y){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);var A,U,ma,xa,Da,Ea;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){xa=Y.map.image;Da=xa.width>>1;Ea=xa.height>>1;U=X.scale.x*n;ma=X.scale.y*k;Y=U*Da;A=ma*Ea;h.set(z.x-Y,z.y-A,z.x+Y,z.y+A);if(p.instersects(h)){o.save();o.translate(z.x,z.y);o.rotate(-X.rotation);o.scale(U,-ma);o.translate(-Da,-Ea);o.drawImage(xa,0,0);o.restore()}}}else if(Y instanceof THREE.ParticleCircleMaterial){if(q){v.r= -C.r+W.r+L.r;v.g=C.g+W.g+L.g;v.b=C.b+W.b+L.b;R.r=Y.color.r*v.r;R.g=Y.color.g*v.g;R.b=Y.color.b*v.b;R.updateStyleString()}else R.__styleString=Y.color.__styleString;Y=X.scale.x*n;A=X.scale.y*k;h.set(z.x-Y,z.y-A,z.x+Y,z.y+A);if(p.instersects(h)){U=R.__styleString;if(H!=U)o.fillStyle=H=U;o.save();o.translate(z.x,z.y);o.rotate(-X.rotation);o.scale(Y,A);o.beginPath();o.arc(0,0,1,0,S,!0);o.closePath();o.fill();o.restore()}}}}function O(z,X,Y,A){if(A.opacity!=0){a(A.opacity);b(A.blending);o.beginPath();o.moveTo(z.positionScreen.x, -z.positionScreen.y);o.lineTo(X.positionScreen.x,X.positionScreen.y);o.closePath();if(A instanceof THREE.LineBasicMaterial){R.__styleString=A.color.__styleString;z=A.linewidth;if(G!=z)o.lineWidth=G=z;z=R.__styleString;if(F!=z)o.strokeStyle=F=z;o.stroke();h.inflate(A.linewidth*2)}}}function M(z,X,Y,A,U,ma){if(U.opacity!=0){a(U.opacity);b(U.blending);K=z.positionScreen.x;d=z.positionScreen.y;ga=X.positionScreen.x;T=X.positionScreen.y;N=Y.positionScreen.x;ba=Y.positionScreen.y;o.beginPath();o.moveTo(K, -d);o.lineTo(ga,T);o.lineTo(N,ba);o.lineTo(K,d);o.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ca(K,d,ga,T,N,ba,U.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&U.env_map.mapping instanceof THREE.SphericalReflectionMapping){z=y.globalMatrix;E.copy(A.vertexNormalsWorld[0]);ca=(E.x*z.n11+E.y*z.n12+E.z*z.n13)*0.5+0.5;Q=-(E.x*z.n21+E.y*z.n22+E.z*z.n23)* -0.5+0.5;E.copy(A.vertexNormalsWorld[1]);ra=(E.x*z.n11+E.y*z.n12+E.z*z.n13)*0.5+0.5;wa=-(E.x*z.n21+E.y*z.n22+E.z*z.n23)*0.5+0.5;E.copy(A.vertexNormalsWorld[2]);f=(E.x*z.n11+E.y*z.n12+E.z*z.n13)*0.5+0.5;m=-(E.x*z.n21+E.y*z.n22+E.z*z.n23)*0.5+0.5;Ca(K,d,ga,T,N,ba,U.env_map.image,ca,Q,ra,wa,f,m)}}else U.wireframe?J(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ca(K, -d,ga,T,N,ba,U.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);b(THREE.SubtractiveBlending)}if(q)if(!U.wireframe&&U.shading==THREE.SmoothShading&&A.vertexNormalsWorld.length==3){aa.r=V.r=B.r=C.r;aa.g=V.g=B.g=C.g;aa.b=V.b=B.b=C.b;za(ma,A.v1.positionWorld,A.vertexNormalsWorld[0],aa);za(ma,A.v2.positionWorld,A.vertexNormalsWorld[1],V);za(ma,A.v3.positionWorld,A.vertexNormalsWorld[2],B);I.r=(V.r+B.r)*0.5;I.g=(V.g+B.g)*0.5;I.b=(V.b+B.b)*0.5;ja=Aa(aa,V,B,I);Ca(K,d,ga,T,N,ba, -ja,0,0,1,0,0,1)}else{v.r=C.r;v.g=C.g;v.b=C.b;za(ma,A.centroidWorld,A.normalWorld,v);R.r=U.color.r*v.r;R.g=U.color.g*v.g;R.b=U.color.b*v.b;R.updateStyleString();U.wireframe?J(R.__styleString,U.wireframe_linewidth):oa(R.__styleString)}else U.wireframe?J(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){ka=y.near;P=y.far;aa.r=aa.g=aa.b=1-u(z.positionScreen.z,ka,P);V.r=V.g=V.b=1-u(X.positionScreen.z,ka,P);B.r=B.g=B.b=1-u(Y.positionScreen.z, -ka,P);I.r=(V.r+B.r)*0.5;I.g=(V.g+B.g)*0.5;I.b=(V.b+B.b)*0.5;ja=Aa(aa,V,B,I);Ca(K,d,ga,T,N,ba,ja,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){R.r=Ba(A.normalWorld.x);R.g=Ba(A.normalWorld.y);R.b=Ba(A.normalWorld.z);R.updateStyleString();U.wireframe?J(R.__styleString,U.wireframe_linewidth):oa(R.__styleString)}}}function J(z,X){if(F!=z)o.strokeStyle=F=z;if(G!=X)o.lineWidth=G=X;o.stroke();h.inflate(X*2)}function oa(z){if(H!=z)o.fillStyle=H=z;o.fill()}function Ca(z,X,Y,A,U,ma,xa,Da,Ea,Ia, -ya,Ja,Qa){var Ka,La;Ka=xa.width-1;La=xa.height-1;Da*=Ka;Ea*=La;Ia*=Ka;ya*=La;Ja*=Ka;Qa*=La;Y-=z;A-=X;U-=z;ma-=X;Ia-=Da;ya-=Ea;Ja-=Da;Qa-=Ea;Ka=Ia*Qa-Ja*ya;if(Ka!=0){La=1/Ka;Ka=(Qa*Y-ya*U)*La;ya=(Qa*A-ya*ma)*La;Y=(Ia*U-Ja*Y)*La;A=(Ia*ma-Ja*A)*La;z=z-Ka*Da-Y*Ea;X=X-ya*Da-A*Ea;o.save();o.transform(Ka,ya,Y,A,z,X);o.clip();o.drawImage(xa,0,0);o.restore()}}function Aa(z,X,Y,A){var U=~~(z.r*255),ma=~~(z.g*255);z=~~(z.b*255);var xa=~~(X.r*255),Da=~~(X.g*255);X=~~(X.b*255);var Ea=~~(Y.r*255),Ia=~~(Y.g*255); -Y=~~(Y.b*255);var ya=~~(A.r*255),Ja=~~(A.g*255);A=~~(A.b*255);la[0]=U<0?0:U>255?255:U;la[1]=ma<0?0:ma>255?255:ma;la[2]=z<0?0:z>255?255:z;la[4]=xa<0?0:xa>255?255:xa;la[5]=Da<0?0:Da>255?255:Da;la[6]=X<0?0:X>255?255:X;la[8]=Ea<0?0:Ea>255?255:Ea;la[9]=Ia<0?0:Ia>255?255:Ia;la[10]=Y<0?0:Y>255?255:Y;la[12]=ya<0?0:ya>255?255:ya;la[13]=Ja<0?0:Ja>255?255:Ja;la[14]=A<0?0:A>255?255:A;ea.putImageData(va,0,0);ia.drawImage(da,0,0);return ha}function u(z,X,Y){z=(z-X)/(Y-X);return z*z*(3-2*z)}function Ba(z){z=(z+ -1)*0.5;return z<0?0:z>1?1:z}function Oa(z,X){var Y=X.x-z.x,A=X.y-z.y,U=1/Math.sqrt(Y*Y+A*A);Y*=U;A*=U;X.x+=Y;X.y+=A;z.x-=Y;z.y-=A}var Ma,Ha,$,sa,pa,ta,ua,qa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,k);c=e.projectScene(na,y,this.sortElements);(q=na.lights.length>0)&&Fa(na);Ma=0;for(Ha=c.length;Ma=0&&V>=0&&D>=0&&J>=0)return!0;else if(ba<0&&V<0||D<0&&J<0)return!1;else{if(ba<0)ca=Math.max(ca,ba/(ba-V));else V<0&&(S=Math.min(S,ba/(ba-V)));if(D<0)ca=Math.max(ca,D/(D-J));else J<0&&(S=Math.min(S,D/(D-J)));if(Sba&&Q.z0&&H.z<1){u=F[x]=F[x]||new THREE.RenderableParticle;u.x=H.x/H.w;u.y=H.y/H.w;u.z=H.z;u.rotation=R.rotation.z;u.scale.x=R.scale.x*Math.abs(u.x- +(H.x+O.projectionMatrix.n11)/(H.w+O.projectionMatrix.n14));u.scale.y=R.scale.y*Math.abs(u.y-(H.y+O.projectionMatrix.n22)/(H.w+O.projectionMatrix.n24));u.materials=R.materials;S.push(u);x++}}}}ca&&S.sort(a);return S};this.unprojectVector=function(T,O){var ca=THREE.Matrix4.makeInvert(O.globalMatrix);ca.multiplySelf(THREE.Matrix4.makeInvert(O.projectionMatrix));ca.multiplyVector3(T);return T}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,g,i;this.domElement=document.createElement("div");this.setSize=function(l,n){d=l;e=n;g=d/2;i=e/2};this.render=function(l,n){var k,o,s,w,u,x,F,I;a=b.projectScene(l,n);k=0;for(o=a.length;k0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}else if(ma instanceof THREE.PointLight){C.sub(ma.position,X);C.normalize();ma=Y.dot(C)* +Da;if(ma>0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}}}function Ga(z,X,Y){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);var B,U,ma,xa,Da,Ea;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){xa=Y.map.image;Da=xa.width>>1;Ea=xa.height>>1;U=X.scale.x*n;ma=X.scale.y*k;Y=U*Da;B=ma*Ea;h.set(z.x-Y,z.y-B,z.x+Y,z.y+B);if(p.instersects(h)){o.save();o.translate(z.x,z.y);o.rotate(-X.rotation);o.scale(U,-ma);o.translate(-Da,-Ea);o.drawImage(xa,0,0);o.restore()}}}else if(Y instanceof THREE.ParticleCircleMaterial){if(q){t.r= +A.r+W.r+G.r;t.g=A.g+W.g+G.g;t.b=A.b+W.b+G.b;S.r=Y.color.r*t.r;S.g=Y.color.g*t.g;S.b=Y.color.b*t.b;S.updateStyleString()}else S.__styleString=Y.color.__styleString;Y=X.scale.x*n;B=X.scale.y*k;h.set(z.x-Y,z.y-B,z.x+Y,z.y+B);if(p.instersects(h)){U=S.__styleString;if(I!=U)o.fillStyle=I=U;o.save();o.translate(z.x,z.y);o.rotate(-X.rotation);o.scale(Y,B);o.beginPath();o.arc(0,0,1,0,M,!0);o.closePath();o.fill();o.restore()}}}}function P(z,X,Y,B){if(B.opacity!=0){a(B.opacity);b(B.blending);o.beginPath();o.moveTo(z.positionScreen.x, +z.positionScreen.y);o.lineTo(X.positionScreen.x,X.positionScreen.y);o.closePath();if(B instanceof THREE.LineBasicMaterial){S.__styleString=B.color.__styleString;z=B.linewidth;if(H!=z)o.lineWidth=H=z;z=S.__styleString;if(F!=z)o.strokeStyle=F=z;o.stroke();h.inflate(B.linewidth*2)}}}function N(z,X,Y,B,U,ma){if(U.opacity!=0){a(U.opacity);b(U.blending);L=z.positionScreen.x;c=z.positionScreen.y;ia=X.positionScreen.x;T=X.positionScreen.y;O=Y.positionScreen.x;ca=Y.positionScreen.y;o.beginPath();o.moveTo(L, +c);o.lineTo(ia,T);o.lineTo(O,ca);o.lineTo(L,c);o.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ca(L,c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&U.env_map.mapping instanceof THREE.SphericalReflectionMapping){z=y.globalMatrix;C.copy(B.vertexNormalsWorld[0]);ea=(C.x*z.n11+C.y*z.n12+C.z*z.n13)*0.5+0.5;R=-(C.x*z.n21+C.y*z.n22+C.z*z.n23)* +0.5+0.5;C.copy(B.vertexNormalsWorld[1]);ra=(C.x*z.n11+C.y*z.n12+C.z*z.n13)*0.5+0.5;wa=-(C.x*z.n21+C.y*z.n22+C.z*z.n23)*0.5+0.5;C.copy(B.vertexNormalsWorld[2]);f=(C.x*z.n11+C.y*z.n12+C.z*z.n13)*0.5+0.5;m=-(C.x*z.n21+C.y*z.n22+C.z*z.n23)*0.5+0.5;Ca(L,c,ia,T,O,ca,U.env_map.image,ea,R,ra,wa,f,m)}}else U.wireframe?K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ca(L, +c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);b(THREE.SubtractiveBlending)}if(q)if(!U.wireframe&&U.shading==THREE.SmoothShading&&B.vertexNormalsWorld.length==3){ba.r=V.r=D.r=A.r;ba.g=V.g=D.g=A.g;ba.b=V.b=D.b=A.b;za(ma,B.v1.positionWorld,B.vertexNormalsWorld[0],ba);za(ma,B.v2.positionWorld,B.vertexNormalsWorld[1],V);za(ma,B.v3.positionWorld,B.vertexNormalsWorld[2],D);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca, +ja,0,0,1,0,0,1)}else{t.r=A.r;t.g=A.g;t.b=A.b;za(ma,B.centroidWorld,B.normalWorld,t);S.r=U.color.r*t.r;S.g=U.color.g*t.g;S.b=U.color.b*t.b;S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}else U.wireframe?K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){la=y.near;Q=y.far;ba.r=ba.g=ba.b=1-v(z.positionScreen.z,la,Q);V.r=V.g=V.b=1-v(X.positionScreen.z,la,Q);D.r=D.g=D.b=1-v(Y.positionScreen.z, +la,Q);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,ja,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){S.r=Ba(B.normalWorld.x);S.g=Ba(B.normalWorld.y);S.b=Ba(B.normalWorld.z);S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}}}function K(z,X){if(F!=z)o.strokeStyle=F=z;if(H!=X)o.lineWidth=H=X;o.stroke();h.inflate(X*2)}function oa(z){if(I!=z)o.fillStyle=I=z;o.fill()}function Ca(z,X,Y,B,U,ma,xa,Da,Ea,Ia, +ya,Ja,Qa){var Ka,La;Ka=xa.width-1;La=xa.height-1;Da*=Ka;Ea*=La;Ia*=Ka;ya*=La;Ja*=Ka;Qa*=La;Y-=z;B-=X;U-=z;ma-=X;Ia-=Da;ya-=Ea;Ja-=Da;Qa-=Ea;Ka=Ia*Qa-Ja*ya;if(Ka!=0){La=1/Ka;Ka=(Qa*Y-ya*U)*La;ya=(Qa*B-ya*ma)*La;Y=(Ia*U-Ja*Y)*La;B=(Ia*ma-Ja*B)*La;z=z-Ka*Da-Y*Ea;X=X-ya*Da-B*Ea;o.save();o.transform(Ka,ya,Y,B,z,X);o.clip();o.drawImage(xa,0,0);o.restore()}}function Aa(z,X,Y,B){var U=~~(z.r*255),ma=~~(z.g*255);z=~~(z.b*255);var xa=~~(X.r*255),Da=~~(X.g*255);X=~~(X.b*255);var Ea=~~(Y.r*255),Ia=~~(Y.g*255); +Y=~~(Y.b*255);var ya=~~(B.r*255),Ja=~~(B.g*255);B=~~(B.b*255);ka[0]=U<0?0:U>255?255:U;ka[1]=ma<0?0:ma>255?255:ma;ka[2]=z<0?0:z>255?255:z;ka[4]=xa<0?0:xa>255?255:xa;ka[5]=Da<0?0:Da>255?255:Da;ka[6]=X<0?0:X>255?255:X;ka[8]=Ea<0?0:Ea>255?255:Ea;ka[9]=Ia<0?0:Ia>255?255:Ia;ka[10]=Y<0?0:Y>255?255:Y;ka[12]=ya<0?0:ya>255?255:ya;ka[13]=Ja<0?0:Ja>255?255:Ja;ka[14]=B<0?0:B>255?255:B;da.putImageData(ua,0,0);ga.drawImage(aa,0,0);return fa}function v(z,X,Y){z=(z-X)/(Y-X);return z*z*(3-2*z)}function Ba(z){z=(z+ +1)*0.5;return z<0?0:z>1?1:z}function Oa(z,X){var Y=X.x-z.x,B=X.y-z.y,U=1/Math.sqrt(Y*Y+B*B);Y*=U;B*=U;X.x+=Y;X.y+=B;z.x-=Y;z.y-=B}var Ma,Ha,$,sa,pa,ta,va,qa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,k);d=e.projectScene(na,y,this.sortElements);(q=na.lights.length>0)&&Fa(na);Ma=0;for(Ha=d.length;Ma0){ra.r+=m.color.r*p;ra.g+=m.color.g*p;ra.b+=m.color.b*p}}else if(m instanceof THREE.PointLight){ba.sub(m.position,Q.centroidWorld);ba.normalize();p=Q.normalWorld.dot(ba)*m.intensity;if(p>0){ra.r+=m.color.r*p;ra.g+=m.color.g*p;ra.b+=m.color.b*p}}}}function b(ca,Q,ra,wa,f,m){B=e(I++);B.setAttribute("d","M "+ -ca.positionScreen.x+" "+ca.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)D.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(Z){K.r=d.r;K.g=d.g;K.b=d.b;a(m,wa,K);D.r=f.color.r*K.r;D.g=f.color.g*K.g;D.b=f.color.b*K.b;D.updateStyleString()}else D.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){N=1-f.__2near/(f.__farPlusNear- -wa.z*f.__farMinusNear);D.setRGB(N,N,N)}else f instanceof THREE.MeshNormalMaterial&&D.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));f.wireframe?B.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):B.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+f.opacity);n.appendChild(B)}function c(ca,Q,ra,wa, -f,m,p){B=e(I++);B.setAttribute("d","M "+ca.positionScreen.x+" "+ca.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(m instanceof THREE.MeshBasicMaterial)D.__styleString=m.color.__styleString;else if(m instanceof THREE.MeshLambertMaterial)if(Z){K.r=d.r;K.g=d.g;K.b=d.b;a(p,f,K);D.r=m.color.r*K.r;D.g=m.color.g*K.g;D.b=m.color.b*K.b;D.updateStyleString()}else D.__styleString=m.color.__styleString; -else if(m instanceof THREE.MeshDepthMaterial){N=1-m.__2near/(m.__farPlusNear-f.z*m.__farMinusNear);D.setRGB(N,N,N)}else m instanceof THREE.MeshNormalMaterial&&D.setRGB(g(f.normalWorld.x),g(f.normalWorld.y),g(f.normalWorld.z));m.wireframe?B.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+m.wireframe_linewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframe_linecap+"; stroke-linejoin: "+m.wireframe_linejoin):B.setAttribute("style","fill: "+D.__styleString+ -"; fill-opacity: "+m.opacity);n.appendChild(B)}function e(ca){if(R[ca]==null){R[ca]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&R[ca].setAttribute("shape-rendering","crispEdges")}return R[ca]}function g(ca){return ca<0?Math.min((1+ca)*0.5,0.5):0.5+Math.min(ca*0.5,0.5)}var i=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,o,s,w,t,x,F,H,G=new THREE.Rectangle,r=new THREE.Rectangle,Z=!1,D=new THREE.Color(16777215),K=new THREE.Color(16777215), -d=new THREE.Color(0),ga=new THREE.Color(0),T=new THREE.Color(0),N,ba=new THREE.Vector3,R=[],aa=[],V=[],B,I,ka,P,ja=1;this.domElement=n;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ca){switch(ca){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ca,Q){k=ca;o=Q;s=k/2;w=o/2;n.setAttribute("viewBox",-s+" "+-w+" "+k+" "+o);n.setAttribute("width",k);n.setAttribute("height",o);G.set(-s,-w,s,w)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])}; -this.render=function(ca,Q){var ra,wa,f,m,p,j,h,q;this.autoClear&&this.clear();i=l.projectScene(ca,Q,this.sortElements);P=ka=I=0;if(Z=ca.lights.length>0){h=ca.lights;d.setRGB(0,0,0);ga.setRGB(0,0,0);T.setRGB(0,0,0);ra=0;for(wa=h.length;ra=0){d.bindBuffer(d.ARRAY_BUFFER, -h.__webGLColorBuffer);d.vertexAttribPointer(f.color,3,d.FLOAT,!1,0,0)}if(f.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLNormalBuffer);d.vertexAttribPointer(f.normal,3,d.FLOAT,!1,0,0)}if(f.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLTangentBuffer);d.vertexAttribPointer(f.tangent,4,d.FLOAT,!1,0,0)}if(f.uv>=0)if(h.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUVBuffer);d.vertexAttribPointer(f.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv)}else d.disableVertexAttribArray(f.uv);if(f.uv2>= -0)if(h.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUV2Buffer);d.vertexAttribPointer(f.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv2)}else d.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);d.vertexAttribPointer(f.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);d.vertexAttribPointer(f.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER, -h.__webGLSkinIndicesBuffer);d.vertexAttribPointer(f.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);d.vertexAttribPointer(f.skinWeight,4,d.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(j.wireframe){d.lineWidth(j.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);d.drawElements(d.LINES,h.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,h.__webGLFaceCount,d.UNSIGNED_SHORT, -0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(j.linewidth);d.drawArrays(q,0,h.__webGLLineCount)}else q instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS,0,h.__webGLParticleCount)}function i(f,m){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=d.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=d.createBuffer();if(f.hasPos){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,f.positionArray,d.DYNAMIC_DRAW); -d.enableVertexAttribArray(m.attributes.position);d.vertexAttribPointer(m.attributes.position,3,d.FLOAT,!1,0,0)}if(f.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,f.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.normal);d.vertexAttribPointer(m.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,f.count);f.count=0}function l(f){if(ba!=f.doubleSided){f.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ba=f.doubleSided}if(R!= -f.flipSided){f.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);R=f.flipSided}}function n(f){if(V!=f){f?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);V=f}}function k(f){B[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);B[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);B[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);B[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);B[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);B[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33, -f.n44+f.n34);var m;for(f=0;f<5;f++){m=B[f];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function o(f){for(var m=f.globalMatrix,p=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=B[j].x*m.n14+B[j].y*m.n24+B[j].z*m.n34+B[j].w;if(f<=p)return!1}return!0}function s(f,m){f.list[f.count]=m;f.count+=1}function w(f){var m,p,j=f.object,h=f.opaque,q=f.transparent;q.count=0;f=h.count=0;for(m=j.materials.length;f0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+ -q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); -d.attachShader(p,Z("fragment",h+W));d.attachShader(p,Z("vertex",q+m));d.linkProgram(p);d.getProgramParameter(p,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(p,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(m=p.length;W< -m;W++){h=p[W];j.uniforms[h]=d.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(m=p.length;W=0&&d.enableVertexAttribArray(j.color);j.normal>=0&&d.enableVertexAttribArray(j.normal);j.tangent>=0&&d.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>= -0&&j.skinIndex>=0&&j.skinWeight>=0){d.enableVertexAttribArray(j.skinVertexA);d.enableVertexAttribArray(j.skinVertexB);d.enableVertexAttribArray(j.skinIndex);d.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,m,p,j){var h,q,v,C,W,L,S,E,da=f.lights,ea=f.fog;m.autoUpdateMatrix&&m.update();m.globalMatrix.flattenToArray(ja);m.projectionMatrix.flattenToArray(ka);m.inverseMatrix.flattenToArray(P);I.multiply(m.projectionMatrix,m.globalMatrix);k(I);THREE.AnimationHandler&&THREE.AnimationHandler.update(); -f.update(undefined,!1,m);this.initWebGLObjects(f,m);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Oa,ea)}if(xa&&la>0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ma,ea)}if(ma){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,z,ea);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,X,ea)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,pa,ea); -d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ta,ea);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,ua,ea);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,qa,ea)}}F(objlist,W,q,C,j)}v.__dirtyVertices=!1;v.__dirtyElements=!1;v.__dirtyUvs=!1;v.__dirtyNormals=!1;v.__dirtyTangents=!1;v.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!v.__webGLVertexBuffer){q=v;q.__webGLVertexBuffer=d.createBuffer(); -q.__webGLColorBuffer=d.createBuffer();q=v;C=q.vertices.length;q.__vertexArray=new Float32Array(C*3);q.__colorArray=new Float32Array(C*3);q.__webGLLineCount=C;v.__dirtyVertices=!0;v.__dirtyColors=!0}if(v.__dirtyVertices||v.__dirtyColors){q=v;C=d.DYNAMIC_DRAW;E=void 0;E=void 0;L=void 0;h=void 0;da=q.vertices;ea=q.colors;la=da.length;va=ea.length;ha=q.__vertexArray;S=q.__colorArray;ia=q.__dirtyColors;if(q.__dirtyVertices){for(E=0;E=0;p--){j= -f.__webGLObjects[p].object;m==j&&f.__webGLObjects.splice(p,1)}};this.setFaceCulling=function(f,m){if(f){!m||m=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(f=="back")d.cullFace(d.BACK);else f=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +THREE.SVGRenderer=function(){function a(ea,R,ra){var wa,f,m,p;wa=0;for(f=ea.lights.length;wa0){ra.r+=m.color.r*p;ra.g+=m.color.g*p;ra.b+=m.color.b*p}}else if(m instanceof THREE.PointLight){ca.sub(m.position,R.centroidWorld);ca.normalize();p=R.normalWorld.dot(ca)*m.intensity;if(p>0){ra.r+=m.color.r*p;ra.g+=m.color.g*p;ra.b+=m.color.b*p}}}}function b(ea,R,ra,wa,f,m){D=e(J++);D.setAttribute("d","M "+ +ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(m,wa,L);E.r=f.color.r*L.r;E.g=f.color.g*L.g;E.b=f.color.b*L.b;E.updateStyleString()}else E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){O=1-f.__2near/(f.__farPlusNear- +wa.z*f.__farMinusNear);E.setRGB(O,O,O)}else f instanceof THREE.MeshNormalMaterial&&E.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));f.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+f.opacity);n.appendChild(D)}function d(ea,R,ra,wa, +f,m,p){D=e(J++);D.setAttribute("d","M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(m instanceof THREE.MeshBasicMaterial)E.__styleString=m.color.__styleString;else if(m instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(p,f,L);E.r=m.color.r*L.r;E.g=m.color.g*L.g;E.b=m.color.b*L.b;E.updateStyleString()}else E.__styleString=m.color.__styleString; +else if(m instanceof THREE.MeshDepthMaterial){O=1-m.__2near/(m.__farPlusNear-f.z*m.__farMinusNear);E.setRGB(O,O,O)}else m instanceof THREE.MeshNormalMaterial&&E.setRGB(g(f.normalWorld.x),g(f.normalWorld.y),g(f.normalWorld.z));m.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+m.wireframe_linewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframe_linecap+"; stroke-linejoin: "+m.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+ +"; fill-opacity: "+m.opacity);n.appendChild(D)}function e(ea){if(S[ea]==null){S[ea]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&S[ea].setAttribute("shape-rendering","crispEdges")}return S[ea]}function g(ea){return ea<0?Math.min((1+ea)*0.5,0.5):0.5+Math.min(ea*0.5,0.5)}var i=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,o,s,w,u,x,F,I,H=new THREE.Rectangle,r=new THREE.Rectangle,Z=!1,E=new THREE.Color(16777215),L=new THREE.Color(16777215), +c=new THREE.Color(0),ia=new THREE.Color(0),T=new THREE.Color(0),O,ca=new THREE.Vector3,S=[],ba=[],V=[],D,J,la,Q,ja=1;this.domElement=n;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ea){switch(ea){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ea,R){k=ea;o=R;s=k/2;w=o/2;n.setAttribute("viewBox",-s+" "+-w+" "+k+" "+o);n.setAttribute("width",k);n.setAttribute("height",o);H.set(-s,-w,s,w)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])}; +this.render=function(ea,R){var ra,wa,f,m,p,j,h,q;this.autoClear&&this.clear();i=l.projectScene(ea,R,this.sortElements);Q=la=J=0;if(Z=ea.lights.length>0){h=ea.lights;c.setRGB(0,0,0);ia.setRGB(0,0,0);T.setRGB(0,0,0);ra=0;for(wa=h.length;ra=0){c.bindBuffer(c.ARRAY_BUFFER, +h.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(h.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>= +0)if(h.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER, +h.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(j.wireframe){c.lineWidth(j.wireframe_linewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.drawElements(c.LINES,h.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,h.__webGLFaceCount,c.UNSIGNED_SHORT, +0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(j.linewidth);c.drawArrays(q,0,h.__webGLLineCount)}else if(q instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,h.__webGLParticleCount);else q instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,h.__webGLVertexCount)}function i(f,m){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER, +f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(m.attributes.position);c.vertexAttribPointer(m.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(m.attributes.normal);c.vertexAttribPointer(m.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function l(f){if(ca!=f.doubleSided){f.doubleSided? +c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ca=f.doubleSided}if(S!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);S=f.flipSided}}function n(f){if(V!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);V=f}}function k(f){D[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);D[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);D[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);D[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);D[4].set(f.n41-f.n31,f.n42-f.n32, +f.n43-f.n33,f.n44-f.n34);D[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var m;for(f=0;f<5;f++){m=D[f];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function o(f){for(var m=f.globalMatrix,p=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=D[j].x*m.n14+D[j].y*m.n24+D[j].z*m.n34+D[j].w;if(f<=p)return!1}return!0}function s(f,m){f.list[f.count]=m;f.count+=1}function w(f){var m,p,j=f.object,h=f.opaque,q=f.transparent;q.count=0;f=h.count= +0;for(m=j.materials.length;f0?"#define VERTEX_TEXTURES": +"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); +c.attachShader(p,Z("fragment",h+W));c.attachShader(p,Z("vertex",q+m));c.linkProgram(p);c.getProgramParameter(p,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(p,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(m=p.length;W< +m;W++){h=p[W];j.uniforms[h]=c.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(m=p.length;W=0&&c.enableVertexAttribArray(j.color);j.normal>=0&&c.enableVertexAttribArray(j.normal);j.tangent>=0&&c.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>= +0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,m,p,j){var h,q,t,A,W,G,M,C,aa=f.lights,da=f.fog;m.autoUpdateMatrix&&m.update();m.globalMatrix.flattenToArray(ja);m.projectionMatrix.flattenToArray(la);m.inverseMatrix.flattenToArray(Q);J.multiply(m.projectionMatrix,m.globalMatrix);k(J);THREE.AnimationHandler&&THREE.AnimationHandler.update(); +f.update(undefined,!1,m);this.initWebGLObjects(f,m);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Oa,da)}if(xa&&ka>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ma,da)}if(ma){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,z,da);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X,da)}if(v>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,pa,da); +c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ta,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,va,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,qa,da)}}F(objlist,W,q,A,j)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer(); +q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=new Float32Array(A*3);q.__webGLVertexCount=A;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;A=c.DYNAMIC_DRAW;C=void 0;C=void 0;G=void 0;h=void 0;aa=q.vertices;da=q.colors;ka=aa.length;ua=da.length;fa=q.__vertexArray;M=q.__colorArray;ga=q.__dirtyColors;if(q.__dirtyVertices){for(C=0;C=0;p--){j=f.__webGLObjects[p].object;m==j&&f.__webGLObjects.splice(p,1)}};this.setFaceCulling= +function(f,m){if(f){!m||m=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", diff --git a/build/ThreeDebug.js b/build/ThreeDebug.js index 3e71278337..665f14bc50 100644 --- a/build/ThreeDebug.js +++ b/build/ThreeDebug.js @@ -1,103 +1,104 @@ // ThreeDebug.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,g,i,l,o,k;if(c==0)e=g=i=0;else{l=Math.floor(a*6);o=a*6-l;a=c*(1-b);k=c*(1-b*o);b=c*(1-b*(1-o));switch(l){case 1:e=k;g=c;i=a;break;case 2:e=a;g=c;i=b;break;case 3:e=a;g=k;i=c;break;case 4:e=b;g=a;i=c;break;case 5:e=c;g=a;i=k;break;case 6:case 0:e=c;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,i,l,o,k;if(d==0)e=g=i=0;else{l=Math.floor(a*6);o=a*6-l;a=d*(1-b);k=d*(1-b*o);b=d*(1-b*(1-o));switch(l){case 1:e=k;g=d;i=a;break;case 2:e=a;g=d;i=b;break;case 3:e=a;g=k;i=d;break;case 4:e=b;g=a;i=d;break;case 5:e=d;g=a;i=k;break;case 6:case 0:e=d;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* -this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=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.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, -cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.x=c*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= -a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+c*c+a*a)},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+ +this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0}; +THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-d*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= +a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+d*d+a*a)},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+ this.y+this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+ -this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e||1}; -THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; +this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1}; +THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a0&&G>0&&d+G<1}var c,e,g,i,l,o,k,m,s,w, -t,x=a.geometry,F=x.vertices,H=[];c=0;for(e=x.faces.length;ck?e:k;g=g>m?g:m}a()}; -this.add3Points=function(k,m,s,w,t,x){if(o){o=!1;b=ks?k>t?k:t:s>t?s:t;g=m>w?m>x?m:x:w>x?w:x}else{b=ks?k>t?k>e?k:e:t>e?t:e:s>t?s>e?s:e:t>e?t:e;g=m>w?m>x?m>g?m:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(o){o=!1;b=k.getLeft();c=k.getTop();e=k.getRight();g=k.getBottom()}else{b=bk.getRight()? -e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e=0&&Math.min(g,k.getBottom())-Math.max(c,k.getTop())>=0};this.empty=function(){o=!0;g=e=c=b=0;a()};this.isEmpty=function(){return o};this.toString=function(){return"THREE.Rectangle ( left: "+ -b+", right: "+e+", top: "+c+", bottom: "+g+", width: "+i+", height: "+l+" )"}};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,e,g,i,l,o,k,m,s,w,t,x,F,H){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=i||1;this.n23=l||0;this.n24=o||0;this.n31=k||0;this.n32=m||0;this.n33=s||1;this.n34=w||0;this.n41=t||0;this.n42=x||0;this.n43=F||0;this.n44=H||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,e,g,i,l,o,k,m,s,w,t,x,F,H){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=i;this.n23=l;this.n24=o;this.n31=k;this.n32=m;this.n33=s;this.n34=w;this.n41=t;this.n42=x;this.n43=F;this.n44=H;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,b).normalize();e.cross(c,i).normalize();g.cross(i,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); -this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,g=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43* -a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*g;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,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,t=a.n33,x=a.n34,F=a.n41,H=a.n42,G=a.n43,r=a.n44,Z=b.n11,D=b.n12,K=b.n13,d=b.n14,ga=b.n21,T=b.n22,N=b.n23,ba=b.n24,R=b.n31,aa=b.n32,V=b.n33,B=b.n34,I=b.n41,ka=b.n42,P=b.n43,ja=b.n44;this.n11=c*Z+e*ga+g*R+i*I;this.n12=c*D+e*T+g*aa+i*ka;this.n13=c*K+e*N+g*V+i*P;this.n14=c*d+e*ba+g*B+i*ja;this.n21=l*Z+o*ga+k*R+m*I;this.n22=l*D+o*T+k*aa+m*ka; -this.n23=l*K+o*N+k*V+m*P;this.n24=l*d+o*ba+k*B+m*ja;this.n31=s*Z+w*ga+t*R+x*I;this.n32=s*D+w*T+t*aa+x*ka;this.n33=s*K+w*N+t*V+x*P;this.n34=s*d+w*ba+t*B+x*ja;this.n41=F*Z+H*ga+G*R+r*I;this.n42=F*D+H*T+G*aa+r*ka;this.n43=F*K+H*N+G*V+r*P;this.n44=F*d+H*ba+G*B+r*ja;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,i=a.n13,l=a.n14,o=a.n21,k=a.n22,m=a.n23,s=a.n24,w=a.n31,t=a.n32,x=a.n33,F=a.n34,H=a.n41,G=a.n42,r=a.n43;a=a.n44;var Z=b.n11,D=b.n12,K=b.n13,d=b.n14,ga=b.n21,T=b.n22,N=b.n23,ba= -b.n24,R=b.n31,aa=b.n32,V=b.n33,B=b.n34,I=b.n41,ka=b.n42,P=b.n43;b=b.n44;this.n11=e*Z+g*ga+i*R+l*I;this.n12=e*D+g*T+i*aa+l*ka;this.n13=e*K+g*N+i*V+l*P;this.n14=e*d+g*ba+i*B+l*b;this.n21=o*Z+k*ga+m*R+s*I;this.n22=o*D+k*T+m*aa+s*ka;this.n23=o*K+k*N+m*V+s*P;this.n24=o*d+k*ba+m*B+s*b;this.n31=w*Z+t*ga+x*R+F*I;this.n32=w*D+t*T+x*aa+F*ka;this.n33=w*K+t*N+x*V+F*P;this.n34=w*d+t*ba+x*B+F*b;this.n41=H*Z+G*ga+r*R+a*I;this.n42=H*D+G*T+r*aa+a*ka;this.n43=H*K+G*N+r*V+a*P;this.n44=H*d+G*ba+r*B+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){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,i=this.n21,l=this.n22,o=this.n23,k=this.n24,m=this.n31,s=this.n32,w=this.n33,t=this.n34,x=this.n41,F=this.n42,H=this.n43,G=this.n44,r=a.n11,Z=a.n21,D=a.n31,K=a.n41,d=a.n12,ga=a.n22,T=a.n32,N=a.n42,ba= -a.n13,R=a.n23,aa=a.n33,V=a.n43,B=a.n14,I=a.n24,ka=a.n34;a=a.n44;this.n11=b*r+c*Z+e*D+g*K;this.n12=b*d+c*ga+e*T+g*N;this.n13=b*ba+c*R+e*aa+g*V;this.n14=b*B+c*I+e*ka+g*a;this.n21=i*r+l*Z+o*D+k*K;this.n22=i*d+l*ga+o*T+k*N;this.n23=i*ba+l*R+o*aa+k*V;this.n24=i*B+l*I+o*ka+k*a;this.n31=m*r+s*Z+w*D+t*K;this.n32=m*d+s*ga+w*T+t*N;this.n33=m*ba+s*R+w*aa+t*V;this.n34=m*B+s*I+w*ka+t*a;this.n41=x*r+F*Z+H*D+G*K;this.n42=x*d+F*ga+H*T+G*N;this.n43=x*ba+F*R+H*aa+G*V;this.n44=x*B+F*I+H*ka+G*a;return this},multiplyScalar:function(a){this.n11*= -a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,g=this.n21,i=this.n22,l=this.n23,o=this.n24,k=this.n31,m=this.n32,s=this.n33,w=this.n34,t=this.n41,x=this.n42,F=this.n43,H=this.n44;return e*l*m*t-c*o*m*t-e*i*s*t+b*o*s*t+c*i*w*t-b*l*w*t-e*l*k*x+c*o*k*x+e*g*s*x-a*o*s*x-c*g*w*x+a*l*w*x+ -e*i*k*F-b*o*k*F-e*g*m*F+a*o*m*F+b*g*w*F-a*i*w*F-c*i*k*H+b*l*k*H+c*g*m*H-a*l*m*H-b*g*s*H+a*i*s*H},transpose:function(){function a(b,c,e){var g=b[c];b[c]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33; +THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a0&&H>0&&c+H<1}var d,e,g,i,l,o,k,m,s,w, +u,x=a.geometry,F=x.vertices,I=[];d=0;for(e=x.faces.length;dk?e:k;g=g>m?g:m}a()}; +this.add3Points=function(k,m,s,w,u,x){if(o){o=!1;b=ks?k>u?k:u:s>u?s:u;g=m>w?m>x?m:x:w>x?w:x}else{b=ks?k>u?k>e?k:e:u>e?u:e:s>u?s>e?s:e:u>e?u:e;g=m>w?m>x?m>g?m:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(o){o=!1;b=k.getLeft();d=k.getTop();e=k.getRight();g=k.getBottom()}else{b=bk.getRight()? +e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;d-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e=0&&Math.min(g,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){o=!0;g=e=d=b=0;a()};this.isEmpty=function(){return o};this.toString=function(){return"THREE.Rectangle ( left: "+ +b+", right: "+e+", top: "+d+", bottom: "+g+", width: "+i+", height: "+l+" )"}};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,d,e,g,i,l,o,k,m,s,w,u,x,F,I){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=i||1;this.n23=l||0;this.n24=o||0;this.n31=k||0;this.n32=m||0;this.n33=s||1;this.n34=w||0;this.n41=u||0;this.n42=x||0;this.n43=F||0;this.n44=I||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,g,i,l,o,k,m,s,w,u,x,F,I){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=i;this.n23=l;this.n24=o;this.n31=k;this.n32=m;this.n33=s;this.n34=w;this.n41=u;this.n42=x;this.n43=F;this.n44=I;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,b).normalize();e.cross(d,i).normalize();g.cross(i,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); +this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,d=a.y;a=a.z;return(this.n31*b+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*d+this.n43* +a+this.n44))},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41* +a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44,Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca=b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43,ja=b.n44;this.n11=d*Z+e*ia+g*S+i*J;this.n12=d*E+e*T+g*ba+i*la;this.n13=d*L+e*O+g*V+i*Q;this.n14=d*c+e*ca+g*D+i*ja;this.n21=l*Z+o*ia+k*S+m*J;this.n22=l*E+o*T+k*ba+m*la; +this.n23=l*L+o*O+k*V+m*Q;this.n24=l*c+o*ca+k*D+m*ja;this.n31=s*Z+w*ia+u*S+x*J;this.n32=s*E+w*T+u*ba+x*la;this.n33=s*L+w*O+u*V+x*Q;this.n34=s*c+w*ca+u*D+x*ja;this.n41=F*Z+I*ia+H*S+r*J;this.n42=F*E+I*T+H*ba+r*la;this.n43=F*L+I*O+H*V+r*Q;this.n44=F*c+I*ca+H*D+r*ja;return this},multiplyToArray:function(a,b,d){var e=a.n11,g=a.n12,i=a.n13,l=a.n14,o=a.n21,k=a.n22,m=a.n23,s=a.n24,w=a.n31,u=a.n32,x=a.n33,F=a.n34,I=a.n41,H=a.n42,r=a.n43;a=a.n44;var Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca= +b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43;b=b.n44;this.n11=e*Z+g*ia+i*S+l*J;this.n12=e*E+g*T+i*ba+l*la;this.n13=e*L+g*O+i*V+l*Q;this.n14=e*c+g*ca+i*D+l*b;this.n21=o*Z+k*ia+m*S+s*J;this.n22=o*E+k*T+m*ba+s*la;this.n23=o*L+k*O+m*V+s*Q;this.n24=o*c+k*ca+m*D+s*b;this.n31=w*Z+u*ia+x*S+F*J;this.n32=w*E+u*T+x*ba+F*la;this.n33=w*L+u*O+x*V+F*Q;this.n34=w*c+u*ca+x*D+F*b;this.n41=I*Z+H*ia+r*S+a*J;this.n42=I*E+H*T+r*ba+a*la;this.n43=I*L+H*O+r*V+a*Q;this.n44=I*c+H*ca+r*D+a*b;d[0]=this.n11; +d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,i=this.n21,l=this.n22,o=this.n23,k=this.n24,m=this.n31,s=this.n32,w=this.n33,u=this.n34,x=this.n41,F=this.n42,I=this.n43,H=this.n44,r=a.n11,Z=a.n21,E=a.n31,L=a.n41,c=a.n12,ia=a.n22,T=a.n32,O=a.n42,ca= +a.n13,S=a.n23,ba=a.n33,V=a.n43,D=a.n14,J=a.n24,la=a.n34;a=a.n44;this.n11=b*r+d*Z+e*E+g*L;this.n12=b*c+d*ia+e*T+g*O;this.n13=b*ca+d*S+e*ba+g*V;this.n14=b*D+d*J+e*la+g*a;this.n21=i*r+l*Z+o*E+k*L;this.n22=i*c+l*ia+o*T+k*O;this.n23=i*ca+l*S+o*ba+k*V;this.n24=i*D+l*J+o*la+k*a;this.n31=m*r+s*Z+w*E+u*L;this.n32=m*c+s*ia+w*T+u*O;this.n33=m*ca+s*S+w*ba+u*V;this.n34=m*D+s*J+w*la+u*a;this.n41=x*r+F*Z+I*E+H*L;this.n42=x*c+F*ia+I*T+H*O;this.n43=x*ca+F*S+I*ba+H*V;this.n44=x*D+F*J+I*la+H*a;return this},multiplyScalar:function(a){this.n11*= +a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,g=this.n21,i=this.n22,l=this.n23,o=this.n24,k=this.n31,m=this.n32,s=this.n33,w=this.n34,u=this.n41,x=this.n42,F=this.n43,I=this.n44;return e*l*m*u-d*o*m*u-e*i*s*u+b*o*s*u+d*i*w*u-b*l*w*u-e*l*k*x+d*o*k*x+e*g*s*x-a*o*s*x-d*g*w*x+a*l*w*x+ +e*i*k*F-b*o*k*F-e*g*m*F+a*o*m*F+b*g*w*F-a*i*w*F-d*i*k*I+b*l*k*I+d*g*m*I-a*l*m*I-b*g*s*I+a*i*s*I},transpose:function(){function a(b,d,e){var g=b[d];b[d]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33; a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]= -this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1); -return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),g=1-c,i=a.x,l=a.y,o=a.z,k=g* -i,m=g*l;this.set(k*i+c,k*l-e*o,k*o+e*l,0,k*l+e*o,m*l+c,m*o-e*i,0,k*o-e*l,m*o+e*i,g*o*o+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},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(-e);e=Math.sin(-e);var i=Math.cos(b);b=Math.sin(b);var l=a*e,o=c*e;this.n11=a*g;this.n12=c*b-l*i;this.n13=l*b+c*i;this.n21=e;this.n22=g*i;this.n23=-g*b;this.n31=-c*g;this.n32=o*i+a*b;this.n33=-o*b+a*i},setRotationFromQuaternion:function(a){var b= -a.x,c=a.y,e=a.z,g=a.w,i=b+b,l=c+c,o=e+e;a=b*i;var k=b*l;b*=o;var m=c*l;c*=o;e*=o;i*=g;l*=g;g*=o;this.n11=1-(m+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=c-i;this.n31=b-l;this.n32=c+i;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22; -a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e}; -THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c}; -THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,t=a.n33,x=a.n34,F=a.n41,H=a.n42,G=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*x*H-m*t*H+m*w*G-o*x*G-k*w*r+o*t*r;b.n12=i*t*H-g*x*H-i*w*G+e*x*G+g*w*r-e*t*r;b.n13=g*m*H-i*k*H+i*o*G-e*m*G-g*o*r+e*k*r;b.n14=i*k*w-g*m*w-i*o*t+e*m*t+g*o*x-e*k*x;b.n21=m*t*F-k*x*F-m*s*G+l*x*G+k*s*r-l*t*r;b.n22=g*x*F-i*t*F+i*s*G-c*x*G-g*s*r+c*t*r;b.n23=i*k*F-g*m*F-i*l*G+c*m*G+g*l*r-c*k*r; -b.n24=g*m*s-i*k*s+i*l*t-c*m*t-g*l*x+c*k*x;b.n31=o*x*F-m*w*F+m*s*H-l*x*H-o*s*r+l*w*r;b.n32=i*w*F-e*x*F-i*s*H+c*x*H+e*s*r-c*w*r;b.n33=g*m*F-i*o*F+i*l*H-c*m*H-e*l*r+c*o*r;b.n34=i*o*s-e*m*s-i*l*w+c*m*w+e*l*x-c*o*x;b.n41=k*w*F-o*t*F-k*s*H+l*t*H+o*s*G-l*w*G;b.n42=e*t*F-g*w*F+g*s*H-c*t*H-e*s*G+c*w*G;b.n43=g*o*F-e*k*F-g*l*H+c*k*H+e*l*G-c*o*G;b.n44=e*k*s-g*o*s+g*l*w-c*k*w-e*l*t+c*o*t;b.multiplyScalar(1/a.determinant());return b}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,s=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*i;c[3]=a*l;c[4]=a*o;c[5]=a*k;c[6]=a*m;c[7]=a*s;c[8]=a*w;return b}; -THREE.Matrix4.makeFrustum=function(a,b,c,e,g,i){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-c);l.n23=(e+c)/(e-c);l.n24=0;l.n31=0;l.n32=0;l.n33=-(i+g)/(i-g);l.n34=-2*i*g/(i-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,c,e){var g;a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,e)}; -THREE.Matrix4.makeOrtho=function(a,b,c,e,g,i){var l,o,k,m;l=new THREE.Matrix4;o=b-a;k=c-e;m=i-g;l.n11=2/o;l.n12=0;l.n13=0;l.n14=-((b+a)/o);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((c+e)/k);l.n31=0;l.n32=0;l.n33=-2/m;l.n34=-((i+g)/m);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; -THREE.Quaternion=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api}; -THREE.Quaternion.prototype.set=function(a,b,c,e){var g=this.that;g.x=a;g.y=b;g.z=c;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(c);c=Math.sin(c);var l=a*b,o=e*g,k=this.that;k.w=l*i-o*c;k.x=l*c+o*i;k.y=e*b*i+a*g*c;k.z=a*g*i-e*b*c;this.isDirty=!0;return this}; -THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,c=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-c*c-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)}; -THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,c=a.y,e=a.z,g=a.w,i=Math.sqrt(b*b+c*c+e*e+g*g);if(i==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}i=1/i;a.x=b*i;a.y=c*i;a.z=e*i;a.w=g*i;this.isDirty=!0;return this}; +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,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1); +return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),g=1-d,i=a.x,l=a.y,o=a.z,k=g* +i,m=g*l;this.set(k*i+d,k*l-e*o,k*o+e*l,0,k*l+e*o,m*l+d,m*o-e*i,0,k*o-e*l,m*o+e*i,g*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(d);d=Math.sin(d);var g=Math.cos(-e);e=Math.sin(-e);var i=Math.cos(b);b=Math.sin(b);var l=a*e,o=d*e;this.n11=a*g;this.n12=d*b-l*i;this.n13=l*b+d*i;this.n21=e;this.n22=g*i;this.n23=-g*b;this.n31=-d*g;this.n32=o*i+a*b;this.n33=-o*b+a*i},setRotationFromQuaternion:function(a){var b= +a.x,d=a.y,e=a.z,g=a.w,i=b+b,l=d+d,o=e+e;a=b*i;var k=b*l;b*=o;var m=d*l;d*=o;e*=o;i*=g;l*=g;g*=o;this.n11=1-(m+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=d-i;this.n31=b-l;this.n32=d+i;this.n33=1-(a+m)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=d;this.n22*=d;this.n23*=d;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22; +a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e}; +THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var d=new THREE.Matrix4;d.setRotAxis(a,b);return d}; +THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*x*I-m*u*I+m*w*H-o*x*H-k*w*r+o*u*r;b.n12=i*u*I-g*x*I-i*w*H+e*x*H+g*w*r-e*u*r;b.n13=g*m*I-i*k*I+i*o*H-e*m*H-g*o*r+e*k*r;b.n14=i*k*w-g*m*w-i*o*u+e*m*u+g*o*x-e*k*x;b.n21=m*u*F-k*x*F-m*s*H+l*x*H+k*s*r-l*u*r;b.n22=g*x*F-i*u*F+i*s*H-d*x*H-g*s*r+d*u*r;b.n23=i*k*F-g*m*F-i*l*H+d*m*H+g*l*r-d*k*r; +b.n24=g*m*s-i*k*s+i*l*u-d*m*u-g*l*x+d*k*x;b.n31=o*x*F-m*w*F+m*s*I-l*x*I-o*s*r+l*w*r;b.n32=i*w*F-e*x*F-i*s*I+d*x*I+e*s*r-d*w*r;b.n33=g*m*F-i*o*F+i*l*I-d*m*I-e*l*r+d*o*r;b.n34=i*o*s-e*m*s-i*l*w+d*m*w+e*l*x-d*o*x;b.n41=k*w*F-o*u*F-k*s*I+l*u*I+o*s*H-l*w*H;b.n42=e*u*F-g*w*F+g*s*I-d*u*I-e*s*H+d*w*H;b.n43=g*o*F-e*k*F-g*l*I+d*k*I+e*l*H-d*o*H;b.n44=e*k*s-g*o*s+g*l*w-d*k*w-e*l*u+d*o*u;b.multiplyScalar(1/a.determinant());return b}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,s=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*i;d[3]=a*l;d[4]=a*o;d[5]=a*k;d[6]=a*m;d[7]=a*s;d[8]=a*w;return b}; +THREE.Matrix4.makeFrustum=function(a,b,d,e,g,i){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-d);l.n23=(e+d)/(e-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(i+g)/(i-g);l.n34=-2*i*g/(i-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,b,d,e,g,i){var l,o,k,m;l=new THREE.Matrix4;o=b-a;k=d-e;m=i-g;l.n11=2/o;l.n12=0;l.n13=0;l.n14=-((b+a)/o);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((d+e)/k);l.n31=0;l.n32=0;l.n33=-2/m;l.n34=-((i+g)/m);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Quaternion=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api}; +THREE.Quaternion.prototype.set=function(a,b,d,e){var g=this.that;g.x=a;g.y=b;g.z=d;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(d);d=Math.sin(d);var l=a*b,o=e*g,k=this.that;k.w=l*i-o*d;k.x=l*d+o*i;k.y=e*b*i+a*g*d;k.z=a*g*i-e*b*d;this.isDirty=!0;return this}; +THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,d=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-d*d-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)}; +THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,d=a.y,e=a.z,g=a.w,i=Math.sqrt(b*b+d*d+e*e+g*g);if(i==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}i=1/i;a.x=b*i;a.y=d*i;a.z=e*i;a.w=g*i;this.isDirty=!0;return this}; THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this}; -THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=this.that,e=a.x,g=a.y,i=a.z,l=c.x,o=c.y,k=c.z;c=c.w;var m=c*e+o*i-k*g,s=c*g+k*e-l*i,w=c*i+l*g-o*e;e=-l*e-o*g-k*i;b.x=m*c+e*-l+s*-k-w*-o;b.y=s*c+e*-o+w*-l-m*-k;b.z=w*c+e*-k+m*-o-s*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){}; -THREE.Quaternion.slerp=function(a,b,c,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var i=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}g=Math.sin((1-e)*i)/l;e=Math.sin(e*i)/l;c.w=a.w*g+b.w*e;c.x=a.x*g+b.x*e;c.y=a.y*g+b.y*e;c.z=a.z*g+b.z*e;return c}; +THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var d=this.that,e=a.x,g=a.y,i=a.z,l=d.x,o=d.y,k=d.z;d=d.w;var m=d*e+o*i-k*g,s=d*g+k*e-l*i,w=d*i+l*g-o*e;e=-l*e-o*g-k*i;b.x=m*d+e*-l+s*-k-w*-o;b.y=s*d+e*-o+w*-l-m*-k;b.z=w*d+e*-k+m*-o-s*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){}; +THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var i=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*i)/l;e=Math.sin(e*i)/l;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,b,c,e,g){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,b,c,e,g,i){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; +THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,b,d,e,g,i){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1}; -THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a0){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;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;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;b0){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,d=this.vertices.length;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;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,d=this.vertices.length;b65535){m[o].counter+=1;k=m[o].hash+"_"+m[o].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix= -new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e=this.children.length;for(a=0;athis.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{c=c==="pos"?i.position:i.scale;c.x=e[0]+(g[0]-e[0])*b;c.y=e[1]+(g[1]-e[1])*b;c.z=e[2]+(g[2]-e[2])*b}}}if(o[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;sthis.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{d=d==="pos"?i.position:i.scale;d.x=e[0]+(g[0]-e[0])*b;d.y=e[1]+(g[1]-e[1])*b;d.z=e[2]+(g[2]-e[2])*b}}}if(o[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;s-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var o=this.projectionMatrix,k=1/(o.n43*l),m=k*this.screenCenterX,s=(g.n11*b+g.n12*c+g.n13*e+g.n14)*o.n11*m;i=o.n11*i*m;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*c+g.n23*e+g.n24)*o.n22*k*this.screenCenterY; +THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix, +this.inverseMatrix)}}for(a=0;a-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var o=this.projectionMatrix,k=1/(o.n43*l),m=k*this.screenCenterX,s=(g.n11*b+g.n12*d+g.n13*e+g.n14)*o.n11*m;i=o.n11*i*m;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*d+g.n23*e+g.n24)*o.n22*k*this.screenCenterY; if(b+i<-this.screenCenterY)return!1;if(b-i>this.screenCenterY)return!1;a.screenPosition.set(s,b,l,i);return!0};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;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight; THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1; THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0}; @@ -132,124 +133,126 @@ THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;th undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}}; THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}}; -THREE.Texture=function(a,b,c,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter}; +THREE.Texture=function(a,b,d,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; -THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var b,c,e,g={};for(b in a){g[b]={};for(c in a[b]){e=a[b][c];g[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,c,e,g={};for(b=0;b=0&&V>=0&&B>=0&&I>=0)return!0;else if(aa<0&&V<0||B<0&&I<0)return!1;else{if(aa<0)ba=Math.max(ba,aa/(aa-V));else V<0&&(R=Math.min(R,aa/(aa-V)));if(B<0)ba=Math.max(ba,B/(B-I));else I<0&&(R=Math.min(R,B/(B-I)));if(Raa&&P.z0&&G.z<1){t=F[x]=F[x]||new THREE.RenderableParticle;t.x=G.x/G.w;t.y=G.y/G.w;t.z=G.z;t.rotation=Q.rotation.z;t.scale.x=Q.scale.x*Math.abs(t.x- -(G.x+N.projectionMatrix.n11)/(G.w+N.projectionMatrix.n14));t.scale.y=Q.scale.y*Math.abs(t.y-(G.y+N.projectionMatrix.n22)/(G.w+N.projectionMatrix.n24));t.materials=Q.materials;R.push(t);x++}}}}ba&&R.sort(a);return R};this.unprojectVector=function(T,N){var ba=THREE.Matrix4.makeInvert(N.globalMatrix);ba.multiplySelf(THREE.Matrix4.makeInvert(N.projectionMatrix));ba.multiplyVector3(T);return T}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,i;this.domElement=document.createElement("div");this.setSize=function(l,o){c=l;e=o;g=c/2;i=e/2};this.render=function(l,o){var k,m,s,w,t,x,F,H;a=b.projectScene(l,o);k=0;for(m=a.length;k0){A.r+=xa.r*ma;A.g+=xa.g*ma;A.b+=xa.b*ma}}else if(ma instanceof THREE.PointLight){E.sub(ma.position,X);E.normalize();ma=Y.dot(E)* -Da;if(ma>0){A.r+=xa.r*ma;A.g+=xa.g*ma;A.b+=xa.b*ma}}}}function Ga(y,X,Y){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);var A,U,ma,xa,Da,Ea;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){xa=Y.map.image;Da=xa.width>>1;Ea=xa.height>>1;U=X.scale.x*o;ma=X.scale.y*k;Y=U*Da;A=ma*Ea;h.set(y.x-Y,y.y-A,y.x+Y,y.y+A);if(!p.instersects(h))return;m.save();m.translate(y.x,y.y);m.rotate(-X.rotation);m.scale(U,-ma);m.translate(-Da,-Ea);m.drawImage(xa,0,0);m.restore()}m.beginPath();m.moveTo(y.x- -10,y.y);m.lineTo(y.x+10,y.y);m.moveTo(y.x,y.y-10);m.lineTo(y.x,y.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(Y instanceof THREE.ParticleCircleMaterial){if(q){v.r=C.r+W.r+L.r;v.g=C.g+W.g+L.g;v.b=C.b+W.b+L.b;R.r=Y.color.r*v.r;R.g=Y.color.g*v.g;R.b=Y.color.b*v.b;R.updateStyleString()}else R.__styleString=Y.color.__styleString;Y=X.scale.x*o;A=X.scale.y*k;h.set(y.x-Y,y.y-A,y.x+Y,y.y+A);if(p.instersects(h)){U=R.__styleString;if(H!=U)m.fillStyle=H=U;m.save();m.translate(y.x,y.y); -m.rotate(-X.rotation);m.scale(Y,A);m.beginPath();m.arc(0,0,1,0,S,!0);m.closePath();m.fill();m.restore()}}}}function O(y,X,Y,A){if(A.opacity!=0){a(A.opacity);b(A.blending);m.beginPath();m.moveTo(y.positionScreen.x,y.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(A instanceof THREE.LineBasicMaterial){R.__styleString=A.color.__styleString;y=A.linewidth;if(G!=y)m.lineWidth=G=y;y=R.__styleString;if(F!=y)m.strokeStyle=F=y;m.stroke();h.inflate(A.linewidth*2)}}}function M(y, -X,Y,A,U,ma){if(U.opacity!=0){a(U.opacity);b(U.blending);K=y.positionScreen.x;d=y.positionScreen.y;ga=X.positionScreen.x;T=X.positionScreen.y;N=Y.positionScreen.x;ba=Y.positionScreen.y;m.beginPath();m.moveTo(K,d);m.lineTo(ga,T);m.lineTo(N,ba);m.lineTo(K,d);m.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ca(K,d,ga,T,N,ba,U.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&& -U.env_map.mapping instanceof THREE.SphericalReflectionMapping){y=z.globalMatrix;E.copy(A.vertexNormalsWorld[0]);ca=(E.x*y.n11+E.y*y.n12+E.z*y.n13)*0.5+0.5;Q=-(E.x*y.n21+E.y*y.n22+E.z*y.n23)*0.5+0.5;E.copy(A.vertexNormalsWorld[1]);ra=(E.x*y.n11+E.y*y.n12+E.z*y.n13)*0.5+0.5;wa=-(E.x*y.n21+E.y*y.n22+E.z*y.n23)*0.5+0.5;E.copy(A.vertexNormalsWorld[2]);f=(E.x*y.n11+E.y*y.n12+E.z*y.n13)*0.5+0.5;n=-(E.x*y.n21+E.y*y.n22+E.z*y.n23)*0.5+0.5;Ca(K,d,ga,T,N,ba,U.env_map.image,ca,Q,ra,wa,f,n)}}else U.wireframe? -J(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ca(K,d,ga,T,N,ba,U.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);b(THREE.SubtractiveBlending)}if(q)if(!U.wireframe&&U.shading==THREE.SmoothShading&&A.vertexNormalsWorld.length==3){aa.r=V.r=B.r=C.r;aa.g=V.g=B.g=C.g;aa.b=V.b=B.b=C.b;za(ma,A.v1.positionWorld,A.vertexNormalsWorld[0],aa); -za(ma,A.v2.positionWorld,A.vertexNormalsWorld[1],V);za(ma,A.v3.positionWorld,A.vertexNormalsWorld[2],B);I.r=(V.r+B.r)*0.5;I.g=(V.g+B.g)*0.5;I.b=(V.b+B.b)*0.5;ja=Aa(aa,V,B,I);Ca(K,d,ga,T,N,ba,ja,0,0,1,0,0,1)}else{v.r=C.r;v.g=C.g;v.b=C.b;za(ma,A.centroidWorld,A.normalWorld,v);R.r=U.color.r*v.r;R.g=U.color.g*v.g;R.b=U.color.b*v.b;R.updateStyleString();U.wireframe?J(R.__styleString,U.wireframe_linewidth):oa(R.__styleString)}else U.wireframe?J(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString)}else if(U instanceof -THREE.MeshDepthMaterial){ka=z.near;P=z.far;aa.r=aa.g=aa.b=1-u(y.positionScreen.z,ka,P);V.r=V.g=V.b=1-u(X.positionScreen.z,ka,P);B.r=B.g=B.b=1-u(Y.positionScreen.z,ka,P);I.r=(V.r+B.r)*0.5;I.g=(V.g+B.g)*0.5;I.b=(V.b+B.b)*0.5;ja=Aa(aa,V,B,I);Ca(K,d,ga,T,N,ba,ja,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){R.r=Ba(A.normalWorld.x);R.g=Ba(A.normalWorld.y);R.b=Ba(A.normalWorld.z);R.updateStyleString();U.wireframe?J(R.__styleString,U.wireframe_linewidth):oa(R.__styleString)}}}function J(y, -X){if(F!=y)m.strokeStyle=F=y;if(G!=X)m.lineWidth=G=X;m.stroke();h.inflate(X*2)}function oa(y){if(H!=y)m.fillStyle=H=y;m.fill()}function Ca(y,X,Y,A,U,ma,xa,Da,Ea,Ia,ya,Ja,Qa){var Ka,La;Ka=xa.width-1;La=xa.height-1;Da*=Ka;Ea*=La;Ia*=Ka;ya*=La;Ja*=Ka;Qa*=La;Y-=y;A-=X;U-=y;ma-=X;Ia-=Da;ya-=Ea;Ja-=Da;Qa-=Ea;Ka=Ia*Qa-Ja*ya;if(Ka!=0){La=1/Ka;Ka=(Qa*Y-ya*U)*La;ya=(Qa*A-ya*ma)*La;Y=(Ia*U-Ja*Y)*La;A=(Ia*ma-Ja*A)*La;y=y-Ka*Da-Y*Ea;X=X-ya*Da-A*Ea;m.save();m.transform(Ka,ya,Y,A,y,X);m.clip();m.drawImage(xa,0, -0);m.restore()}}function Aa(y,X,Y,A){var U=~~(y.r*255),ma=~~(y.g*255);y=~~(y.b*255);var xa=~~(X.r*255),Da=~~(X.g*255);X=~~(X.b*255);var Ea=~~(Y.r*255),Ia=~~(Y.g*255);Y=~~(Y.b*255);var ya=~~(A.r*255),Ja=~~(A.g*255);A=~~(A.b*255);la[0]=U<0?0:U>255?255:U;la[1]=ma<0?0:ma>255?255:ma;la[2]=y<0?0:y>255?255:y;la[4]=xa<0?0:xa>255?255:xa;la[5]=Da<0?0:Da>255?255:Da;la[6]=X<0?0:X>255?255:X;la[8]=Ea<0?0:Ea>255?255:Ea;la[9]=Ia<0?0:Ia>255?255:Ia;la[10]=Y<0?0:Y>255?255:Y;la[12]=ya<0?0:ya>255?255:ya;la[13]=Ja<0?0: -Ja>255?255:Ja;la[14]=A<0?0:A>255?255:A;ea.putImageData(va,0,0);ia.drawImage(da,0,0);return ha}function u(y,X,Y){y=(y-X)/(Y-X);return y*y*(3-2*y)}function Ba(y){y=(y+1)*0.5;return y<0?0:y>1?1:y}function Oa(y,X){var Y=X.x-y.x,A=X.y-y.y,U=1/Math.sqrt(Y*Y+A*A);Y*=U;A*=U;X.x+=Y;X.y+=A;y.x-=Y;y.y-=A}var Ma,Ha,$,sa,pa,ta,ua,qa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,k);c=e.projectScene(na,z,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(p.getX(),p.getY(),p.getWidth(), -p.getHeight());(q=na.lights.length>0)&&Fa(na);Ma=0;for(Ha=c.length;Ma0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}else if(n instanceof THREE.PointLight){ba.sub(n.position,Q.centroidWorld);ba.normalize();p=Q.normalWorld.dot(ba)*n.intensity;if(p>0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}}}function b(ca,Q,ra,wa,f,n){B=e(I++);B.setAttribute("d", -"M "+ca.positionScreen.x+" "+ca.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)D.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(Z){K.r=d.r;K.g=d.g;K.b=d.b;a(n,wa,K);D.r=f.color.r*K.r;D.g=f.color.g*K.g;D.b=f.color.b*K.b;D.updateStyleString()}else D.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){N=1-f.__2near/(f.__farPlusNear- -wa.z*f.__farMinusNear);D.setRGB(N,N,N)}else f instanceof THREE.MeshNormalMaterial&&D.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));f.wireframe?B.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):B.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+f.opacity);o.appendChild(B)}function c(ca,Q,ra,wa, -f,n,p){B=e(I++);B.setAttribute("d","M "+ca.positionScreen.x+" "+ca.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(n instanceof THREE.MeshBasicMaterial)D.__styleString=n.color.__styleString;else if(n instanceof THREE.MeshLambertMaterial)if(Z){K.r=d.r;K.g=d.g;K.b=d.b;a(p,f,K);D.r=n.color.r*K.r;D.g=n.color.g*K.g;D.b=n.color.b*K.b;D.updateStyleString()}else D.__styleString=n.color.__styleString; -else if(n instanceof THREE.MeshDepthMaterial){N=1-n.__2near/(n.__farPlusNear-f.z*n.__farMinusNear);D.setRGB(N,N,N)}else n instanceof THREE.MeshNormalMaterial&&D.setRGB(g(f.normalWorld.x),g(f.normalWorld.y),g(f.normalWorld.z));n.wireframe?B.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+n.wireframe_linewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframe_linecap+"; stroke-linejoin: "+n.wireframe_linejoin):B.setAttribute("style","fill: "+D.__styleString+ -"; fill-opacity: "+n.opacity);o.appendChild(B)}function e(ca){if(R[ca]==null){R[ca]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&R[ca].setAttribute("shape-rendering","crispEdges")}return R[ca]}function g(ca){return ca<0?Math.min((1+ca)*0.5,0.5):0.5+Math.min(ca*0.5,0.5)}var i=null,l=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,s,w,t,x,F,H,G=new THREE.Rectangle,r=new THREE.Rectangle,Z=!1,D=new THREE.Color(16777215),K=new THREE.Color(16777215), -d=new THREE.Color(0),ga=new THREE.Color(0),T=new THREE.Color(0),N,ba=new THREE.Vector3,R=[],aa=[],V=[],B,I,ka,P,ja=1;this.domElement=o;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ca){switch(ca){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ca,Q){k=ca;m=Q;s=k/2;w=m/2;o.setAttribute("viewBox",-s+" "+-w+" "+k+" "+m);o.setAttribute("width",k);o.setAttribute("height",m);G.set(-s,-w,s,w)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])}; -this.render=function(ca,Q){var ra,wa,f,n,p,j,h,q;this.autoClear&&this.clear();i=l.projectScene(ca,Q,this.sortElements);P=ka=I=0;if(Z=ca.lights.length>0){h=ca.lights;d.setRGB(0,0,0);ga.setRGB(0,0,0);T.setRGB(0,0,0);ra=0;for(wa=h.length;ra=0){d.bindBuffer(d.ARRAY_BUFFER, -h.__webGLColorBuffer);d.vertexAttribPointer(f.color,3,d.FLOAT,!1,0,0)}if(f.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLNormalBuffer);d.vertexAttribPointer(f.normal,3,d.FLOAT,!1,0,0)}if(f.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLTangentBuffer);d.vertexAttribPointer(f.tangent,4,d.FLOAT,!1,0,0)}if(f.uv>=0)if(h.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUVBuffer);d.vertexAttribPointer(f.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv)}else d.disableVertexAttribArray(f.uv);if(f.uv2>= -0)if(h.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUV2Buffer);d.vertexAttribPointer(f.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv2)}else d.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);d.vertexAttribPointer(f.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);d.vertexAttribPointer(f.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER, -h.__webGLSkinIndicesBuffer);d.vertexAttribPointer(f.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);d.vertexAttribPointer(f.skinWeight,4,d.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(j.wireframe){d.lineWidth(j.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);d.drawElements(d.LINES,h.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,h.__webGLFaceCount,d.UNSIGNED_SHORT, -0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(j.linewidth);d.drawArrays(q,0,h.__webGLLineCount)}else q instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS,0,h.__webGLParticleCount)}function i(f,n){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=d.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=d.createBuffer();if(f.hasPos){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,f.positionArray,d.DYNAMIC_DRAW); -d.enableVertexAttribArray(n.attributes.position);d.vertexAttribPointer(n.attributes.position,3,d.FLOAT,!1,0,0)}if(f.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,f.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(n.attributes.normal);d.vertexAttribPointer(n.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,f.count);f.count=0}function l(f){if(ba!=f.doubleSided){f.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ba=f.doubleSided}if(R!= -f.flipSided){f.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);R=f.flipSided}}function o(f){if(V!=f){f?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);V=f}}function k(f){B[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);B[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);B[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);B[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);B[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);B[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33, -f.n44+f.n34);var n;for(f=0;f<5;f++){n=B[f];n.divideScalar(Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z))}}function m(f){for(var n=f.globalMatrix,p=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=B[j].x*n.n14+B[j].y*n.n24+B[j].z*n.n34+B[j].w;if(f<=p)return!1}return!0}function s(f,n){f.list[f.count]=n;f.count+=1}function w(f){var n,p,j=f.object,h=f.opaque,q=f.transparent;q.count=0;f=h.count=0;for(n=j.materials.length;f0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+ -q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); -d.attachShader(p,Z("fragment",h+W));d.attachShader(p,Z("vertex",q+n));d.linkProgram(p);d.getProgramParameter(p,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(p,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(n=p.length;W< -n;W++){h=p[W];j.uniforms[h]=d.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(n=p.length;W=0&&d.enableVertexAttribArray(j.color);j.normal>=0&&d.enableVertexAttribArray(j.normal);j.tangent>=0&&d.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>= -0&&j.skinIndex>=0&&j.skinWeight>=0){d.enableVertexAttribArray(j.skinVertexA);d.enableVertexAttribArray(j.skinVertexB);d.enableVertexAttribArray(j.skinIndex);d.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,n,p,j){var h,q,v,C,W,L,S,E,da=f.lights,ea=f.fog;n.autoUpdateMatrix&&n.update();n.globalMatrix.flattenToArray(ja);n.projectionMatrix.flattenToArray(ka);n.inverseMatrix.flattenToArray(P);I.multiply(n.projectionMatrix,n.globalMatrix);k(I);THREE.AnimationHandler&&THREE.AnimationHandler.update(); -f.update(undefined,!1,n);this.initWebGLObjects(f,n);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Oa,ea)}if(xa&&la>0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ma,ea)}if(ma){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,y,ea);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,X,ea)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,pa,ea); -d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ta,ea);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,ua,ea);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,qa,ea)}}F(objlist,W,q,C,j)}v.__dirtyVertices=!1;v.__dirtyElements=!1;v.__dirtyUvs=!1;v.__dirtyNormals=!1;v.__dirtyTangents=!1;v.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!v.__webGLVertexBuffer){q=v;q.__webGLVertexBuffer=d.createBuffer(); -q.__webGLColorBuffer=d.createBuffer();q=v;C=q.vertices.length;q.__vertexArray=new Float32Array(C*3);q.__colorArray=new Float32Array(C*3);q.__webGLLineCount=C;v.__dirtyVertices=!0;v.__dirtyColors=!0}if(v.__dirtyVertices||v.__dirtyColors){q=v;C=d.DYNAMIC_DRAW;E=void 0;E=void 0;L=void 0;h=void 0;da=q.vertices;ea=q.colors;la=da.length;va=ea.length;ha=q.__vertexArray;S=q.__colorArray;ia=q.__dirtyColors;if(q.__dirtyVertices){for(E=0;E=0;p--){j= -f.__webGLObjects[p].object;n==j&&f.__webGLObjects.splice(p,1)}};this.setFaceCulling=function(f,n){if(f){!n||n=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(f=="back")d.cullFace(d.BACK);else f=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4}; +THREE.Projector=function(){function a(T,O){return O.z-T.z}function b(T,O){var ca=0,S=1,ba=T.z+T.w,V=O.z+O.w,D=-T.z+T.w,J=-O.z+O.w;if(ba>=0&&V>=0&&D>=0&&J>=0)return!0;else if(ba<0&&V<0||D<0&&J<0)return!1;else{if(ba<0)ca=Math.max(ca,ba/(ba-V));else V<0&&(S=Math.min(S,ba/(ba-V)));if(D<0)ca=Math.max(ca,D/(D-J));else J<0&&(S=Math.min(S,D/(D-J)));if(Sba&&Q.z0&&H.z<1){u=F[x]=F[x]||new THREE.RenderableParticle;u.x=H.x/H.w;u.y=H.y/H.w;u.z=H.z;u.rotation=R.rotation.z;u.scale.x=R.scale.x*Math.abs(u.x- +(H.x+O.projectionMatrix.n11)/(H.w+O.projectionMatrix.n14));u.scale.y=R.scale.y*Math.abs(u.y-(H.y+O.projectionMatrix.n22)/(H.w+O.projectionMatrix.n24));u.materials=R.materials;S.push(u);x++}}}}ca&&S.sort(a);return S};this.unprojectVector=function(T,O){var ca=THREE.Matrix4.makeInvert(O.globalMatrix);ca.multiplySelf(THREE.Matrix4.makeInvert(O.projectionMatrix));ca.multiplyVector3(T);return T}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,g,i;this.domElement=document.createElement("div");this.setSize=function(l,o){d=l;e=o;g=d/2;i=e/2};this.render=function(l,o){var k,m,s,w,u,x,F,I;a=b.projectScene(l,o);k=0;for(m=a.length;k0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}else if(ma instanceof THREE.PointLight){C.sub(ma.position,X);C.normalize();ma=Y.dot(C)* +Da;if(ma>0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}}}function Ga(y,X,Y){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);var B,U,ma,xa,Da,Ea;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){xa=Y.map.image;Da=xa.width>>1;Ea=xa.height>>1;U=X.scale.x*o;ma=X.scale.y*k;Y=U*Da;B=ma*Ea;h.set(y.x-Y,y.y-B,y.x+Y,y.y+B);if(!p.instersects(h))return;m.save();m.translate(y.x,y.y);m.rotate(-X.rotation);m.scale(U,-ma);m.translate(-Da,-Ea);m.drawImage(xa,0,0);m.restore()}m.beginPath();m.moveTo(y.x- +10,y.y);m.lineTo(y.x+10,y.y);m.moveTo(y.x,y.y-10);m.lineTo(y.x,y.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(Y instanceof THREE.ParticleCircleMaterial){if(q){t.r=A.r+W.r+G.r;t.g=A.g+W.g+G.g;t.b=A.b+W.b+G.b;S.r=Y.color.r*t.r;S.g=Y.color.g*t.g;S.b=Y.color.b*t.b;S.updateStyleString()}else S.__styleString=Y.color.__styleString;Y=X.scale.x*o;B=X.scale.y*k;h.set(y.x-Y,y.y-B,y.x+Y,y.y+B);if(p.instersects(h)){U=S.__styleString;if(I!=U)m.fillStyle=I=U;m.save();m.translate(y.x,y.y); +m.rotate(-X.rotation);m.scale(Y,B);m.beginPath();m.arc(0,0,1,0,M,!0);m.closePath();m.fill();m.restore()}}}}function P(y,X,Y,B){if(B.opacity!=0){a(B.opacity);b(B.blending);m.beginPath();m.moveTo(y.positionScreen.x,y.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(B instanceof THREE.LineBasicMaterial){S.__styleString=B.color.__styleString;y=B.linewidth;if(H!=y)m.lineWidth=H=y;y=S.__styleString;if(F!=y)m.strokeStyle=F=y;m.stroke();h.inflate(B.linewidth*2)}}}function N(y, +X,Y,B,U,ma){if(U.opacity!=0){a(U.opacity);b(U.blending);L=y.positionScreen.x;c=y.positionScreen.y;ia=X.positionScreen.x;T=X.positionScreen.y;O=Y.positionScreen.x;ca=Y.positionScreen.y;m.beginPath();m.moveTo(L,c);m.lineTo(ia,T);m.lineTo(O,ca);m.lineTo(L,c);m.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ca(L,c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&& +U.env_map.mapping instanceof THREE.SphericalReflectionMapping){y=z.globalMatrix;C.copy(B.vertexNormalsWorld[0]);ea=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;R=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;C.copy(B.vertexNormalsWorld[1]);ra=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;wa=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;C.copy(B.vertexNormalsWorld[2]);f=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;n=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;Ca(L,c,ia,T,O,ca,U.env_map.image,ea,R,ra,wa,f,n)}}else U.wireframe? +K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ca(L,c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);b(THREE.SubtractiveBlending)}if(q)if(!U.wireframe&&U.shading==THREE.SmoothShading&&B.vertexNormalsWorld.length==3){ba.r=V.r=D.r=A.r;ba.g=V.g=D.g=A.g;ba.b=V.b=D.b=A.b;za(ma,B.v1.positionWorld,B.vertexNormalsWorld[0],ba); +za(ma,B.v2.positionWorld,B.vertexNormalsWorld[1],V);za(ma,B.v3.positionWorld,B.vertexNormalsWorld[2],D);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,ja,0,0,1,0,0,1)}else{t.r=A.r;t.g=A.g;t.b=A.b;za(ma,B.centroidWorld,B.normalWorld,t);S.r=U.color.r*t.r;S.g=U.color.g*t.g;S.b=U.color.b*t.b;S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}else U.wireframe?K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString)}else if(U instanceof +THREE.MeshDepthMaterial){la=z.near;Q=z.far;ba.r=ba.g=ba.b=1-v(y.positionScreen.z,la,Q);V.r=V.g=V.b=1-v(X.positionScreen.z,la,Q);D.r=D.g=D.b=1-v(Y.positionScreen.z,la,Q);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,ja,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){S.r=Ba(B.normalWorld.x);S.g=Ba(B.normalWorld.y);S.b=Ba(B.normalWorld.z);S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}}}function K(y, +X){if(F!=y)m.strokeStyle=F=y;if(H!=X)m.lineWidth=H=X;m.stroke();h.inflate(X*2)}function oa(y){if(I!=y)m.fillStyle=I=y;m.fill()}function Ca(y,X,Y,B,U,ma,xa,Da,Ea,Ia,ya,Ja,Qa){var Ka,La;Ka=xa.width-1;La=xa.height-1;Da*=Ka;Ea*=La;Ia*=Ka;ya*=La;Ja*=Ka;Qa*=La;Y-=y;B-=X;U-=y;ma-=X;Ia-=Da;ya-=Ea;Ja-=Da;Qa-=Ea;Ka=Ia*Qa-Ja*ya;if(Ka!=0){La=1/Ka;Ka=(Qa*Y-ya*U)*La;ya=(Qa*B-ya*ma)*La;Y=(Ia*U-Ja*Y)*La;B=(Ia*ma-Ja*B)*La;y=y-Ka*Da-Y*Ea;X=X-ya*Da-B*Ea;m.save();m.transform(Ka,ya,Y,B,y,X);m.clip();m.drawImage(xa,0, +0);m.restore()}}function Aa(y,X,Y,B){var U=~~(y.r*255),ma=~~(y.g*255);y=~~(y.b*255);var xa=~~(X.r*255),Da=~~(X.g*255);X=~~(X.b*255);var Ea=~~(Y.r*255),Ia=~~(Y.g*255);Y=~~(Y.b*255);var ya=~~(B.r*255),Ja=~~(B.g*255);B=~~(B.b*255);ka[0]=U<0?0:U>255?255:U;ka[1]=ma<0?0:ma>255?255:ma;ka[2]=y<0?0:y>255?255:y;ka[4]=xa<0?0:xa>255?255:xa;ka[5]=Da<0?0:Da>255?255:Da;ka[6]=X<0?0:X>255?255:X;ka[8]=Ea<0?0:Ea>255?255:Ea;ka[9]=Ia<0?0:Ia>255?255:Ia;ka[10]=Y<0?0:Y>255?255:Y;ka[12]=ya<0?0:ya>255?255:ya;ka[13]=Ja<0?0: +Ja>255?255:Ja;ka[14]=B<0?0:B>255?255:B;da.putImageData(ua,0,0);ga.drawImage(aa,0,0);return fa}function v(y,X,Y){y=(y-X)/(Y-X);return y*y*(3-2*y)}function Ba(y){y=(y+1)*0.5;return y<0?0:y>1?1:y}function Oa(y,X){var Y=X.x-y.x,B=X.y-y.y,U=1/Math.sqrt(Y*Y+B*B);Y*=U;B*=U;X.x+=Y;X.y+=B;y.x-=Y;y.y-=B}var Ma,Ha,$,sa,pa,ta,va,qa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,k);d=e.projectScene(na,z,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(p.getX(),p.getY(),p.getWidth(), +p.getHeight());(q=na.lights.length>0)&&Fa(na);Ma=0;for(Ha=d.length;Ma0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}else if(n instanceof THREE.PointLight){ca.sub(n.position,R.centroidWorld);ca.normalize();p=R.normalWorld.dot(ca)*n.intensity;if(p>0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}}}function b(ea,R,ra,wa,f,n){D=e(J++);D.setAttribute("d", +"M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(n,wa,L);E.r=f.color.r*L.r;E.g=f.color.g*L.g;E.b=f.color.b*L.b;E.updateStyleString()}else E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){O=1-f.__2near/(f.__farPlusNear- +wa.z*f.__farMinusNear);E.setRGB(O,O,O)}else f instanceof THREE.MeshNormalMaterial&&E.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));f.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+f.opacity);o.appendChild(D)}function d(ea,R,ra,wa, +f,n,p){D=e(J++);D.setAttribute("d","M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(n instanceof THREE.MeshBasicMaterial)E.__styleString=n.color.__styleString;else if(n instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(p,f,L);E.r=n.color.r*L.r;E.g=n.color.g*L.g;E.b=n.color.b*L.b;E.updateStyleString()}else E.__styleString=n.color.__styleString; +else if(n instanceof THREE.MeshDepthMaterial){O=1-n.__2near/(n.__farPlusNear-f.z*n.__farMinusNear);E.setRGB(O,O,O)}else n instanceof THREE.MeshNormalMaterial&&E.setRGB(g(f.normalWorld.x),g(f.normalWorld.y),g(f.normalWorld.z));n.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+n.wireframe_linewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframe_linecap+"; stroke-linejoin: "+n.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+ +"; fill-opacity: "+n.opacity);o.appendChild(D)}function e(ea){if(S[ea]==null){S[ea]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&S[ea].setAttribute("shape-rendering","crispEdges")}return S[ea]}function g(ea){return ea<0?Math.min((1+ea)*0.5,0.5):0.5+Math.min(ea*0.5,0.5)}var i=null,l=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,s,w,u,x,F,I,H=new THREE.Rectangle,r=new THREE.Rectangle,Z=!1,E=new THREE.Color(16777215),L=new THREE.Color(16777215), +c=new THREE.Color(0),ia=new THREE.Color(0),T=new THREE.Color(0),O,ca=new THREE.Vector3,S=[],ba=[],V=[],D,J,la,Q,ja=1;this.domElement=o;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ea){switch(ea){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ea,R){k=ea;m=R;s=k/2;w=m/2;o.setAttribute("viewBox",-s+" "+-w+" "+k+" "+m);o.setAttribute("width",k);o.setAttribute("height",m);H.set(-s,-w,s,w)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])}; +this.render=function(ea,R){var ra,wa,f,n,p,j,h,q;this.autoClear&&this.clear();i=l.projectScene(ea,R,this.sortElements);Q=la=J=0;if(Z=ea.lights.length>0){h=ea.lights;c.setRGB(0,0,0);ia.setRGB(0,0,0);T.setRGB(0,0,0);ra=0;for(wa=h.length;ra=0){c.bindBuffer(c.ARRAY_BUFFER, +h.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(h.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>= +0)if(h.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER, +h.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(j.wireframe){c.lineWidth(j.wireframe_linewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.drawElements(c.LINES,h.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,h.__webGLFaceCount,c.UNSIGNED_SHORT, +0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(j.linewidth);c.drawArrays(q,0,h.__webGLLineCount)}else if(q instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,h.__webGLParticleCount);else q instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,h.__webGLVertexCount)}function i(f,n){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER, +f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(n.attributes.position);c.vertexAttribPointer(n.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(n.attributes.normal);c.vertexAttribPointer(n.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function l(f){if(ca!=f.doubleSided){f.doubleSided? +c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ca=f.doubleSided}if(S!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);S=f.flipSided}}function o(f){if(V!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);V=f}}function k(f){D[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);D[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);D[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);D[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);D[4].set(f.n41-f.n31,f.n42-f.n32, +f.n43-f.n33,f.n44-f.n34);D[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var n;for(f=0;f<5;f++){n=D[f];n.divideScalar(Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z))}}function m(f){for(var n=f.globalMatrix,p=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=D[j].x*n.n14+D[j].y*n.n24+D[j].z*n.n34+D[j].w;if(f<=p)return!1}return!0}function s(f,n){f.list[f.count]=n;f.count+=1}function w(f){var n,p,j=f.object,h=f.opaque,q=f.transparent;q.count=0;f=h.count= +0;for(n=j.materials.length;f0?"#define VERTEX_TEXTURES": +"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); +c.attachShader(p,Z("fragment",h+W));c.attachShader(p,Z("vertex",q+n));c.linkProgram(p);c.getProgramParameter(p,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(p,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(n=p.length;W< +n;W++){h=p[W];j.uniforms[h]=c.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(n=p.length;W=0&&c.enableVertexAttribArray(j.color);j.normal>=0&&c.enableVertexAttribArray(j.normal);j.tangent>=0&&c.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>= +0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,n,p,j){var h,q,t,A,W,G,M,C,aa=f.lights,da=f.fog;n.autoUpdateMatrix&&n.update();n.globalMatrix.flattenToArray(ja);n.projectionMatrix.flattenToArray(la);n.inverseMatrix.flattenToArray(Q);J.multiply(n.projectionMatrix,n.globalMatrix);k(J);THREE.AnimationHandler&&THREE.AnimationHandler.update(); +f.update(undefined,!1,n);this.initWebGLObjects(f,n);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Oa,da)}if(xa&&ka>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ma,da)}if(ma){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,y,da);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X,da)}if(v>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,pa,da); +c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ta,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,va,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,qa,da)}}F(objlist,W,q,A,j)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer(); +q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=new Float32Array(A*3);q.__webGLVertexCount=A;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;A=c.DYNAMIC_DRAW;C=void 0;C=void 0;G=void 0;h=void 0;aa=q.vertices;da=q.colors;ka=aa.length;ua=da.length;fa=q.__vertexArray;M=q.__colorArray;ga=q.__dirtyColors;if(q.__dirtyVertices){for(C=0;C=0;p--){j=f.__webGLObjects[p].object;n==j&&f.__webGLObjects.splice(p,1)}};this.setFaceCulling= +function(f,n){if(f){!n||n=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", diff --git a/build/ThreeExtras.js b/build/ThreeExtras.js index 8086364d2a..6abb5e44f0 100644 --- a/build/ThreeExtras.js +++ b/build/ThreeExtras.js @@ -13,7 +13,7 @@ this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,d){this.x=a|| 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.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a0&&F>0&&e+F<1}var c,d,f,g,h,k,j,m,o,w, +THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a0&&F>0&&e+F<1}var c,d,f,g,h,k,j,m,o,w, u,t=a.geometry,x=t.vertices,A=[];c=0;for(d=t.faces.length;cj?d:j;f=f>m?f:m}a()}; @@ -25,11 +25,11 @@ THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a); this.n31=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;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*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43* a+this.n44))},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},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,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,w=a.n32,u=a.n33,t=a.n34,x=a.n41,A=a.n42,F=a.n43,v=a.n44,H=b.n11,q=b.n12,J=b.n13,e=b.n14,ba=b.n21,L=b.n22,M=b.n23,V=b.n24,S=b.n31,Y=b.n32,Z=b.n33,G=b.n34,T=b.n41,la=b.n42,W=b.n43,ja=b.n44;this.n11=c*H+d*ba+f*S+g*T;this.n12=c*q+d*L+f*Y+g*la;this.n13=c*J+d*M+f*Z+g*W;this.n14=c*e+d*V+f*G+g*ja;this.n21=h*H+k*ba+j*S+m*T;this.n22=h*q+k*L+j*Y+m*la;this.n23= -h*J+k*M+j*Z+m*W;this.n24=h*e+k*V+j*G+m*ja;this.n31=o*H+w*ba+u*S+t*T;this.n32=o*q+w*L+u*Y+t*la;this.n33=o*J+w*M+u*Z+t*W;this.n34=o*e+w*V+u*G+t*ja;this.n41=x*H+A*ba+F*S+v*T;this.n42=x*q+A*L+F*Y+v*la;this.n43=x*J+A*M+F*Z+v*W;this.n44=x*e+A*V+F*G+v*ja;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,o=a.n24,w=a.n31,u=a.n32,t=a.n33,x=a.n34,A=a.n41,F=a.n42,v=a.n43;a=a.n44;var H=b.n11,q=b.n12,J=b.n13,e=b.n14,ba=b.n21,L=b.n22,M=b.n23,V=b.n24,S=b.n31, -Y=b.n32,Z=b.n33,G=b.n34,T=b.n41,la=b.n42,W=b.n43;b=b.n44;this.n11=d*H+f*ba+g*S+h*T;this.n12=d*q+f*L+g*Y+h*la;this.n13=d*J+f*M+g*Z+h*W;this.n14=d*e+f*V+g*G+h*b;this.n21=k*H+j*ba+m*S+o*T;this.n22=k*q+j*L+m*Y+o*la;this.n23=k*J+j*M+m*Z+o*W;this.n24=k*e+j*V+m*G+o*b;this.n31=w*H+u*ba+t*S+x*T;this.n32=w*q+u*L+t*Y+x*la;this.n33=w*J+u*M+t*Z+x*W;this.n34=w*e+u*V+t*G+x*b;this.n41=A*H+F*ba+v*S+a*T;this.n42=A*q+F*L+v*Y+a*la;this.n43=A*J+F*M+v*Z+a*W;this.n44=A*e+F*V+v*G+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){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,o=this.n32,w=this.n33,u=this.n34,t=this.n41,x=this.n42,A=this.n43,F=this.n44,v=a.n11,H=a.n21,q=a.n31,J=a.n41,e=a.n12,ba=a.n22,L=a.n32,M=a.n42,V=a.n13,S=a.n23,Y=a.n33,Z=a.n43, -G=a.n14,T=a.n24,la=a.n34;a=a.n44;this.n11=b*v+c*H+d*q+f*J;this.n12=b*e+c*ba+d*L+f*M;this.n13=b*V+c*S+d*Y+f*Z;this.n14=b*G+c*T+d*la+f*a;this.n21=g*v+h*H+k*q+j*J;this.n22=g*e+h*ba+k*L+j*M;this.n23=g*V+h*S+k*Y+j*Z;this.n24=g*G+h*T+k*la+j*a;this.n31=m*v+o*H+w*q+u*J;this.n32=m*e+o*ba+w*L+u*M;this.n33=m*V+o*S+w*Y+u*Z;this.n34=m*G+o*T+w*la+u*a;this.n41=t*v+x*H+A*q+F*J;this.n42=t*e+x*ba+A*L+F*M;this.n43=t*V+x*S+A*Y+F*Z;this.n44=t*G+x*T+A*la+F*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*= +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,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,w=a.n32,u=a.n33,t=a.n34,x=a.n41,A=a.n42,F=a.n43,v=a.n44,I=b.n11,q=b.n12,J=b.n13,e=b.n14,ba=b.n21,L=b.n22,M=b.n23,V=b.n24,S=b.n31,Y=b.n32,Z=b.n33,G=b.n34,U=b.n41,na=b.n42,W=b.n43,ka=b.n44;this.n11=c*I+d*ba+f*S+g*U;this.n12=c*q+d*L+f*Y+g*na;this.n13=c*J+d*M+f*Z+g*W;this.n14=c*e+d*V+f*G+g*ka;this.n21=h*I+k*ba+j*S+m*U;this.n22=h*q+k*L+j*Y+m*na;this.n23= +h*J+k*M+j*Z+m*W;this.n24=h*e+k*V+j*G+m*ka;this.n31=o*I+w*ba+u*S+t*U;this.n32=o*q+w*L+u*Y+t*na;this.n33=o*J+w*M+u*Z+t*W;this.n34=o*e+w*V+u*G+t*ka;this.n41=x*I+A*ba+F*S+v*U;this.n42=x*q+A*L+F*Y+v*na;this.n43=x*J+A*M+F*Z+v*W;this.n44=x*e+A*V+F*G+v*ka;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,o=a.n24,w=a.n31,u=a.n32,t=a.n33,x=a.n34,A=a.n41,F=a.n42,v=a.n43;a=a.n44;var I=b.n11,q=b.n12,J=b.n13,e=b.n14,ba=b.n21,L=b.n22,M=b.n23,V=b.n24,S=b.n31, +Y=b.n32,Z=b.n33,G=b.n34,U=b.n41,na=b.n42,W=b.n43;b=b.n44;this.n11=d*I+f*ba+g*S+h*U;this.n12=d*q+f*L+g*Y+h*na;this.n13=d*J+f*M+g*Z+h*W;this.n14=d*e+f*V+g*G+h*b;this.n21=k*I+j*ba+m*S+o*U;this.n22=k*q+j*L+m*Y+o*na;this.n23=k*J+j*M+m*Z+o*W;this.n24=k*e+j*V+m*G+o*b;this.n31=w*I+u*ba+t*S+x*U;this.n32=w*q+u*L+t*Y+x*na;this.n33=w*J+u*M+t*Z+x*W;this.n34=w*e+u*V+t*G+x*b;this.n41=A*I+F*ba+v*S+a*U;this.n42=A*q+F*L+v*Y+a*na;this.n43=A*J+F*M+v*Z+a*W;this.n44=A*e+F*V+v*G+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){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,o=this.n32,w=this.n33,u=this.n34,t=this.n41,x=this.n42,A=this.n43,F=this.n44,v=a.n11,I=a.n21,q=a.n31,J=a.n41,e=a.n12,ba=a.n22,L=a.n32,M=a.n42,V=a.n13,S=a.n23,Y=a.n33,Z=a.n43, +G=a.n14,U=a.n24,na=a.n34;a=a.n44;this.n11=b*v+c*I+d*q+f*J;this.n12=b*e+c*ba+d*L+f*M;this.n13=b*V+c*S+d*Y+f*Z;this.n14=b*G+c*U+d*na+f*a;this.n21=g*v+h*I+k*q+j*J;this.n22=g*e+h*ba+k*L+j*M;this.n23=g*V+h*S+k*Y+j*Z;this.n24=g*G+h*U+k*na+j*a;this.n31=m*v+o*I+w*q+u*J;this.n32=m*e+o*ba+w*L+u*M;this.n33=m*V+o*S+w*Y+u*Z;this.n34=m*G+o*U+w*na+u*a;this.n41=t*v+x*I+A*q+F*J;this.n42=t*e+x*ba+A*L+F*M;this.n43=t*V+x*S+A*Y+F*Z;this.n44=t*G+x*U+A*na+F*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,h=this.n23,k=this.n24,j=this.n31,m=this.n32,o=this.n33,w=this.n34,u=this.n41,t=this.n42,x=this.n43,A=this.n44;return d*h*m*u-c*k*m*u-d*g*o*u+b*k*o*u+c*g*w*u-b*h*w*u-d*h*j*t+c*k*j*t+d*f*o*t-a*k*o*t-c*f*w*t+a*h*w*t+d*g*j*x-b*k* j*x-d*f*m*x+a*k*m*x+b*f*w*x-a*g*w*x-c*g*j*A+b*h*j*A+c*f*m*A-a*h*m*A-b*f*o*A+a*g*o*A},transpose:function(){function a(b,c,d){var f=b[c];b[c]=b[d];b[d]=f}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34; a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},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]= @@ -59,8 +59,8 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d0){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;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z @@ -83,6 +83,7 @@ THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpd THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a}; THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c=0&&Z>=0&&G>=0&&T>=0)return!0;else if(Y<0&&Z<0||G<0&&T<0)return!1;else{if(Y<0)V=Math.max(V,Y/(Y-Z));else Z<0&&(S=Math.min(S,Y/(Y-Z)));if(G<0)V=Math.max(V,G/(G-T));else T<0&&(S=Math.min(S,G/(G-T)));if(S=0&&Z>=0&&G>=0&&U>=0)return!0;else if(Y<0&&Z<0||G<0&&U<0)return!1;else{if(Y<0)V=Math.max(V,Y/(Y-Z));else Z<0&&(S=Math.min(S,Y/(Y-Z)));if(G<0)V=Math.max(V,G/(G-U));else U<0&&(S=Math.min(S,G/(G-U)));if(SY&&W.zY&&W.z0&&F.z<1){u=x[t]=x[t]||new THREE.RenderableParticle;u.x=F.x/F.w;u.y=F.y/F.w;u.z=F.z;u.rotation=$.rotation.z;u.scale.x=$.scale.x*Math.abs(u.x-(F.x+M.projectionMatrix.n11)/ (F.w+M.projectionMatrix.n14));u.scale.y=$.scale.y*Math.abs(u.y-(F.y+M.projectionMatrix.n22)/(F.w+M.projectionMatrix.n24));u.materials=$.materials;S.push(u);t++}}}}V&&S.sort(a);return S};this.unprojectVector=function(L,M){var V=THREE.Matrix4.makeInvert(M.globalMatrix);V.multiplySelf(THREE.Matrix4.makeInvert(M.projectionMatrix));V.multiplyVector3(L);return L}}; THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,o,w,u,t,x,A;a=b.projectScene(h,k);j=0;for(m=a.length;j0){R.r+=Aa.r*qa;R.g+=Aa.g*qa;R.b+=Aa.b*qa}}else if(qa instanceof THREE.PointLight){D.sub(qa.position,fa);D.normalize(); -qa=ga.dot(D)*Ga;if(qa>0){R.r+=Aa.r*qa;R.g+=Aa.g*qa;R.b+=Aa.b*qa}}}}function Ja(O,fa,ga){if(ga.opacity!=0){a(ga.opacity);b(ga.blending);var R,ea,qa,Aa,Ga,Ha;if(ga instanceof THREE.ParticleBasicMaterial){if(ga.map&&ga.map.image.loaded){Aa=ga.map.image;Ga=Aa.width>>1;Ha=Aa.height>>1;ea=fa.scale.x*k;qa=fa.scale.y*j;ga=ea*Ga;R=qa*Ha;n.set(O.x-ga,O.y-R,O.x+ga,O.y+R);if(B.instersects(n)){m.save();m.translate(O.x,O.y);m.rotate(-fa.rotation);m.scale(ea,-qa);m.translate(-Ga,-Ha);m.drawImage(Aa,0,0);m.restore()}}}else if(ga instanceof -THREE.ParticleCircleMaterial){if(E){I.r=P.r+da.r+y.r;I.g=P.g+da.g+y.g;I.b=P.b+da.b+y.b;S.r=ga.color.r*I.r;S.g=ga.color.g*I.g;S.b=ga.color.b*I.b;S.updateStyleString()}else S.__styleString=ga.color.__styleString;ga=fa.scale.x*k;R=fa.scale.y*j;n.set(O.x-ga,O.y-R,O.x+ga,O.y+R);if(B.instersects(n)){ea=S.__styleString;if(A!=ea)m.fillStyle=A=ea;m.save();m.translate(O.x,O.y);m.rotate(-fa.rotation);m.scale(ga,R);m.beginPath();m.arc(0,0,1,0,C,!0);m.closePath();m.fill();m.restore()}}}}function ca(O,fa,ga,R){if(R.opacity!= -0){a(R.opacity);b(R.blending);m.beginPath();m.moveTo(O.positionScreen.x,O.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(R instanceof THREE.LineBasicMaterial){S.__styleString=R.color.__styleString;O=R.linewidth;if(F!=O)m.lineWidth=F=O;O=S.__styleString;if(x!=O)m.strokeStyle=x=O;m.stroke();n.inflate(R.linewidth*2)}}}function aa(O,fa,ga,R,ea,qa){if(ea.opacity!=0){a(ea.opacity);b(ea.blending);J=O.positionScreen.x;e=O.positionScreen.y;ba=fa.positionScreen.x;L=fa.positionScreen.y; -M=ga.positionScreen.x;V=ga.positionScreen.y;m.beginPath();m.moveTo(J,e);m.lineTo(ba,L);m.lineTo(M,V);m.lineTo(J,e);m.closePath();if(ea instanceof THREE.MeshBasicMaterial)if(ea.map)ea.map.image.loaded&&ea.map.mapping instanceof THREE.UVMapping&&Fa(J,e,ba,L,M,V,ea.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);else if(ea.env_map){if(ea.env_map.image.loaded&&ea.env_map.mapping instanceof THREE.SphericalReflectionMapping){O=N.globalMatrix;D.copy(R.vertexNormalsWorld[0]); -ia=(D.x*O.n11+D.y*O.n12+D.z*O.n13)*0.5+0.5;$=-(D.x*O.n21+D.y*O.n22+D.z*O.n23)*0.5+0.5;D.copy(R.vertexNormalsWorld[1]);ra=(D.x*O.n11+D.y*O.n12+D.z*O.n13)*0.5+0.5;ya=-(D.x*O.n21+D.y*O.n22+D.z*O.n23)*0.5+0.5;D.copy(R.vertexNormalsWorld[2]);l=(D.x*O.n11+D.y*O.n12+D.z*O.n13)*0.5+0.5;z=-(D.x*O.n21+D.y*O.n22+D.z*O.n23)*0.5+0.5;Fa(J,e,ba,L,M,V,ea.env_map.image,ia,$,ra,ya,l,z)}}else ea.wireframe?X(ea.color.__styleString,ea.wireframe_linewidth):ta(ea.color.__styleString);else if(ea instanceof THREE.MeshLambertMaterial){if(ea.map&& -!ea.wireframe){ea.map.mapping instanceof THREE.UVMapping&&Fa(J,e,ba,L,M,V,ea.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);b(THREE.SubtractiveBlending)}if(E)if(!ea.wireframe&&ea.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==3){Y.r=Z.r=G.r=P.r;Y.g=Z.g=G.g=P.g;Y.b=Z.b=G.b=P.b;Ca(qa,R.v1.positionWorld,R.vertexNormalsWorld[0],Y);Ca(qa,R.v2.positionWorld,R.vertexNormalsWorld[1],Z);Ca(qa,R.v3.positionWorld,R.vertexNormalsWorld[2],G);T.r=(Z.r+G.r)*0.5;T.g=(Z.g+ -G.g)*0.5;T.b=(Z.b+G.b)*0.5;ja=Da(Y,Z,G,T);Fa(J,e,ba,L,M,V,ja,0,0,1,0,0,1)}else{I.r=P.r;I.g=P.g;I.b=P.b;Ca(qa,R.centroidWorld,R.normalWorld,I);S.r=ea.color.r*I.r;S.g=ea.color.g*I.g;S.b=ea.color.b*I.b;S.updateStyleString();ea.wireframe?X(S.__styleString,ea.wireframe_linewidth):ta(S.__styleString)}else ea.wireframe?X(ea.color.__styleString,ea.wireframe_linewidth):ta(ea.color.__styleString)}else if(ea instanceof THREE.MeshDepthMaterial){la=N.near;W=N.far;Y.r=Y.g=Y.b=1-K(O.positionScreen.z,la,W);Z.r=Z.g= -Z.b=1-K(fa.positionScreen.z,la,W);G.r=G.g=G.b=1-K(ga.positionScreen.z,la,W);T.r=(Z.r+G.r)*0.5;T.g=(Z.g+G.g)*0.5;T.b=(Z.b+G.b)*0.5;ja=Da(Y,Z,G,T);Fa(J,e,ba,L,M,V,ja,0,0,1,0,0,1)}else if(ea instanceof THREE.MeshNormalMaterial){S.r=Ea(R.normalWorld.x);S.g=Ea(R.normalWorld.y);S.b=Ea(R.normalWorld.z);S.updateStyleString();ea.wireframe?X(S.__styleString,ea.wireframe_linewidth):ta(S.__styleString)}}}function X(O,fa){if(x!=O)m.strokeStyle=x=O;if(F!=fa)m.lineWidth=F=fa;m.stroke();n.inflate(fa*2)}function ta(O){if(A!= -O)m.fillStyle=A=O;m.fill()}function Fa(O,fa,ga,R,ea,qa,Aa,Ga,Ha,La,Ba,Ma,Ta){var Na,Oa;Na=Aa.width-1;Oa=Aa.height-1;Ga*=Na;Ha*=Oa;La*=Na;Ba*=Oa;Ma*=Na;Ta*=Oa;ga-=O;R-=fa;ea-=O;qa-=fa;La-=Ga;Ba-=Ha;Ma-=Ga;Ta-=Ha;Na=La*Ta-Ma*Ba;if(Na!=0){Oa=1/Na;Na=(Ta*ga-Ba*ea)*Oa;Ba=(Ta*R-Ba*qa)*Oa;ga=(La*ea-Ma*ga)*Oa;R=(La*qa-Ma*R)*Oa;O=O-Na*Ga-ga*Ha;fa=fa-Ba*Ga-R*Ha;m.save();m.transform(Na,Ba,ga,R,O,fa);m.clip();m.drawImage(Aa,0,0);m.restore()}}function Da(O,fa,ga,R){var ea=~~(O.r*255),qa=~~(O.g*255);O=~~(O.b*255); -var Aa=~~(fa.r*255),Ga=~~(fa.g*255);fa=~~(fa.b*255);var Ha=~~(ga.r*255),La=~~(ga.g*255);ga=~~(ga.b*255);var Ba=~~(R.r*255),Ma=~~(R.g*255);R=~~(R.b*255);ka[0]=ea<0?0:ea>255?255:ea;ka[1]=qa<0?0:qa>255?255:qa;ka[2]=O<0?0:O>255?255:O;ka[4]=Aa<0?0:Aa>255?255:Aa;ka[5]=Ga<0?0:Ga>255?255:Ga;ka[6]=fa<0?0:fa>255?255:fa;ka[8]=Ha<0?0:Ha>255?255:Ha;ka[9]=La<0?0:La>255?255:La;ka[10]=ga<0?0:ga>255?255:ga;ka[12]=Ba<0?0:Ba>255?255:Ba;ka[13]=Ma<0?0:Ma>255?255:Ma;ka[14]=R<0?0:R>255?255:R;U.putImageData(pa,0,0);na.drawImage(Q, -0,0);return ma}function K(O,fa,ga){O=(O-fa)/(ga-fa);return O*O*(3-2*O)}function Ea(O){O=(O+1)*0.5;return O<0?0:O>1?1:O}function Ra(O,fa){var ga=fa.x-O.x,R=fa.y-O.y,ea=1/Math.sqrt(ga*ga+R*R);ga*=ea;R*=ea;fa.x+=ga;fa.y+=R;O.x-=ga;O.y-=R}var Pa,Ka,ha,wa,ua,xa,za,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(sa,N,this.sortElements);(E=sa.lights.length>0)&&Ia(sa);Pa=0;for(Ka=c.length;Pa0){ra.r+=z.color.r*B;ra.g+=z.color.g*B;ra.b+=z.color.b*B}}else if(z instanceof THREE.PointLight){V.sub(z.position,$.centroidWorld);V.normalize();B=$.normalWorld.dot(V)*z.intensity;if(B>0){ra.r+=z.color.r*B;ra.g+=z.color.g*B;ra.b+=z.color.b*B}}}}function b(ia,$,ra,ya,l,z){G=d(T++);G.setAttribute("d", -"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)q.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(H){J.r=e.r;J.g=e.g;J.b=e.b;a(z,ya,J);q.r=l.color.r*J.r;q.g=l.color.g*J.g;q.b=l.color.b*J.b;q.updateStyleString()}else q.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){M=1-l.__2near/(l.__farPlusNear- +THREE.CanvasRenderer=function(){function a(sa){if(u!=sa)m.globalAlpha=u=sa}function b(sa){if(t!=sa){switch(sa){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}t=sa}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),o=new THREE.Color(0),w=0,u=1,t=0,x=null,A=null,F=1,v,I,q,J,e,ba,L,M,V,S=new THREE.Color, +Y=new THREE.Color,Z=new THREE.Color,G=new THREE.Color,U=new THREE.Color,na,W,ka,ia,$,ra,ya,l,z,C=new THREE.Rectangle,p=new THREE.Rectangle,n=new THREE.Rectangle,B=!1,H=new THREE.Color,N=new THREE.Color,ca=new THREE.Color,y=new THREE.Color,E=Math.PI*2,D=new THREE.Vector3,P,T,oa,la,ja,ma,pa=16;P=document.createElement("canvas");P.width=P.height=2;T=P.getContext("2d");T.fillStyle="rgba(0,0,0,1)";T.fillRect(0,0,2,2);oa=T.getImageData(0,0,2,2);la=oa.data;ja=document.createElement("canvas");ja.width=ja.height= +pa;ma=ja.getContext("2d");ma.translate(-pa/2,-pa/2);ma.scale(pa,pa);pa--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(sa,O){g=sa;h=O;k=g/2;j=h/2;f.width=g;f.height=h;C.set(-k,-j,k,j);u=1;t=0;A=x=null;F=1};this.setClearColor=function(sa,O){o=sa;w=O;p.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(sa,O){o.setHex(sa);w=O;p.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=function(){m.setTransform(1, +0,0,-1,k,j);if(!p.isEmpty()){p.inflate(1);p.minSelf(C);if(o.hex==0&&w==0)m.clearRect(p.getX(),p.getY(),p.getWidth(),p.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+w+")";m.fillRect(p.getX(),p.getY(),p.getWidth(),p.getHeight())}p.empty()}};this.render=function(sa,O){function Ia(Q){var fa,ga,R,ea=Q.lights;N.setRGB(0,0,0);ca.setRGB(0,0,0);y.setRGB(0,0,0);Q=0;for(fa=ea.length;Q0){R.r+=Aa.r*qa;R.g+=Aa.g*qa;R.b+=Aa.b*qa}}else if(qa instanceof THREE.PointLight){D.sub(qa.position,fa);D.normalize(); +qa=ga.dot(D)*Ga;if(qa>0){R.r+=Aa.r*qa;R.g+=Aa.g*qa;R.b+=Aa.b*qa}}}}function Ja(Q,fa,ga){if(ga.opacity!=0){a(ga.opacity);b(ga.blending);var R,ea,qa,Aa,Ga,Ha;if(ga instanceof THREE.ParticleBasicMaterial){if(ga.map&&ga.map.image.loaded){Aa=ga.map.image;Ga=Aa.width>>1;Ha=Aa.height>>1;ea=fa.scale.x*k;qa=fa.scale.y*j;ga=ea*Ga;R=qa*Ha;n.set(Q.x-ga,Q.y-R,Q.x+ga,Q.y+R);if(C.instersects(n)){m.save();m.translate(Q.x,Q.y);m.rotate(-fa.rotation);m.scale(ea,-qa);m.translate(-Ga,-Ha);m.drawImage(Aa,0,0);m.restore()}}}else if(ga instanceof +THREE.ParticleCircleMaterial){if(B){H.r=N.r+ca.r+y.r;H.g=N.g+ca.g+y.g;H.b=N.b+ca.b+y.b;S.r=ga.color.r*H.r;S.g=ga.color.g*H.g;S.b=ga.color.b*H.b;S.updateStyleString()}else S.__styleString=ga.color.__styleString;ga=fa.scale.x*k;R=fa.scale.y*j;n.set(Q.x-ga,Q.y-R,Q.x+ga,Q.y+R);if(C.instersects(n)){ea=S.__styleString;if(A!=ea)m.fillStyle=A=ea;m.save();m.translate(Q.x,Q.y);m.rotate(-fa.rotation);m.scale(ga,R);m.beginPath();m.arc(0,0,1,0,E,!0);m.closePath();m.fill();m.restore()}}}}function da(Q,fa,ga,R){if(R.opacity!= +0){a(R.opacity);b(R.blending);m.beginPath();m.moveTo(Q.positionScreen.x,Q.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(R instanceof THREE.LineBasicMaterial){S.__styleString=R.color.__styleString;Q=R.linewidth;if(F!=Q)m.lineWidth=F=Q;Q=S.__styleString;if(x!=Q)m.strokeStyle=x=Q;m.stroke();n.inflate(R.linewidth*2)}}}function aa(Q,fa,ga,R,ea,qa){if(ea.opacity!=0){a(ea.opacity);b(ea.blending);J=Q.positionScreen.x;e=Q.positionScreen.y;ba=fa.positionScreen.x;L=fa.positionScreen.y; +M=ga.positionScreen.x;V=ga.positionScreen.y;m.beginPath();m.moveTo(J,e);m.lineTo(ba,L);m.lineTo(M,V);m.lineTo(J,e);m.closePath();if(ea instanceof THREE.MeshBasicMaterial)if(ea.map)ea.map.image.loaded&&ea.map.mapping instanceof THREE.UVMapping&&Fa(J,e,ba,L,M,V,ea.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);else if(ea.env_map){if(ea.env_map.image.loaded&&ea.env_map.mapping instanceof THREE.SphericalReflectionMapping){Q=O.globalMatrix;D.copy(R.vertexNormalsWorld[0]); +ia=(D.x*Q.n11+D.y*Q.n12+D.z*Q.n13)*0.5+0.5;$=-(D.x*Q.n21+D.y*Q.n22+D.z*Q.n23)*0.5+0.5;D.copy(R.vertexNormalsWorld[1]);ra=(D.x*Q.n11+D.y*Q.n12+D.z*Q.n13)*0.5+0.5;ya=-(D.x*Q.n21+D.y*Q.n22+D.z*Q.n23)*0.5+0.5;D.copy(R.vertexNormalsWorld[2]);l=(D.x*Q.n11+D.y*Q.n12+D.z*Q.n13)*0.5+0.5;z=-(D.x*Q.n21+D.y*Q.n22+D.z*Q.n23)*0.5+0.5;Fa(J,e,ba,L,M,V,ea.env_map.image,ia,$,ra,ya,l,z)}}else ea.wireframe?X(ea.color.__styleString,ea.wireframe_linewidth):ta(ea.color.__styleString);else if(ea instanceof THREE.MeshLambertMaterial){if(ea.map&& +!ea.wireframe){ea.map.mapping instanceof THREE.UVMapping&&Fa(J,e,ba,L,M,V,ea.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);b(THREE.SubtractiveBlending)}if(B)if(!ea.wireframe&&ea.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==3){Y.r=Z.r=G.r=N.r;Y.g=Z.g=G.g=N.g;Y.b=Z.b=G.b=N.b;Ca(qa,R.v1.positionWorld,R.vertexNormalsWorld[0],Y);Ca(qa,R.v2.positionWorld,R.vertexNormalsWorld[1],Z);Ca(qa,R.v3.positionWorld,R.vertexNormalsWorld[2],G);U.r=(Z.r+G.r)*0.5;U.g=(Z.g+ +G.g)*0.5;U.b=(Z.b+G.b)*0.5;ka=Da(Y,Z,G,U);Fa(J,e,ba,L,M,V,ka,0,0,1,0,0,1)}else{H.r=N.r;H.g=N.g;H.b=N.b;Ca(qa,R.centroidWorld,R.normalWorld,H);S.r=ea.color.r*H.r;S.g=ea.color.g*H.g;S.b=ea.color.b*H.b;S.updateStyleString();ea.wireframe?X(S.__styleString,ea.wireframe_linewidth):ta(S.__styleString)}else ea.wireframe?X(ea.color.__styleString,ea.wireframe_linewidth):ta(ea.color.__styleString)}else if(ea instanceof THREE.MeshDepthMaterial){na=O.near;W=O.far;Y.r=Y.g=Y.b=1-K(Q.positionScreen.z,na,W);Z.r=Z.g= +Z.b=1-K(fa.positionScreen.z,na,W);G.r=G.g=G.b=1-K(ga.positionScreen.z,na,W);U.r=(Z.r+G.r)*0.5;U.g=(Z.g+G.g)*0.5;U.b=(Z.b+G.b)*0.5;ka=Da(Y,Z,G,U);Fa(J,e,ba,L,M,V,ka,0,0,1,0,0,1)}else if(ea instanceof THREE.MeshNormalMaterial){S.r=Ea(R.normalWorld.x);S.g=Ea(R.normalWorld.y);S.b=Ea(R.normalWorld.z);S.updateStyleString();ea.wireframe?X(S.__styleString,ea.wireframe_linewidth):ta(S.__styleString)}}}function X(Q,fa){if(x!=Q)m.strokeStyle=x=Q;if(F!=fa)m.lineWidth=F=fa;m.stroke();n.inflate(fa*2)}function ta(Q){if(A!= +Q)m.fillStyle=A=Q;m.fill()}function Fa(Q,fa,ga,R,ea,qa,Aa,Ga,Ha,La,Ba,Ma,Ta){var Na,Oa;Na=Aa.width-1;Oa=Aa.height-1;Ga*=Na;Ha*=Oa;La*=Na;Ba*=Oa;Ma*=Na;Ta*=Oa;ga-=Q;R-=fa;ea-=Q;qa-=fa;La-=Ga;Ba-=Ha;Ma-=Ga;Ta-=Ha;Na=La*Ta-Ma*Ba;if(Na!=0){Oa=1/Na;Na=(Ta*ga-Ba*ea)*Oa;Ba=(Ta*R-Ba*qa)*Oa;ga=(La*ea-Ma*ga)*Oa;R=(La*qa-Ma*R)*Oa;Q=Q-Na*Ga-ga*Ha;fa=fa-Ba*Ga-R*Ha;m.save();m.transform(Na,Ba,ga,R,Q,fa);m.clip();m.drawImage(Aa,0,0);m.restore()}}function Da(Q,fa,ga,R){var ea=~~(Q.r*255),qa=~~(Q.g*255);Q=~~(Q.b*255); +var Aa=~~(fa.r*255),Ga=~~(fa.g*255);fa=~~(fa.b*255);var Ha=~~(ga.r*255),La=~~(ga.g*255);ga=~~(ga.b*255);var Ba=~~(R.r*255),Ma=~~(R.g*255);R=~~(R.b*255);la[0]=ea<0?0:ea>255?255:ea;la[1]=qa<0?0:qa>255?255:qa;la[2]=Q<0?0:Q>255?255:Q;la[4]=Aa<0?0:Aa>255?255:Aa;la[5]=Ga<0?0:Ga>255?255:Ga;la[6]=fa<0?0:fa>255?255:fa;la[8]=Ha<0?0:Ha>255?255:Ha;la[9]=La<0?0:La>255?255:La;la[10]=ga<0?0:ga>255?255:ga;la[12]=Ba<0?0:Ba>255?255:Ba;la[13]=Ma<0?0:Ma>255?255:Ma;la[14]=R<0?0:R>255?255:R;T.putImageData(oa,0,0);ma.drawImage(P, +0,0);return ja}function K(Q,fa,ga){Q=(Q-fa)/(ga-fa);return Q*Q*(3-2*Q)}function Ea(Q){Q=(Q+1)*0.5;return Q<0?0:Q>1?1:Q}function Ra(Q,fa){var ga=fa.x-Q.x,R=fa.y-Q.y,ea=1/Math.sqrt(ga*ga+R*R);ga*=ea;R*=ea;fa.x+=ga;fa.y+=R;Q.x-=ga;Q.y-=R}var Pa,Ka,ha,wa,ua,xa,za,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(sa,O,this.sortElements);(B=sa.lights.length>0)&&Ia(sa);Pa=0;for(Ka=c.length;Pa0){ra.r+=z.color.r*C;ra.g+=z.color.g*C;ra.b+=z.color.b*C}}else if(z instanceof THREE.PointLight){V.sub(z.position,$.centroidWorld);V.normalize();C=$.normalWorld.dot(V)*z.intensity;if(C>0){ra.r+=z.color.r*C;ra.g+=z.color.g*C;ra.b+=z.color.b*C}}}}function b(ia,$,ra,ya,l,z){G=d(U++);G.setAttribute("d", +"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)q.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(I){J.r=e.r;J.g=e.g;J.b=e.b;a(z,ya,J);q.r=l.color.r*J.r;q.g=l.color.g*J.g;q.b=l.color.b*J.b;q.updateStyleString()}else q.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){M=1-l.__2near/(l.__farPlusNear- ya.z*l.__farMinusNear);q.setRGB(M,M,M)}else l instanceof THREE.MeshNormalMaterial&&q.setRGB(f(ya.normalWorld.x),f(ya.normalWorld.y),f(ya.normalWorld.z));l.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+l.wireframe_linewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframe_linecap+"; stroke-linejoin: "+l.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(G)}function c(ia,$,ra,ya, -l,z,B){G=d(T++);G.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+ya.positionScreen.x+","+ya.positionScreen.y+"z");if(z instanceof THREE.MeshBasicMaterial)q.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshLambertMaterial)if(H){J.r=e.r;J.g=e.g;J.b=e.b;a(B,l,J);q.r=z.color.r*J.r;q.g=z.color.g*J.g;q.b=z.color.b*J.b;q.updateStyleString()}else q.__styleString=z.color.__styleString; +l,z,C){G=d(U++);G.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+ya.positionScreen.x+","+ya.positionScreen.y+"z");if(z instanceof THREE.MeshBasicMaterial)q.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshLambertMaterial)if(I){J.r=e.r;J.g=e.g;J.b=e.b;a(C,l,J);q.r=z.color.r*J.r;q.g=z.color.g*J.g;q.b=z.color.b*J.b;q.updateStyleString()}else q.__styleString=z.color.__styleString; else if(z instanceof THREE.MeshDepthMaterial){M=1-z.__2near/(z.__farPlusNear-l.z*z.__farMinusNear);q.setRGB(M,M,M)}else z instanceof THREE.MeshNormalMaterial&&q.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));z.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+z.wireframe_linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframe_linecap+"; stroke-linejoin: "+z.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+ -"; fill-opacity: "+z.opacity);k.appendChild(G)}function d(ia){if(S[ia]==null){S[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&S[ia].setAttribute("shape-rendering","crispEdges")}return S[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,o,w,u,t,x,A,F=new THREE.Rectangle,v=new THREE.Rectangle,H=!1,q=new THREE.Color(16777215),J=new THREE.Color(16777215), -e=new THREE.Color(0),ba=new THREE.Color(0),L=new THREE.Color(0),M,V=new THREE.Vector3,S=[],Y=[],Z=[],G,T,la,W,ja=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ia,$){j=ia;m=$;o=j/2;w=m/2;k.setAttribute("viewBox",-o+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);F.set(-o,-w,o,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])}; -this.render=function(ia,$){var ra,ya,l,z,B,p,n,E;this.autoClear&&this.clear();g=h.projectScene(ia,$,this.sortElements);W=la=T=0;if(H=ia.lights.length>0){n=ia.lights;e.setRGB(0,0,0);ba.setRGB(0,0,0);L.setRGB(0,0,0);ra=0;for(ya=n.length;ra=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer); +"; fill-opacity: "+z.opacity);k.appendChild(G)}function d(ia){if(S[ia]==null){S[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");ka==0&&S[ia].setAttribute("shape-rendering","crispEdges")}return S[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,o,w,u,t,x,A,F=new THREE.Rectangle,v=new THREE.Rectangle,I=!1,q=new THREE.Color(16777215),J=new THREE.Color(16777215), +e=new THREE.Color(0),ba=new THREE.Color(0),L=new THREE.Color(0),M,V=new THREE.Vector3,S=[],Y=[],Z=[],G,U,na,W,ka=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":ka=1;break;case "low":ka=0}};this.setSize=function(ia,$){j=ia;m=$;o=j/2;w=m/2;k.setAttribute("viewBox",-o+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);F.set(-o,-w,o,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])}; +this.render=function(ia,$){var ra,ya,l,z,C,p,n,B;this.autoClear&&this.clear();g=h.projectScene(ia,$,this.sortElements);W=na=U=0;if(I=ia.lights.length>0){n=ia.lights;e.setRGB(0,0,0);ba.setRGB(0,0,0);L.setRGB(0,0,0);ra=0;for(ya=n.length;ra=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer); e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(n.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(n.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER, n.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);if(p.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex, -4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0)}if(E instanceof THREE.Mesh)if(p.wireframe){e.lineWidth(p.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);e.drawElements(e.LINES,n.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,n.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip? -e.LINE_STRIP:e.LINES;e.lineWidth(p.linewidth);e.drawArrays(E,0,n.__webGLLineCount)}else E instanceof THREE.ParticleSystem&&e.drawArrays(e.POINTS,0,n.__webGLParticleCount)}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.position);e.vertexAttribPointer(z.attributes.position, -3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.normal);e.vertexAttribPointer(z.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(V!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);V=l.doubleSided}if(S!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);S=l.flipSided}}function k(l){if(Z!= -l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Z=l}}function j(l){G[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);G[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);G[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);G[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);G[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);G[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<5;l++){z=G[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}} -function m(l){for(var z=l.globalMatrix,B=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),p=0;p<6;p++){l=G[p].x*z.n14+G[p].y*z.n24+G[p].z*z.n34+G[p].w;if(l<=B)return!1}return!0}function o(l,z){l.list[l.count]=z;l.count+=1}function w(l){var z,B,p=l.object,n=l.opaque,E=l.transparent;E.count=0;l=n.count=0;for(z=p.materials.length;l0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP": -"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"",E.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); -e.attachShader(B,H("fragment",n+da));e.attachShader(B,H("vertex",E+z));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};l.program=B;B=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(p in l.uniforms)B.push(p);p=l.program;da=0;for(z=B.length;da< -z;da++){n=B[da];p.uniforms[n]=e.getUniformLocation(p,n)}p=l.program;B=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];da=0;for(z=B.length;da=0&&e.enableVertexAttribArray(p.color);p.normal>=0&&e.enableVertexAttribArray(p.normal);p.tangent>=0&&e.enableVertexAttribArray(p.tangent);if(l.skinning&&p.skinVertexA>=0&&p.skinVertexB>= -0&&p.skinIndex>=0&&p.skinWeight>=0){e.enableVertexAttribArray(p.skinVertexA);e.enableVertexAttribArray(p.skinVertexB);e.enableVertexAttribArray(p.skinIndex);e.enableVertexAttribArray(p.skinWeight)}};this.render=function(l,z,B,p){var n,E,I,P,da,y,C,D,Q=l.lights,U=l.fog;z.autoUpdateMatrix&&z.update();z.globalMatrix.flattenToArray(ja);z.projectionMatrix.flattenToArray(la);z.inverseMatrix.flattenToArray(W);T.multiply(z.projectionMatrix,z.globalMatrix);j(T);THREE.AnimationHandler&&THREE.AnimationHandler.update(); -l.update(undefined,!1,z);this.initWebGLObjects(l,z);v(B,p!==undefined?p:!0);this.autoClear&&this.clear();da=l.__webGLObjects.length;for(p=0;p0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,U)}if(Aa&&ka>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Pa,U)}if(qa){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,O,U);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer); -e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa,U)}if(K>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ua,U);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,xa,U);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,za,U);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,va,U)}}x(objlist,da,E,P,p)}I.__dirtyVertices=!1;I.__dirtyElements=!1;I.__dirtyUvs=!1;I.__dirtyNormals= -!1;I.__dirtyTangents=!1;I.__dirtyColors=!1}else if(p instanceof THREE.Line){if(!I.__webGLVertexBuffer){E=I;E.__webGLVertexBuffer=e.createBuffer();E.__webGLColorBuffer=e.createBuffer();E=I;P=E.vertices.length;E.__vertexArray=new Float32Array(P*3);E.__colorArray=new Float32Array(P*3);E.__webGLLineCount=P;I.__dirtyVertices=!0;I.__dirtyColors=!0}if(I.__dirtyVertices||I.__dirtyColors){E=I;P=e.DYNAMIC_DRAW;D=void 0;D=void 0;y=void 0;n=void 0;Q=E.vertices;U=E.colors;ka=Q.length;pa=U.length;ma=E.__vertexArray; -C=E.__colorArray;na=E.__dirtyColors;if(E.__dirtyVertices){for(D=0;D=0;B--){p=l.__webGLObjects[B].object;z==p&&l.__webGLObjects.splice(B,1)}};this.setFaceCulling=function(l,z){if(l){!z||z=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)> -0}}; -THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", -envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", -map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif", -lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", +4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0)}if(B instanceof THREE.Mesh)if(p.wireframe){e.lineWidth(p.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);e.drawElements(e.LINES,n.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,n.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(B instanceof THREE.Line){B=B.type==THREE.LineStrip? +e.LINE_STRIP:e.LINES;e.lineWidth(p.linewidth);e.drawArrays(B,0,n.__webGLLineCount)}else if(B instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,n.__webGLParticleCount);else B instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,n.__webGLVertexCount)}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray, +e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.position);e.vertexAttribPointer(z.attributes.position,3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.normal);e.vertexAttribPointer(z.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(V!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);V= +l.doubleSided}if(S!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);S=l.flipSided}}function k(l){if(Z!=l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Z=l}}function j(l){G[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);G[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);G[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);G[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);G[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);G[5].set(l.n41+l.n31,l.n42+ +l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<5;l++){z=G[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function m(l){for(var z=l.globalMatrix,C=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),p=0;p<6;p++){l=G[p].x*z.n14+G[p].y*z.n24+G[p].z*z.n34+G[p].w;if(l<=C)return!1}return!0}function o(l,z){l.list[l.count]=z;l.count+=1}function w(l){var z,C,p=l.object,n=l.opaque,B=l.transparent;B.count=0;l=n.count=0;for(z=p.materials.length;l0?"#define VERTEX_TEXTURES": +"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.map?"#define USE_MAP":"",B.env_map?"#define USE_ENVMAP":"",B.light_map?"#define USE_LIGHTMAP":"",B.vertex_colors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); +e.attachShader(C,I("fragment",n+ca));e.attachShader(C,I("vertex",B+z));e.linkProgram(C);e.getProgramParameter(C,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(C,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");C.uniforms={};C.attributes={};l.program=C;C=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(p in l.uniforms)C.push(p);p=l.program;ca=0;for(z=C.length;ca< +z;ca++){n=C[ca];p.uniforms[n]=e.getUniformLocation(p,n)}p=l.program;C=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];ca=0;for(z=C.length;ca=0&&e.enableVertexAttribArray(p.color);p.normal>=0&&e.enableVertexAttribArray(p.normal);p.tangent>=0&&e.enableVertexAttribArray(p.tangent);if(l.skinning&&p.skinVertexA>=0&&p.skinVertexB>= +0&&p.skinIndex>=0&&p.skinWeight>=0){e.enableVertexAttribArray(p.skinVertexA);e.enableVertexAttribArray(p.skinVertexB);e.enableVertexAttribArray(p.skinIndex);e.enableVertexAttribArray(p.skinWeight)}};this.render=function(l,z,C,p){var n,B,H,N,ca,y,E,D,P=l.lights,T=l.fog;z.autoUpdateMatrix&&z.update();z.globalMatrix.flattenToArray(ka);z.projectionMatrix.flattenToArray(na);z.inverseMatrix.flattenToArray(W);U.multiply(z.projectionMatrix,z.globalMatrix);j(U);THREE.AnimationHandler&&THREE.AnimationHandler.update(); +l.update(undefined,!1,z);this.initWebGLObjects(l,z);v(C,p!==undefined?p:!0);this.autoClear&&this.clear();ca=l.__webGLObjects.length;for(p=0;p0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,T)}if(Aa&&la>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Pa,T)}if(qa){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Q,T);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer); +e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa,T)}if(K>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ua,T);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,xa,T);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,za,T);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,va,T)}}x(objlist,ca,B,N,p)}H.__dirtyVertices=!1;H.__dirtyElements=!1;H.__dirtyUvs=!1;H.__dirtyNormals= +!1;H.__dirtyTangents=!1;H.__dirtyColors=!1}else if(p instanceof THREE.Ribbon){if(!H.__webGLVertexBuffer){B=H;B.__webGLVertexBuffer=e.createBuffer();B.__webGLColorBuffer=e.createBuffer();B=H;N=B.vertices.length;B.__vertexArray=new Float32Array(N*3);B.__colorArray=new Float32Array(N*3);B.__webGLVertexCount=N;H.__dirtyVertices=!0;H.__dirtyColors=!0}if(H.__dirtyVertices||H.__dirtyColors){B=H;N=e.DYNAMIC_DRAW;D=void 0;D=void 0;y=void 0;n=void 0;P=B.vertices;T=B.colors;la=P.length;oa=T.length;ja=B.__vertexArray; +E=B.__colorArray;ma=B.__dirtyColors;if(B.__dirtyVertices){for(D=0;D=0;C--){p=l.__webGLObjects[C].object;z==p&&l.__webGLObjects.splice(C,1)}};this.setFaceCulling=function(l,z){if(l){!z||z=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", +envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", +envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", +map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif", +lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 uBoneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( uBoneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( uBoneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"}; @@ -278,13 +281,13 @@ c;c=d.style;c.fontFamily="monospace";c.fontSize="13px";c.textAlign="center";c.ba var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.autoUpdateMatrix&&b.updateMatrix();for(var o=0,w=h.length;o25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b=this.maxCount-3&&k(this)};this.begin= function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;dthis.size-1&&(j=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k); -k>this.size-1&&(k=this.size-1);for(var x,A,F,v,H,q;w0&&(this.field[F+x]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,o=this.yd,w=this.zd,u=this.field,t=m*Math.sqrt(c/d);t>m&&(t=m);for(f=0;f0)for(g=0;gthis.size-1&&(k=this.size-1);for(var x,A,F,v,I,q;w0&&(this.field[F+x]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,o=this.yd,w=this.zd,u=this.field,t=m*Math.sqrt(c/d);t>m&&(t=m);for(f=0;f0)for(g=0;go&&(x=o);for(g=0;g0){j=g*w;for(f=0;fsize&&(dist=size);for(h=0;h0){j=zd*h;for(g=0;g>7)-127;D|=(U&127)<<16|Q<<8;if(D==0&&ka==-127)return 0;return(1-2*(pa>>7))*(1+D*Math.pow(2,-23))*Math.pow(2,ka)}function k(y,C){var D=o(y,C),Q=o(y,C+1),U=o(y,C+2);return(o(y,C+3)<<24)+(U<<16)+(Q<<8)+D}function j(y,C){var D=o(y,C);return(o(y,C+1)<<8)+D}function m(y,C){var D=o(y,C);return D>127?D-256:D}function o(y,C){return y.charCodeAt(C)&255}function w(y){var C,D,Q;C= -k(a,y);D=k(a,y+ba);Q=k(a,y+L);y=j(a,y+M);THREE.Loader.prototype.f3(v,C,D,Q,y)}function u(y){var C,D,Q,U,pa,ka;C=k(a,y);D=k(a,y+ba);Q=k(a,y+L);U=j(a,y+M);pa=k(a,y+V);ka=k(a,y+S);y=k(a,y+Y);THREE.Loader.prototype.f3n(v,J,C,D,Q,U,pa,ka,y)}function t(y){var C,D,Q,U;C=k(a,y);D=k(a,y+Z);Q=k(a,y+G);U=k(a,y+T);y=j(a,y+la);THREE.Loader.prototype.f4(v,C,D,Q,U,y)}function x(y){var C,D,Q,U,pa,ka,ma,na;C=k(a,y);D=k(a,y+Z);Q=k(a,y+G);U=k(a,y+T);pa=j(a,y+la);ka=k(a,y+W);ma=k(a,y+ja);na=k(a,y+ia);y=k(a,y+$);THREE.Loader.prototype.f4n(v, -J,C,D,Q,U,pa,ka,ma,na,y)}function A(y){var C,D;C=k(a,y);D=k(a,y+ra);y=k(a,y+ya);THREE.Loader.prototype.uv3(v.uvs,e[C*2],e[C*2+1],e[D*2],e[D*2+1],e[y*2],e[y*2+1])}function F(y){var C,D,Q;C=k(a,y);D=k(a,y+l);Q=k(a,y+z);y=k(a,y+B);THREE.Loader.prototype.uv4(v.uvs,e[C*2],e[C*2+1],e[D*2],e[D*2+1],e[Q*2],e[Q*2+1],e[y*2],e[y*2+1])}var v=this,H=0,q,J=[],e=[],ba,L,M,V,S,Y,Z,G,T,la,W,ja,ia,$,ra,ya,l,z,B,p,n,E,I,P,da;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);q={signature:a.substr(H, -8),header_bytes:o(a,H+8),vertex_coordinate_bytes:o(a,H+9),normal_coordinate_bytes:o(a,H+10),uv_coordinate_bytes:o(a,H+11),vertex_index_bytes:o(a,H+12),normal_index_bytes:o(a,H+13),uv_index_bytes:o(a,H+14),material_index_bytes:o(a,H+15),nvertices:k(a,H+16),nnormals:k(a,H+16+4),nuvs:k(a,H+16+8),ntri_flat:k(a,H+16+12),ntri_smooth:k(a,H+16+16),ntri_flat_uv:k(a,H+16+20),ntri_smooth_uv:k(a,H+16+24),nquad_flat:k(a,H+16+28),nquad_smooth:k(a,H+16+32),nquad_flat_uv:k(a,H+16+36),nquad_smooth_uv:k(a,H+16+40)}; -H+=q.header_bytes;ba=q.vertex_index_bytes;L=q.vertex_index_bytes*2;M=q.vertex_index_bytes*3;V=q.vertex_index_bytes*3+q.material_index_bytes;S=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;Y=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;Z=q.vertex_index_bytes;G=q.vertex_index_bytes*2;T=q.vertex_index_bytes*3;la=q.vertex_index_bytes*4;W=q.vertex_index_bytes*4+q.material_index_bytes;ja=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ia=q.vertex_index_bytes* -4+q.material_index_bytes+q.normal_index_bytes*2;$=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;ra=q.uv_index_bytes;ya=q.uv_index_bytes*2;l=q.uv_index_bytes;z=q.uv_index_bytes*2;B=q.uv_index_bytes*3;g=q.vertex_index_bytes*3+q.material_index_bytes;da=q.vertex_index_bytes*4+q.material_index_bytes;p=q.ntri_flat*g;n=q.ntri_smooth*(g+q.normal_index_bytes*3);E=q.ntri_flat_uv*(g+q.uv_index_bytes*3);I=q.ntri_smooth_uv*(g+q.normal_index_bytes*3+q.uv_index_bytes*3);P=q.nquad_flat*da; -g=q.nquad_smooth*(da+q.normal_index_bytes*4);da=q.nquad_flat_uv*(da+q.uv_index_bytes*4);H+=function(y){for(var C,D,Q,U=q.vertex_coordinate_bytes*3,pa=y+q.nvertices*U;y>7)-127;D|=(T&127)<<16|P<<8;if(D==0&&la==-127)return 0;return(1-2*(oa>>7))*(1+D*Math.pow(2,-23))*Math.pow(2,la)}function k(y,E){var D=o(y,E),P=o(y,E+1),T=o(y,E+2);return(o(y,E+3)<<24)+(T<<16)+(P<<8)+D}function j(y,E){var D=o(y,E);return(o(y,E+1)<<8)+D}function m(y,E){var D=o(y,E);return D>127?D-256:D}function o(y,E){return y.charCodeAt(E)&255}function w(y){var E,D,P;E= +k(a,y);D=k(a,y+ba);P=k(a,y+L);y=j(a,y+M);THREE.Loader.prototype.f3(v,E,D,P,y)}function u(y){var E,D,P,T,oa,la;E=k(a,y);D=k(a,y+ba);P=k(a,y+L);T=j(a,y+M);oa=k(a,y+V);la=k(a,y+S);y=k(a,y+Y);THREE.Loader.prototype.f3n(v,J,E,D,P,T,oa,la,y)}function t(y){var E,D,P,T;E=k(a,y);D=k(a,y+Z);P=k(a,y+G);T=k(a,y+U);y=j(a,y+na);THREE.Loader.prototype.f4(v,E,D,P,T,y)}function x(y){var E,D,P,T,oa,la,ja,ma;E=k(a,y);D=k(a,y+Z);P=k(a,y+G);T=k(a,y+U);oa=j(a,y+na);la=k(a,y+W);ja=k(a,y+ka);ma=k(a,y+ia);y=k(a,y+$);THREE.Loader.prototype.f4n(v, +J,E,D,P,T,oa,la,ja,ma,y)}function A(y){var E,D;E=k(a,y);D=k(a,y+ra);y=k(a,y+ya);THREE.Loader.prototype.uv3(v.uvs,e[E*2],e[E*2+1],e[D*2],e[D*2+1],e[y*2],e[y*2+1])}function F(y){var E,D,P;E=k(a,y);D=k(a,y+l);P=k(a,y+z);y=k(a,y+C);THREE.Loader.prototype.uv4(v.uvs,e[E*2],e[E*2+1],e[D*2],e[D*2+1],e[P*2],e[P*2+1],e[y*2],e[y*2+1])}var v=this,I=0,q,J=[],e=[],ba,L,M,V,S,Y,Z,G,U,na,W,ka,ia,$,ra,ya,l,z,C,p,n,B,H,N,ca;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);q={signature:a.substr(I, +8),header_bytes:o(a,I+8),vertex_coordinate_bytes:o(a,I+9),normal_coordinate_bytes:o(a,I+10),uv_coordinate_bytes:o(a,I+11),vertex_index_bytes:o(a,I+12),normal_index_bytes:o(a,I+13),uv_index_bytes:o(a,I+14),material_index_bytes:o(a,I+15),nvertices:k(a,I+16),nnormals:k(a,I+16+4),nuvs:k(a,I+16+8),ntri_flat:k(a,I+16+12),ntri_smooth:k(a,I+16+16),ntri_flat_uv:k(a,I+16+20),ntri_smooth_uv:k(a,I+16+24),nquad_flat:k(a,I+16+28),nquad_smooth:k(a,I+16+32),nquad_flat_uv:k(a,I+16+36),nquad_smooth_uv:k(a,I+16+40)}; +I+=q.header_bytes;ba=q.vertex_index_bytes;L=q.vertex_index_bytes*2;M=q.vertex_index_bytes*3;V=q.vertex_index_bytes*3+q.material_index_bytes;S=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;Y=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;Z=q.vertex_index_bytes;G=q.vertex_index_bytes*2;U=q.vertex_index_bytes*3;na=q.vertex_index_bytes*4;W=q.vertex_index_bytes*4+q.material_index_bytes;ka=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ia=q.vertex_index_bytes* +4+q.material_index_bytes+q.normal_index_bytes*2;$=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;ra=q.uv_index_bytes;ya=q.uv_index_bytes*2;l=q.uv_index_bytes;z=q.uv_index_bytes*2;C=q.uv_index_bytes*3;g=q.vertex_index_bytes*3+q.material_index_bytes;ca=q.vertex_index_bytes*4+q.material_index_bytes;p=q.ntri_flat*g;n=q.ntri_smooth*(g+q.normal_index_bytes*3);B=q.ntri_flat_uv*(g+q.uv_index_bytes*3);H=q.ntri_smooth_uv*(g+q.normal_index_bytes*3+q.uv_index_bytes*3);N=q.nquad_flat*ca; +g=q.nquad_smooth*(ca+q.normal_index_bytes*4);ca=q.nquad_flat_uv*(ca+q.uv_index_bytes*4);I+=function(y){for(var E,D,P,T=q.vertex_coordinate_bytes*3,oa=y+q.nvertices*T;y + + + three.js - ribbons - webgl + + + + + +
+ three.js - webgl ribbons example +
+ + + + + + + diff --git a/examples/uqbiquity_test.html b/examples/uqbiquity_test.html index bf06438a1b..f32ca3ae15 100644 --- a/examples/uqbiquity_test.html +++ b/examples/uqbiquity_test.html @@ -39,6 +39,7 @@ + diff --git a/src/objects/Object3D.js b/src/objects/Object3D.js index 4e64567834..b4ed96a508 100644 --- a/src/objects/Object3D.js +++ b/src/objects/Object3D.js @@ -132,7 +132,7 @@ THREE.Object3D.prototype.addChild = function( child ) { if( child.parent !== undefined ) child.parent.removeChild( child ); - child.parent = this; + child.parent = this; this.children.push( child ); } diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index d9a4dbdd27..90c8e6f2b7 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -205,6 +205,13 @@ THREE.WebGLRenderer = function ( parameters ) { }; + function createRibbonBuffers ( geometry ) { + + geometry.__webGLVertexBuffer = _gl.createBuffer(); + geometry.__webGLColorBuffer = _gl.createBuffer(); + + }; + function createMeshBuffers ( geometryChunk ) { geometryChunk.__webGLVertexBuffer = _gl.createBuffer(); @@ -235,6 +242,17 @@ THREE.WebGLRenderer = function ( parameters ) { }; + function initRibbonBuffers ( geometry ) { + + var nvertices = geometry.vertices.length; + + geometry.__vertexArray = new Float32Array( nvertices * 3 ); + geometry.__colorArray = new Float32Array( nvertices * 3 ); + + geometry.__webGLVertexCount = nvertices; + + }; + function initParticleBuffers ( geometry ) { var nvertices = geometry.vertices.length; @@ -1039,6 +1057,60 @@ THREE.WebGLRenderer = function ( parameters ) { }; + function setRibbonBuffers ( geometry, hint ) { + + var v, c, vertex, offset, + vertices = geometry.vertices, + colors = geometry.colors, + vl = vertices.length, + cl = colors.length, + + vertexArray = geometry.__vertexArray, + colorArray = geometry.__colorArray, + + dirtyVertices = geometry.__dirtyVertices, + dirtyColors = geometry.__dirtyColors; + + if ( dirtyVertices ) { + + for ( v = 0; v < vl; v++ ) { + + vertex = vertices[ v ].position; + + offset = v * 3; + + vertexArray[ offset ] = vertex.x; + vertexArray[ offset + 1 ] = vertex.y; + vertexArray[ offset + 2 ] = vertex.z; + + } + + _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webGLVertexBuffer ); + _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); + + } + + if ( dirtyColors ) { + + for ( c = 0; c < cl; c++ ) { + + color = colors[ c ]; + + offset = c * 3; + + colorArray[ offset ] = color.r; + colorArray[ offset + 1 ] = color.g; + colorArray[ offset + 2 ] = color.b; + + } + + _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webGLColorBuffer ); + _gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint ); + + } + + }; + function setParticleBuffers ( geometry, hint, object, camera ) { var v, c, vertex, offset, @@ -1377,8 +1449,8 @@ THREE.WebGLRenderer = function ( parameters ) { } else if ( material instanceof THREE.MeshDepthMaterial ) { - m_uniforms.mNear.value = camera.near; - m_uniforms.mFar.value = camera.far; + m_uniforms.mNear.value = camera.zNear; + m_uniforms.mFar.value = camera.zFar; m_uniforms.opacity.value = material.opacity; } else if ( material instanceof THREE.MeshNormalMaterial ) { @@ -1560,6 +1632,12 @@ THREE.WebGLRenderer = function ( parameters ) { _gl.drawArrays( _gl.POINTS, 0, geometryChunk.__webGLParticleCount ); + // render ribbon + + } else if ( object instanceof THREE.Ribbon ) { + + _gl.drawArrays( _gl.TRIANGLE_STRIP, 0, geometryChunk.__webGLVertexCount ); + } }; @@ -2066,6 +2144,29 @@ THREE.WebGLRenderer = function ( parameters ) { geometry.__dirtyTangents = false; geometry.__dirtyColors = false; + } else if ( object instanceof THREE.Ribbon ) { + + if( ! geometry.__webGLVertexBuffer ) { + + createRibbonBuffers( geometry ); + initRibbonBuffers( geometry ); + + geometry.__dirtyVertices = true; + geometry.__dirtyColors = true; + + } + + if( geometry.__dirtyVertices || geometry.__dirtyColors ) { + + setRibbonBuffers( geometry, _gl.DYNAMIC_DRAW ); + + } + + add_buffer( objlist, objmap, 0, geometry, object ); + + geometry.__dirtyVertices = false; + geometry.__dirtyColors = false; + } else if ( object instanceof THREE.Line ) { if( ! geometry.__webGLVertexBuffer ) { diff --git a/utils/build.py b/utils/build.py index 1a63e4cc7a..5e4c8f1da0 100644 --- a/utils/build.py +++ b/utils/build.py @@ -34,6 +34,7 @@ COMMON_FILES = [ 'objects/Mesh.js', 'objects/Bone.js', 'objects/SkinnedMesh.js', +'objects/Ribbon.js', 'animation/AnimationHandler.js', 'animation/Animation.js', 'cameras/Camera.js', -- GitLab