From 9eb852db1328877292613c01b14d174edbbf0df6 Mon Sep 17 00:00:00 2001 From: alteredq Date: Fri, 28 Oct 2011 18:49:04 +0200 Subject: [PATCH] Fixed bug in custom attributes setting for face-bound attributes. Zombies now look correct. Though still getting undebuggable random crashes in Chrome with ro.me animals demo :S --- build/Three.js | 414 ++++++++++++++++----------------- build/custom/ThreeWebGL.js | 208 ++++++++--------- src/renderers/WebGLRenderer.js | 25 +- 3 files changed, 319 insertions(+), 328 deletions(-) diff --git a/build/Three.js b/build/Three.js index c7d4bac3..225bc105 100644 --- a/build/Three.js +++ b/build/Three.js @@ -16,8 +16,8 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,d){this.x= c.z;this.w=a.w-c.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){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,d=[];c=0;for(b=a.length;c=0&&n>=0&&o+n<1}for(var d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Vector3,f,h,i,k,l,m,o,n,s,p=[],u=0,v=a.children.length;ua.scale.x)return[];s={distance:u,point:a.position, -face:null,object:a};p.push(s)}else if(a instanceof THREE.Mesh){u=c(this.origin,this.direction,a.matrixWorld.getPosition());if(u===null||u>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var y,q,t,w,z,L,J,I,D=a.geometry,C=D.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);u=0;for(v=D.faces.length;u=0&&n>=0&&o+n<1}for(var d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Vector3,f,h,i,k,l,m,o,n,s,p=[],v=0,u=a.children.length;va.scale.x)return[];s={distance:v,point:a.position, +face:null,object:a};p.push(s)}else if(a instanceof THREE.Mesh){v=c(this.origin,this.direction,a.matrixWorld.getPosition());if(v===null||v>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var y,q,t,w,z,L,J,I,D=a.geometry,C=D.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);v=0;for(u=D.faces.length;v0:L<0)))if(L=z.dot((new THREE.Vector3).sub(y,J))/L,J=J.addSelf(I.multiplyScalar(L)),s instanceof THREE.Face3)b(J,y,q,t)&&(s={distance:this.origin.distanceTo(J),point:J,face:s,object:a}, p.push(s));else if(s instanceof THREE.Face4&&(b(J,y,q,w)||b(J,q,t,w)))s={distance:this.origin.distanceTo(J),point:J,face:s,object:a},p.push(s)}return p}}; THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,l,m){h=!1;c=e;b=f;d=l;g=m;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=ce?d:e,g=g>f?g:f);a()};this.add3Points= @@ -27,19 +27,19 @@ THREE.Math={clamp:function(a,c,b){return ab?b:a},clampBottom:function(a,c THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}}; THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,k,l,m,o,n,s,p){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,k||0,l!==void 0?l:1,m||0,o||0,n||0,s||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,k,l,m,o,n,s,p){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=k;this.n33=l;this.n34=m;this.n41=o;this.n42=n;this.n43=s;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a, -c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,m=a.n32,o=a.n33,n=a.n34,s=a.n41,p=a.n42,u=a.n43, -v=a.n44,y=c.n11,q=c.n12,t=c.n13,w=c.n14,z=c.n21,L=c.n22,J=c.n23,I=c.n24,D=c.n31,C=c.n32,P=c.n33,R=c.n34,fa=c.n41,M=c.n42,N=c.n43,ga=c.n44;this.n11=b*y+d*z+g*D+e*fa;this.n12=b*q+d*L+g*C+e*M;this.n13=b*t+d*J+g*P+e*N;this.n14=b*w+d*I+g*R+e*ga;this.n21=f*y+h*z+i*D+k*fa;this.n22=f*q+h*L+i*C+k*M;this.n23=f*t+h*J+i*P+k*N;this.n24=f*w+h*I+i*R+k*ga;this.n31=l*y+m*z+o*D+n*fa;this.n32=l*q+m*L+o*C+n*M;this.n33=l*t+m*J+o*P+n*N;this.n34=l*w+m*I+o*R+n*ga;this.n41=s*y+p*z+u*D+v*fa;this.n42=s*q+p*L+u*C+v*M;this.n43= -s*t+p*J+u*P+v*N;this.n44=s*w+p*I+u*R+v*ga;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},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},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y= -this.n21*c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31* -a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,k=this.n32,l=this.n33,m=this.n34,o=this.n41,n=this.n42,s=this.n43,p=this.n44;return d*f*k*o-b*h*k*o-d*e*l*o+c*h*l*o+b*e*m*o-c*f*m*o-d*f*i*n+b*h*i*n+d*g*l*n-a*h*l*n-b*g*m*n+a*f*m*n+d*e*i*s-c*h*i*s-d*g*k*s+a*h*k*s+c*g*m*s-a*e*m*s-b*e*i*p+c*f*i*p+b*g*k*p-a*f*k*p- -c*g*l*p+a*e*l*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33; -a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]= -this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]= -this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0, -0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,k=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,k*f+b,k*h-d*e,0,i*h-d*f,k*h+d*e,g*h*h+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12, -this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,k=a.n31,l=a.n32,m=a.n33,o=a.n34,n=a.n41,s=a.n42,p=a.n43,u=a.n44;this.n11=h*o*s-i*m*s+i*l*p-f*o*p-h*l*u+f*m*u;this.n12=g*m*s-d*o*s-g*l*p+b*o*p+d*l*u-b*m*u;this.n13=d*i*s-g*h*s+g*f*p-b*i*p-d*f*u+b*h*u;this.n14=g*h*l-d*i*l-g*f*m+b*i*m+d*f*o-b*h*o;this.n21=i*m*n-h*o*n-i*k*p+e*o*p+h*k*u-e*m*u;this.n22=d*o*n-g*m*n+ -g*k*p-c*o*p-d*k*u+c*m*u;this.n23=g*h*n-d*i*n-g*e*p+c*i*p+d*e*u-c*h*u;this.n24=d*i*k-g*h*k+g*e*m-c*i*m-d*e*o+c*h*o;this.n31=f*o*n-i*l*n+i*k*s-e*o*s-f*k*u+e*l*u;this.n32=g*l*n-b*o*n-g*k*s+c*o*s+b*k*u-c*l*u;this.n33=d*i*n-g*f*n+g*e*s-c*i*s-b*e*u+c*f*u;this.n34=g*f*k-b*i*k-g*e*l+c*i*l+b*e*o-c*f*o;this.n41=h*l*n-f*m*n-h*k*s+e*m*s+f*k*p-e*l*p;this.n42=b*m*n-d*l*n+d*k*s-c*m*s-b*k*p+c*l*p;this.n43=d*f*n-b*h*n-d*e*s+c*h*s+b*e*p-c*f*p;this.n44=b*h*k-d*f*k+d*e*l-c*h*l-b*e*m+c*f*m;this.multiplyScalar(1/a.determinant()); +c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,m=a.n32,o=a.n33,n=a.n34,s=a.n41,p=a.n42,v=a.n43, +u=a.n44,y=c.n11,q=c.n12,t=c.n13,w=c.n14,z=c.n21,L=c.n22,J=c.n23,I=c.n24,D=c.n31,C=c.n32,P=c.n33,R=c.n34,ea=c.n41,M=c.n42,N=c.n43,$=c.n44;this.n11=b*y+d*z+g*D+e*ea;this.n12=b*q+d*L+g*C+e*M;this.n13=b*t+d*J+g*P+e*N;this.n14=b*w+d*I+g*R+e*$;this.n21=f*y+h*z+i*D+k*ea;this.n22=f*q+h*L+i*C+k*M;this.n23=f*t+h*J+i*P+k*N;this.n24=f*w+h*I+i*R+k*$;this.n31=l*y+m*z+o*D+n*ea;this.n32=l*q+m*L+o*C+n*M;this.n33=l*t+m*J+o*P+n*N;this.n34=l*w+m*I+o*R+n*$;this.n41=s*y+p*z+v*D+u*ea;this.n42=s*q+p*L+v*C+u*M;this.n43=s* +t+p*J+v*P+u*N;this.n44=s*w+p*I+v*R+u*$;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},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},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*c+this.n22* +b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33* +a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,k=this.n32,l=this.n33,m=this.n34,o=this.n41,n=this.n42,s=this.n43,p=this.n44;return d*f*k*o-b*h*k*o-d*e*l*o+c*h*l*o+b*e*m*o-c*f*m*o-d*f*i*n+b*h*i*n+d*g*l*n-a*h*l*n-b*g*m*n+a*f*m*n+d*e*i*s-c*h*i*s-d*g*k*s+a*h*k*s+c*g*m*s-a*e*m*s-b*e*i*p+c*f*i*p+b*g*k*p-a*f*k*p-c*g*l*p+a*e*l*p},transpose:function(){var a; +a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42; +a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31; +a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a}, +setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this}, +setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,k=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,k*f+b,k*h-d*e,0,i*h-d*f,k*h+d*e,g*h*h+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12, +this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,k=a.n31,l=a.n32,m=a.n33,o=a.n34,n=a.n41,s=a.n42,p=a.n43,v=a.n44;this.n11=h*o*s-i*m*s+i*l*p-f*o*p-h*l*v+f*m*v;this.n12=g*m*s-d*o*s-g*l*p+b*o*p+d*l*v-b*m*v;this.n13=d*i*s-g*h*s+g*f*p-b*i*p-d*f*v+b*h*v;this.n14=g*h*l-d*i*l-g*f*m+b*i*m+d*f*o-b*h*o;this.n21=i*m*n-h*o*n-i*k*p+e*o*p+h*k*v-e*m*v;this.n22=d*o*n-g*m*n+ +g*k*p-c*o*p-d*k*v+c*m*v;this.n23=g*h*n-d*i*n-g*e*p+c*i*p+d*e*v-c*h*v;this.n24=d*i*k-g*h*k+g*e*m-c*i*m-d*e*o+c*h*o;this.n31=f*o*n-i*l*n+i*k*s-e*o*s-f*k*v+e*l*v;this.n32=g*l*n-b*o*n-g*k*s+c*o*s+b*k*v-c*l*v;this.n33=d*i*n-g*f*n+g*e*s-c*i*s-b*e*v+c*f*v;this.n34=g*f*k-b*i*k-g*e*l+c*i*l+b*e*o-c*f*o;this.n41=h*l*n-f*m*n-h*k*s+e*m*s+f*k*p-e*l*p;this.n42=b*m*n-d*l*n+d*k*s-c*m*s-b*k*p+c*l*p;this.n43=d*f*n-b*h*n-d*e*s+c*h*s+b*e*p-c*f*p;this.n44=b*h*k-d*f*k+d*e*l-c*h*l-b*e*m+c*f*m;this.multiplyScalar(1/a.determinant()); return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,k=f*g,l=d*h,m=d*g;this.n11=i+m*b;this.n12=l*b-k;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=k*b-l;this.n32=m+i*b;this.n33=e*f;break;case "ZXY":i=f*h;k=f*g;l=d*h;m=d*g;this.n11=i-m*b;this.n12=-e*g;this.n13=l+k*b;this.n21=k+l*b;this.n22=e*h;this.n23=m-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i= e*h;k=e*g;l=b*h;m=b*g;this.n11=f*h;this.n12=l*d-k;this.n13=i*d+m;this.n21=f*g;this.n22=m*d+i;this.n23=k*d-l;this.n31=-d;this.n32=b*f;this.n33=e*f;break;case "YZX":i=e*f;k=e*d;l=b*f;m=b*d;this.n11=f*h;this.n12=m-i*g;this.n13=l*g+k;this.n21=g;this.n22=e*h;this.n23=-b*h;this.n31=-d*h;this.n32=k*g+l;this.n33=i-m*g;break;case "XZY":i=e*f;k=e*d;l=b*f;m=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+m;this.n22=e*h;this.n23=k*g-l;this.n31=l*g-k;this.n32=b*h;this.n33=m*g+i;break;default:i=e*h,k=e* g,l=b*h,m=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=k+l*d,this.n22=i-m*d,this.n23=-b*f,this.n31=m-i*d,this.n32=l+k*d,this.n33=e*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,g=a.w,e=c+c,f=b+b,h=d+d,a=c*e,i=c*f;c*=h;var k=b*f;b*=h;d*=h;e*=g;f*=g;g*=h;this.n11=1-(k+d);this.n12=i-g;this.n13=c+f;this.n21=i+g;this.n22=1-(a+d);this.n23=b-e;this.n31=c-f;this.n32=b+e;this.n33=1-(a+k);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*= @@ -56,17 +56,17 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){thi if(c&&(g=g.getChildByName(a,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&& this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),df&&h.positionScreen.z0&&L.z<1))f=t[q]=t[q]||new THREE.RenderableParticle,q++,y=f,y.x=L.x/L.w,y.y=L.y/L.w,y.z=L.z,y.rotation=aa.rotation.z,y.scale.x=aa.scale.x*Math.abs(y.x-(L.x+e.projectionMatrix.n11)/(L.w+e.projectionMatrix.n14)),y.scale.y=aa.scale.y*Math.abs(y.y-(L.y+e.projectionMatrix.n22)/(L.w+e.projectionMatrix.n24)),y.material=aa.material,w.elements.push(y); +w.objects.sort(b);return w};this.projectScene=function(a,e,g){var f=e.near,z=e.far,D,ga,F,B,Q,O,j,ha,fa,V,U,ca,da,aa,K,Z;q=v=n=m=0;w.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);J.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(J);w=this.projectGraph(a,!1);a=0;for(D=w.objects.length;af&&h.positionScreen.z0&&L.z<1))f=t[q]=t[q]||new THREE.RenderableParticle,q++,y=f,y.x=L.x/L.w,y.y=L.y/L.w,y.z=L.z,y.rotation=fa.rotation.z,y.scale.x=fa.scale.x*Math.abs(y.x-(L.x+e.projectionMatrix.n11)/(L.w+e.projectionMatrix.n14)),y.scale.y=fa.scale.y*Math.abs(y.y-(L.y+e.projectionMatrix.n22)/(L.w+e.projectionMatrix.n24)),y.material=fa.material,w.elements.push(y); g&&w.elements.sort(b);return w}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b); this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z); @@ -83,9 +83,9 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid b,d,g,e,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, +b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,O){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];m=f[g];o=f[O];n=i.x-h.x;s=k.x-h.x;p=i.y-h.y;v=k.y-h.y;u=i.z-h.z;y=k.z-h.z;q=m.u-l.u;t=o.u-l.u;w=m.v-l.v;z=o.v-l.v;L=1/(q*z-t*w);C.set((z*n-w*s)*L,(z*p-w*v)*L,(z*u-w*y)*L);P.set((q*s-t*n)*L,(q*v-t*p)*L,(q*y-t*u)*L);I[b].addSelf(C);I[c].addSelf(C);I[d].addSelf(C);D[b].addSelf(P); +D[c].addSelf(P);D[d].addSelf(P)}var c,b,d,g,e,f,h,i,k,l,m,o,n,s,p,v,u,y,q,t,w,z,L,J,I=[],D=[],C=new THREE.Vector3,P=new THREE.Vector3,R=new THREE.Vector3,ea=new THREE.Vector3,M=new THREE.Vector3;c=0;for(b=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;cthis.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.zthis.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+v+")"),p.fillRect(Math.floor(E.getX()), -Math.floor(E.getY()),Math.floor(E.getWidth()),Math.floor(E.getHeight()))),E.empty())};this.render=function(a,l){function m(a){var b,c,d,e;H.setRGB(0,0,0);ia.setRGB(0,0,0);W.setRGB(0,0,0);b=0;for(c=a.length;b>1,da=k.height>>1,f= -e.scale.x*n,i=e.scale.y*s,j=f*l,h=i*da,Y.set(a.x-j,a.y-h,a.x+j,a.y+h),S.intersects(Y)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-l,-da),p.drawImage(k,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*n,h=e.scale.y*s,Y.set(a.x-j,a.y-h,a.x+j,a.y+h),S.intersects(Y)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(j,h),f.program(p),p.restore()))}function u(a,e,g,f){c(f.opacity); -b(f.blending);p.beginPath();p.moveTo(a.positionScreen.x,a.positionScreen.y);p.lineTo(e.positionScreen.x,e.positionScreen.y);p.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(z!=a)p.lineWidth=z=a;a=f.linecap;if(L!=a)p.lineCap=L=a;a=f.linejoin;if(J!=a)p.lineJoin=J=a;d(f.color.getContextStyle());p.stroke();Y.inflate(f.linewidth*2)}}function v(a,d,f,g,j,h,k,n){e.info.render.vertices+=3;e.info.render.faces++;c(n.opacity);b(n.blending);M=a.positionScreen.x;N=a.positionScreen.y;ga= -d.positionScreen.x;ka=d.positionScreen.y;Z=f.positionScreen.x;F=f.positionScreen.y;y(M,N,ga,ka,Z,F);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(na=k.uvs[0],w(M,N,ga,ka,Z,F,na[g].u,na[g].v,na[j].u,na[j].v,na[h].u,na[h].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,X.copy(k.vertexNormalsWorld[g]),ua=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,va=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,X.copy(k.vertexNormalsWorld[j]), -pa=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,ra=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,X.copy(k.vertexNormalsWorld[h]),Aa=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,x=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,w(M,N,ga,ka,Z,F,ua,va,pa,ra,Aa,x,n.envMap)}else n.wireframe?wa(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(na=k.uvs[0],w(M,N,ga,ka,Z,F,na[g].u,na[g].v, -na[j].u,na[j].v,na[h].u,na[h].v,n.map)),b(THREE.SubtractiveBlending)),ja?!n.wireframe&&n.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(ba.r=U.r=ea.r=H.r,ba.g=U.g=ea.g=H.g,ba.b=U.b=ea.b=H.b,o(i,k.v1.positionWorld,k.vertexNormalsWorld[0],ba),o(i,k.v2.positionWorld,k.vertexNormalsWorld[1],U),o(i,k.v3.positionWorld,k.vertexNormalsWorld[2],ea),ba.r=Math.max(0,Math.min(n.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(n.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(n.color.b*ba.b,1)),U.r=Math.max(0, -Math.min(n.color.r*U.r,1)),U.g=Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),ea.r=Math.max(0,Math.min(n.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(n.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(n.color.b*ea.b,1)),ca.r=(U.r+ea.r)*0.5,ca.g=(U.g+ea.g)*0.5,ca.b=(U.b+ea.b)*0.5,oa=Ga(ba,U,ea,ca),Ea(M,N,ga,ka,Z,F,0,0,1,0,0,1,oa)):(V.r=H.r,V.g=H.g,V.b=H.b,o(i,k.centroidWorld,k.normalWorld,V),V.r=Math.max(0,Math.min(n.color.r*V.r,1)),V.g=Math.max(0,Math.min(n.color.g*V.g,1)), -V.b=Math.max(0,Math.min(n.color.b*V.b,1)),n.wireframe?wa(V,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(V)):n.wireframe?wa(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(n.color);else if(n instanceof THREE.MeshDepthMaterial)$=l.near,la=l.far,ba.r=ba.g=ba.b=1-Da(a.positionScreen.z,$,la),U.r=U.g=U.b=1-Da(d.positionScreen.z,$,la),ea.r=ea.g=ea.b=1-Da(f.positionScreen.z,$,la),ca.r=(U.r+ea.r)*0.5,ca.g=(U.g+ea.g)*0.5,ca.b=(U.b+ea.b)*0.5,oa=Ga(ba,U,ea,ca),Ea(M, -N,ga,ka,Z,F,0,0,1,0,0,1,oa);else if(n instanceof THREE.MeshNormalMaterial)V.r=Fa(k.normalWorld.x),V.g=Fa(k.normalWorld.y),V.b=Fa(k.normalWorld.z),n.wireframe?wa(V,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(V)}function Ja(a,d,f,g,h,n,k,da,m){e.info.render.vertices+=4;e.info.render.faces++;c(da.opacity);b(da.blending);if(da.map||da.envMap)v(a,d,g,0,1,3,k,da,m),v(h,f,n,1,2,3,k,da,m);else if(M=a.positionScreen.x,N=a.positionScreen.y,ga=d.positionScreen.x,ka=d.positionScreen.y,Z=f.positionScreen.x, -F=f.positionScreen.y,B=g.positionScreen.x,Q=g.positionScreen.y,O=h.positionScreen.x,j=h.positionScreen.y,ha=n.positionScreen.x,aa=n.positionScreen.y,da instanceof THREE.MeshBasicMaterial)t(M,N,ga,ka,Z,F,B,Q),da.wireframe?wa(da.color,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ba(da.color);else if(da instanceof THREE.MeshLambertMaterial)ja?!da.wireframe&&da.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4?(ba.r=U.r=ea.r=ca.r=H.r,ba.g=U.g=ea.g=ca.g=H.g,ba.b=U.b=ea.b= -ca.b=H.b,o(i,k.v1.positionWorld,k.vertexNormalsWorld[0],ba),o(i,k.v2.positionWorld,k.vertexNormalsWorld[1],U),o(i,k.v4.positionWorld,k.vertexNormalsWorld[3],ea),o(i,k.v3.positionWorld,k.vertexNormalsWorld[2],ca),ba.r=Math.max(0,Math.min(da.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(da.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(da.color.b*ba.b,1)),U.r=Math.max(0,Math.min(da.color.r*U.r,1)),U.g=Math.max(0,Math.min(da.color.g*U.g,1)),U.b=Math.max(0,Math.min(da.color.b*U.b,1)),ea.r=Math.max(0,Math.min(da.color.r* -ea.r,1)),ea.g=Math.max(0,Math.min(da.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(da.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(da.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(da.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(da.color.b*ca.b,1)),oa=Ga(ba,U,ea,ca),y(M,N,ga,ka,B,Q),Ea(M,N,ga,ka,B,Q,0,0,1,0,0,1,oa),y(O,j,Z,F,ha,aa),Ea(O,j,Z,F,ha,aa,1,0,1,1,0,1,oa)):(V.r=H.r,V.g=H.g,V.b=H.b,o(i,k.centroidWorld,k.normalWorld,V),V.r=Math.max(0,Math.min(da.color.r*V.r,1)),V.g=Math.max(0,Math.min(da.color.g*V.g,1)), -V.b=Math.max(0,Math.min(da.color.b*V.b,1)),t(M,N,ga,ka,Z,F,B,Q),da.wireframe?wa(V,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ba(V)):(t(M,N,ga,ka,Z,F,B,Q),da.wireframe?wa(da.color,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ba(da.color));else if(da instanceof THREE.MeshNormalMaterial)V.r=Fa(k.normalWorld.x),V.g=Fa(k.normalWorld.y),V.b=Fa(k.normalWorld.z),t(M,N,ga,ka,Z,F,B,Q),da.wireframe?wa(V,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ba(V); -else if(da instanceof THREE.MeshDepthMaterial)$=l.near,la=l.far,ba.r=ba.g=ba.b=1-Da(a.positionScreen.z,$,la),U.r=U.g=U.b=1-Da(d.positionScreen.z,$,la),ea.r=ea.g=ea.b=1-Da(g.positionScreen.z,$,la),ca.r=ca.g=ca.b=1-Da(f.positionScreen.z,$,la),oa=Ga(ba,U,ea,ca),y(M,N,ga,ka,B,Q),Ea(M,N,ga,ka,B,Q,0,0,1,0,0,1,oa),y(O,j,Z,F,ha,aa),Ea(O,j,Z,F,ha,aa,1,0,1,1,0,1,oa)}function y(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(a,b);p.closePath()}function t(a,b,c,d,e,f,g,j){p.beginPath(); -p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(g,j);p.lineTo(a,b);p.closePath()}function wa(a,b,c,e){if(z!=b)p.lineWidth=z=b;if(L!=c)p.lineCap=L=c;if(J!=e)p.lineJoin=J=e;d(a.getContextStyle());p.stroke();Y.inflate(b*2)}function Ba(a){g(a.getContextStyle());p.fill()}function w(a,b,c,d,e,f,j,h,i,n,k,da,l){if(l.image.width!=0){if(l.needsUpdate==!0||K[l.id]==void 0){var m=l.wrapS==THREE.RepeatWrapping,o=l.wrapT==THREE.RepeatWrapping;K[l.id]=p.createPattern(l.image,m&&o?"repeat":m&&!o?"repeat-x":!m&& -o?"repeat-y":"no-repeat");l.needsUpdate=!1}g(K[l.id]);var m=l.offset.x/l.repeat.x,o=l.offset.y/l.repeat.y,x=(l.image.width-1)*l.repeat.x,l=(l.image.height-1)*l.repeat.y,j=(j+m)*x,h=(h+o)*l,i=(i+m)*x,n=(n+o)*l,k=(k+m)*x,da=(da+o)*l;c-=a;d-=b;e-=a;f-=b;i-=j;n-=h;k-=j;da-=h;m=1/(i*da-k*n);l=(da*c-n*e)*m;n=(da*d-n*f)*m;c=(i*e-k*c)*m;d=(i*f-k*d)*m;a=a-l*j-c*h;b=b-n*j-d*h;p.save();p.transform(l,n,c,d,a,b);p.fill();p.restore()}}function Ea(a,b,c,d,e,f,g,j,h,i,n,k,da){var l,m;l=da.width-1;m=da.height-1;g*= -l;j*=m;h*=l;i*=m;n*=l;k*=m;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;n-=g;k-=j;m=1/(h*k-n*i);l=(k*c-i*e)*m;i=(k*d-i*f)*m;c=(h*e-n*c)*m;d=(h*f-n*d)*m;a=a-l*g-c*j;b=b-i*g-d*j;p.save();p.transform(l,i,c,d,a,b);p.clip();p.drawImage(da,0,0);p.restore()}function Ga(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),n=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);G[0]=e<0?0:e>255?255:e;G[1]=f<0?0:f>255?255:f;G[2]=a<0?0:a>255?255:a;G[4]= +L=z=w=t=null};this.setClearColor=function(a,b){v.copy(a);u=b;E.set(-n,-s,n,s)};this.setClearColorHex=function(a,b){v.setHex(a);u=b;E.set(-n,-s,n,s)};this.clear=function(){p.setTransform(1,0,0,-1,n,s);E.isEmpty()||(E.minSelf(S),E.inflate(2),u<1&&p.clearRect(Math.floor(E.getX()),Math.floor(E.getY()),Math.floor(E.getWidth()),Math.floor(E.getHeight())),u>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(v.r*255)+","+Math.floor(v.g*255)+","+Math.floor(v.b*255)+","+u+")"),p.fillRect(Math.floor(E.getX()), +Math.floor(E.getY()),Math.floor(E.getWidth()),Math.floor(E.getHeight()))),E.empty())};this.render=function(a,l){function m(a){var b,c,d,e;H.setRGB(0,0,0);ia.setRGB(0,0,0);X.setRGB(0,0,0);b=0;for(c=a.length;b>1,ba=k.height>>1,f= +e.scale.x*n,i=e.scale.y*s,j=f*l,h=i*ba,Y.set(a.x-j,a.y-h,a.x+j,a.y+h),S.intersects(Y)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-l,-ba),p.drawImage(k,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*n,h=e.scale.y*s,Y.set(a.x-j,a.y-h,a.x+j,a.y+h),S.intersects(Y)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(j,h),f.program(p),p.restore()))}function v(a,e,g,f){c(f.opacity); +b(f.blending);p.beginPath();p.moveTo(a.positionScreen.x,a.positionScreen.y);p.lineTo(e.positionScreen.x,e.positionScreen.y);p.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(z!=a)p.lineWidth=z=a;a=f.linecap;if(L!=a)p.lineCap=L=a;a=f.linejoin;if(J!=a)p.lineJoin=J=a;d(f.color.getContextStyle());p.stroke();Y.inflate(f.linewidth*2)}}function u(a,d,f,g,j,h,k,n){e.info.render.vertices+=3;e.info.render.faces++;c(n.opacity);b(n.blending);M=a.positionScreen.x;N=a.positionScreen.y;$=d.positionScreen.x; +ka=d.positionScreen.y;ga=f.positionScreen.x;F=f.positionScreen.y;y(M,N,$,ka,ga,F);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(na=k.uvs[0],w(M,N,$,ka,ga,F,na[g].u,na[g].v,na[j].u,na[j].v,na[h].u,na[h].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,W.copy(k.vertexNormalsWorld[g]),ua=(W.x*a.n11+W.y*a.n12+W.z*a.n13)*0.5+0.5,va=-(W.x*a.n21+W.y*a.n22+W.z*a.n23)*0.5+0.5,W.copy(k.vertexNormalsWorld[j]), +pa=(W.x*a.n11+W.y*a.n12+W.z*a.n13)*0.5+0.5,ra=-(W.x*a.n21+W.y*a.n22+W.z*a.n23)*0.5+0.5,W.copy(k.vertexNormalsWorld[h]),Aa=(W.x*a.n11+W.y*a.n12+W.z*a.n13)*0.5+0.5,x=-(W.x*a.n21+W.y*a.n22+W.z*a.n23)*0.5+0.5,w(M,N,$,ka,ga,F,ua,va,pa,ra,Aa,x,n.envMap)}else n.wireframe?wa(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(na=k.uvs[0],w(M,N,$,ka,ga,F,na[g].u,na[g].v, +na[j].u,na[j].v,na[h].u,na[h].v,n.map)),b(THREE.SubtractiveBlending)),ja?!n.wireframe&&n.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(U.r=ca.r=da.r=H.r,U.g=ca.g=da.g=H.g,U.b=ca.b=da.b=H.b,o(i,k.v1.positionWorld,k.vertexNormalsWorld[0],U),o(i,k.v2.positionWorld,k.vertexNormalsWorld[1],ca),o(i,k.v3.positionWorld,k.vertexNormalsWorld[2],da),U.r=Math.max(0,Math.min(n.color.r*U.r,1)),U.g=Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),ca.r=Math.max(0,Math.min(n.color.r* +ca.r,1)),ca.g=Math.max(0,Math.min(n.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(n.color.b*ca.b,1)),da.r=Math.max(0,Math.min(n.color.r*da.r,1)),da.g=Math.max(0,Math.min(n.color.g*da.g,1)),da.b=Math.max(0,Math.min(n.color.b*da.b,1)),aa.r=(ca.r+da.r)*0.5,aa.g=(ca.g+da.g)*0.5,aa.b=(ca.b+da.b)*0.5,oa=Ga(U,ca,da,aa),Ea(M,N,$,ka,ga,F,0,0,1,0,0,1,oa)):(V.r=H.r,V.g=H.g,V.b=H.b,o(i,k.centroidWorld,k.normalWorld,V),V.r=Math.max(0,Math.min(n.color.r*V.r,1)),V.g=Math.max(0,Math.min(n.color.g*V.g,1)),V.b=Math.max(0, +Math.min(n.color.b*V.b,1)),n.wireframe?wa(V,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(V)):n.wireframe?wa(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(n.color);else if(n instanceof THREE.MeshDepthMaterial)Z=l.near,la=l.far,U.r=U.g=U.b=1-Da(a.positionScreen.z,Z,la),ca.r=ca.g=ca.b=1-Da(d.positionScreen.z,Z,la),da.r=da.g=da.b=1-Da(f.positionScreen.z,Z,la),aa.r=(ca.r+da.r)*0.5,aa.g=(ca.g+da.g)*0.5,aa.b=(ca.b+da.b)*0.5,oa=Ga(U,ca,da,aa),Ea(M,N,$,ka,ga,F, +0,0,1,0,0,1,oa);else if(n instanceof THREE.MeshNormalMaterial)V.r=Fa(k.normalWorld.x),V.g=Fa(k.normalWorld.y),V.b=Fa(k.normalWorld.z),n.wireframe?wa(V,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(V)}function Ja(a,d,f,g,h,n,k,ba,m){e.info.render.vertices+=4;e.info.render.faces++;c(ba.opacity);b(ba.blending);if(ba.map||ba.envMap)u(a,d,g,0,1,3,k,ba,m),u(h,f,n,1,2,3,k,ba,m);else if(M=a.positionScreen.x,N=a.positionScreen.y,$=d.positionScreen.x,ka=d.positionScreen.y,ga=f.positionScreen.x, +F=f.positionScreen.y,B=g.positionScreen.x,Q=g.positionScreen.y,O=h.positionScreen.x,j=h.positionScreen.y,ha=n.positionScreen.x,fa=n.positionScreen.y,ba instanceof THREE.MeshBasicMaterial)t(M,N,$,ka,ga,F,B,Q),ba.wireframe?wa(ba.color,ba.wireframeLinewidth,ba.wireframeLinecap,ba.wireframeLinejoin):Ba(ba.color);else if(ba instanceof THREE.MeshLambertMaterial)ja?!ba.wireframe&&ba.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4?(U.r=ca.r=da.r=aa.r=H.r,U.g=ca.g=da.g=aa.g=H.g,U.b=ca.b=da.b= +aa.b=H.b,o(i,k.v1.positionWorld,k.vertexNormalsWorld[0],U),o(i,k.v2.positionWorld,k.vertexNormalsWorld[1],ca),o(i,k.v4.positionWorld,k.vertexNormalsWorld[3],da),o(i,k.v3.positionWorld,k.vertexNormalsWorld[2],aa),U.r=Math.max(0,Math.min(ba.color.r*U.r,1)),U.g=Math.max(0,Math.min(ba.color.g*U.g,1)),U.b=Math.max(0,Math.min(ba.color.b*U.b,1)),ca.r=Math.max(0,Math.min(ba.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(ba.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(ba.color.b*ca.b,1)),da.r=Math.max(0,Math.min(ba.color.r* +da.r,1)),da.g=Math.max(0,Math.min(ba.color.g*da.g,1)),da.b=Math.max(0,Math.min(ba.color.b*da.b,1)),aa.r=Math.max(0,Math.min(ba.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(ba.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(ba.color.b*aa.b,1)),oa=Ga(U,ca,da,aa),y(M,N,$,ka,B,Q),Ea(M,N,$,ka,B,Q,0,0,1,0,0,1,oa),y(O,j,ga,F,ha,fa),Ea(O,j,ga,F,ha,fa,1,0,1,1,0,1,oa)):(V.r=H.r,V.g=H.g,V.b=H.b,o(i,k.centroidWorld,k.normalWorld,V),V.r=Math.max(0,Math.min(ba.color.r*V.r,1)),V.g=Math.max(0,Math.min(ba.color.g*V.g,1)), +V.b=Math.max(0,Math.min(ba.color.b*V.b,1)),t(M,N,$,ka,ga,F,B,Q),ba.wireframe?wa(V,ba.wireframeLinewidth,ba.wireframeLinecap,ba.wireframeLinejoin):Ba(V)):(t(M,N,$,ka,ga,F,B,Q),ba.wireframe?wa(ba.color,ba.wireframeLinewidth,ba.wireframeLinecap,ba.wireframeLinejoin):Ba(ba.color));else if(ba instanceof THREE.MeshNormalMaterial)V.r=Fa(k.normalWorld.x),V.g=Fa(k.normalWorld.y),V.b=Fa(k.normalWorld.z),t(M,N,$,ka,ga,F,B,Q),ba.wireframe?wa(V,ba.wireframeLinewidth,ba.wireframeLinecap,ba.wireframeLinejoin):Ba(V); +else if(ba instanceof THREE.MeshDepthMaterial)Z=l.near,la=l.far,U.r=U.g=U.b=1-Da(a.positionScreen.z,Z,la),ca.r=ca.g=ca.b=1-Da(d.positionScreen.z,Z,la),da.r=da.g=da.b=1-Da(g.positionScreen.z,Z,la),aa.r=aa.g=aa.b=1-Da(f.positionScreen.z,Z,la),oa=Ga(U,ca,da,aa),y(M,N,$,ka,B,Q),Ea(M,N,$,ka,B,Q,0,0,1,0,0,1,oa),y(O,j,ga,F,ha,fa),Ea(O,j,ga,F,ha,fa,1,0,1,1,0,1,oa)}function y(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(a,b);p.closePath()}function t(a,b,c,d,e,f,g,j){p.beginPath(); +p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(g,j);p.lineTo(a,b);p.closePath()}function wa(a,b,c,e){if(z!=b)p.lineWidth=z=b;if(L!=c)p.lineCap=L=c;if(J!=e)p.lineJoin=J=e;d(a.getContextStyle());p.stroke();Y.inflate(b*2)}function Ba(a){g(a.getContextStyle());p.fill()}function w(a,b,c,d,e,f,j,h,i,n,k,ba,l){if(l.image.width!=0){if(l.needsUpdate==!0||K[l.id]==void 0){var m=l.wrapS==THREE.RepeatWrapping,o=l.wrapT==THREE.RepeatWrapping;K[l.id]=p.createPattern(l.image,m&&o?"repeat":m&&!o?"repeat-x":!m&& +o?"repeat-y":"no-repeat");l.needsUpdate=!1}g(K[l.id]);var m=l.offset.x/l.repeat.x,o=l.offset.y/l.repeat.y,x=(l.image.width-1)*l.repeat.x,l=(l.image.height-1)*l.repeat.y,j=(j+m)*x,h=(h+o)*l,i=(i+m)*x,n=(n+o)*l,k=(k+m)*x,ba=(ba+o)*l;c-=a;d-=b;e-=a;f-=b;i-=j;n-=h;k-=j;ba-=h;m=1/(i*ba-k*n);l=(ba*c-n*e)*m;n=(ba*d-n*f)*m;c=(i*e-k*c)*m;d=(i*f-k*d)*m;a=a-l*j-c*h;b=b-n*j-d*h;p.save();p.transform(l,n,c,d,a,b);p.fill();p.restore()}}function Ea(a,b,c,d,e,f,g,j,h,i,n,k,ba){var l,m;l=ba.width-1;m=ba.height-1;g*= +l;j*=m;h*=l;i*=m;n*=l;k*=m;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;n-=g;k-=j;m=1/(h*k-n*i);l=(k*c-i*e)*m;i=(k*d-i*f)*m;c=(h*e-n*c)*m;d=(h*f-n*d)*m;a=a-l*g-c*j;b=b-i*g-d*j;p.save();p.transform(l,i,c,d,a,b);p.clip();p.drawImage(ba,0,0);p.restore()}function Ga(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),n=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);G[0]=e<0?0:e>255?255:e;G[1]=f<0?0:f>255?255:f;G[2]=a<0?0:a>255?255:a;G[4]= g<0?0:g>255?255:g;G[5]=j<0?0:j>255?255:j;G[6]=b<0?0:b>255?255:b;G[8]=h<0?0:h>255?255:h;G[9]=i<0?0:i>255?255:i;G[10]=c<0?0:c>255?255:c;G[12]=n<0?0:n>255?255:n;G[13]=k<0?0:k>255?255:k;G[14]=d<0?0:d>255?255:d;xa.putImageData(ma,0,0);ta.drawImage(sa,0,0);return ya}function Da(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Fa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ca(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ha,Ia,qa,za;this.autoClear? this.clear():p.setTransform(1,0,0,-1,n,s);e.info.render.vertices=0;e.info.render.faces=0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ja=i.length>0)&&m(i);Ha=0;for(Ia=h.length;Ha1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,m,o,n,s,p,u,v=new THREE.Rectangle,y=new THREE.Rectangle,q=!1,t=new THREE.Color,w=new THREE.Color,z=new THREE.Color,L=new THREE.Color,J,I=new THREE.Vector3,D=[],C=[],P,R,fa,M=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0, -faces:0}};this.setQuality=function(a){switch(a){case "high":M=1;break;case "low":M=0}};this.setSize=function(a,b){k=a;l=b;m=k/2;o=l/2;i.setAttribute("viewBox",-m+" "+-o+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);v.set(-m,-o,m,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var I,D,F,B;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);e=g.elements; -f=g.lights;fa=R=0;if(q=f.length>0){w.setRGB(0,0,0);z.setRGB(0,0,0);L.setRGB(0,0,0);I=0;for(D=f.length;I1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,m,o,n,s,p,v,u=new THREE.Rectangle,y=new THREE.Rectangle,q=!1,t=new THREE.Color,w=new THREE.Color,z=new THREE.Color,L=new THREE.Color,J,I=new THREE.Vector3,D=[],C=[],P,R,ea,M=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0, +faces:0}};this.setQuality=function(a){switch(a){case "high":M=1;break;case "low":M=0}};this.setSize=function(a,b){k=a;l=b;m=k/2;o=l/2;i.setAttribute("viewBox",-m+" "+-o+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);u.set(-m,-o,m,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var I,D,F,B;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);e=g.elements; +f=g.lights;ea=R=0;if(q=f.length>0){w.setRGB(0,0,0);z.setRGB(0,0,0);L.setRGB(0,0,0);I=0;for(D=f.length;I=0)a&&(j.bindBuffer(j.ARRAY_BUFFER, +(g+k+l)/3,c[m]=d,c[m+1]=e,c[m+2]=g,c[m+3]=d,c[m+4]=e,c[m+5]=g,c[m+6]=d,c[m+7]=e,c[m+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=u(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==ca&&(ca=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER, e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;fn&&(k=l,n=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]= n;i[k]=1;n=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color, @@ -237,19 +237,19 @@ j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)): 4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==pa&&(j.lineWidth(d),pa=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),O.info.render.calls++,O.info.render.vertices+= e.__webglFaceCount,O.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==pa&&(j.lineWidth(d),pa=d),j.drawArrays(g,0,e.__webglLineCount),O.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),O.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),O.info.render.calls++)}}function f(a){E[0].set(a.n41-a.n11,a.n42-a.n12,a.n43- a.n13,a.n44-a.n14);E[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);E[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);E[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);E[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);E[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=E[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y, -a.scale.z)),d=0;d<6;d++)if(a=E[d].x*b.n14+E[d].y*b.n24+E[d].z*b.n34+E[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function k(a){var b,c,d,i=0,n,k,l,m,p,o,x=a.lights;X||(X=new THREE.PerspectiveCamera(O.shadowCameraFov,O.shadowMapWidth/O.shadowMapHeight,O.shadowCameraNear,O.shadowCameraFar));b=0;for(c=x.length;b=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=d)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function o(a,b){var c,d,e;c=G.attributes;var g=G.uniforms,f=S/x,h,n=[],k=x*0.5,l=S*0.5,m=!0;j.useProgram(G.program);aa=G.program;U=la=$=-1; -ya||(j.enableVertexAttribArray(G.attributes.position),j.enableVertexAttribArray(G.attributes.uv),ya=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,G.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,G.elementBuffer);j.uniformMatrix4fv(g.projectionMatrix,!1,ja);j.activeTexture(j.TEXTURE0);j.uniform1i(g.map,0);c=0;for(d=a.__webglSprites.length;c=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=d)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function o(a,b){var c,d,e;c=G.attributes;var g=G.uniforms,f=S/x,h,n=[],k=x*0.5,l=S*0.5,m=!0;j.useProgram(G.program);fa=G.program;ca=la=Z= +-1;ya||(j.enableVertexAttribArray(G.attributes.position),j.enableVertexAttribArray(G.attributes.uv),ya=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,G.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,G.elementBuffer);j.uniformMatrix4fv(g.projectionMatrix,!1,ja);j.activeTexture(j.TEXTURE0);j.uniform1i(g.map,0);c=0;for(d=a.__webglSprites.length;c=0;c--)a[c].object===b&&a.splice(c,1)}function v(a,b,c,d,e){d.program||O.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets);for(var g=0,f=O.maxMorphTargets;g=0;c--)a[c].object===b&&a.splice(c,1)}function u(a,b,c,d,e){d.program||O.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets);for(var g=0,f=O.maxMorphTargets;g=0;d--)if(u=a.__webglObjects[d],u.render&&(S=u.object,wa=u.buffer,p=u.opaque))q(S),t(p.depthTest),w(p.depthWrite),z(p.polygonOffset,p.polygonOffsetFactor,p.polygonOffsetUnits),e(b,B,ca,p,wa,S);for(d=0;d=0;d--)if(v=a.__webglObjects[d],v.render&&(S=v.object,wa=v.buffer,p=v.opaque))q(S),t(p.depthTest),w(p.depthWrite),z(p.polygonOffset,p.polygonOffsetFactor,p.polygonOffsetUnits),e(b,B,aa,p,wa,S);for(d=0;d65535&&(q[E].counter+=1,S=q[E].hash+"_"+q[E].counter,i.geometryGroups[S]===void 0&&(i.geometryGroups[S]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:v})),m instanceof THREE.Face3?i.geometryGroups[S].faces3.push(k):i.geometryGroups[S].faces4.push(k),i.geometryGroups[S].vertices+=x;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id= -ea++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer= +e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var i=h,k=void 0,l=void 0,m=void 0,o=void 0,x=void 0,E=void 0,S=void 0,q={},u=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k65535&&(q[E].counter+=1,S=q[E].hash+"_"+q[E].counter,i.geometryGroups[S]===void 0&&(i.geometryGroups[S]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:u})),m instanceof THREE.Face3?i.geometryGroups[S].faces3.push(k):i.geometryGroups[S].faces4.push(k),i.geometryGroups[S].vertices+=x;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id= +da++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer= j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){m=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(m=k.numMorphTargets;l0||x.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k* +l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;u=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(q)i.__normalArray=new Float32Array(k*3);if(x.hasTangents)i.__tangentArray=new Float32Array(k*4);if(u)i.__colorArray=new Float32Array(k*3);if(S){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k* 2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(m*3);i.__lineArray=new Uint16Array(E*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];o=0;for(x=i.numMorphTargets;o=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&u(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,M,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,$,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,C,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,U,m))}if(xa&&I){x=0;for(E=q.length;x0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER, -ja,m))}if(ka&&Z.hasTangents){x=0;for(E=q.length;x0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,ba,m))}if(oa&&ya&&L){x=0;for(E=q.length;x0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,A,m))}if(aa){x=0;for(E=q.length;x=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&v(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,M,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,C,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,U,m))}if(xa&&I){x=0;for(E=q.length;x0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER, +ja,m))}if(ka&&$.hasTangents){x=0;for(E=q.length;x0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,fa,m))}if(oa&&ya&&L){x=0;for(E=q.length;x0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,A,m))}if(ga){x=0;for(E=q.length;x1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=e;return c}}; THREE.ColorUtils.__hsv={h:0,s:0,v:0}; THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,e=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,h=e.vertices,i=a.faces,k=e.faces,l=a.faceVertexUvs[0],m=e.faceVertexUvs[0],o={},n=0;n1&&(d=1-d,g=1-g);e=1-d-g;f.copy(a);f.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);f.addSelf(h);h.copy(b);h.multiplyScalar(e);f.addSelf(h);return f},randomPointInFace:function(a,c,b){var d,g,e;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position, e=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,e);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;e=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c));return THREE.GeometryUtils.random()*(b+ @@ -365,9 +365,9 @@ f)0?(f=b[b.length-1],n=f.x,s=f.y):(f=this.actions[d-1].args,n=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b2(p,n,m,h),p=THREE.Shape.Utils.b2(p,s,o, i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];m=e[0];o=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],n=f.x,s=f.y):(f=this.actions[d-1].args,n=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b3(p,n,m,k,h),p=THREE.Shape.Utils.b3(p,s,o,l,i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];p=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f); -for(f=1;f<=p;f++)b.push(e.getPointAt(f/p));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];m=e[3];p=e[4];o=!!e[5];l=f[f.length-2];n=f[f.length-1];f.length==0&&(l=n=0);s=p-m;var u=a*2;for(f=1;f<=u;f++)p=f/u,o||(p=1-p),p=m+p*s,e=l+h+k*Math.cos(p),p=n+i+k*Math.sin(p),b.push(new THREE.Vector2(e,p))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)}; +for(f=1;f<=p;f++)b.push(e.getPointAt(f/p));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];m=e[3];p=e[4];o=!!e[5];l=f[f.length-2];n=f[f.length-1];f.length==0&&(l=n=0);s=p-m;var v=a*2;for(f=1;f<=v;f++)p=f/v,o||(p=1-p),p=m+p*s,e=l+h+k*Math.cos(p),p=n+i+k*Math.sin(p),b.push(new THREE.Vector2(e,p))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)}; THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,k,l,m;h=0;for(i=f.length;h=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var p=[k[f],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(p);var u=[k[f],k[e],b[h]];o=THREE.FontUtils.Triangulate.area(u);n=h;l=f;h+=1;f+=-1;h< -0&&(h+=b.length);h%=b.length;f<0&&(f+=k.length);f%=k.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;p=[k[f],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(p);u=[k[f],k[e],b[h]];u=THREE.FontUtils.Triangulate.area(u);m+o>p+u&&(h=n,f=l,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=k.length),f%=k.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:k.length-1);m=b.slice(0,h);o=b.slice(h);n=k.slice(f);l=k.slice(0,f);e=[k[f],k[e],b[h]];s.push([k[f],b[h],b[g]]);s.push(e);b=m.concat(n).concat(l).concat(o)}return{shape:b, +THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,e,f,h,i,k,l,m,o,n,s=[];for(i=0;i=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var p=[k[f],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(p);var v=[k[f],k[e],b[h]];o=THREE.FontUtils.Triangulate.area(v);n=h;l=f;h+=1;f+=-1;h< +0&&(h+=b.length);h%=b.length;f<0&&(f+=k.length);f%=k.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;p=[k[f],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(p);v=[k[f],k[e],b[h]];v=THREE.FontUtils.Triangulate.area(v);m+o>p+v&&(h=n,f=l,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=k.length),f%=k.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:k.length-1);m=b.slice(0,h);o=b.slice(h);n=k.slice(f);l=k.slice(0,f);e=[k[f],k[e],b[h]];s.push([k[f],b[h],b[g]]);s.push(e);b=m.concat(n).concat(l).concat(o)}return{shape:b, isolatedPts:s,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,k={};e=0;for(f=d.length;e=0?a:a+f;c=this.verticalAngleMap.srcRange; @@ -491,22 +491,22 @@ b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?m=o:m.addSelf(a. b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=l=b.getMouseOnScreen(a.clientX,a.clientY),m=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=b.getMouseOnScreen(a.clientX, a.clientY):e===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=l=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(), e=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&e===d.NONE){if(a.keyCode===b.keys[d.ROTATE])e=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)e=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)e=d.PAN;e!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&e!==d.NONE)e=d.NONE},!1)}; -THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,l,m){var n,o,p=d||1,q=g||1,s=h/2,v=i/2,u=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",q=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",p=e||1;var y=p+1,F=q+1;h/=p;var B=i/q;for(o=0;o0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;ha&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){O=C;j=C-1;j<0&&(j=a.length-1);for(var b= -0,c=n+l*2,b=0;b=0;R--){fa=R/l;M=i*(1-fa);fa=k*Math.sin(fa*Math.PI/2);C=0;for(P=y.length;C=0;R--){ea=R/l;M=i*(1-ea);ea=k*Math.sin(ea*Math.PI/2);C=0;for(P=y.length;C0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,o)))-1);k.push(l)}c.push(k)}for(var n,s,p,g=c.length,b=0;b0)for(d=0;d1&&(n= -this.vertices[f].position.clone(),s=this.vertices[i].position.clone(),p=this.vertices[k].position.clone(),n.normalize(),s.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,m,u]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry; +e-1:d];k=c[b-1][k?0:d+1];o=b/(g-1);n=(b-1)/(g-1);s=(d+1)/e;var m=d/e,l=new THREE.UV(1-s,o),o=new THREE.UV(1-m,o),m=new THREE.UV(1-m,n),v=new THREE.UV(1-s,n);b1&&(n= +this.vertices[f].position.clone(),s=this.vertices[i].position.clone(),p=this.vertices[k].position.clone(),n.normalize(),s.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,m,v]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry; THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d= -0,g=String(a).split(""),e=g.length,f=[],a=0;a0)for(k=0;k2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);l=k+1;g<=l&&(l=0);var o;a:{o=a;var n=i,s=k,p=l,u=g,v=f,y=void 0,q=void 0,t=void 0, -w=void 0,z=void 0,L=void 0,J=void 0,I=void 0,D=void 0,q=o[v[n]].x,t=o[v[n]].y,w=o[v[s]].x,z=o[v[s]].y,L=o[v[p]].x,J=o[v[p]].y;if(1.0E-10>(w-q)*(J-t)-(z-t)*(L-q))o=!1;else{for(y=0;y=0&&R>=0&&M>=0){o=!1;break a}}o= +0,g=String(a).split(""),e=g.length,f=[],a=0;a0)for(k=0;k2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);l=k+1;g<=l&&(l=0);var o;a:{o=a;var n=i,s=k,p=l,v=g,u=f,y=void 0,q=void 0,t=void 0, +w=void 0,z=void 0,L=void 0,J=void 0,I=void 0,D=void 0,q=o[u[n]].x,t=o[u[n]].y,w=o[u[s]].x,z=o[u[s]].y,L=o[u[p]].x,J=o[u[p]].y;if(1.0E-10>(w-q)*(J-t)-(z-t)*(L-q))o=!1;else{for(y=0;y=0&&R>=0&&M>=0){o=!1;break a}}o= !0}}if(o){e.push([a[f[i]],a[f[k]],a[f[l]]]);h.push([f[i],f[k],f[l]]);i=k;for(l=k+1;l0;)this.smooth(a)}; THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var l,j,n,m=0;m<4;m++){n=i[m];l=new THREE.Color;l.setRGB(0,0,0);for(var p=0;p>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=l(a,b),d=l(a,b+1),e=l(a,b+2);return(l(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=l(a,b);return(l(a,b+1)<<8)+c}function k(a,b){var c=l(a,b);return c>127?c-256:c}function l(a,b){return a.charCodeAt(b)&255}function m(b){var c, -d,e;c=g(a,b);d=g(a,b+z);e=g(a,b+L);b=i(a,b+J);v.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+z);e=g(a,b+L);f=i(a,b+J);j=g(a,b+I);k=g(a,b+D);l=g(a,b+C);var b=t[k*3],m=t[k*3+1];k=t[k*3+2];var n=t[l*3],o=t[l*3+1];l=t[l*3+2];v.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(t[j*3],t[j*3+1],t[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+P);e=g(a,b+R);f=g(a,b+fa);b=i(a,b+M);v.faces.push(new THREE.Face4(c, -d,e,f,null,null,b))}function s(b){var c,d,e,f,j,k,l,m,n;c=g(a,b);d=g(a,b+P);e=g(a,b+R);f=g(a,b+fa);j=i(a,b+M);k=g(a,b+N);l=g(a,b+ga);m=g(a,b+ka);n=g(a,b+Z);var b=t[l*3],o=t[l*3+1];l=t[l*3+2];var x=t[m*3],p=t[m*3+1];m=t[m*3+2];var E=t[n*3],q=t[n*3+1];n=t[n*3+2];v.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(t[k*3],t[k*3+1],t[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(x,p,m),new THREE.Vector3(E,q,n)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+F);e=g(a,b+B);b=w[c*2];f=w[c*2+ -1];c=w[d*2];var i=v.faceVertexUvs[0];d=w[d*2+1];var j=w[e*2];e=w[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function u(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+Q);e=g(a,b+O);f=g(a,b+j);b=w[c*2];i=w[c*2+1];c=w[d*2];k=w[d*2+1];d=w[e*2];var l=v.faceVertexUvs[0];e=w[e*2+1];var m=w[f*2];f=w[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,k));n.push(new THREE.UV(d,e));n.push(new THREE.UV(m,f));l.push(n)}var v=this,y=0,q,t=[],w=[],z, -L,J,I,D,C,P,R,fa,M,N,ga,ka,Z,F,B,Q,O,j,ha,aa,V,ba,U,ea;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(v,d,b);q={signature:a.substr(y,8),header_bytes:l(a,y+8),vertex_coordinate_bytes:l(a,y+9),normal_coordinate_bytes:l(a,y+10),uv_coordinate_bytes:l(a,y+11),vertex_index_bytes:l(a,y+12),normal_index_bytes:l(a,y+13),uv_index_bytes:l(a,y+14),material_index_bytes:l(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a, -y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=q.header_bytes;z=q.vertex_index_bytes;L=q.vertex_index_bytes*2;J=q.vertex_index_bytes*3;I=q.vertex_index_bytes*3+q.material_index_bytes;D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;C=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;P=q.vertex_index_bytes;R=q.vertex_index_bytes*2;fa=q.vertex_index_bytes*3;M=q.vertex_index_bytes* -4;N=q.vertex_index_bytes*4+q.material_index_bytes;ga=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ka=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;Z=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;F=q.uv_index_bytes;B=q.uv_index_bytes*2;Q=q.uv_index_bytes;O=q.uv_index_bytes*2;j=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;ea=q.vertex_index_bytes*4+q.material_index_bytes;ha=q.ntri_flat*b;aa=q.ntri_smooth*(b+q.normal_index_bytes* -3);V=q.ntri_flat_uv*(b+q.uv_index_bytes*3);ba=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);U=q.nquad_flat*ea;b=q.nquad_smooth*(ea+q.normal_index_bytes*4);ea=q.nquad_flat_uv*(ea+q.uv_index_bytes*4);y+=function(b){for(var d,e,g,h=q.vertex_coordinate_bytes*3,i=b+q.nvertices*h;b=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p1){j=new THREE.MeshFaceMaterial;for(h=0;h1){j=new THREE.MeshFaceMaterial;for(h=0;h1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation, b.scale);for(f=0;f1?c[1].substr(0,b):"0";c[1].length1?c[1].substr(0,b):"0";c[1].length=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift(); for(d=0;db){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4? g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};m.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};D.prototype.create=function(){var a= -{},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof I)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ca[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(va+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color= +a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new I).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=fa.evaluate(".//dae:float",c,ga,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};D.prototype.create=function(){var a= +{},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof I)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=aa[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(va+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color= d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Aa;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var b=0;b=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("("); -a=e.shift();for(b=0;b=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("("); +a=e.shift();for(b=0;b1&&(fa=new THREE.MeshFaceMaterial);a=new THREE.Mesh(D,fa);a.name=n;a.position.set(w[0],w[1],w[2]);L?(a.quaternion.set(L[0],L[1],L[2],L[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(J[0],J[1],J[2]);a.visible=y.visible;B.scene.add(a);B.objects[n]=a;if(y.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(y.castsShadow)b=new THREE.ShadowVolume(D),B.scene.add(b), +THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(n in M.objects)if(!B.objects[n])if(y=M.objects[n],y.geometry!==void 0){if(D=B.geometries[y.geometry]){a=!1;for(O=0;O1&&(ea=new THREE.MeshFaceMaterial);a=new THREE.Mesh(D,ea);a.name=n;a.position.set(w[0],w[1],w[2]);L?(a.quaternion.set(L[0],L[1],L[2],L[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(J[0],J[1],J[2]);a.visible=y.visible;B.scene.add(a);B.objects[n]=a;if(y.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(y.castsShadow)b=new THREE.ShadowVolume(D),B.scene.add(b), b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(b={type:y.trigger,object:y},B.triggers[a.name]=b)}}else w=y.position,z=y.rotation,L=y.quaternion,J=y.scale,L=0,a=new THREE.Object3D,a.name=n,a.position.set(w[0],w[1],w[2]),L?(a.quaternion.set(L[0],L[1],L[2],L[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(J[0],J[1],J[2]),a.visible=y.visible!==void 0?y.visible:!1,B.scene.add(a),B.objects[n]=a,B.empties[n]=a,y.trigger&&y.trigger.toLowerCase()!= -"none"&&(b={type:y.trigger,object:y},B.triggers[a.name]=b)}function i(a){return function(c){B.geometries[a]=c;h();ga-=1;b.onLoadComplete();l()}}function k(a){return function(b){B.geometries[a]=b}}function l(){b.callbackProgress({totalModels:Z,totalTextures:F,loadedModels:Z-ga,loadedTextures:F-ka},B);b.onLoadProgress();ga==0&&ka==0&&c(B)}var m,o,n,s,p,u,v,y,q,t,w,z,L,J,I,D,C,P,R,fa,M,N,ga,ka,Z,F,B;M=a.data;R=new THREE.BinaryLoader;N=new THREE.JSONLoader;ka=ga=0;B={scene:new THREE.Scene,geometries:{}, +"none"&&(b={type:y.trigger,object:y},B.triggers[a.name]=b)}function i(a){return function(c){B.geometries[a]=c;h();$-=1;b.onLoadComplete();l()}}function k(a){return function(b){B.geometries[a]=b}}function l(){b.callbackProgress({totalModels:ga,totalTextures:F,loadedModels:ga-$,loadedTextures:F-ka},B);b.onLoadProgress();$==0&&ka==0&&c(B)}var m,o,n,s,p,v,u,y,q,t,w,z,L,J,I,D,C,P,R,ea,M,N,$,ka,ga,F,B;M=a.data;R=new THREE.BinaryLoader;N=new THREE.JSONLoader;ka=$=0;B={scene:new THREE.Scene,geometries:{}, materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in M.objects)if(y=M.objects[n],y.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(M.transform){a=M.transform.position;q=M.transform.rotation;var Q=M.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);q&&B.scene.rotation.set(q[0],q[1],q[2]);Q&&B.scene.scale.set(Q[0],Q[1],Q[2]);(a||q||Q)&&B.scene.updateMatrix()}a=function(){ka-=1;l();b.onLoadComplete()};for(p in M.cameras)q= M.cameras[p],q.type=="perspective"?C=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):q.type=="ortho"&&(C=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),w=q.position,q=q.target,C.position.set(w[0],w[1],w[2]),C.target=new THREE.Vector3(q[0],q[1],q[2]),B.cameras[p]=C;for(s in M.lights)q=M.lights[s],p=q.color!==void 0?q.color:16777215,C=q.intensity!==void 0?q.intensity:1,q.type=="directional"?(w=q.direction,t=new THREE.DirectionalLight(p,C),t.position.set(w[0],w[1], -w[2]),t.position.normalize()):q.type=="point"?(w=q.position,t=q.distance,t=new THREE.PointLight(p,C,t),t.position.set(w[0],w[1],w[2])):q.type=="ambient"&&(t=new THREE.AmbientLight(p)),B.scene.add(t),B.lights[s]=t;for(u in M.fogs)s=M.fogs[u],s.type=="linear"?P=new THREE.Fog(0,s.near,s.far):s.type=="exp2"&&(P=new THREE.FogExp2(0,s.density)),q=s.color,P.color.setRGB(q[0],q[1],q[2]),B.fogs[u]=P;if(B.cameras&&M.defaults.camera)B.currentCamera=B.cameras[M.defaults.camera];if(B.fogs&&M.defaults.fog)B.scene.fog= -B.fogs[M.defaults.fog];q=M.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(q[0],q[1],q[2]);B.bgColorAlpha=M.defaults.bgalpha;for(m in M.geometries)if(u=M.geometries[m],u.type=="bin_mesh"||u.type=="ascii_mesh")ga+=1,b.onLoadStart();Z=ga;for(m in M.geometries)u=M.geometries[m],u.type=="cube"?(D=new THREE.CubeGeometry(u.width,u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),B.geometries[m]=D):u.type=="plane"?(D=new THREE.PlaneGeometry(u.width,u.height, -u.segmentsWidth,u.segmentsHeight),B.geometries[m]=D):u.type=="sphere"?(D=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),B.geometries[m]=D):u.type=="cylinder"?(D=new THREE.CylinderGeometry(u.topRad,u.botRad,u.height,u.radSegs,u.heightSegs),B.geometries[m]=D):u.type=="torus"?(D=new THREE.TorusGeometry(u.radius,u.tube,u.segmentsR,u.segmentsT),B.geometries[m]=D):u.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(u.subdivisions),B.geometries[m]=D):u.type=="bin_mesh"?R.load(d(u.url, -M.urlBaseType),i(m)):u.type=="ascii_mesh"?N.load(d(u.url,M.urlBaseType),i(m)):u.type=="embedded_mesh"&&(u=M.embeds[u.id])&&N.createModel(u,k(m),"");for(v in M.textures)if(m=M.textures[v],m.url instanceof Array){ka+=m.url.length;for(R=0;R=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var e=0,f=0;f>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g=this.maxCount-3&&h(this)};this.begin= function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;cthis.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(l-h);n<1&&(n=1);h=Math.floor(l+h); -h>this.size-1&&(h=this.size-1);for(var s,p,u,v,y,q;m0&&(this.field[u+s]+=v)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,m=this.zd,o=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g0)for(e=0;ethis.size-1&&(h=this.size-1);for(var s,p,v,u,y,q;m0&&(this.field[v+s]+=u)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,m=this.zd,o=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g0)for(e=0;el&&(s=l);for(e=0;e0){i=e*m;for(g=0;gl&&(s=l);for(f=0;f0){i=o*f;for(e=0;e=0&&B>=0&&t+B<1}for(var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h,i,o,r,j,q,t,B,G,L=[],N=0,ka=a.children.length;Na.scale.x)return[];G={distance:N,point:a.position, -face:null,object:a};L.push(G)}else if(a instanceof THREE.Mesh){N=b(this.origin,this.direction,a.matrixWorld.getPosition());if(N===null||N>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return L;var P,U,Y,E,M,C,D,V,ca=a.geometry,Z=ca.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);N=0;for(ka=ca.faces.length;N0:C<0)))if(C=M.dot((new THREE.Vector3).sub(P,D))/C,D=D.addSelf(V.multiplyScalar(C)),G instanceof THREE.Face3)c(D,P,U,Y)&&(G={distance:this.origin.distanceTo(D),point:D,face:G,object:a}, -L.push(G));else if(G instanceof THREE.Face4&&(c(D,P,U,E)||c(D,U,Y,E)))G={distance:this.origin.distanceTo(D),point:D,face:G,object:a},L.push(G)}return L}}; +f.copy(c).subSelf(b);g.copy(a).subSelf(b);h=e.dot(e);i=e.dot(f);o=e.dot(g);r=f.dot(f);j=f.dot(g);q=1/(h*r-i*i);s=(r*o-i*j)*q;B=(h*j-i*o)*q;return s>=0&&B>=0&&s+B<1}for(var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h,i,o,r,j,q,s,B,G,L=[],N=0,ka=a.children.length;Na.scale.x)return[];G={distance:N,point:a.position, +face:null,object:a};L.push(G)}else if(a instanceof THREE.Mesh){N=b(this.origin,this.direction,a.matrixWorld.getPosition());if(N===null||N>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return L;var P,U,Y,E,M,C,D,V,ba=a.geometry,ha=ba.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);N=0;for(ka=ba.faces.length;N0:C<0)))if(C=M.dot((new THREE.Vector3).sub(P,D))/C,D=D.addSelf(V.multiplyScalar(C)),G instanceof THREE.Face3)c(D,P,U,Y)&&(G={distance:this.origin.distanceTo(D),point:D,face:G, +object:a},L.push(G));else if(G instanceof THREE.Face4&&(c(D,P,U,E)||c(D,U,Y,E)))G={distance:this.origin.distanceTo(D),point:D,face:G,object:a},L.push(G)}return L}}; THREE.Rectangle=function(){function a(){g=e-b;h=f-c}var b,c,e,f,g,h,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,h,j,q){i=!1;b=g;c=h;e=j;f=q;a()};this.addPoint=function(g,h){i?(i=!1,b=g,c=h,e=g,f=h):(b=bg?e:g,f=f>h?f:h);a()};this.add3Points= -function(g,h,j,q,t,B){i?(i=!1,b=gj?g>t?g:t:j>t?j:t,f=h>q?h>B?h:B:q>B?q:B):(b=gj?g>t?g>e?g:e:t>e?t:e:j>t?j>e?j:e:t>e?t:e,f=h>q?h>B?h>f?h:f:B>f?B:f:q>B?q>f?q:f:B>f?B:f);a()};this.addRectangle=function(g){i?(i=!1,b=g.getLeft(),c=g.getTop(),e=g.getRight(),f=g.getBottom()):(b=bg.getRight()?e:g.getRight(),f=f> +function(g,h,j,q,s,B){i?(i=!1,b=gj?g>s?g:s:j>s?j:s,f=h>q?h>B?h:B:q>B?q:B):(b=gj?g>s?g>e?g:e:s>e?s:e:j>s?j>e?j:e:s>e?s:e,f=h>q?h>B?h>f?h:f:B>f?B:f:q>B?q>f?q:f:B>f?B:f);a()};this.addRectangle=function(g){i?(i=!1,b=g.getLeft(),c=g.getTop(),e=g.getRight(),f=g.getBottom()):(b=bg.getRight()?e:g.getRight(),f=f> g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;e+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();e=e=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;f=e=c=b=0;a()};this.isEmpty=function(){return i}}; THREE.Math={clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a=0&&f>=0&&h>=0&&i>=0?!0:g<0&&f<0||h<0&&i<0?!1:(g<0?c=Math.max(c,g/(g-f)):f<0&&(e=Math.min(e,g/(g-f))),h<0?c=Math.max(c,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),eh&&i.positionScreen.zh&&i.positionScreen.z0&&C.z<1))h=Y[U]=Y[U]||new THREE.RenderableParticle,U++,P=h,P.x=C.x/C.w,P.y=C.y/C.w,P.z=C.z,P.rotation=S.rotation.z,P.scale.x=S.scale.x*Math.abs(P.x-(C.x+g.projectionMatrix.n11)/(C.w+g.projectionMatrix.n14)),P.scale.y=S.scale.y*Math.abs(P.y-(C.y+g.projectionMatrix.n22)/(C.w+g.projectionMatrix.n24)),P.material= S.material,E.elements.push(P);f&&E.elements.sort(c);return E}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,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;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),h=a*b,i=e*f;this.w=h*g-i*c;this.x=h*c+i*g;this.y=e*b*g+a*f*c;this.z=a*f*g-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c); @@ -82,14 +82,14 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid c,e,f,g,h,i=new THREE.Vector3,o=new THREE.Vector3;e=0;for(f=this.faces.length;e0){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.zthis.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;bthis.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;r=this.points[c[0]];j=this.points[c[1]]; -q=this.points[c[2]];t=this.points[c[3]];i=h*h;o=h*i;e.x=b(r.x,j.x,q.x,t.x,h,i,o);e.y=b(r.y,j.y,q.y,t.y,h,i,o);e.z=b(r.z,j.z,q.z,t.z,h,i,o);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;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[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;bthis.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;r=this.points[c[0]];j=this.points[c[1]]; +q=this.points[c[2]];s=this.points[c[3]];i=h*h;o=h*i;e.x=b(r.x,j.x,q.x,s.x,h,i,o);e.y=b(r.y,j.y,q.y,s.y,h,i,o);e.z=b(r.z,j.z,q.z,s.z,h,i,o);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a=0)b=b.geometry.materials[d],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=c)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function t(a,b){var c,e,f;c=s.attributes;var g=s.uniforms,h=Ea/Ha,n,i=[],j=Ha*0.5,l=Ea*0.5,p=!0;d.useProgram(s.program); -S=s.program;qa=Na=sa=-1;Ra||(d.enableVertexAttribArray(s.attributes.position),d.enableVertexAttribArray(s.attributes.uv),Ra=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,s.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s.elementBuffer);d.uniformMatrix4fv(g.projectionMatrix,!1,La);d.activeTexture(d.TEXTURE0);d.uniform1i(g.map,0);c=0;for(e=a.__webglSprites.length;c< +b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function q(a){var b=a.object,d=a.buffer,c;c=b.material;if(c instanceof THREE.MeshFaceMaterial){if(d=d.materialIndex,d>=0)b=b.geometry.materials[d],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=c)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function s(a,b){var c,e,f;c=t.attributes;var g=t.uniforms,h=Ea/Ha,n,i=[],j=Ha*0.5,l=Ea*0.5,p=!0;d.useProgram(t.program); +S=t.program;qa=Na=sa=-1;Ra||(d.enableVertexAttribArray(t.attributes.position),d.enableVertexAttribArray(t.attributes.uv),Ra=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,t.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,t.elementBuffer);d.uniformMatrix4fv(g.projectionMatrix,!1,La);d.activeTexture(d.TEXTURE0);d.uniform1i(g.map,0);c=0;for(e=a.__webglSprites.length;c< e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(o);c=0;for(e=a.__webglSprites.length;c=0;d--)a[d].object===b&&a.splice(d,1)}function ka(a,b,c,e,f){e.program||F.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var g=0,h=F.maxMorphTargets;g0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Wa};this.setSize=function(a,b){ua.width=a;ua.height=b;this.setViewport(0,0,ua.width,ua.height)};this.setViewport=function(a,b,c,e){Pa=a;Qa=b;Ha=c;Ea=e;d.viewport(Pa,Qa,Ha,Ea)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)}; -this.setClearColorHex=function(a,b){O.setHex(a);ma=b;d.clearColor(O.r,O.g,O.b,ma)};this.setClearColor=function(a,b){O.copy(a);ma=b;d.clearColor(O.r,O.g,O.b,ma)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return ma};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.clearTarget=function(a,b,c,d){ba(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit= +this.setClearColorHex=function(a,b){O.setHex(a);la=b;d.clearColor(O.r,O.g,O.b,la)};this.setClearColor=function(a,b){O.copy(a);la=b;d.clearColor(O.r,O.g,O.b,la)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return la};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.clearTarget=function(a,b,c,d){ma(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit= !1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];d.deleteBuffer(c.__webglVertexBuffer);d.deleteBuffer(c.__webglNormalBuffer);d.deleteBuffer(c.__webglTangentBuffer);d.deleteBuffer(c.__webglColorBuffer);d.deleteBuffer(c.__webglUVBuffer);d.deleteBuffer(c.__webglUV2Buffer);d.deleteBuffer(c.__webglSkinVertexABuffer);d.deleteBuffer(c.__webglSkinVertexBBuffer); d.deleteBuffer(c.__webglSkinIndicesBuffer);d.deleteBuffer(c.__webglSkinWeightsBuffer);d.deleteBuffer(c.__webglFaceBuffer);d.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e=0;e--)if(Q=a.__webglObjects[e],Q.render&&(R=Q.object,l=Q.buffer,W=Q.opaque))U(R),Y(W.depthTest),E(W.depthWrite),M(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),g(b,p,B,W,l,R);for(e=0;e65535&&(z[p].counter+=1,s=z[p].hash+"_"+z[p].counter,j.geometryGroups[s]===void 0&&(j.geometryGroups[s]={faces3:[],faces4:[],materialIndex:q,vertices:0,numMorphTargets:t})),r instanceof THREE.Face3?j.geometryGroups[s].faces3.push(o):j.geometryGroups[s].faces4.push(o),j.geometryGroups[s].vertices+= +a.__webglObjectsImmediate[e],R=Q.object,R.visible&&(R.matrixAutoUpdate&&R.matrixWorld.flattenToArray(R._objectMatrixArray),P(R,b,!0),j(Q));if(a.overrideMaterial){Y(a.overrideMaterial.depthTest);C(a.overrideMaterial.blending);for(e=0;e=0;e--)if(Q=a.__webglObjects[e],Q.render&&(R=Q.object,l=Q.buffer,W=Q.opaque))U(R),Y(W.depthTest),E(W.depthWrite),M(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),g(b,p,B,W,l,R);for(e=0;e65535&&(z[p].counter+=1,t=z[p].hash+"_"+z[p].counter,j.geometryGroups[t]===void 0&&(j.geometryGroups[t]={faces3:[],faces4:[],materialIndex:q,vertices:0,numMorphTargets:s})),r instanceof THREE.Face3?j.geometryGroups[t].faces3.push(o):j.geometryGroups[t].faces4.push(o),j.geometryGroups[t].vertices+= l;j.geometryGroupsList=[];o=void 0;for(o in j.geometryGroups)j.geometryGroups[o].id=Ia++,j.geometryGroupsList.push(j.geometryGroups[o])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){o=j;o.__webglVertexBuffer=d.createBuffer();o.__webglNormalBuffer=d.createBuffer();o.__webglTangentBuffer=d.createBuffer();o.__webglColorBuffer=d.createBuffer();o.__webglUVBuffer=d.createBuffer();o.__webglUV2Buffer=d.createBuffer();o.__webglSkinVertexABuffer=d.createBuffer();o.__webglSkinVertexBBuffer= -d.createBuffer();o.__webglSkinIndicesBuffer=d.createBuffer();o.__webglSkinWeightsBuffer=d.createBuffer();o.__webglFaceBuffer=d.createBuffer();o.__webglLineBuffer=d.createBuffer();if(o.numMorphTargets){r=n=void 0;o.__webglMorphTargetsBuffers=[];n=0;for(r=o.numMorphTargets;n0||l.faceVertexUvs.length>0)j.__uvArray=new Float32Array(o* +d.createBuffer();o.__webglSkinIndicesBuffer=d.createBuffer();o.__webglSkinWeightsBuffer=d.createBuffer();o.__webglFaceBuffer=d.createBuffer();o.__webglLineBuffer=d.createBuffer();if(o.numMorphTargets){r=n=void 0;o.__webglMorphTargetsBuffers=[];n=0;for(r=o.numMorphTargets;n0||l.faceVertexUvs.length>0)j.__uvArray=new Float32Array(o* 2);if(l.faceUvs.length>1||l.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(o*2)}if(q.geometry.skinWeights.length&&q.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(o*4),j.__skinVertexBArray=new Float32Array(o*4),j.__skinIndexArray=new Float32Array(o*4),j.__skinWeightArray=new Float32Array(o*4);j.__faceArray=new Uint16Array(r*3);j.__lineArray=new Uint16Array(p*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];q=0;for(l=j.numMorphTargets;q=0;i--)g[i]===h&&g.splice(i,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&N(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f0&&(d.bindBuffer(d.ARRAY_BUFFER,n.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,$,r),d.bindBuffer(d.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,aa,r),d.bindBuffer(d.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,H,r),d.bindBuffer(d.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER, -ia,r))}if(ua&&P){l=0;for(p=z.length;l0&&(d.bindBuffer(d.ARRAY_BUFFER,n.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,fa,r))}if(ta&&ba.hasTangents){l=0;for(p=z.length;l0&&(d.bindBuffer(d.ARRAY_BUFFER,n.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ja,r))}if(ma&&wa&&ca){l=0;for(p=z.length;l0&&(d.bindBuffer(d.ARRAY_BUFFER,n.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,m,r))}if(Z){l=0;for(p=z.length;l0&&(d.bindBuffer(d.ARRAY_BUFFER,n.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,Z,r),d.bindBuffer(d.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,$,r),d.bindBuffer(d.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,H,r),d.bindBuffer(d.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ia,r))}if(ua&&P){l=0;for(p=z.length;l< +p;l++)u=ga[z[l]],v=u.vertexColors,H=u.color,v.length===3&&P===THREE.VertexColors?(u=v[0],Z=v[1],$=v[2]):$=Z=u=H,ea[da]=u.r,ea[da+1]=u.g,ea[da+2]=u.b,ea[da+3]=Z.r,ea[da+4]=Z.g,ea[da+5]=Z.b,ea[da+6]=$.r,ea[da+7]=$.g,ea[da+8]=$.b,da+=9;l=0;for(p=s.length;l0&&(d.bindBuffer(d.ARRAY_BUFFER,n.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,ea,r))}if(ta&&aa.hasTangents){l=0;for(p=z.length;l0&&(d.bindBuffer(d.ARRAY_BUFFER,n.__webglUVBuffer), +d.bufferData(d.ARRAY_BUFFER,ha,r))}if(la&&wa&&ba){l=0;for(p=z.length;l0&&(d.bindBuffer(d.ARRAY_BUFFER,n.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,m,r))}if(ma){l=0;for(p=z.length;l=0&&d.enableVertexAttribArray(q.position);q.color>=0&&d.enableVertexAttribArray(q.color);q.normal>=0&&d.enableVertexAttribArray(q.normal); +o);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t=0&&d.enableVertexAttribArray(q.position);q.color>=0&&d.enableVertexAttribArray(q.color);q.normal>=0&&d.enableVertexAttribArray(q.normal); q.tangent>=0&&d.enableVertexAttribArray(q.tangent);a.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0&&(d.enableVertexAttribArray(q.skinVertexA),d.enableVertexAttribArray(q.skinVertexB),d.enableVertexAttribArray(q.skinIndex),d.enableVertexAttribArray(q.skinWeight));if(a.attributes)for(g in a.attributes)q[g]!==void 0&&q[g]>=0&&d.enableVertexAttribArray(q[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g=0&&(d.enableVertexAttribArray(q[t]), a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)}}; THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type: diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index a19d566a..d6306a85 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -2214,20 +2214,19 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - value = customAttribute.value[ offset_customSrc ]; + value = customAttribute.value[ chunk_faces3[ f ] ]; customAttribute.array[ offset_custom ] = value; customAttribute.array[ offset_custom + 1 ] = value; customAttribute.array[ offset_custom + 2 ] = value; offset_custom += 3; - offset_customSrc += 1; } for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) { - value = customAttribute.value[ offset_customSrc ]; + value = customAttribute.value[ chunk_faces4[ f ] ]; customAttribute.array[ offset_custom ] = value; customAttribute.array[ offset_custom + 1 ] = value; @@ -2235,7 +2234,6 @@ THREE.WebGLRenderer = function ( parameters ) { customAttribute.array[ offset_custom + 3 ] = value; offset_custom += 4; - offset_customSrc += 1; } @@ -2320,7 +2318,7 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - value = customAttribute.value[ offset_customSrc ]; + value = customAttribute.value[ chunk_faces3[ f ] ]; v1 = value; v2 = value; @@ -2336,13 +2334,12 @@ THREE.WebGLRenderer = function ( parameters ) { customAttribute.array[ offset_custom + 5 ] = v3.y; offset_custom += 6; - offset_customSrc += 1; } for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) { - value = customAttribute.value[ offset_customSrc ]; + value = customAttribute.value[ chunk_faces4[ f ] ]; v1 = value; v2 = value; @@ -2362,7 +2359,6 @@ THREE.WebGLRenderer = function ( parameters ) { customAttribute.array[ offset_custom + 7 ] = v4.y; offset_custom += 8; - offset_customSrc += 1; } @@ -2480,7 +2476,6 @@ THREE.WebGLRenderer = function ( parameters ) { customAttribute.array[ offset_custom + 11 ] = v4[ pp[ 2 ] ]; offset_custom += 12; - offset_customSrc += 1; } @@ -2488,7 +2483,7 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - value = customAttribute.value[ offset_customSrc ]; + value = customAttribute.value[ chunk_faces3[ f ] ]; v1 = value; v2 = value; @@ -2507,13 +2502,12 @@ THREE.WebGLRenderer = function ( parameters ) { customAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ]; offset_custom += 9; - offset_customSrc += 1; } for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) { - value = customAttribute.value[ offset_customSrc ]; + value = customAttribute.value[ chunk_faces4[ f ] ]; v1 = value; v2 = value; @@ -2537,7 +2531,6 @@ THREE.WebGLRenderer = function ( parameters ) { customAttribute.array[ offset_custom + 11 ] = v4[ pp[ 2 ] ]; offset_custom += 12; - offset_customSrc += 1; } @@ -2664,7 +2657,7 @@ THREE.WebGLRenderer = function ( parameters ) { for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) { - value = customAttribute.value[ offset_customSrc ]; + value = customAttribute.value[ chunk_faces3[ f ] ]; v1 = value; v2 = value; @@ -2686,13 +2679,12 @@ THREE.WebGLRenderer = function ( parameters ) { customAttribute.array[ offset_custom + 11 ] = v3.w; offset_custom += 12; - offset_customSrc += 1; } for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) { - value = customAttribute.value[ offset_customSrc ]; + value = customAttribute.value[ chunk_faces4[ f ] ]; v1 = value; v2 = value; @@ -2720,7 +2712,6 @@ THREE.WebGLRenderer = function ( parameters ) { customAttribute.array[ offset_custom + 15 ] = v4.w; offset_custom += 16; - offset_customSrc += 1; }