|
@@ -15,64 +15,64 @@ Math.abs(c)>1.0E-5?(this.x=Math.atan2(-a.n23/c,a.n33/c),this.z=Math.atan2(-a.n12
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-
|
|
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())},
|
|
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};
|
|
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,e=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(e,this.intersectObject(a[c]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function c(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function b(a,b,c,u){e.copy(u).subSelf(b);
|
|
|
|
-l.copy(c).subSelf(b);h.copy(a).subSelf(b);f=e.dot(e);k=e.dot(l);n=e.dot(h);t=l.dot(l);v=l.dot(h);p=1/(f*t-k*k);x=(t*n-k*v)*p;w=(f*v-k*n)*p;return x>=0&&w>=0&&x+w<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,h=new THREE.Vector3,f,k,n,t,v,p,x,w,z,u=[],B=0,y=a.children.length;B<y;B++)Array.prototype.push.apply(u,this.intersectObject(a.children[B]));if(a instanceof THREE.Particle){B=c(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.scale.x)return[];z={distance:B,point:a.position,
|
|
|
|
-face:null,object:a};u.push(z)}else if(a instanceof THREE.Mesh){B=c(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return u;var E,C,H,L,R,D,O,J,N=a.geometry,K=N.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);B=0;for(y=N.faces.length;B<y;B++)if(z=N.faces[B],O=this.origin.clone(),J=this.direction.clone(),L=a.matrixWorld,E=L.multiplyVector3(z.centroid.clone()).subSelf(O),D=E.dot(J),
|
|
|
|
-!(D<=0)&&(E=L.multiplyVector3(K[z.a].position.clone()),C=L.multiplyVector3(K[z.b].position.clone()),H=L.multiplyVector3(K[z.c].position.clone()),L=z instanceof THREE.Face4?L.multiplyVector3(K[z.d].position.clone()):null,R=a.matrixRotationWorld.multiplyVector3(z.normal.clone()),D=J.dot(R),a.doubleSided||(a.flipSided?D>0:D<0)))if(D=R.dot((new THREE.Vector3).sub(E,O))/D,O=O.addSelf(J.multiplyScalar(D)),z instanceof THREE.Face3)b(O,E,C,H)&&(z={distance:this.origin.distanceTo(O),point:O,face:z,object:a},
|
|
|
|
-u.push(z));else if(z instanceof THREE.Face4&&(b(O,E,C,L)||b(O,C,H,L)))z={distance:this.origin.distanceTo(O),point:O,face:z,object:a},u.push(z)}return u}};
|
|
|
|
-THREE.Rectangle=function(){function a(){h=e-c;f=l-b}var c,b,e,l,h,f,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return h};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(h,f,v,p){k=!1;c=h;b=f;e=v;l=p;a()};this.addPoint=function(h,f){k?(k=!1,c=h,b=f,e=h,l=f):(c=c<h?c:h,b=b<f?b:f,e=e>h?e:h,l=l>f?l:f);a()};this.add3Points=
|
|
|
|
-function(h,f,v,p,x,w){k?(k=!1,c=h<v?h<x?h:x:v<x?v:x,b=f<p?f<w?f:w:p<w?p:w,e=h>v?h>x?h:x:v>x?v:x,l=f>p?f>w?f:w:p>w?p:w):(c=h<v?h<x?h<c?h:c:x<c?x:c:v<x?v<c?v:c:x<c?x:c,b=f<p?f<w?f<b?f:b:w<b?w:b:p<w?p<b?p:b:w<b?w:b,e=h>v?h>x?h>e?h:e:x>e?x:e:v>x?v>e?v:e:x>e?x:e,l=f>p?f>w?f>l?f:l:w>l?w:l:p>w?p>l?p:l:w>l?w:l);a()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),b=h.getTop(),e=h.getRight(),l=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),b=b<h.getTop()?b:h.getTop(),e=e>h.getRight()?e:h.getRight(),l=l>
|
|
|
|
|
|
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,e=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(e,this.intersectObject(a[c]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function c(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function b(a,b,c,t){e.copy(t).subSelf(b);
|
|
|
|
+l.copy(c).subSelf(b);h.copy(a).subSelf(b);f=e.dot(e);k=e.dot(l);n=e.dot(h);p=l.dot(l);v=l.dot(h);u=1/(f*p-k*k);x=(p*n-k*v)*u;w=(f*v-k*n)*u;return x>=0&&w>=0&&x+w<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,h=new THREE.Vector3,f,k,n,p,v,u,x,w,y,t=[],B=0,A=a.children.length;B<A;B++)Array.prototype.push.apply(t,this.intersectObject(a.children[B]));if(a instanceof THREE.Particle){B=c(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.scale.x)return[];y={distance:B,point:a.position,
|
|
|
|
+face:null,object:a};t.push(y)}else if(a instanceof THREE.Mesh){B=c(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return t;var D,C,H,O,T,E,S,K,N=a.geometry,L=N.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);B=0;for(A=N.faces.length;B<A;B++)if(y=N.faces[B],S=this.origin.clone(),K=this.direction.clone(),O=a.matrixWorld,D=O.multiplyVector3(y.centroid.clone()).subSelf(S),E=D.dot(K),
|
|
|
|
+!(E<=0)&&(D=O.multiplyVector3(L[y.a].position.clone()),C=O.multiplyVector3(L[y.b].position.clone()),H=O.multiplyVector3(L[y.c].position.clone()),O=y instanceof THREE.Face4?O.multiplyVector3(L[y.d].position.clone()):null,T=a.matrixRotationWorld.multiplyVector3(y.normal.clone()),E=K.dot(T),a.doubleSided||(a.flipSided?E>0:E<0)))if(E=T.dot((new THREE.Vector3).sub(D,S))/E,S=S.addSelf(K.multiplyScalar(E)),y instanceof THREE.Face3)b(S,D,C,H)&&(y={distance:this.origin.distanceTo(S),point:S,face:y,object:a},
|
|
|
|
+t.push(y));else if(y instanceof THREE.Face4&&(b(S,D,C,O)||b(S,C,H,O)))y={distance:this.origin.distanceTo(S),point:S,face:y,object:a},t.push(y)}return t}};
|
|
|
|
+THREE.Rectangle=function(){function a(){h=e-c;f=l-b}var c,b,e,l,h,f,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return h};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(h,f,v,u){k=!1;c=h;b=f;e=v;l=u;a()};this.addPoint=function(h,f){k?(k=!1,c=h,b=f,e=h,l=f):(c=c<h?c:h,b=b<f?b:f,e=e>h?e:h,l=l>f?l:f);a()};this.add3Points=
|
|
|
|
+function(h,f,v,u,x,w){k?(k=!1,c=h<v?h<x?h:x:v<x?v:x,b=f<u?f<w?f:w:u<w?u:w,e=h>v?h>x?h:x:v>x?v:x,l=f>u?f>w?f:w:u>w?u:w):(c=h<v?h<x?h<c?h:c:x<c?x:c:v<x?v<c?v:c:x<c?x:c,b=f<u?f<w?f<b?f:b:w<b?w:b:u<w?u<b?u:b:w<b?w:b,e=h>v?h>x?h>e?h:e:x>e?x:e:v>x?v>e?v:e:x>e?x:e,l=f>u?f>w?f>l?f:l:w>l?w:l:u>w?u>l?u:l:w>l?w:l);a()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),b=h.getTop(),e=h.getRight(),l=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),b=b<h.getTop()?b:h.getTop(),e=e>h.getRight()?e:h.getRight(),l=l>
|
|
h.getBottom()?l:h.getBottom());a()};this.inflate=function(h){c-=h;b-=h;e+=h;l+=h;a()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();b=b>h.getTop()?b:h.getTop();e=e<h.getRight()?e:h.getRight();l=l<h.getBottom()?l:h.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(l,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){k=!0;l=e=b=c=0;a()};this.isEmpty=function(){return k}};
|
|
h.getBottom()?l:h.getBottom());a()};this.inflate=function(h){c-=h;b-=h;e+=h;l+=h;a()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();b=b>h.getTop()?b:h.getTop();e=e<h.getRight()?e:h.getRight();l=l<h.getBottom()?l:h.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(l,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){k=!0;l=e=b=c=0;a()};this.isEmpty=function(){return k}};
|
|
THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,e,l){return e+(a-c)*(l-e)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
|
|
THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,e,l){return e+(a-c)*(l-e)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
|
|
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.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,e,l,h,f,k,n,t,v,p,x,w,z,u){this.set(a!==void 0?a:1,c||0,b||0,e||0,l||0,h!==void 0?h:1,f||0,k||0,n||0,t||0,v!==void 0?v:1,p||0,x||0,w||0,z||0,u!==void 0?u:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,l,h,f,k,n,t,v,p,x,w,z,u){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=l;this.n22=h;this.n23=f;this.n24=k;this.n31=n;this.n32=t;this.n33=v;this.n34=p;this.n41=x;this.n42=w;this.n43=z;this.n44=u;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 e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;e.cross(b,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(b,h).normalize());l.cross(h,e).normalize();this.n11=e.x;this.n12=l.x;this.n13=h.x;this.n21=e.y;this.n22=l.y;this.n23=h.y;this.n31=e.z;this.n32=l.z;this.n33=h.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,l=a.n13,h=a.n14,f=a.n21,k=a.n22,n=a.n23,t=a.n24,v=a.n31,p=a.n32,x=a.n33,w=a.n34,z=a.n41,u=a.n42,B=a.n43,
|
|
|
|
-y=a.n44,E=c.n11,C=c.n12,H=c.n13,L=c.n14,R=c.n21,D=c.n22,O=c.n23,J=c.n24,N=c.n31,K=c.n32,M=c.n33,Y=c.n34,oa=c.n41,Z=c.n42,U=c.n43,o=c.n44;this.n11=b*E+e*R+l*N+h*oa;this.n12=b*C+e*D+l*K+h*Z;this.n13=b*H+e*O+l*M+h*U;this.n14=b*L+e*J+l*Y+h*o;this.n21=f*E+k*R+n*N+t*oa;this.n22=f*C+k*D+n*K+t*Z;this.n23=f*H+k*O+n*M+t*U;this.n24=f*L+k*J+n*Y+t*o;this.n31=v*E+p*R+x*N+w*oa;this.n32=v*C+p*D+x*K+w*Z;this.n33=v*H+p*O+x*M+w*U;this.n34=v*L+p*J+x*Y+w*o;this.n41=z*E+u*R+B*N+y*oa;this.n42=z*C+u*D+B*K+y*Z;this.n43=z*
|
|
|
|
-H+u*O+B*M+y*U;this.n44=z*L+u*J+B*Y+y*o;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*=
|
|
|
|
|
|
+THREE.Matrix4=function(a,c,b,e,l,h,f,k,n,p,v,u,x,w,y,t){this.set(a!==void 0?a:1,c||0,b||0,e||0,l||0,h!==void 0?h:1,f||0,k||0,n||0,p||0,v!==void 0?v:1,u||0,x||0,w||0,y||0,t!==void 0?t:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,l,h,f,k,n,p,v,u,x,w,y,t){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=l;this.n22=h;this.n23=f;this.n24=k;this.n31=n;this.n32=p;this.n33=v;this.n34=u;this.n41=x;this.n42=w;this.n43=y;this.n44=t;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 e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;e.cross(b,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(b,h).normalize());l.cross(h,e).normalize();this.n11=e.x;this.n12=l.x;this.n13=h.x;this.n21=e.y;this.n22=l.y;this.n23=h.y;this.n31=e.z;this.n32=l.z;this.n33=h.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,l=a.n13,h=a.n14,f=a.n21,k=a.n22,n=a.n23,p=a.n24,v=a.n31,u=a.n32,x=a.n33,w=a.n34,y=a.n41,t=a.n42,B=a.n43,
|
|
|
|
+A=a.n44,D=c.n11,C=c.n12,H=c.n13,O=c.n14,T=c.n21,E=c.n22,S=c.n23,K=c.n24,N=c.n31,L=c.n32,J=c.n33,X=c.n34,oa=c.n41,Y=c.n42,V=c.n43,o=c.n44;this.n11=b*D+e*T+l*N+h*oa;this.n12=b*C+e*E+l*L+h*Y;this.n13=b*H+e*S+l*J+h*V;this.n14=b*O+e*K+l*X+h*o;this.n21=f*D+k*T+n*N+p*oa;this.n22=f*C+k*E+n*L+p*Y;this.n23=f*H+k*S+n*J+p*V;this.n24=f*O+k*K+n*X+p*o;this.n31=v*D+u*T+x*N+w*oa;this.n32=v*C+u*E+x*L+w*Y;this.n33=v*H+u*S+x*J+w*V;this.n34=v*O+u*K+x*X+w*o;this.n41=y*D+t*T+B*N+A*oa;this.n42=y*C+t*E+B*L+A*Y;this.n43=y*
|
|
|
|
+H+t*S+B*J+A*V;this.n44=y*O+t*K+B*X+A*o;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,e=a.z,l=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*l;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*l;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*l;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,l=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*l;a.y=this.n21*c+this.n22*
|
|
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,e=a.z,l=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*l;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*l;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*l;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,l=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*l;a.y=this.n21*c+this.n22*
|
|
b+this.n23*e+this.n24*l;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*l;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*l;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*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*
|
|
b+this.n23*e+this.n24*l;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*l;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*l;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*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,e=this.n14,l=this.n21,h=this.n22,f=this.n23,k=this.n24,n=this.n31,t=this.n32,v=this.n33,p=this.n34,x=this.n41,w=this.n42,z=this.n43,u=this.n44;return e*f*t*x-b*k*t*x-e*h*v*x+c*k*v*x+b*h*p*x-c*f*p*x-e*f*n*w+b*k*n*w+e*l*v*w-a*k*v*w-b*l*p*w+a*f*p*w+e*h*n*z-c*k*n*z-e*l*t*z+a*k*t*z+c*l*p*z-a*h*p*z-b*h*n*u+c*f*n*u+b*l*t*u-a*f*t*u-c*l*v*u+a*h*v*u},transpose:function(){var a;
|
|
|
|
|
|
+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,e=this.n14,l=this.n21,h=this.n22,f=this.n23,k=this.n24,n=this.n31,p=this.n32,v=this.n33,u=this.n34,x=this.n41,w=this.n42,y=this.n43,t=this.n44;return e*f*p*x-b*k*p*x-e*h*v*x+c*k*v*x+b*h*u*x-c*f*u*x-e*f*n*w+b*k*n*w+e*l*v*w-a*k*v*w-b*l*u*w+a*f*u*w+e*h*n*y-c*k*n*y-e*l*p*y+a*k*p*y+c*l*u*y-a*h*u*y-b*h*n*t+c*f*n*t+b*l*p*t-a*f*p*t-c*l*v*t+a*h*v*t},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=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.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},
|
|
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},
|
|
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),e=Math.sin(c),l=1-b,h=a.x,f=a.y,k=a.z,n=l*h,t=l*f;this.set(n*h+b,n*f-e*k,n*k+e*f,0,n*f+e*k,t*f+b,t*k-e*h,0,n*k-e*f,t*k+e*h,l*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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,e=a.n13,l=a.n14,h=a.n21,f=a.n22,k=a.n23,n=a.n24,t=a.n31,v=a.n32,p=a.n33,x=a.n34,w=a.n41,z=a.n42,u=a.n43,B=a.n44;this.n11=k*x*z-n*p*z+n*v*u-f*x*u-k*v*B+f*p*B;this.n12=l*p*z-e*x*z-l*v*u+b*x*u+e*v*B-b*p*B;this.n13=e*n*z-l*k*z+l*f*u-b*n*u-e*f*B+b*k*B;this.n14=l*k*v-e*n*v-l*f*p+b*n*p+e*f*x-b*k*x;this.n21=n*p*w-k*x*w-n*t*u+h*x*u+k*t*B-h*p*B;this.n22=e*x*w-l*p*w+
|
|
|
|
-l*t*u-c*x*u-e*t*B+c*p*B;this.n23=l*k*w-e*n*w-l*h*u+c*n*u+e*h*B-c*k*B;this.n24=e*n*t-l*k*t+l*h*p-c*n*p-e*h*x+c*k*x;this.n31=f*x*w-n*v*w+n*t*z-h*x*z-f*t*B+h*v*B;this.n32=l*v*w-b*x*w-l*t*z+c*x*z+b*t*B-c*v*B;this.n33=e*n*w-l*f*w+l*h*z-c*n*z-b*h*B+c*f*B;this.n34=l*f*t-b*n*t-l*h*v+c*n*v+b*h*x-c*f*x;this.n41=k*v*w-f*p*w-k*t*z+h*p*z+f*t*u-h*v*u;this.n42=b*p*w-e*v*w+e*t*z-c*p*z-b*t*u+c*v*u;this.n43=e*f*w-b*k*w-e*h*z+c*k*z+b*h*u-c*f*u;this.n44=b*k*t-e*f*t+e*h*v-c*k*v-b*h*p+c*f*p;this.multiplyScalar(1/a.determinant());
|
|
|
|
-return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,l=a.z,h=Math.cos(b),b=Math.sin(b),f=Math.cos(e),e=Math.sin(e),k=Math.cos(l),l=Math.sin(l);switch(c){case "YXZ":var n=f*k,t=f*l,v=e*k,p=e*l;this.n11=n+p*b;this.n12=v*b-t;this.n13=h*e;this.n21=h*l;this.n22=h*k;this.n23=-b;this.n31=t*b-v;this.n32=p+n*b;this.n33=h*f;break;case "ZXY":n=f*k;t=f*l;v=e*k;p=e*l;this.n11=n-p*b;this.n12=-h*l;this.n13=v+t*b;this.n21=t+v*b;this.n22=h*k;this.n23=p-n*b;this.n31=-h*e;this.n32=b;this.n33=h*f;break;case "ZYX":n=
|
|
|
|
-h*k;t=h*l;v=b*k;p=b*l;this.n11=f*k;this.n12=v*e-t;this.n13=n*e+p;this.n21=f*l;this.n22=p*e+n;this.n23=t*e-v;this.n31=-e;this.n32=b*f;this.n33=h*f;break;case "YZX":n=h*f;t=h*e;v=b*f;p=b*e;this.n11=f*k;this.n12=p-n*l;this.n13=v*l+t;this.n21=l;this.n22=h*k;this.n23=-b*k;this.n31=-e*k;this.n32=t*l+v;this.n33=n-p*l;break;case "XZY":n=h*f;t=h*e;v=b*f;p=b*e;this.n11=f*k;this.n12=-l;this.n13=e*k;this.n21=n*l+p;this.n22=h*k;this.n23=t*l-v;this.n31=v*l-t;this.n32=b*k;this.n33=p*l+n;break;default:n=h*k,t=h*
|
|
|
|
-l,v=b*k,p=b*l,this.n11=f*k,this.n12=-f*l,this.n13=e,this.n21=t+v*e,this.n22=n-p*e,this.n23=-b*f,this.n31=p-n*e,this.n32=v+t*e,this.n33=h*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,l=a.w,h=c+c,f=b+b,k=e+e,a=c*h,n=c*f;c*=k;var t=b*f;b*=k;e*=k;h*=l;f*=l;l*=k;this.n11=1-(t+e);this.n12=n-l;this.n13=c+f;this.n21=n+l;this.n22=1-(a+e);this.n23=b-h;this.n31=c-f;this.n32=b+h;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
|
|
|
|
|
|
+setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),l=1-b,h=a.x,f=a.y,k=a.z,n=l*h,p=l*f;this.set(n*h+b,n*f-e*k,n*k+e*f,0,n*f+e*k,p*f+b,p*k-e*h,0,n*k-e*f,p*k+e*h,l*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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,e=a.n13,l=a.n14,h=a.n21,f=a.n22,k=a.n23,n=a.n24,p=a.n31,v=a.n32,u=a.n33,x=a.n34,w=a.n41,y=a.n42,t=a.n43,B=a.n44;this.n11=k*x*y-n*u*y+n*v*t-f*x*t-k*v*B+f*u*B;this.n12=l*u*y-e*x*y-l*v*t+b*x*t+e*v*B-b*u*B;this.n13=e*n*y-l*k*y+l*f*t-b*n*t-e*f*B+b*k*B;this.n14=l*k*v-e*n*v-l*f*u+b*n*u+e*f*x-b*k*x;this.n21=n*u*w-k*x*w-n*p*t+h*x*t+k*p*B-h*u*B;this.n22=e*x*w-l*u*w+
|
|
|
|
+l*p*t-c*x*t-e*p*B+c*u*B;this.n23=l*k*w-e*n*w-l*h*t+c*n*t+e*h*B-c*k*B;this.n24=e*n*p-l*k*p+l*h*u-c*n*u-e*h*x+c*k*x;this.n31=f*x*w-n*v*w+n*p*y-h*x*y-f*p*B+h*v*B;this.n32=l*v*w-b*x*w-l*p*y+c*x*y+b*p*B-c*v*B;this.n33=e*n*w-l*f*w+l*h*y-c*n*y-b*h*B+c*f*B;this.n34=l*f*p-b*n*p-l*h*v+c*n*v+b*h*x-c*f*x;this.n41=k*v*w-f*u*w-k*p*y+h*u*y+f*p*t-h*v*t;this.n42=b*u*w-e*v*w+e*p*y-c*u*y-b*p*t+c*v*t;this.n43=e*f*w-b*k*w-e*h*y+c*k*y+b*h*t-c*f*t;this.n44=b*k*p-e*f*p+e*h*v-c*k*v-b*h*u+c*f*u;this.multiplyScalar(1/a.determinant());
|
|
|
|
+return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,l=a.z,h=Math.cos(b),b=Math.sin(b),f=Math.cos(e),e=Math.sin(e),k=Math.cos(l),l=Math.sin(l);switch(c){case "YXZ":var n=f*k,p=f*l,v=e*k,u=e*l;this.n11=n+u*b;this.n12=v*b-p;this.n13=h*e;this.n21=h*l;this.n22=h*k;this.n23=-b;this.n31=p*b-v;this.n32=u+n*b;this.n33=h*f;break;case "ZXY":n=f*k;p=f*l;v=e*k;u=e*l;this.n11=n-u*b;this.n12=-h*l;this.n13=v+p*b;this.n21=p+v*b;this.n22=h*k;this.n23=u-n*b;this.n31=-h*e;this.n32=b;this.n33=h*f;break;case "ZYX":n=
|
|
|
|
+h*k;p=h*l;v=b*k;u=b*l;this.n11=f*k;this.n12=v*e-p;this.n13=n*e+u;this.n21=f*l;this.n22=u*e+n;this.n23=p*e-v;this.n31=-e;this.n32=b*f;this.n33=h*f;break;case "YZX":n=h*f;p=h*e;v=b*f;u=b*e;this.n11=f*k;this.n12=u-n*l;this.n13=v*l+p;this.n21=l;this.n22=h*k;this.n23=-b*k;this.n31=-e*k;this.n32=p*l+v;this.n33=n-u*l;break;case "XZY":n=h*f;p=h*e;v=b*f;u=b*e;this.n11=f*k;this.n12=-l;this.n13=e*k;this.n21=n*l+u;this.n22=h*k;this.n23=p*l-v;this.n31=v*l-p;this.n32=b*k;this.n33=u*l+n;break;default:n=h*k,p=h*
|
|
|
|
+l,v=b*k,u=b*l,this.n11=f*k,this.n12=-f*l,this.n13=e,this.n21=p+v*e,this.n22=n-u*e,this.n23=-b*f,this.n31=u-n*e,this.n32=v+p*e,this.n33=h*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,l=a.w,h=c+c,f=b+b,k=e+e,a=c*h,n=c*f;c*=k;var p=b*f;b*=k;e*=k;h*=l;f*=l;l*=k;this.n11=1-(p+e);this.n12=n-l;this.n13=c+f;this.n21=n+l;this.n22=1-(a+e);this.n23=b-h;this.n31=c-f;this.n32=b+h;this.n33=1-(a+p);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
|
|
a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var e=THREE.Matrix4.__m1,l=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(c);l.setScale(b.x,b.y,b.z);this.multiply(e,l);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);l.set(this.n12,this.n22,this.n32);h.set(this.n13,
|
|
a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var e=THREE.Matrix4.__m1,l=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(c);l.setScale(b.x,b.y,b.z);this.multiply(e,l);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);l.set(this.n12,this.n22,this.n32);h.set(this.n13,
|
|
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=e.length();b.y=l.length();b.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=b.x;e.n21/=b.x;e.n31/=b.x;e.n12/=b.y;e.n22/=b.y;e.n32/=b.y;e.n13/=b.z;e.n23/=b.z;e.n33/=b.z;c.setFromRotationMatrix(e);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
|
|
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=e.length();b.y=l.length();b.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=b.x;e.n21/=b.x;e.n31/=b.x;e.n12/=b.y;e.n22/=b.y;e.n32/=b.y;e.n13/=b.z;e.n23/=b.z;e.n33/=b.z;c.setFromRotationMatrix(e);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
|
|
return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),e=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
|
|
return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),e=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,l=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,v=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*f+a.n31*t;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*e;b[1]=a*l;b[2]=a*h;b[3]=a*f;b[4]=a*k;b[5]=a*n;b[6]=a*t;b[7]=a*v;b[8]=a*p;return c};
|
|
|
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,l=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,v=-a.n23*a.n11+a.n21*a.n13,u=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*f+a.n31*p;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*e;b[1]=a*l;b[2]=a*h;b[3]=a*f;b[4]=a*k;b[5]=a*n;b[6]=a*p;b[7]=a*v;b[8]=a*u;return c};
|
|
THREE.Matrix4.makeFrustum=function(a,c,b,e,l,h){var f;f=new THREE.Matrix4;f.n11=2*l/(c-a);f.n12=0;f.n13=(c+a)/(c-a);f.n14=0;f.n21=0;f.n22=2*l/(e-b);f.n23=(e+b)/(e-b);f.n24=0;f.n31=0;f.n32=0;f.n33=-(h+l)/(h-l);f.n34=-2*h*l/(h-l);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,c,b,e){var l,a=b*Math.tan(a*Math.PI/360);l=-a;return THREE.Matrix4.makeFrustum(l*c,a*c,l,a,b,e)};
|
|
THREE.Matrix4.makeFrustum=function(a,c,b,e,l,h){var f;f=new THREE.Matrix4;f.n11=2*l/(c-a);f.n12=0;f.n13=(c+a)/(c-a);f.n14=0;f.n21=0;f.n22=2*l/(e-b);f.n23=(e+b)/(e-b);f.n24=0;f.n31=0;f.n32=0;f.n33=-(h+l)/(h-l);f.n34=-2*h*l/(h-l);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,c,b,e){var l,a=b*Math.tan(a*Math.PI/360);l=-a;return THREE.Matrix4.makeFrustum(l*c,a*c,l,a,b,e)};
|
|
-THREE.Matrix4.makeOrtho=function(a,c,b,e,l,h){var f,k,n,t;f=new THREE.Matrix4;k=c-a;n=b-e;t=h-l;f.n11=2/k;f.n12=0;f.n13=0;f.n14=-((c+a)/k);f.n21=0;f.n22=2/n;f.n23=0;f.n24=-((b+e)/n);f.n31=0;f.n32=0;f.n33=-2/t;f.n34=-((h+l)/t);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
|
|
|
+THREE.Matrix4.makeOrtho=function(a,c,b,e,l,h){var f,k,n,p;f=new THREE.Matrix4;k=c-a;n=b-e;p=h-l;f.n11=2/k;f.n12=0;f.n13=0;f.n14=-((c+a)/k);f.n21=0;f.n22=2/n;f.n23=0;f.n24=-((b+e)/n);f.n31=0;f.n32=0;f.n33=-2/p;f.n34=-((h+l)/p);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
|
|
-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,e,l;b=0;for(e=this.children.length;b<e;b++){l=this.children[b];if(l.name===a)return l;
|
|
-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,e,l;b=0;for(e=this.children.length;b<e;b++){l=this.children[b];if(l.name===a)return l;
|
|
if(c&&(l=l.getChildByName(a,c),l!==void 0))return l}},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&&
|
|
if(c&&(l=l.getChildByName(a,c),l!==void 0))return l}},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<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
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<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
-THREE.Projector=function(){function a(){var a=f[h]=f[h]||new THREE.RenderableObject;h++;return a}function c(){var a=t[n]=t[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,h=a.z+a.w,l=b.z+b.w,f=-a.z+a.w,k=-b.z+b.w;return h>=0&&l>=0&&f>=0&&k>=0?!0:h<0&&l<0||f<0&&k<0?!1:(h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var l,h,f=[],k,n,t=[],
|
|
|
|
-v,p,x=[],w,z=[],u,B,y=[],E,C,H=[],L={objects:[],sprites:[],lights:[],elements:[]},R=new THREE.Vector3,D=new THREE.Vector4,O=new THREE.Matrix4,J=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Vector4,M=new THREE.Vector4;this.computeFrustum=function(a){N[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);N[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);N[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
|
-a.n23,a.n44+a.n24);N[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);N[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);N[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=N[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);O.multiply(b.projectionMatrix,b.matrixWorldInverse);O.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
|
-O.multiply(b.matrixWorld,b.projectionMatrixInverse);O.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,e){h=0;L.objects.length=0;L.sprites.length=0;L.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
|
|
|
|
-h=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),k=0;k<6;k++)if(c=N[k].x*e.n14+N[k].y*e.n24+N[k].z*e.n34+N[k].w,c<=h){c=!1;break a}c=!0}c?(O.multiplyVector3(R.copy(b.position)),l=a(),l.object=b,l.z=R.z,L.objects.push(l)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(O.multiplyVector3(R.copy(b.position)),l=a(),l.object=b,l.z=R.z,L.sprites.push(l)):b instanceof THREE.Light&&L.lights.push(b);c=0;for(e=b.children.length;c<e;c++)f(b.children[c])}};f(c);e&&
|
|
|
|
-L.objects.sort(b);return L};this.projectScene=function(a,h,l){var f=h.near,o=h.far,R,N,G,W,$,la,ja,sa,T,ea,ga,na,ia,I,Q,ha;C=B=w=p=0;L.elements.length=0;h.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(h));a.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);O.multiply(h.projectionMatrix,h.matrixWorldInverse);this.computeFrustum(O);L=this.projectGraph(a,!1);a=0;for(R=L.objects.length;a<R;a++)if(T=L.objects[a].object,ea=T.matrixWorld,
|
|
|
|
-na=T.material,n=0,T instanceof THREE.Mesh){ga=T.geometry;ia=T.geometry.materials;W=ga.vertices;I=ga.faces;Q=ga.faceVertexUvs;ga=T.matrixRotationWorld.extractRotation(ea);N=0;for(G=W.length;N<G;N++)k=c(),k.positionWorld.copy(W[N].position),ea.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),O.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>f&&k.positionScreen.z<o;W=0;for(N=I.length;W<
|
|
|
|
-N;W++){G=I[W];if(G instanceof THREE.Face3)if($=t[G.a],la=t[G.b],ja=t[G.c],$.visible&&la.visible&&ja.visible&&(T.doubleSided||T.flipSided!=(ja.positionScreen.x-$.positionScreen.x)*(la.positionScreen.y-$.positionScreen.y)-(ja.positionScreen.y-$.positionScreen.y)*(la.positionScreen.x-$.positionScreen.x)<0))sa=x[p]=x[p]||new THREE.RenderableFace3,p++,v=sa,v.v1.copy($),v.v2.copy(la),v.v3.copy(ja);else continue;else if(G instanceof THREE.Face4)if($=t[G.a],la=t[G.b],ja=t[G.c],sa=t[G.d],$.visible&&la.visible&&
|
|
|
|
-ja.visible&&sa.visible&&(T.doubleSided||T.flipSided!=((sa.positionScreen.x-$.positionScreen.x)*(la.positionScreen.y-$.positionScreen.y)-(sa.positionScreen.y-$.positionScreen.y)*(la.positionScreen.x-$.positionScreen.x)<0||(la.positionScreen.x-ja.positionScreen.x)*(sa.positionScreen.y-ja.positionScreen.y)-(la.positionScreen.y-ja.positionScreen.y)*(sa.positionScreen.x-ja.positionScreen.x)<0)))ha=z[w]=z[w]||new THREE.RenderableFace4,w++,v=ha,v.v1.copy($),v.v2.copy(la),v.v3.copy(ja),v.v4.copy(sa);else continue;
|
|
|
|
-v.normalWorld.copy(G.normal);ga.multiplyVector3(v.normalWorld);v.centroidWorld.copy(G.centroid);ea.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);O.multiplyVector3(v.centroidScreen);ja=G.vertexNormals;$=0;for(la=ja.length;$<la;$++)sa=v.vertexNormalsWorld[$],sa.copy(ja[$]),ga.multiplyVector3(sa);$=0;for(la=Q.length;$<la;$++)if(ha=Q[$][W]){ja=0;for(sa=ha.length;ja<sa;ja++)v.uvs[$][ja]=ha[ja]}v.material=na;v.faceMaterial=G.materialIndex!==null?ia[G.materialIndex]:null;v.z=v.centroidScreen.z;
|
|
|
|
-L.elements.push(v)}}else if(T instanceof THREE.Line){J.multiply(O,ea);W=T.geometry.vertices;$=c();$.positionScreen.copy(W[0].position);J.multiplyVector4($.positionScreen);N=1;for(G=W.length;N<G;N++)if($=c(),$.positionScreen.copy(W[N].position),J.multiplyVector4($.positionScreen),la=t[n-2],K.copy($.positionScreen),M.copy(la.positionScreen),e(K,M))K.multiplyScalar(1/K.w),M.multiplyScalar(1/M.w),T=y[B]=y[B]||new THREE.RenderableLine,B++,u=T,u.v1.positionScreen.copy(K),u.v2.positionScreen.copy(M),u.z=
|
|
|
|
-Math.max(K.z,M.z),u.material=na,L.elements.push(u)}a=0;for(R=L.sprites.length;a<R;a++)if(T=L.sprites[a].object,ea=T.matrixWorld,T instanceof THREE.Particle&&(D.set(ea.n14,ea.n24,ea.n34,1),O.multiplyVector4(D),D.z/=D.w,D.z>0&&D.z<1))f=H[C]=H[C]||new THREE.RenderableParticle,C++,E=f,E.x=D.x/D.w,E.y=D.y/D.w,E.z=D.z,E.rotation=T.rotation.z,E.scale.x=T.scale.x*Math.abs(E.x-(D.x+h.projectionMatrix.n11)/(D.w+h.projectionMatrix.n14)),E.scale.y=T.scale.y*Math.abs(E.y-(D.y+h.projectionMatrix.n22)/(D.w+h.projectionMatrix.n24)),
|
|
|
|
-E.material=T.material,L.elements.push(E);l&&L.elements.sort(b);return L}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
|
|
|
|
|
|
+THREE.Projector=function(){function a(){var a=f[h]=f[h]||new THREE.RenderableObject;h++;return a}function c(){var a=p[n]=p[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,h=a.z+a.w,l=b.z+b.w,f=-a.z+a.w,k=-b.z+b.w;return h>=0&&l>=0&&f>=0&&k>=0?!0:h<0&&l<0||f<0&&k<0?!1:(h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var l,h,f=[],k,n,p=[],
|
|
|
|
+v,u,x=[],w,y=[],t,B,A=[],D,C,H=[],O={objects:[],sprites:[],lights:[],elements:[]},T=new THREE.Vector3,E=new THREE.Vector4,S=new THREE.Matrix4,K=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,J=new THREE.Vector4;this.computeFrustum=function(a){N[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);N[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);N[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
|
+a.n23,a.n44+a.n24);N[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);N[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);N[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=N[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);S.multiply(b.projectionMatrix,b.matrixWorldInverse);S.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
|
+S.multiply(b.matrixWorld,b.projectionMatrixInverse);S.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,e){h=0;O.objects.length=0;O.sprites.length=0;O.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
|
|
|
|
+h=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),k=0;k<6;k++)if(c=N[k].x*e.n14+N[k].y*e.n24+N[k].z*e.n34+N[k].w,c<=h){c=!1;break a}c=!0}c?(S.multiplyVector3(T.copy(b.position)),l=a(),l.object=b,l.z=T.z,O.objects.push(l)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(S.multiplyVector3(T.copy(b.position)),l=a(),l.object=b,l.z=T.z,O.sprites.push(l)):b instanceof THREE.Light&&O.lights.push(b);c=0;for(e=b.children.length;c<e;c++)f(b.children[c])}};f(c);e&&
|
|
|
|
+O.objects.sort(b);return O};this.projectScene=function(a,h,l){var f=h.near,o=h.far,T,N,G,W,Z,na,ma,sa,U,da,ia,ea,la,I,R,ja;C=B=w=u=0;O.elements.length=0;h.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(h));a.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);S.multiply(h.projectionMatrix,h.matrixWorldInverse);this.computeFrustum(S);O=this.projectGraph(a,!1);a=0;for(T=O.objects.length;a<T;a++)if(U=O.objects[a].object,da=U.matrixWorld,
|
|
|
|
+ea=U.material,n=0,U instanceof THREE.Mesh){ia=U.geometry;la=U.geometry.materials;W=ia.vertices;I=ia.faces;R=ia.faceVertexUvs;ia=U.matrixRotationWorld.extractRotation(da);N=0;for(G=W.length;N<G;N++)k=c(),k.positionWorld.copy(W[N].position),da.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),S.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>f&&k.positionScreen.z<o;W=0;for(N=I.length;W<
|
|
|
|
+N;W++){G=I[W];if(G instanceof THREE.Face3)if(Z=p[G.a],na=p[G.b],ma=p[G.c],Z.visible&&na.visible&&ma.visible&&(U.doubleSided||U.flipSided!=(ma.positionScreen.x-Z.positionScreen.x)*(na.positionScreen.y-Z.positionScreen.y)-(ma.positionScreen.y-Z.positionScreen.y)*(na.positionScreen.x-Z.positionScreen.x)<0))sa=x[u]=x[u]||new THREE.RenderableFace3,u++,v=sa,v.v1.copy(Z),v.v2.copy(na),v.v3.copy(ma);else continue;else if(G instanceof THREE.Face4)if(Z=p[G.a],na=p[G.b],ma=p[G.c],sa=p[G.d],Z.visible&&na.visible&&
|
|
|
|
+ma.visible&&sa.visible&&(U.doubleSided||U.flipSided!=((sa.positionScreen.x-Z.positionScreen.x)*(na.positionScreen.y-Z.positionScreen.y)-(sa.positionScreen.y-Z.positionScreen.y)*(na.positionScreen.x-Z.positionScreen.x)<0||(na.positionScreen.x-ma.positionScreen.x)*(sa.positionScreen.y-ma.positionScreen.y)-(na.positionScreen.y-ma.positionScreen.y)*(sa.positionScreen.x-ma.positionScreen.x)<0)))ja=y[w]=y[w]||new THREE.RenderableFace4,w++,v=ja,v.v1.copy(Z),v.v2.copy(na),v.v3.copy(ma),v.v4.copy(sa);else continue;
|
|
|
|
+v.normalWorld.copy(G.normal);ia.multiplyVector3(v.normalWorld);v.centroidWorld.copy(G.centroid);da.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);S.multiplyVector3(v.centroidScreen);ma=G.vertexNormals;Z=0;for(na=ma.length;Z<na;Z++)sa=v.vertexNormalsWorld[Z],sa.copy(ma[Z]),ia.multiplyVector3(sa);Z=0;for(na=R.length;Z<na;Z++)if(ja=R[Z][W]){ma=0;for(sa=ja.length;ma<sa;ma++)v.uvs[Z][ma]=ja[ma]}v.material=ea;v.faceMaterial=G.materialIndex!==null?la[G.materialIndex]:null;v.z=v.centroidScreen.z;
|
|
|
|
+O.elements.push(v)}}else if(U instanceof THREE.Line){K.multiply(S,da);W=U.geometry.vertices;Z=c();Z.positionScreen.copy(W[0].position);K.multiplyVector4(Z.positionScreen);N=1;for(G=W.length;N<G;N++)if(Z=c(),Z.positionScreen.copy(W[N].position),K.multiplyVector4(Z.positionScreen),na=p[n-2],L.copy(Z.positionScreen),J.copy(na.positionScreen),e(L,J))L.multiplyScalar(1/L.w),J.multiplyScalar(1/J.w),U=A[B]=A[B]||new THREE.RenderableLine,B++,t=U,t.v1.positionScreen.copy(L),t.v2.positionScreen.copy(J),t.z=
|
|
|
|
+Math.max(L.z,J.z),t.material=ea,O.elements.push(t)}a=0;for(T=O.sprites.length;a<T;a++)if(U=O.sprites[a].object,da=U.matrixWorld,U instanceof THREE.Particle&&(E.set(da.n14,da.n24,da.n34,1),S.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))f=H[C]=H[C]||new THREE.RenderableParticle,C++,D=f,D.x=E.x/E.w,D.y=E.y/E.w,D.z=E.z,D.rotation=U.rotation.z,D.scale.x=U.scale.x*Math.abs(D.x-(E.x+h.projectionMatrix.n11)/(E.w+h.projectionMatrix.n14)),D.scale.y=U.scale.y*Math.abs(D.y-(E.y+h.projectionMatrix.n22)/(E.w+h.projectionMatrix.n24)),
|
|
|
|
+D.material=U.material,O.elements.push(D);l&&O.elements.sort(b);return O}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;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 c=Math.PI/360,b=a.x*c,e=a.y*c,l=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-l),l=Math.sin(-l),h=Math.cos(b),b=Math.sin(b),f=a*c,k=e*l;this.w=f*h-k*b;this.x=f*b+k*h;this.y=e*c*h+a*l*b;this.z=a*l*h-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;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 c=Math.PI/360,b=a.x*c,e=a.y*c,l=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-l),l=Math.sin(-l),h=Math.cos(b),b=Math.sin(b),f=a*c,k=e*l;this.w=f*h-k*b;this.x=f*b+k*h;this.y=e*c*h+a*l*b;this.z=a*l*h-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;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);
|
|
this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;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);
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
|
|
-this.x,b=this.y,e=this.z,l=this.w,h=a.x,f=a.y,k=a.z,a=a.w;this.x=c*a+l*h+b*k-e*f;this.y=b*a+l*f+e*h-c*k;this.z=e*a+l*k+c*f-b*h;this.w=l*a-c*h-b*f-e*k;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,l=a.z,h=this.x,f=this.y,k=this.z,n=this.w,t=n*b+f*l-k*e,v=n*e+k*b-h*l,p=n*l+h*e-f*b,b=-h*
|
|
|
|
-b-f*e-k*l;c.x=t*n+b*-h+v*-k-p*-f;c.y=v*n+b*-f+p*-h-t*-k;c.z=p*n+b*-k+t*-f-v*-h;return c}};
|
|
|
|
|
|
+this.x,b=this.y,e=this.z,l=this.w,h=a.x,f=a.y,k=a.z,a=a.w;this.x=c*a+l*h+b*k-e*f;this.y=b*a+l*f+e*h-c*k;this.z=e*a+l*k+c*f-b*h;this.w=l*a-c*h-b*f-e*k;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,l=a.z,h=this.x,f=this.y,k=this.z,n=this.w,p=n*b+f*l-k*e,v=n*e+k*b-h*l,u=n*l+h*e-f*b,b=-h*
|
|
|
|
+b-f*e-k*l;c.x=p*n+b*-h+v*-k-u*-f;c.y=v*n+b*-f+u*-h-p*-k;c.z=u*n+b*-k+p*-f-v*-h;return c}};
|
|
THREE.Quaternion.slerp=function(a,c,b,e){var l=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;l<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,l=-l):b.copy(c);if(Math.abs(l)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var h=Math.acos(l),l=Math.sqrt(1-l*l);if(Math.abs(l)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*h)/l;e=Math.sin(e*h)/l;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
THREE.Quaternion.slerp=function(a,c,b,e){var l=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;l<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,l=-l):b.copy(c);if(Math.abs(l)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var h=Math.acos(l),l=Math.sqrt(1-l*l);if(Math.abs(l)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*h)/l;e=Math.sin(e*h)/l;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
THREE.Face3=function(a,c,b,e,l,h){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=l instanceof THREE.Color?l:new THREE.Color;this.vertexColors=l instanceof Array?l:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
|
|
THREE.Face3=function(a,c,b,e,l,h){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=l instanceof THREE.Color?l:new THREE.Color;this.vertexColors=l instanceof Array?l:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
|
|
THREE.Face4=function(a,c,b,e,l,h,f){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=l instanceof THREE.Vector3?l:new THREE.Vector3;this.vertexNormals=l instanceof Array?l:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
|
|
THREE.Face4=function(a,c,b,e,l,h,f){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=l instanceof THREE.Vector3?l:new THREE.Vector3;this.vertexNormals=l instanceof Array?l:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
|
|
@@ -83,15 +83,15 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
|
|
b,e,l,h,f,k=new THREE.Vector3,n=new THREE.Vector3;e=0;for(l=this.faces.length;e<l;e++){h=this.faces[e];if(a&&h.vertexNormals.length){k.set(0,0,0);c=0;for(b=h.vertexNormals.length;c<b;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],b=this.vertices[h.b],f=this.vertices[h.c],k.sub(f.position,b.position),n.sub(c.position,b.position),k.crossSelf(n);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
|
|
b,e,l,h,f,k=new THREE.Vector3,n=new THREE.Vector3;e=0;for(l=this.faces.length;e<l;e++){h=this.faces[e];if(a&&h.vertexNormals.length){k.set(0,0,0);c=0;for(b=h.vertexNormals.length;c<b;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],b=this.vertices[h.b],f=this.vertices[h.c],k.sub(f.position,b.position),n.sub(c.position,b.position),k.crossSelf(n);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
|
|
Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
|
|
Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
|
|
THREE.Face3?(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal),e[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(e[b.a]),b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(e[b.a]),
|
|
THREE.Face3?(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal),e[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(e[b.a]),b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(e[b.a]),
|
|
-b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,h,l,U){k=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;v=f[h];p=f[l];x=f[U];w=n.x-k.x;z=t.x-k.x;u=n.y-k.y;B=t.y-k.y;y=n.z-k.z;E=t.z-k.z;C=p.u-v.u;H=x.u-v.u;L=p.v-v.v;R=x.v-v.v;D=1/(C*R-H*L);K.set((R*w-L*z)*D,(R*u-L*B)*D,(R*y-L*E)*D);M.set((C*z-H*w)*D,(C*B-H*u)*D,(C*E-H*y)*D);J[b].addSelf(K);J[c].addSelf(K);J[e].addSelf(K);N[b].addSelf(M);
|
|
|
|
-N[c].addSelf(M);N[e].addSelf(M)}var c,b,e,l,h,f,k,n,t,v,p,x,w,z,u,B,y,E,C,H,L,R,D,O,J=[],N=[],K=new THREE.Vector3,M=new THREE.Vector3,Y=new THREE.Vector3,oa=new THREE.Vector3,Z=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)J[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)h=this.faces[c],f=this.faceVertexUvs[0][c],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var U=["a",
|
|
|
|
-"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)Z.copy(h.vertexNormals[e]),l=h[U[e]],O=J[l],Y.copy(O),Y.subSelf(Z.multiplyScalar(Z.dot(O))).normalize(),oa.cross(h.vertexNormals[e],O),l=oa.dot(N[l]),l=l<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(Y.x,Y.y,Y.z,l)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
|
|
|
|
+b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,h,l,V){k=a.vertices[b].position;n=a.vertices[c].position;p=a.vertices[e].position;v=f[h];u=f[l];x=f[V];w=n.x-k.x;y=p.x-k.x;t=n.y-k.y;B=p.y-k.y;A=n.z-k.z;D=p.z-k.z;C=u.u-v.u;H=x.u-v.u;O=u.v-v.v;T=x.v-v.v;E=1/(C*T-H*O);L.set((T*w-O*y)*E,(T*t-O*B)*E,(T*A-O*D)*E);J.set((C*y-H*w)*E,(C*B-H*t)*E,(C*D-H*A)*E);K[b].addSelf(L);K[c].addSelf(L);K[e].addSelf(L);N[b].addSelf(J);
|
|
|
|
+N[c].addSelf(J);N[e].addSelf(J)}var c,b,e,l,h,f,k,n,p,v,u,x,w,y,t,B,A,D,C,H,O,T,E,S,K=[],N=[],L=new THREE.Vector3,J=new THREE.Vector3,X=new THREE.Vector3,oa=new THREE.Vector3,Y=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)K[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)h=this.faces[c],f=this.faceVertexUvs[0][c],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var V=["a",
|
|
|
|
+"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)Y.copy(h.vertexNormals[e]),l=h[V[e]],S=K[l],X.copy(S),X.subSelf(Y.multiplyScalar(Y.dot(S))).normalize(),oa.cross(h.vertexNormals[e],S),l=oa.dot(N[l]),l=l<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(X.x,X.y,X.z,l)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
|
|
this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
|
|
a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],e,l=Math.pow(10,4),h,f;h=0;for(f=this.vertices.length;h<f;h++)e=this.vertices[h].position,e=[Math.round(e.x*l),Math.round(e.y*l),Math.round(e.z*l)].join("_"),a[e]===void 0?(a[e]=h,c.push(this.vertices[h]),
|
|
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,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],e,l=Math.pow(10,4),h,f;h=0;for(f=this.vertices.length;h<f;h++)e=this.vertices[h].position,e=[Math.round(e.x*l),Math.round(e.y*l),Math.round(e.z*l)].join("_"),a[e]===void 0?(a[e]=h,c.push(this.vertices[h]),
|
|
b[h]=c.length-1):b[h]=b[a[e]];h=0;for(f=this.faces.length;h<f;h++)if(a=this.faces[h],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
|
|
b[h]=c.length-1):b[h]=b[a[e]];h=0;for(f=this.faces.length;h<f;h++)if(a=this.faces[h],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
|
|
-THREE.Spline=function(a){function c(a,b,c,e,h,l,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*l+a*h+b}this.points=a;var b=[],e={x:0,y:0,z:0},l,h,f,k,n,t,v,p,x;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){l=(this.points.length-1)*a;h=Math.floor(l);f=l-h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>this.points.length-2?h:h+1;b[3]=h>this.points.length-3?h:h+2;t=this.points[b[0]];v=this.points[b[1]];
|
|
|
|
-p=this.points[b[2]];x=this.points[b[3]];k=f*f;n=f*k;e.x=c(t.x,v.x,p.x,x.x,f,k,n);e.y=c(t.y,v.y,p.y,x.y,f,k,n);e.z=c(t.z,v.z,p.z,x.z,f,k,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,l=new THREE.Vector3,f=[],k=0;f[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),l.copy(position),
|
|
|
|
-k+=l.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(f[b]=k,e=b);f[f.length]=k;return{chunks:f,total:k}};this.reparametrizeByArcLength=function(a){var b,c,e,h,l,f,k=[],n=new THREE.Vector3,t=this.getLength();k.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=t.chunks[b]-t.chunks[b-1];f=Math.ceil(a*c/t.total);h=(b-1)/(this.points.length-1);l=b/(this.points.length-1);for(c=1;c<f-1;c++)e=h+c*(1/f)*(l-h),position=this.getPoint(e),k.push(n.copy(position).clone());
|
|
|
|
|
|
+THREE.Spline=function(a){function c(a,b,c,e,h,l,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*l+a*h+b}this.points=a;var b=[],e={x:0,y:0,z:0},l,h,f,k,n,p,v,u,x;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){l=(this.points.length-1)*a;h=Math.floor(l);f=l-h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>this.points.length-2?h:h+1;b[3]=h>this.points.length-3?h:h+2;p=this.points[b[0]];v=this.points[b[1]];
|
|
|
|
+u=this.points[b[2]];x=this.points[b[3]];k=f*f;n=f*k;e.x=c(p.x,v.x,u.x,x.x,f,k,n);e.y=c(p.y,v.y,u.y,x.y,f,k,n);e.z=c(p.z,v.z,u.z,x.z,f,k,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,l=new THREE.Vector3,f=[],k=0;f[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),l.copy(position),
|
|
|
|
+k+=l.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(f[b]=k,e=b);f[f.length]=k;return{chunks:f,total:k}};this.reparametrizeByArcLength=function(a){var b,c,e,h,l,f,k=[],n=new THREE.Vector3,p=this.getLength();k.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=p.chunks[b]-p.chunks[b-1];f=Math.ceil(a*c/p.total);h=(b-1)/(this.points.length-1);l=b/(this.points.length-1);for(c=1;c<f-1;c++)e=h+c*(1/f)*(l-h),position=this.getPoint(e),k.push(n.copy(position).clone());
|
|
k.push(n.copy(this.points[b]).clone())}this.points=k}};THREE.Edge=function(a,c,b,e){this.vertices=[a,c];this.vertexIndices=[b,e];this.faces=[];this.faceIndices=[]};
|
|
k.push(n.copy(this.points[b]).clone())}this.points=k}};THREE.Edge=function(a,c,b,e){this.vertices=[a,c];this.vertexIndices=[b,e];this.faces=[];this.faceIndices=[]};
|
|
THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
|
|
THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
|
|
THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,e,l,h){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=e;this.near=l!==void 0?l:0.1;this.far=h!==void 0?h:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
|
|
THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,e,l,h){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=e;this.near=l!==void 0?l:0.1;this.far=h!==void 0?h:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
|
|
@@ -149,47 +149,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
|
|
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
|
|
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
|
|
THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,l,h;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;l=b/2;h=e/2};this.render=function(b,e){var n,t,v,p,x,w,z,u;a=c.projectScene(b,e);n=0;for(t=a.length;n<t;n++)if(x=a[n],x instanceof THREE.RenderableParticle){z=x.x*l+l;u=x.y*h+h;v=0;for(p=x.material.length;v<p;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=z+"px",w.style.top=u+"px"}}};
|
|
|
|
-THREE.CanvasRenderer=function(a){function c(a){if(E!=a)u.globalAlpha=E=a}function b(a){if(C!=a){switch(a){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation="darker"}C=a}}function e(a){if(H!=a)u.strokeStyle=H=a}function l(a){if(L!=a)u.fillStyle=L=a}var h=this,f,k,n,t=new THREE.Projector,a=a||{},v=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
-p,x,w,z,u=v.getContext("2d"),B=new THREE.Color(0),y=0,E=1,C=0,H=null,L=null,R=null,D=null,O=null,J,N,K,M,Y=new THREE.RenderableVertex,oa=new THREE.RenderableVertex,Z,U,o,P,ra,G,W,$,la,ja,sa,T,ea=new THREE.Color,ga=new THREE.Color,na=new THREE.Color,ia=new THREE.Color,I=new THREE.Color,Q=[],ha,ka,ua,va,Ca,Ga,ya,Aa,Ja,X,ca=new THREE.Rectangle,V=new THREE.Rectangle,aa=new THREE.Rectangle,fa=!1,ma=new THREE.Color,wa=new THREE.Color,pa=new THREE.Color,qa=new THREE.Vector3,ta,Da,Ha,za,Ea,S,a=16;ta=document.createElement("canvas");
|
|
|
|
-ta.width=ta.height=2;Da=ta.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ha=Da.getImageData(0,0,2,2);za=Ha.data;Ea=document.createElement("canvas");Ea.width=Ea.height=a;S=Ea.getContext("2d");S.translate(-a/2,-a/2);S.scale(a,a);a--;this.domElement=v;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;x=b;w=Math.floor(p/2);z=Math.floor(x/2);v.width=p;v.height=x;ca.set(-w,-z,w,z);V.set(-w,-z,w,z);E=1;C=0;O=D=
|
|
|
|
-R=L=H=null};this.setClearColor=function(a,b){B.copy(a);y=b;V.set(-w,-z,w,z)};this.setClearColorHex=function(a,b){B.setHex(a);y=b;V.set(-w,-z,w,z)};this.clear=function(){u.setTransform(1,0,0,-1,w,z);V.isEmpty()||(V.minSelf(ca),V.inflate(2),y<1&&u.clearRect(Math.floor(V.getX()),Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight())),y>0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*255)+","+y+")"),u.fillRect(Math.floor(V.getX()),
|
|
|
|
-Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight()))),V.empty())};this.render=function(a,v){function p(a){var b,c,e,h;ma.setRGB(0,0,0);wa.setRGB(0,0,0);pa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],h=e.color,e instanceof THREE.AmbientLight?(ma.r+=h.r,ma.g+=h.g,ma.b+=h.b):e instanceof THREE.DirectionalLight?(wa.r+=h.r,wa.g+=h.g,wa.b+=h.b):e instanceof THREE.PointLight&&(pa.r+=h.r,pa.g+=h.g,pa.b+=h.b)}function x(a,b,c,e){var h,l,f,k,o,n;h=0;for(l=a.length;h<l;h++)f=a[h],k=f.color,
|
|
|
|
-f instanceof THREE.DirectionalLight?(o=f.matrixWorld.getPosition(),n=c.dot(o),n<=0||(n*=f.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)):f instanceof THREE.PointLight&&(o=f.matrixWorld.getPosition(),n=c.dot(qa.sub(o,b).normalize()),n<=0||(n*=f.distance==0?1:1-Math.min(b.distanceTo(o)/f.distance,1),n!=0&&(n*=f.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)))}function Ta(a,h,f){c(f.opacity);b(f.blending);var k,o,n,t,v,xa;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)t=f.map.image,v=t.width>>1,xa=
|
|
|
|
-t.height>>1,f=h.scale.x*w,n=h.scale.y*z,k=f*v,o=n*xa,aa.set(a.x-k,a.y-o,a.x+k,a.y+o),ca.intersects(aa)&&(u.save(),u.translate(a.x,a.y),u.rotate(-h.rotation),u.scale(f,-n),u.translate(-v,-xa),u.drawImage(t,0,0),u.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*w,o=h.scale.y*z,aa.set(a.x-k,a.y-o,a.x+k,a.y+o),ca.intersects(aa)&&(e(f.color.getContextStyle()),l(f.color.getContextStyle()),u.save(),u.translate(a.x,a.y),u.rotate(-h.rotation),u.scale(k,o),f.program(u),u.restore()))}
|
|
|
|
-function B(a,h,l,f){c(f.opacity);b(f.blending);u.beginPath();u.moveTo(a.positionScreen.x,a.positionScreen.y);u.lineTo(h.positionScreen.x,h.positionScreen.y);u.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(R!=a)u.lineWidth=R=a;a=f.linecap;if(D!=a)u.lineCap=D=a;a=f.linejoin;if(O!=a)u.lineJoin=O=a;e(f.color.getContextStyle());u.stroke();aa.inflate(f.linewidth*2)}}function Pa(a,e,f,l,k,t,w,p){h.info.render.vertices+=3;h.info.render.faces++;c(p.opacity);b(p.blending);Z=a.positionScreen.x;
|
|
|
|
-U=a.positionScreen.y;o=e.positionScreen.x;P=e.positionScreen.y;ra=f.positionScreen.x;G=f.positionScreen.y;C(Z,U,o,P,ra,G);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(va=w.uvs[0],Qa(Z,U,o,P,ra,G,va[l].u,va[l].v,va[k].u,va[k].v,va[t].u,va[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=v.matrixWorldInverse,qa.copy(w.vertexNormalsWorld[l]),Ca=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,Ga=-(qa.x*a.n21+qa.y*
|
|
|
|
-a.n22+qa.z*a.n23)*0.5+0.5,qa.copy(w.vertexNormalsWorld[k]),ya=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,Aa=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,qa.copy(w.vertexNormalsWorld[t]),Ja=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,X=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,Qa(Z,U,o,P,ra,G,Ca,Ga,ya,Aa,Ja,X,p.envMap)}else p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof
|
|
|
|
-THREE.UVMapping&&(va=w.uvs[0],Qa(Z,U,o,P,ra,G,va[l].u,va[l].v,va[k].u,va[k].v,va[t].u,va[t].v,p.map)),b(THREE.SubtractiveBlending)),fa?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==3?(ga.r=na.r=ia.r=ma.r,ga.g=na.g=ia.g=ma.g,ga.b=na.b=ia.b=ma.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],ga),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],na),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],ia),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*
|
|
|
|
-ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),na.r=Math.max(0,Math.min(p.color.r*na.r,1)),na.g=Math.max(0,Math.min(p.color.g*na.g,1)),na.b=Math.max(0,Math.min(p.color.b*na.b,1)),ia.r=Math.max(0,Math.min(p.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ia.b,1)),I.r=(na.r+ia.r)*0.5,I.g=(na.g+ia.g)*0.5,I.b=(na.b+ia.b)*0.5,ua=Na(ga,na,ia,I),L(Z,U,o,P,ra,G,0,0,1,0,0,1,ua)):(ea.r=ma.r,ea.g=ma.g,ea.b=ma.b,x(n,w.centroidWorld,w.normalWorld,ea),ea.r=
|
|
|
|
-Math.max(0,Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(p.color.b*ea.b,1)),p.wireframe?H(ea,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(ea)):p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(p.color);else if(p instanceof THREE.MeshDepthMaterial)ha=v.near,ka=v.far,ga.r=ga.g=ga.b=1-La(a.positionScreen.z,ha,ka),na.r=na.g=na.b=1-La(e.positionScreen.z,ha,ka),ia.r=ia.g=ia.b=1-La(f.positionScreen.z,
|
|
|
|
-ha,ka),I.r=(na.r+ia.r)*0.5,I.g=(na.g+ia.g)*0.5,I.b=(na.b+ia.b)*0.5,ua=Na(ga,na,ia,I),L(Z,U,o,P,ra,G,0,0,1,0,0,1,ua);else if(p instanceof THREE.MeshNormalMaterial)ea.r=Ma(w.normalWorld.x),ea.g=Ma(w.normalWorld.y),ea.b=Ma(w.normalWorld.z),p.wireframe?H(ea,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(ea)}function y(a,e,f,l,k,t,w,p,u){h.info.render.vertices+=4;h.info.render.faces++;c(p.opacity);b(p.blending);if(p.map||p.envMap)Pa(a,e,l,0,1,3,w,p,u),Pa(k,f,t,1,2,3,w,p,u);else if(Z=a.positionScreen.x,
|
|
|
|
-U=a.positionScreen.y,o=e.positionScreen.x,P=e.positionScreen.y,ra=f.positionScreen.x,G=f.positionScreen.y,W=l.positionScreen.x,$=l.positionScreen.y,la=k.positionScreen.x,ja=k.positionScreen.y,sa=t.positionScreen.x,T=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)E(Z,U,o,P,ra,G,W,$),p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(p.color);else if(p instanceof THREE.MeshLambertMaterial)fa?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==
|
|
|
|
-4?(ga.r=na.r=ia.r=I.r=ma.r,ga.g=na.g=ia.g=I.g=ma.g,ga.b=na.b=ia.b=I.b=ma.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],ga),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],na),x(n,w.v4.positionWorld,w.vertexNormalsWorld[3],ia),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],I),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),na.r=Math.max(0,Math.min(p.color.r*na.r,1)),na.g=Math.max(0,Math.min(p.color.g*na.g,1)),na.b=
|
|
|
|
-Math.max(0,Math.min(p.color.b*na.b,1)),ia.r=Math.max(0,Math.min(p.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ia.b,1)),I.r=Math.max(0,Math.min(p.color.r*I.r,1)),I.g=Math.max(0,Math.min(p.color.g*I.g,1)),I.b=Math.max(0,Math.min(p.color.b*I.b,1)),ua=Na(ga,na,ia,I),C(Z,U,o,P,W,$),L(Z,U,o,P,W,$,0,0,1,0,0,1,ua),C(la,ja,ra,G,sa,T),L(la,ja,ra,G,sa,T,1,0,1,1,0,1,ua)):(ea.r=ma.r,ea.g=ma.g,ea.b=ma.b,x(n,w.centroidWorld,w.normalWorld,ea),ea.r=Math.max(0,Math.min(p.color.r*
|
|
|
|
-ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(p.color.b*ea.b,1)),E(Z,U,o,P,ra,G,W,$),p.wireframe?H(ea,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(ea)):(E(Z,U,o,P,ra,G,W,$),p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(p.color));else if(p instanceof THREE.MeshNormalMaterial)ea.r=Ma(w.normalWorld.x),ea.g=Ma(w.normalWorld.y),ea.b=Ma(w.normalWorld.z),E(Z,U,o,P,ra,G,W,$),p.wireframe?H(ea,p.wireframeLinewidth,p.wireframeLinecap,
|
|
|
|
-p.wireframeLinejoin):Fa(ea);else if(p instanceof THREE.MeshDepthMaterial)ha=v.near,ka=v.far,ga.r=ga.g=ga.b=1-La(a.positionScreen.z,ha,ka),na.r=na.g=na.b=1-La(e.positionScreen.z,ha,ka),ia.r=ia.g=ia.b=1-La(l.positionScreen.z,ha,ka),I.r=I.g=I.b=1-La(f.positionScreen.z,ha,ka),ua=Na(ga,na,ia,I),C(Z,U,o,P,W,$),L(Z,U,o,P,W,$,0,0,1,0,0,1,ua),C(la,ja,ra,G,sa,T),L(la,ja,ra,G,sa,T,1,0,1,1,0,1,ua)}function C(a,b,c,e,h,f){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(h,f);u.lineTo(a,b);u.closePath()}function E(a,
|
|
|
|
-b,c,e,h,f,l,k){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(h,f);u.lineTo(l,k);u.lineTo(a,b);u.closePath()}function H(a,b,c,h){if(R!=b)u.lineWidth=R=b;if(D!=c)u.lineCap=D=c;if(O!=h)u.lineJoin=O=h;e(a.getContextStyle());u.stroke();aa.inflate(b*2)}function Fa(a){l(a.getContextStyle());u.fill()}function Qa(a,b,c,e,h,f,k,o,n,p,t,w,v){if(v.image.width!=0){if(v.needsUpdate==!0||Q[v.id]==void 0){var xa=v.wrapS==THREE.RepeatWrapping,x=v.wrapT==THREE.RepeatWrapping;Q[v.id]=u.createPattern(v.image,xa&&
|
|
|
|
-x?"repeat":xa&&!x?"repeat-x":!xa&&x?"repeat-y":"no-repeat");v.needsUpdate=!1}l(Q[v.id]);var xa=v.offset.x/v.repeat.x,x=v.offset.y/v.repeat.y,X=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,k=(k+xa)*X,o=(o+x)*v,n=(n+xa)*X,p=(p+x)*v,t=(t+xa)*X,w=(w+x)*v;c-=a;e-=b;h-=a;f-=b;n-=k;p-=o;t-=k;w-=o;xa=1/(n*w-t*p);v=(w*c-p*h)*xa;p=(w*e-p*f)*xa;c=(n*h-t*c)*xa;e=(n*f-t*e)*xa;a=a-v*k-c*o;b=b-p*k-e*o;u.save();u.transform(v,p,c,e,a,b);u.fill();u.restore()}}function L(a,b,c,e,h,f,l,k,o,n,p,t,w){var v,
|
|
|
|
-xa;v=w.width-1;xa=w.height-1;l*=v;k*=xa;o*=v;n*=xa;p*=v;t*=xa;c-=a;e-=b;h-=a;f-=b;o-=l;n-=k;p-=l;t-=k;xa=1/(o*t-p*n);v=(t*c-n*h)*xa;n=(t*e-n*f)*xa;c=(o*h-p*c)*xa;e=(o*f-p*e)*xa;a=a-v*l-c*k;b=b-n*l-e*k;u.save();u.transform(v,n,c,e,a,b);u.clip();u.drawImage(w,0,0);u.restore()}function Na(a,b,c,e){var h=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),l=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),o=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),p=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255);za[0]=h<0?0:h>255?255:h;za[1]=f<0?
|
|
|
|
-0:f>255?255:f;za[2]=a<0?0:a>255?255:a;za[4]=l<0?0:l>255?255:l;za[5]=k<0?0:k>255?255:k;za[6]=b<0?0:b>255?255:b;za[8]=o<0?0:o>255?255:o;za[9]=n<0?0:n>255?255:n;za[10]=c<0?0:c>255?255:c;za[12]=p<0?0:p>255?255:p;za[13]=t<0?0:t>255?255:t;za[14]=e<0?0:e>255?255:e;Da.putImageData(Ha,0,0);S.drawImage(ta,0,0);return Ea}function La(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ma(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ka(a,b){var c=b.x-a.x,e=b.y-a.y,h=c*c+e*e;h!=0&&(h=1/Math.sqrt(h),c*=h,e*=h,b.x+=
|
|
|
|
-c,b.y+=e,a.x-=c,a.y-=e)}var Oa,Sa,Ba,Ia;this.autoClear?this.clear():u.setTransform(1,0,0,-1,w,z);h.info.render.vertices=0;h.info.render.faces=0;f=t.projectScene(a,v,this.sortElements);k=f.elements;n=f.lights;(fa=n.length>0)&&p(n);Oa=0;for(Sa=k.length;Oa<Sa;Oa++)if(Ba=k[Oa],Ia=Ba.material,Ia=Ia instanceof THREE.MeshFaceMaterial?Ba.faceMaterial:Ia,!(Ia==null||Ia.opacity==0)){aa.empty();if(Ba instanceof THREE.RenderableParticle)J=Ba,J.x*=w,J.y*=z,Ta(J,Ba,Ia,a);else if(Ba instanceof THREE.RenderableLine)J=
|
|
|
|
-Ba.v1,N=Ba.v2,J.positionScreen.x*=w,J.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,aa.addPoint(J.positionScreen.x,J.positionScreen.y),aa.addPoint(N.positionScreen.x,N.positionScreen.y),ca.intersects(aa)&&B(J,N,Ba,Ia,a);else if(Ba instanceof THREE.RenderableFace3)J=Ba.v1,N=Ba.v2,K=Ba.v3,J.positionScreen.x*=w,J.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,K.positionScreen.x*=w,K.positionScreen.y*=z,Ia.overdraw&&(Ka(J.positionScreen,N.positionScreen),Ka(N.positionScreen,
|
|
|
|
-K.positionScreen),Ka(K.positionScreen,J.positionScreen)),aa.add3Points(J.positionScreen.x,J.positionScreen.y,N.positionScreen.x,N.positionScreen.y,K.positionScreen.x,K.positionScreen.y),ca.intersects(aa)&&Pa(J,N,K,0,1,2,Ba,Ia,a);else if(Ba instanceof THREE.RenderableFace4)J=Ba.v1,N=Ba.v2,K=Ba.v3,M=Ba.v4,J.positionScreen.x*=w,J.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,K.positionScreen.x*=w,K.positionScreen.y*=z,M.positionScreen.x*=w,M.positionScreen.y*=z,Y.positionScreen.copy(N.positionScreen),
|
|
|
|
-oa.positionScreen.copy(M.positionScreen),Ia.overdraw&&(Ka(J.positionScreen,N.positionScreen),Ka(N.positionScreen,M.positionScreen),Ka(M.positionScreen,J.positionScreen),Ka(K.positionScreen,Y.positionScreen),Ka(K.positionScreen,oa.positionScreen)),aa.addPoint(J.positionScreen.x,J.positionScreen.y),aa.addPoint(N.positionScreen.x,N.positionScreen.y),aa.addPoint(K.positionScreen.x,K.positionScreen.y),aa.addPoint(M.positionScreen.x,M.positionScreen.y),ca.intersects(aa)&&y(J,N,K,M,Y,oa,Ba,Ia,a);V.addRectangle(aa)}u.setTransform(1,
|
|
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,l,h;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;l=b/2;h=e/2};this.render=function(b,e){var n,p,v,u,x,w,y,t;a=c.projectScene(b,e);n=0;for(p=a.length;n<p;n++)if(x=a[n],x instanceof THREE.RenderableParticle){y=x.x*l+l;t=x.y*h+h;v=0;for(u=x.material.length;v<u;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=y+"px",w.style.top=t+"px"}}};
|
|
|
|
+THREE.CanvasRenderer=function(a){function c(a){if(D!=a)t.globalAlpha=D=a}function b(a){if(C!=a){switch(a){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}C=a}}function e(a){if(H!=a)t.strokeStyle=H=a}function l(a){if(O!=a)t.fillStyle=O=a}var h=this,f,k,n,p=new THREE.Projector,a=a||{},v=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
|
+u,x,w,y,t=v.getContext("2d"),B=new THREE.Color(0),A=0,D=1,C=0,H=null,O=null,T=null,E=null,S=null,K,N,L,J,X=new THREE.RenderableVertex,oa=new THREE.RenderableVertex,Y,V,o,Q,qa,G,W,Z,na,ma,sa,U,da=new THREE.Color,ia=new THREE.Color,ea=new THREE.Color,la=new THREE.Color,I=new THREE.Color,R=[],ja,ka,ya,ta,pa,Ca,za,Ba,Ga,fa,P=new THREE.Rectangle,M=new THREE.Rectangle,ca=new THREE.Rectangle,ra=!1,ga=new THREE.Color,ua=new THREE.Color,va=new THREE.Color,ha=new THREE.Vector3,Fa,Ia,Da,xa,Ea,La,a=16;Fa=document.createElement("canvas");
|
|
|
|
+Fa.width=Fa.height=2;Ia=Fa.getContext("2d");Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Da=Ia.getImageData(0,0,2,2);xa=Da.data;Ea=document.createElement("canvas");Ea.width=Ea.height=a;La=Ea.getContext("2d");La.translate(-a/2,-a/2);La.scale(a,a);a--;this.domElement=v;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){u=a;x=b;w=Math.floor(u/2);y=Math.floor(x/2);v.width=u;v.height=x;P.set(-w,-y,w,y);M.set(-w,-y,w,y);D=1;C=0;S=
|
|
|
|
+E=T=O=H=null};this.setClearColor=function(a,b){B.copy(a);A=b;M.set(-w,-y,w,y)};this.setClearColorHex=function(a,b){B.setHex(a);A=b;M.set(-w,-y,w,y)};this.clear=function(){t.setTransform(1,0,0,-1,w,y);M.isEmpty()||(M.minSelf(P),M.inflate(2),A<1&&t.clearRect(Math.floor(M.getX()),Math.floor(M.getY()),Math.floor(M.getWidth()),Math.floor(M.getHeight())),A>0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*255)+","+A+")"),t.fillRect(Math.floor(M.getX()),
|
|
|
|
+Math.floor(M.getY()),Math.floor(M.getWidth()),Math.floor(M.getHeight()))),M.empty())};this.render=function(a,v){function u(a){var b,c,e,h;ga.setRGB(0,0,0);ua.setRGB(0,0,0);va.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],h=e.color,e instanceof THREE.AmbientLight?(ga.r+=h.r,ga.g+=h.g,ga.b+=h.b):e instanceof THREE.DirectionalLight?(ua.r+=h.r,ua.g+=h.g,ua.b+=h.b):e instanceof THREE.PointLight&&(va.r+=h.r,va.g+=h.g,va.b+=h.b)}function x(a,b,c,e){var h,l,f,k,o,n;h=0;for(l=a.length;h<l;h++)f=a[h],k=f.color,
|
|
|
|
+f instanceof THREE.DirectionalLight?(o=f.matrixWorld.getPosition(),n=c.dot(o),n<=0||(n*=f.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)):f instanceof THREE.PointLight&&(o=f.matrixWorld.getPosition(),n=c.dot(ha.sub(o,b).normalize()),n<=0||(n*=f.distance==0?1:1-Math.min(b.distanceTo(o)/f.distance,1),n!=0&&(n*=f.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)))}function B(a,h,f){c(f.opacity);b(f.blending);var k,o,n,p,v,u;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)p=f.map.image,v=p.width>>1,u=p.height>>
|
|
|
|
+1,f=h.scale.x*w,n=h.scale.y*y,k=f*v,o=n*u,ca.set(a.x-k,a.y-o,a.x+k,a.y+o),P.intersects(ca)&&(t.save(),t.translate(a.x,a.y),t.rotate(-h.rotation),t.scale(f,-n),t.translate(-v,-u),t.drawImage(p,0,0),t.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*w,o=h.scale.y*y,ca.set(a.x-k,a.y-o,a.x+k,a.y+o),P.intersects(ca)&&(e(f.color.getContextStyle()),l(f.color.getContextStyle()),t.save(),t.translate(a.x,a.y),t.rotate(-h.rotation),t.scale(k,o),f.program(t),t.restore()))}function Ta(a,
|
|
|
|
+h,l,f){c(f.opacity);b(f.blending);t.beginPath();t.moveTo(a.positionScreen.x,a.positionScreen.y);t.lineTo(h.positionScreen.x,h.positionScreen.y);t.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(T!=a)t.lineWidth=T=a;a=f.linecap;if(E!=a)t.lineCap=E=a;a=f.linejoin;if(S!=a)t.lineJoin=S=a;e(f.color.getContextStyle());t.stroke();ca.inflate(f.linewidth*2)}}function A(a,e,f,l,k,p,w,u){h.info.render.vertices+=3;h.info.render.faces++;c(u.opacity);b(u.blending);Y=a.positionScreen.x;V=a.positionScreen.y;
|
|
|
|
+o=e.positionScreen.x;Q=e.positionScreen.y;qa=f.positionScreen.x;G=f.positionScreen.y;C(Y,V,o,Q,qa,G);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(ta=w.uvs[0],Ja(Y,V,o,Q,qa,G,ta[l].u,ta[l].v,ta[k].u,ta[k].v,ta[p].u,ta[p].v,u.map));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=v.matrixWorldInverse,ha.copy(w.vertexNormalsWorld[l]),pa=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,Ca=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+
|
|
|
|
+0.5,ha.copy(w.vertexNormalsWorld[k]),za=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,Ba=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,ha.copy(w.vertexNormalsWorld[p]),Ga=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,fa=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,Ja(Y,V,o,Q,qa,G,pa,Ca,za,Ba,Ga,fa,u.envMap)}else u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):H(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&
|
|
|
|
+(ta=w.uvs[0],Ja(Y,V,o,Q,qa,G,ta[l].u,ta[l].v,ta[k].u,ta[k].v,ta[p].u,ta[p].v,u.map)),b(THREE.SubtractiveBlending)),ra?!u.wireframe&&u.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==3?(ia.r=ea.r=la.r=ga.r,ia.g=ea.g=la.g=ga.g,ia.b=ea.b=la.b=ga.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],ia),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],ea),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],la),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=
|
|
|
|
+Math.max(0,Math.min(u.color.b*ia.b,1)),ea.r=Math.max(0,Math.min(u.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(u.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(u.color.b*ea.b,1)),la.r=Math.max(0,Math.min(u.color.r*la.r,1)),la.g=Math.max(0,Math.min(u.color.g*la.g,1)),la.b=Math.max(0,Math.min(u.color.b*la.b,1)),I.r=(ea.r+la.r)*0.5,I.g=(ea.g+la.g)*0.5,I.b=(ea.b+la.b)*0.5,ya=O(ia,ea,la,I),Na(Y,V,o,Q,qa,G,0,0,1,0,0,1,ya)):(da.r=ga.r,da.g=ga.g,da.b=ga.b,x(n,w.centroidWorld,w.normalWorld,da),da.r=Math.max(0,Math.min(u.color.r*
|
|
|
|
+da.r,1)),da.g=Math.max(0,Math.min(u.color.g*da.g,1)),da.b=Math.max(0,Math.min(u.color.b*da.b,1)),u.wireframe?D(da,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):H(da)):u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):H(u.color);else if(u instanceof THREE.MeshDepthMaterial)ja=v.near,ka=v.far,ia.r=ia.g=ia.b=1-Ma(a.positionScreen.z,ja,ka),ea.r=ea.g=ea.b=1-Ma(e.positionScreen.z,ja,ka),la.r=la.g=la.b=1-Ma(f.positionScreen.z,ja,ka),I.r=(ea.r+la.r)*0.5,I.g=
|
|
|
|
+(ea.g+la.g)*0.5,I.b=(ea.b+la.b)*0.5,ya=O(ia,ea,la,I),Na(Y,V,o,Q,qa,G,0,0,1,0,0,1,ya);else if(u instanceof THREE.MeshNormalMaterial)da.r=Oa(w.normalWorld.x),da.g=Oa(w.normalWorld.y),da.b=Oa(w.normalWorld.z),u.wireframe?D(da,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):H(da)}function Ua(a,e,f,l,k,p,w,u,wa){h.info.render.vertices+=4;h.info.render.faces++;c(u.opacity);b(u.blending);if(u.map||u.envMap)A(a,e,l,0,1,3,w,u,wa),A(k,f,p,1,2,3,w,u,wa);else if(Y=a.positionScreen.x,V=a.positionScreen.y,
|
|
|
|
+o=e.positionScreen.x,Q=e.positionScreen.y,qa=f.positionScreen.x,G=f.positionScreen.y,W=l.positionScreen.x,Z=l.positionScreen.y,na=k.positionScreen.x,ma=k.positionScreen.y,sa=p.positionScreen.x,U=p.positionScreen.y,u instanceof THREE.MeshBasicMaterial)Pa(Y,V,o,Q,qa,G,W,Z),u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):H(u.color);else if(u instanceof THREE.MeshLambertMaterial)ra?!u.wireframe&&u.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==4?(ia.r=ea.r=
|
|
|
|
+la.r=I.r=ga.r,ia.g=ea.g=la.g=I.g=ga.g,ia.b=ea.b=la.b=I.b=ga.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],ia),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],ea),x(n,w.v4.positionWorld,w.vertexNormalsWorld[3],la),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],I),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(u.color.b*ia.b,1)),ea.r=Math.max(0,Math.min(u.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(u.color.g*ea.g,1)),ea.b=Math.max(0,
|
|
|
|
+Math.min(u.color.b*ea.b,1)),la.r=Math.max(0,Math.min(u.color.r*la.r,1)),la.g=Math.max(0,Math.min(u.color.g*la.g,1)),la.b=Math.max(0,Math.min(u.color.b*la.b,1)),I.r=Math.max(0,Math.min(u.color.r*I.r,1)),I.g=Math.max(0,Math.min(u.color.g*I.g,1)),I.b=Math.max(0,Math.min(u.color.b*I.b,1)),ya=O(ia,ea,la,I),C(Y,V,o,Q,W,Z),Na(Y,V,o,Q,W,Z,0,0,1,0,0,1,ya),C(na,ma,qa,G,sa,U),Na(na,ma,qa,G,sa,U,1,0,1,1,0,1,ya)):(da.r=ga.r,da.g=ga.g,da.b=ga.b,x(n,w.centroidWorld,w.normalWorld,da),da.r=Math.max(0,Math.min(u.color.r*
|
|
|
|
+da.r,1)),da.g=Math.max(0,Math.min(u.color.g*da.g,1)),da.b=Math.max(0,Math.min(u.color.b*da.b,1)),Pa(Y,V,o,Q,qa,G,W,Z),u.wireframe?D(da,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):H(da)):(Pa(Y,V,o,Q,qa,G,W,Z),u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):H(u.color));else if(u instanceof THREE.MeshNormalMaterial)da.r=Oa(w.normalWorld.x),da.g=Oa(w.normalWorld.y),da.b=Oa(w.normalWorld.z),Pa(Y,V,o,Q,qa,G,W,Z),u.wireframe?D(da,u.wireframeLinewidth,u.wireframeLinecap,
|
|
|
|
+u.wireframeLinejoin):H(da);else if(u instanceof THREE.MeshDepthMaterial)ja=v.near,ka=v.far,ia.r=ia.g=ia.b=1-Ma(a.positionScreen.z,ja,ka),ea.r=ea.g=ea.b=1-Ma(e.positionScreen.z,ja,ka),la.r=la.g=la.b=1-Ma(l.positionScreen.z,ja,ka),I.r=I.g=I.b=1-Ma(f.positionScreen.z,ja,ka),ya=O(ia,ea,la,I),C(Y,V,o,Q,W,Z),Na(Y,V,o,Q,W,Z,0,0,1,0,0,1,ya),C(na,ma,qa,G,sa,U),Na(na,ma,qa,G,sa,U,1,0,1,1,0,1,ya)}function C(a,b,c,e,h,f){t.beginPath();t.moveTo(a,b);t.lineTo(c,e);t.lineTo(h,f);t.lineTo(a,b);t.closePath()}function Pa(a,
|
|
|
|
+b,c,e,h,f,l,k){t.beginPath();t.moveTo(a,b);t.lineTo(c,e);t.lineTo(h,f);t.lineTo(l,k);t.lineTo(a,b);t.closePath()}function D(a,b,c,h){if(T!=b)t.lineWidth=T=b;if(E!=c)t.lineCap=E=c;if(S!=h)t.lineJoin=S=h;e(a.getContextStyle());t.stroke();ca.inflate(b*2)}function H(a){l(a.getContextStyle());t.fill()}function Ja(a,b,c,e,h,f,k,o,n,u,p,w,v){if(v.image.width!=0){if(v.needsUpdate==!0||R[v.id]==void 0){var wa=v.wrapS==THREE.RepeatWrapping,x=v.wrapT==THREE.RepeatWrapping;R[v.id]=t.createPattern(v.image,wa&&
|
|
|
|
+x?"repeat":wa&&!x?"repeat-x":!wa&&x?"repeat-y":"no-repeat");v.needsUpdate=!1}l(R[v.id]);var wa=v.offset.x/v.repeat.x,x=v.offset.y/v.repeat.y,fa=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,k=(k+wa)*fa,o=(o+x)*v,n=(n+wa)*fa,u=(u+x)*v,p=(p+wa)*fa,w=(w+x)*v;c-=a;e-=b;h-=a;f-=b;n-=k;u-=o;p-=k;w-=o;wa=1/(n*w-p*u);v=(w*c-u*h)*wa;u=(w*e-u*f)*wa;c=(n*h-p*c)*wa;e=(n*f-p*e)*wa;a=a-v*k-c*o;b=b-u*k-e*o;t.save();t.transform(v,u,c,e,a,b);t.fill();t.restore()}}function Na(a,b,c,e,h,f,l,k,o,n,u,p,
|
|
|
|
+w){var v,wa;v=w.width-1;wa=w.height-1;l*=v;k*=wa;o*=v;n*=wa;u*=v;p*=wa;c-=a;e-=b;h-=a;f-=b;o-=l;n-=k;u-=l;p-=k;wa=1/(o*p-u*n);v=(p*c-n*h)*wa;n=(p*e-n*f)*wa;c=(o*h-u*c)*wa;e=(o*f-u*e)*wa;a=a-v*l-c*k;b=b-n*l-e*k;t.save();t.transform(v,n,c,e,a,b);t.clip();t.drawImage(w,0,0);t.restore()}function O(a,b,c,e){var h=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),l=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),o=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),u=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255);xa[0]=h<0?0:h>255?255:h;xa[1]=
|
|
|
|
+f<0?0:f>255?255:f;xa[2]=a<0?0:a>255?255:a;xa[4]=l<0?0:l>255?255:l;xa[5]=k<0?0:k>255?255:k;xa[6]=b<0?0:b>255?255:b;xa[8]=o<0?0:o>255?255:o;xa[9]=n<0?0:n>255?255:n;xa[10]=c<0?0:c>255?255:c;xa[12]=u<0?0:u>255?255:u;xa[13]=p<0?0:p>255?255:p;xa[14]=e<0?0:e>255?255:e;Ia.putImageData(Da,0,0);La.drawImage(Fa,0,0);return Ea}function Ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Oa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ka(a,b){var c=b.x-a.x,e=b.y-a.y,h=c*c+e*e;h!=0&&(h=1/Math.sqrt(h),c*=h,e*=h,
|
|
|
|
+b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Qa,Sa,Aa,Ha;this.autoClear?this.clear():t.setTransform(1,0,0,-1,w,y);h.info.render.vertices=0;h.info.render.faces=0;f=p.projectScene(a,v,this.sortElements);k=f.elements;n=f.lights;(ra=n.length>0)&&u(n);Qa=0;for(Sa=k.length;Qa<Sa;Qa++)if(Aa=k[Qa],Ha=Aa.material,Ha=Ha instanceof THREE.MeshFaceMaterial?Aa.faceMaterial:Ha,!(Ha==null||Ha.opacity==0)){ca.empty();if(Aa instanceof THREE.RenderableParticle)K=Aa,K.x*=w,K.y*=y,B(K,Aa,Ha,a);else if(Aa instanceof THREE.RenderableLine)K=
|
|
|
|
+Aa.v1,N=Aa.v2,K.positionScreen.x*=w,K.positionScreen.y*=y,N.positionScreen.x*=w,N.positionScreen.y*=y,ca.addPoint(K.positionScreen.x,K.positionScreen.y),ca.addPoint(N.positionScreen.x,N.positionScreen.y),P.intersects(ca)&&Ta(K,N,Aa,Ha,a);else if(Aa instanceof THREE.RenderableFace3)K=Aa.v1,N=Aa.v2,L=Aa.v3,K.positionScreen.x*=w,K.positionScreen.y*=y,N.positionScreen.x*=w,N.positionScreen.y*=y,L.positionScreen.x*=w,L.positionScreen.y*=y,Ha.overdraw&&(Ka(K.positionScreen,N.positionScreen),Ka(N.positionScreen,
|
|
|
|
+L.positionScreen),Ka(L.positionScreen,K.positionScreen)),ca.add3Points(K.positionScreen.x,K.positionScreen.y,N.positionScreen.x,N.positionScreen.y,L.positionScreen.x,L.positionScreen.y),P.intersects(ca)&&A(K,N,L,0,1,2,Aa,Ha,a);else if(Aa instanceof THREE.RenderableFace4)K=Aa.v1,N=Aa.v2,L=Aa.v3,J=Aa.v4,K.positionScreen.x*=w,K.positionScreen.y*=y,N.positionScreen.x*=w,N.positionScreen.y*=y,L.positionScreen.x*=w,L.positionScreen.y*=y,J.positionScreen.x*=w,J.positionScreen.y*=y,X.positionScreen.copy(N.positionScreen),
|
|
|
|
+oa.positionScreen.copy(J.positionScreen),Ha.overdraw&&(Ka(K.positionScreen,N.positionScreen),Ka(N.positionScreen,J.positionScreen),Ka(J.positionScreen,K.positionScreen),Ka(L.positionScreen,X.positionScreen),Ka(L.positionScreen,oa.positionScreen)),ca.addPoint(K.positionScreen.x,K.positionScreen.y),ca.addPoint(N.positionScreen.x,N.positionScreen.y),ca.addPoint(L.positionScreen.x,L.positionScreen.y),ca.addPoint(J.positionScreen.x,J.positionScreen.y),P.intersects(ca)&&Ua(K,N,L,J,X,oa,Aa,Ha,a);M.addRectangle(ca)}t.setTransform(1,
|
|
0,0,1,0,0)}};
|
|
0,0,1,0,0)}};
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,e){var h,f,l,k,n,p;h=0;for(f=a.length;h<f;h++)l=a[h],k=l.color,l instanceof THREE.DirectionalLight?(n=l.matrixWorld.getPosition(),p=c.dot(n),p<=0||(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)):l instanceof THREE.PointLight&&(n=l.matrixWorld.getPosition(),p=c.dot(J.sub(n,b).normalize()),p<=0||(p*=l.distance==0?1:1-Math.min(b.distanceTo(n)/l.distance,1),p!=0&&(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)))}function c(a){N[a]==null&&(N[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
-"path"),Z==0&&N[a].setAttribute("shape-rendering","crispEdges"));return N[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,l,h,f,k=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,v,p,x,w,z,u,B,y=new THREE.Rectangle,E=new THREE.Rectangle,C=!1,H=new THREE.Color,L=new THREE.Color,R=new THREE.Color,D=new THREE.Color,O,J=new THREE.Vector3,N=[],K=[],M,Y,oa,Z=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
|
-faces:0}};this.setQuality=function(a){switch(a){case "high":Z=1;break;case "low":Z=0}};this.setSize=function(a,b){t=a;v=b;p=t/2;x=v/2;n.setAttribute("viewBox",-p+" "+-x+" "+t+" "+v);n.setAttribute("width",t);n.setAttribute("height",v);y.set(-p,-x,p,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(t,o){var v,J,G,W;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(t,o,this.sortElements);h=l.elements;
|
|
|
|
-f=l.lights;oa=Y=0;if(C=f.length>0){L.setRGB(0,0,0);R.setRGB(0,0,0);D.setRGB(0,0,0);v=0;for(J=f.length;v<J;v++)W=f[v],G=W.color,W instanceof THREE.AmbientLight?(L.r+=G.r,L.g+=G.g,L.b+=G.b):W instanceof THREE.DirectionalLight?(R.r+=G.r,R.g+=G.g,R.b+=G.b):W instanceof THREE.PointLight&&(D.r+=G.r,D.g+=G.g,D.b+=G.b)}v=0;for(J=h.length;v<J;v++)if(G=h[v],W=G.material,W=W instanceof THREE.MeshFaceMaterial?G.faceMaterial:W,!(W==null||W.opacity==0))if(E.empty(),G instanceof THREE.RenderableParticle)w=G,w.x*=
|
|
|
|
-p,w.y*=-x,m=0,ml=G.materials.length;else if(G instanceof THREE.RenderableLine){if(w=G.v1,z=G.v2,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),y.intersects(E)){G=w;var N=z,la=oa++;K[la]==null&&(K[la]=document.createElementNS("http://www.w3.org/2000/svg","line"),Z==0&&K[la].setAttribute("shape-rendering","crispEdges"));M=K[la];M.setAttribute("x1",G.positionScreen.x);
|
|
|
|
-M.setAttribute("y1",G.positionScreen.y);M.setAttribute("x2",N.positionScreen.x);M.setAttribute("y2",N.positionScreen.y);W instanceof THREE.LineBasicMaterial&&(M.setAttribute("style","fill: none; stroke: "+W.color.getContextStyle()+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin),n.appendChild(M))}}else if(G instanceof THREE.RenderableFace3){if(w=G.v1,z=G.v2,u=G.v3,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=
|
|
|
|
-p,z.positionScreen.y*=-x,u.positionScreen.x*=p,u.positionScreen.y*=-x,E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(u.positionScreen.x,u.positionScreen.y),y.intersects(E)){var N=w,la=z,ja=u;e.info.render.vertices+=3;e.info.render.faces++;M=c(Y++);M.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+la.positionScreen.x+" "+la.positionScreen.y+" L "+ja.positionScreen.x+","+ja.positionScreen.y+"z");W instanceof THREE.MeshBasicMaterial?
|
|
|
|
-H.copy(W.color):W instanceof THREE.MeshLambertMaterial?C?(H.r=L.r,H.g=L.g,H.b=L.b,a(f,G.centroidWorld,G.normalWorld,H),H.r=Math.max(0,Math.min(W.color.r*H.r,1)),H.g=Math.max(0,Math.min(W.color.g*H.g,1)),H.b=Math.max(0,Math.min(W.color.b*H.b,1))):H.copy(W.color):W instanceof THREE.MeshDepthMaterial?(O=1-W.__2near/(W.__farPlusNear-G.z*W.__farMinusNear),H.setRGB(O,O,O)):W instanceof THREE.MeshNormalMaterial&&H.setRGB(b(G.normalWorld.x),b(G.normalWorld.y),b(G.normalWorld.z));W.wireframe?M.setAttribute("style",
|
|
|
|
-"fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+W.wireframeLinewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.wireframeLinecap+"; stroke-linejoin: "+W.wireframeLinejoin):M.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+W.opacity);n.appendChild(M)}}else if(G instanceof THREE.RenderableFace4&&(w=G.v1,z=G.v2,u=G.v3,B=G.v4,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,u.positionScreen.x*=p,u.positionScreen.y*=
|
|
|
|
--x,B.positionScreen.x*=p,B.positionScreen.y*=-x,E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(u.positionScreen.x,u.positionScreen.y),E.addPoint(B.positionScreen.x,B.positionScreen.y),y.intersects(E))){var N=w,la=z,ja=u,sa=B;e.info.render.vertices+=4;e.info.render.faces++;M=c(Y++);M.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+la.positionScreen.x+" "+la.positionScreen.y+" L "+ja.positionScreen.x+","+ja.positionScreen.y+
|
|
|
|
-" L "+sa.positionScreen.x+","+sa.positionScreen.y+"z");W instanceof THREE.MeshBasicMaterial?H.copy(W.color):W instanceof THREE.MeshLambertMaterial?C?(H.r=L.r,H.g=L.g,H.b=L.b,a(f,G.centroidWorld,G.normalWorld,H),H.r=Math.max(0,Math.min(W.color.r*H.r,1)),H.g=Math.max(0,Math.min(W.color.g*H.g,1)),H.b=Math.max(0,Math.min(W.color.b*H.b,1))):H.copy(W.color):W instanceof THREE.MeshDepthMaterial?(O=1-W.__2near/(W.__farPlusNear-G.z*W.__farMinusNear),H.setRGB(O,O,O)):W instanceof THREE.MeshNormalMaterial&&
|
|
|
|
-H.setRGB(b(G.normalWorld.x),b(G.normalWorld.y),b(G.normalWorld.z));W.wireframe?M.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+W.wireframeLinewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.wireframeLinecap+"; stroke-linejoin: "+W.wireframeLinejoin):M.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+W.opacity);n.appendChild(M)}}};
|
|
|
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,e){var h,f,l,k,n,u;h=0;for(f=a.length;h<f;h++)l=a[h],k=l.color,l instanceof THREE.DirectionalLight?(n=l.matrixWorld.getPosition(),u=c.dot(n),u<=0||(u*=l.intensity,e.r+=k.r*u,e.g+=k.g*u,e.b+=k.b*u)):l instanceof THREE.PointLight&&(n=l.matrixWorld.getPosition(),u=c.dot(K.sub(n,b).normalize()),u<=0||(u*=l.distance==0?1:1-Math.min(b.distanceTo(n)/l.distance,1),u!=0&&(u*=l.intensity,e.r+=k.r*u,e.g+=k.g*u,e.b+=k.b*u)))}function c(a){N[a]==null&&(N[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
+"path"),Y==0&&N[a].setAttribute("shape-rendering","crispEdges"));return N[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,l,h,f,k=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,v,u,x,w,y,t,B,A=new THREE.Rectangle,D=new THREE.Rectangle,C=!1,H=new THREE.Color,O=new THREE.Color,T=new THREE.Color,E=new THREE.Color,S,K=new THREE.Vector3,N=[],L=[],J,X,oa,Y=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
|
+faces:0}};this.setQuality=function(a){switch(a){case "high":Y=1;break;case "low":Y=0}};this.setSize=function(a,b){p=a;v=b;u=p/2;x=v/2;n.setAttribute("viewBox",-u+" "+-x+" "+p+" "+v);n.setAttribute("width",p);n.setAttribute("height",v);A.set(-u,-x,u,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(p,o){var v,K,G,W;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(p,o,this.sortElements);h=l.elements;
|
|
|
|
+f=l.lights;oa=X=0;if(C=f.length>0){O.setRGB(0,0,0);T.setRGB(0,0,0);E.setRGB(0,0,0);v=0;for(K=f.length;v<K;v++)W=f[v],G=W.color,W instanceof THREE.AmbientLight?(O.r+=G.r,O.g+=G.g,O.b+=G.b):W instanceof THREE.DirectionalLight?(T.r+=G.r,T.g+=G.g,T.b+=G.b):W instanceof THREE.PointLight&&(E.r+=G.r,E.g+=G.g,E.b+=G.b)}v=0;for(K=h.length;v<K;v++)if(G=h[v],W=G.material,W=W instanceof THREE.MeshFaceMaterial?G.faceMaterial:W,!(W==null||W.opacity==0))if(D.empty(),G instanceof THREE.RenderableParticle)w=G,w.x*=
|
|
|
|
+u,w.y*=-x,m=0,ml=G.materials.length;else if(G instanceof THREE.RenderableLine){if(w=G.v1,y=G.v2,w.positionScreen.x*=u,w.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(D)){G=w;var N=y,na=oa++;L[na]==null&&(L[na]=document.createElementNS("http://www.w3.org/2000/svg","line"),Y==0&&L[na].setAttribute("shape-rendering","crispEdges"));J=L[na];J.setAttribute("x1",G.positionScreen.x);
|
|
|
|
+J.setAttribute("y1",G.positionScreen.y);J.setAttribute("x2",N.positionScreen.x);J.setAttribute("y2",N.positionScreen.y);W instanceof THREE.LineBasicMaterial&&(J.setAttribute("style","fill: none; stroke: "+W.color.getContextStyle()+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin),n.appendChild(J))}}else if(G instanceof THREE.RenderableFace3){if(w=G.v1,y=G.v2,t=G.v3,w.positionScreen.x*=u,w.positionScreen.y*=-x,y.positionScreen.x*=
|
|
|
|
+u,y.positionScreen.y*=-x,t.positionScreen.x*=u,t.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(t.positionScreen.x,t.positionScreen.y),A.intersects(D)){var N=w,na=y,ma=t;e.info.render.vertices+=3;e.info.render.faces++;J=c(X++);J.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+na.positionScreen.x+" "+na.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");W instanceof THREE.MeshBasicMaterial?
|
|
|
|
+H.copy(W.color):W instanceof THREE.MeshLambertMaterial?C?(H.r=O.r,H.g=O.g,H.b=O.b,a(f,G.centroidWorld,G.normalWorld,H),H.r=Math.max(0,Math.min(W.color.r*H.r,1)),H.g=Math.max(0,Math.min(W.color.g*H.g,1)),H.b=Math.max(0,Math.min(W.color.b*H.b,1))):H.copy(W.color):W instanceof THREE.MeshDepthMaterial?(S=1-W.__2near/(W.__farPlusNear-G.z*W.__farMinusNear),H.setRGB(S,S,S)):W instanceof THREE.MeshNormalMaterial&&H.setRGB(b(G.normalWorld.x),b(G.normalWorld.y),b(G.normalWorld.z));W.wireframe?J.setAttribute("style",
|
|
|
|
+"fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+W.wireframeLinewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.wireframeLinecap+"; stroke-linejoin: "+W.wireframeLinejoin):J.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+W.opacity);n.appendChild(J)}}else if(G instanceof THREE.RenderableFace4&&(w=G.v1,y=G.v2,t=G.v3,B=G.v4,w.positionScreen.x*=u,w.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,t.positionScreen.x*=u,t.positionScreen.y*=
|
|
|
|
+-x,B.positionScreen.x*=u,B.positionScreen.y*=-x,D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(t.positionScreen.x,t.positionScreen.y),D.addPoint(B.positionScreen.x,B.positionScreen.y),A.intersects(D))){var N=w,na=y,ma=t,sa=B;e.info.render.vertices+=4;e.info.render.faces++;J=c(X++);J.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+na.positionScreen.x+" "+na.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+
|
|
|
|
+" L "+sa.positionScreen.x+","+sa.positionScreen.y+"z");W instanceof THREE.MeshBasicMaterial?H.copy(W.color):W instanceof THREE.MeshLambertMaterial?C?(H.r=O.r,H.g=O.g,H.b=O.b,a(f,G.centroidWorld,G.normalWorld,H),H.r=Math.max(0,Math.min(W.color.r*H.r,1)),H.g=Math.max(0,Math.min(W.color.g*H.g,1)),H.b=Math.max(0,Math.min(W.color.b*H.b,1))):H.copy(W.color):W instanceof THREE.MeshDepthMaterial?(S=1-W.__2near/(W.__farPlusNear-G.z*W.__farMinusNear),H.setRGB(S,S,S)):W instanceof THREE.MeshNormalMaterial&&
|
|
|
|
+H.setRGB(b(G.normalWorld.x),b(G.normalWorld.y),b(G.normalWorld.z));W.wireframe?J.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+W.wireframeLinewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.wireframeLinecap+"; stroke-linejoin: "+W.wireframeLinejoin):J.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+W.opacity);n.appendChild(J)}}};
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
|
|
envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
@@ -225,131 +225,131 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_
|
|
THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
|
|
THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var h in e.attributes){var f=e.attributes[h];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var l=1;f.type==="v2"?l=2:f.type==="v3"?l=3:f.type==="v4"?l=4:f.type==="c"&&(l=3);f.size=l;f.array=new Float32Array(c*l);f.buffer=o.createBuffer();f.buffer.belongsToAttribute=h;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var h in e.attributes){var f=e.attributes[h];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var l=1;f.type==="v2"?l=2:f.type==="v3"?l=3:f.type==="v4"?l=4:f.type==="c"&&(l=3);f.size=l;f.array=new Float32Array(c*l);f.buffer=o.createBuffer();f.buffer.belongsToAttribute=h;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
-function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,h,f,l=a.vertices,k=l.length,n=a.colors,p=n.length,t=a.__vertexArray,w=a.__colorArray,v=a.__sortArray,u=a.__dirtyVertices,x=a.__dirtyColors,X=a.__webglCustomAttributesList;if(c.sortParticles){Ca.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)h=l[e].position,Aa.copy(h),Ca.multiplyVector3(Aa),v[e]=[Aa.z,e];v.sort(function(a,
|
|
|
|
-b){return b[0]-a[0]});for(e=0;e<k;e++)h=l[v[e][1]].position,f=e*3,t[f]=h.x,t[f+1]=h.y,t[f+2]=h.z;for(e=0;e<p;e++)f=e*3,color=n[v[e][1]],w[f]=color.r,w[f+1]=color.g,w[f+2]=color.b;if(X){n=0;for(p=X.length;n<p;n++)if(k=X[n],k.boundTo===void 0||k.boundTo==="vertices")if(f=0,h=k.value.length,k.size===1)for(e=0;e<h;e++)index=v[e][1],k.array[e]=k.value[index];else if(k.size===2)for(e=0;e<h;e++)index=v[e][1],l=k.value[index],k.array[f]=l.x,k.array[f+1]=l.y,f+=2;else if(k.size===3)if(k.type==="c")for(e=0;e<
|
|
|
|
-h;e++)index=v[e][1],l=k.value[index],k.array[f]=l.r,k.array[f+1]=l.g,k.array[f+2]=l.b,f+=3;else for(e=0;e<h;e++)index=v[e][1],l=k.value[index],k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,f+=3;else if(k.size===4)for(e=0;e<h;e++)index=v[e][1],l=k.value[index],k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,k.array[f+3]=l.w,f+=4}}else{if(u)for(e=0;e<k;e++)h=l[e].position,f=e*3,t[f]=h.x,t[f+1]=h.y,t[f+2]=h.z;if(x)for(e=0;e<p;e++)color=n[e],f=e*3,w[f]=color.r,w[f+1]=color.g,w[f+2]=color.b;if(X){n=
|
|
|
|
-0;for(p=X.length;n<p;n++)if(k=X[n],k.needsUpdate&&(k.boundTo===void 0||k.boundTo==="vertices"))if(h=k.value.length,f=0,k.size===1)for(e=0;e<h;e++)k.array[e]=k.value[e];else if(k.size===2)for(e=0;e<h;e++)l=k.value[e],k.array[f]=l.x,k.array[f+1]=l.y,f+=2;else if(k.size===3)if(k.type==="c")for(e=0;e<h;e++)l=k.value[e],k.array[f]=l.r,k.array[f+1]=l.g,k.array[f+2]=l.b,f+=3;else for(e=0;e<h;e++)l=k.value[e],k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,f+=3;else if(k.size===4)for(e=0;e<h;e++)l=k.value[e],
|
|
|
|
-k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,k.array[f+3]=l.w,f+=4}}if(u||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,t,b);if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,b);if(X){n=0;for(p=X.length;n<p;n++)if(k=X[n],k.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,k.buffer),o.bufferData(o.ARRAY_BUFFER,k.array,b)}}function l(a,b,c,e,f){e.program||U.initMaterial(e,b,c,f);if(e.morphTargets&&
|
|
|
|
-!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(U.maxMorphTargets);for(var h=0,l=U.maxMorphTargets;h<l;h++)f.__webglMorphTargetInfluences[h]=0}var k=!1,h=e.program,l=h.uniforms,n=e.uniforms;h!==ra&&(o.useProgram(h),ra=h,k=!0);if(e.id!==W)W=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,Ga);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;
|
|
|
|
-if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var p,t,w=0,v=0,u=0,x,z,B,V=Ja,ca=V.directional.colors,C=V.directional.positions,y=V.point.colors,E=V.point.positions,H=V.point.distances,aa=0,I=0,c=p=B=0,k=b.length;c<k;c++)if(p=b[c],t=p.color,x=p.position,z=p.intensity,B=p.distance,p instanceof THREE.AmbientLight)U.gammaInput?(w+=t.r*t.r,v+=t.g*t.g,u+=t.b*t.b):(w+=t.r,v+=t.g,u+=t.b);else if(p instanceof THREE.DirectionalLight)B=aa*3,U.gammaInput?(ca[B]=
|
|
|
|
-t.r*t.r*z*z,ca[B+1]=t.g*t.g*z*z,ca[B+2]=t.b*t.b*z*z):(ca[B]=t.r*z,ca[B+1]=t.g*z,ca[B+2]=t.b*z),C[B]=x.x,C[B+1]=x.y,C[B+2]=x.z,aa+=1;else if(p instanceof THREE.SpotLight)B=aa*3,U.gammaInput?(ca[B]=t.r*t.r*z*z,ca[B+1]=t.g*t.g*z*z,ca[B+2]=t.b*t.b*z*z):(ca[B]=t.r*z,ca[B+1]=t.g*z,ca[B+2]=t.b*z),t=1/x.length(),C[B]=x.x*t,C[B+1]=x.y*t,C[B+2]=x.z*t,aa+=1;else if(p instanceof THREE.PointLight)p=I*3,U.gammaInput?(y[p]=t.r*t.r*z*z,y[p+1]=t.g*t.g*z*z,y[p+2]=t.b*t.b*z*z):(y[p]=t.r*z,y[p+1]=t.g*z,y[p+2]=t.b*z),
|
|
|
|
-E[p]=x.x,E[p+1]=x.y,E[p+2]=x.z,H[I]=B,I+=1;c=aa*3;for(k=ca.length;c<k;c++)ca[c]=0;c=I*3;for(k=y.length;c<k;c++)y[c]=0;V.point.length=I;V.directional.length=aa;V.ambient[0]=w;V.ambient[1]=v;V.ambient[2]=u;b=Ja;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=
|
|
|
|
-b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=e.opacity,U.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,
|
|
|
|
-n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=X.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,U.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),
|
|
|
|
-n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)U.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<qa.length;b++)n.shadowMatrix.value[b]=
|
|
|
|
-qa[b],n.shadowMap.texture[b]=U.shadowMap[b];n.shadowDarkness.value=U.shadowMapDarkness;n.shadowBias.value=U.shadowMapBias}b=e.uniformsList;n=0;for(c=b.length;n<c;n++)if(v=h.uniforms[b[n][1]])if(w=b[n][0],u=w.type,k=w.value,u==="i")o.uniform1i(v,k);else if(u==="f")o.uniform1f(v,k);else if(u==="v2")o.uniform2f(v,k.x,k.y);else if(u==="v3")o.uniform3f(v,k.x,k.y,k.z);else if(u==="v4")o.uniform4f(v,k.x,k.y,k.z,k.w);else if(u==="c")o.uniform3f(v,k.r,k.g,k.b);else if(u==="fv1")o.uniform1fv(v,k);else if(u===
|
|
|
|
-"fv")o.uniform3fv(v,k);else if(u==="v3v"){if(!w._array)w._array=new Float32Array(3*k.length);u=0;for(x=k.length;u<x;u++)V=u*3,w._array[V]=k[u].x,w._array[V+1]=k[u].y,w._array[V+2]=k[u].z;o.uniform3fv(v,w._array)}else if(u==="m4"){if(!w._array)w._array=new Float32Array(16);k.flattenToArray(w._array);o.uniformMatrix4fv(v,!1,w._array)}else if(u==="m4v"){if(!w._array)w._array=new Float32Array(16*k.length);u=0;for(x=k.length;u<x;u++)k[u].flattenToArrayOffset(w._array,u*16);o.uniformMatrix4fv(v,!1,w._array)}else if(u===
|
|
|
|
-"t"){if(o.uniform1i(v,k),v=w.texture)if(v.image instanceof Array&&v.image.length===6){if(w=v,w.image.length===6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+k);o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);for(k=0;k<6;k++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,w.image[k]);O(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,
|
|
|
|
-w.image.__webglTextureCube)}else v instanceof THREE.WebGLRenderTargetCube?(w=v,o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):J(v,k)}else if(u==="tv"){if(!w._array){w._array=[];u=0;for(x=w.texture.length;u<x;u++)w._array[u]=k+u}o.uniform1iv(v,w._array);u=0;for(x=w.texture.length;u<x;u++)(v=w.texture[u])&&J(v,w._array[u])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&l.cameraPosition!==null&&o.uniform3f(l.cameraPosition,a.position.x,
|
|
|
|
-a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&l.viewMatrix!==null&&o.uniformMatrix4fv(l.viewMatrix,!1,ya);e.skinning&&(o.uniformMatrix4fv(l.cameraInverseMatrix,!1,ya),o.uniformMatrix4fv(l.boneGlobalMatrices,!1,f.boneMatrices))}o.uniformMatrix4fv(l.modelViewMatrix,!1,f._modelViewMatrixArray);l.normalMatrix&&o.uniformMatrix3fv(l.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||
|
|
|
|
-e.envMap||e.skinning||f.receiveShadow)&&l.objectMatrix!==null&&o.uniformMatrix4fv(l.objectMatrix,!1,f._objectMatrixArray);return h}function h(a,b,c,e,f,h){if(e.opacity!==0){var k,n,c=l(a,b,c,e,h),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==$&&($=c,b=!0);if(!e.morphTargets&&a.position>=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=e.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
-f.__webglMorphTargetsBuffers[h.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){k=0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;k<e.numSupportedMorphTargets&&k<p.length;)o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[k]]),o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[k]=
|
|
|
|
-n[p[k]],k++}else{var p=[],t=-1,w=0;n=h.morphTargetInfluences;var v,u=n.length;k=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);k<e.numSupportedMorphTargets;){for(v=0;v<u;v++)!p[v]&&n[v]>t&&(w=v,t=n[w]);o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[k]=t;p[w]=1;t=-1;k++}}e.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(e.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){k=
|
|
|
|
-0;for(n=f.__webglCustomAttributesList.length;k<n;k++)c=f.__webglCustomAttributesList[k],a[c.buffer.belongsToAttribute]>=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
-f.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):o.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));e.skinning&&a.skinVertexA>=0&&a.skinVertexB>=
|
|
|
|
-0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(e.wireframe?
|
|
|
|
-(o.lineWidth(e.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),o.drawElements(o.LINES,f.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),o.drawElements(o.TRIANGLES,f.__webglFaceCount,o.UNSIGNED_SHORT,0)),U.info.render.calls++,U.info.render.vertices+=f.__webglFaceCount,U.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(e.linewidth),o.drawArrays(h,
|
|
|
|
-0,f.__webglLineCount),U.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),U.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),U.info.render.calls++)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,
|
|
|
|
-o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,l,k,n,p,t,w,v,u=a.count*3;for(v=0;v<u;v+=9)c=a.normalArray,e=c[v],f=c[v+1],h=c[v+2],l=c[v+3],n=c[v+4],t=c[v+5],k=c[v+6],p=c[v+7],w=c[v+8],e=(e+l+k)/3,f=(f+n+p)/3,h=(h+t+w)/3,c[v]=e,c[v+1]=f,c[v+2]=h,c[v+3]=e,c[v+4]=f,c[v+5]=h,c[v+6]=e,c[v+7]=f,c[v+8]=h}o.bufferData(o.ARRAY_BUFFER,
|
|
|
|
-a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function k(a){if(ja!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ja=a.doubleSided;if(sa!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),sa=a.flipSided}function n(a){ea!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ea=a)}function t(a){ga!==a&&(o.depthMask(a),ga=a)}
|
|
|
|
-function v(a,b,c){na!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),na=a);if(a&&(ia!==b||I!==c))o.polygonOffset(b,c),ia=b,I=c}function p(a){va[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);va[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);va[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);va[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);va[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);va[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=va[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function x(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=va[e].x*b.n14+va[e].y*b.n24+va[e].z*b.n34+va[e].w,a<=c)return!1;return!0}function w(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=
|
|
|
|
-c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function u(a,b){return b.z-a.z}function B(a){var b,c,e,t=0,w,v,u,X,z=a.lights;pa||(pa=new THREE.PerspectiveCamera(U.shadowCameraFov,U.shadowMapWidth/U.shadowMapHeight,U.shadowCameraNear,U.shadowCameraFar));b=0;for(c=z.length;b<c;b++)if(e=z[b],e instanceof THREE.SpotLight&&e.castShadow){W=
|
|
|
|
--1;U.shadowMap[t]||(U.shadowMap[t]=new THREE.WebGLRenderTarget(U.shadowMapWidth,U.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));qa[t]||(qa[t]=new THREE.Matrix4);w=U.shadowMap[t];v=qa[t];pa.position.copy(e.position);pa.lookAt(e.target.position);pa.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(pa));this.autoUpdateScene&&a.updateMatrixWorld();pa.matrixWorldInverse.getInverse(pa.matrixWorld);v.set(0.5,0,0,0.5,0,0.5,
|
|
|
|
-0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(pa.projectionMatrix);v.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(ya);pa.projectionMatrix.flattenToArray(Ga);Ca.multiply(pa.projectionMatrix,pa.matrixWorldInverse);p(Ca);K(w);o.clearColor(1,1,1,1);U.clear();o.clearColor(fa.r,fa.g,fa.b,ma);v=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(w=0;w<v;w++)u=a.__webglObjects[w],X=u.object,X.visible&&X.castShadow?!(X instanceof THREE.Mesh)||!X.frustumCulled||x(X)?(X.matrixWorld.flattenToArray(X._objectMatrixArray),
|
|
|
|
-E(X,pa,!1),u.render=!0):u.render=!1:u.render=!1;n(!0);D(THREE.NormalBlending);for(w=0;w<v;w++)if(u=a.__webglObjects[w],u.render)X=u.object,buffer=u.buffer,k(X),u=X.customDepthMaterial?X.customDepthMaterial:X.geometry.morphTargets.length?Ha:Da,h(pa,z,null,u,buffer,X);for(w=0;w<e;w++)u=a.__webglObjectsImmediate[w],X=u.object,X.visible&&X.castShadow&&(X.matrixAutoUpdate&&X.matrixWorld.flattenToArray(X._objectMatrixArray),$=-1,E(X,pa,!1),k(X),program=l(pa,z,null,Da,X),X.immediateRenderCallback?X.immediateRenderCallback(program,
|
|
|
|
-o,va):X.render(function(a){f(a,program,Da.shading)}));t++}}function y(a,b){var c,e,f;c=S.attributes;var h=S.uniforms,l=ua/ka,k,n=[],t=ka*0.5,w=ua*0.5,p=!0;o.useProgram(S.program);ra=S.program;$=ea=T=-1;Ra||(o.enableVertexAttribArray(S.attributes.position),o.enableVertexAttribArray(S.attributes.uv),Ra=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,S.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,
|
|
|
|
-8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,S.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,Ga);o.activeTexture(o.TEXTURE0);o.uniform1i(h.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(u);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&
|
|
|
|
-f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,(f.position.x-t)/t,(w-f.position.y)/w,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/(f.scaleByViewport?ua:1),n[0]=k*l*f.scale.x,n[1]=k*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,
|
|
|
|
-f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),o.uniform1f(h.opacity,f.opacity),o.uniform3f(h.color,f.color.r,f.color.g,f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),D(f.blending),J(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ga)}function E(a,
|
|
|
|
-b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function C(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function H(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function L(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function R(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
|
-function D(a){if(a!==T){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}T=a}}function O(a,b,c){(c.width&c.width-
|
|
|
|
-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Z(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Z(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Z(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Z(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,oa(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,oa(b.minFilter)))}function J(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
|
|
|
|
-!0,a.__webglTexture=o.createTexture(),U.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Z(a.format),a.image.width,a.image.height,0,Z(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);O(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function N(a,b){o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
|
-a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function K(a){var b=a instanceof THREE.WebGLRenderTargetCube;
|
|
|
|
-if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);O(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Z(a.format),a.width,a.height,0,Z(a.format),Z(a.type),
|
|
|
|
-null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,f,e.__webglTexture,0);N(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),O(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Z(a.format),a.width,a.height,0,Z(a.format),Z(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
|
-a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),N(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=ka,a=ua,e=Q,f=ha);b!==G&&(o.bindFramebuffer(o.FRAMEBUFFER,b),
|
|
|
|
-o.viewport(e,f,c,a),G=b)}function M(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function Y(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,
|
|
|
|
-o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function oa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Z(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;
|
|
|
|
-case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;
|
|
|
|
-case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var U=this,o,P=[],ra=null,G=null,W=-1,$=null,la=0,ja=null,sa=null,T=null,ea=null,ga=null,na=null,ia=null,I=null,Q=0,ha=0,ka=0,ua=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ga=new Float32Array(16),
|
|
|
|
-ya=new Float32Array(16),Aa=new THREE.Vector4,Ja={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},X=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ca=a.stencil!==void 0?a.stencil:!0,V=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,aa=a.antialias!==void 0?a.antialias:!1,fa=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ma=a.clearAlpha!==void 0?a.clearAlpha:0,wa=a.maxLights!==
|
|
|
|
-void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=X;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=
|
|
|
|
-5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var pa,qa=[],a=THREE.ShaderLib.depthRGBA,ta=THREE.UniformsUtils.clone(a.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ta}),Ha=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ta,morphTargets:!0});Da._shadowPass=!0;Ha._shadowPass=!0;try{if(!(o=X.getContext("experimental-webgl",
|
|
|
|
-{antialias:aa,stencil:ca,preserveDrawingBuffer:V})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(za){console.error(za)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);
|
|
|
|
-o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(fa.r,fa.g,fa.b,ma);this.context=o;var Ea=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,S={};S.vertices=new Float32Array(16);S.faces=new Uint16Array(6);ca=0;S.vertices[ca++]=-1;S.vertices[ca++]=-1;S.vertices[ca++]=0;S.vertices[ca++]=1;S.vertices[ca++]=1;S.vertices[ca++]=-1;S.vertices[ca++]=1;S.vertices[ca++]=1;S.vertices[ca++]=1;S.vertices[ca++]=1;S.vertices[ca++]=1;S.vertices[ca++]=0;S.vertices[ca++]=-1;S.vertices[ca++]=1;S.vertices[ca++]=
|
|
|
|
-0;ca=S.vertices[ca++]=0;S.faces[ca++]=0;S.faces[ca++]=1;S.faces[ca++]=2;S.faces[ca++]=0;S.faces[ca++]=2;S.faces[ca++]=3;S.vertexBuffer=o.createBuffer();S.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,S.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,S.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,S.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,S.faces,o.STATIC_DRAW);S.program=o.createProgram();o.attachShader(S.program,Y("fragment",THREE.ShaderLib.sprite.fragmentShader));
|
|
|
|
-o.attachShader(S.program,Y("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(S.program);S.attributes={};S.uniforms={};S.attributes.position=o.getAttribLocation(S.program,"position");S.attributes.uv=o.getAttribLocation(S.program,"uv");S.uniforms.uvOffset=o.getUniformLocation(S.program,"uvOffset");S.uniforms.uvScale=o.getUniformLocation(S.program,"uvScale");S.uniforms.rotation=o.getUniformLocation(S.program,"rotation");S.uniforms.scale=o.getUniformLocation(S.program,"scale");S.uniforms.alignment=
|
|
|
|
-o.getUniformLocation(S.program,"alignment");S.uniforms.color=o.getUniformLocation(S.program,"color");S.uniforms.map=o.getUniformLocation(S.program,"map");S.uniforms.opacity=o.getUniformLocation(S.program,"opacity");S.uniforms.useScreenCoordinates=o.getUniformLocation(S.program,"useScreenCoordinates");S.uniforms.affectedByDistance=o.getUniformLocation(S.program,"affectedByDistance");S.uniforms.screenPosition=o.getUniformLocation(S.program,"screenPosition");S.uniforms.modelViewMatrix=o.getUniformLocation(S.program,
|
|
|
|
-"modelViewMatrix");S.uniforms.projectionMatrix=o.getUniformLocation(S.program,"projectionMatrix");var Ra=!1;this.setSize=function(a,b){X.width=a;X.height=b;this.setViewport(0,0,X.width,X.height)};this.setViewport=function(a,b,c,e){Q=a;ha=b;ka=c;ua=e;o.viewport(Q,ha,ka,ua)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){fa.setHex(a);ma=b;o.clearColor(fa.r,fa.g,fa.b,ma)};
|
|
|
|
-this.setClearColor=function(a,b){fa.copy(a);ma=b;o.clearColor(fa.r,fa.g,fa.b,ma)};this.getClearColor=function(){return fa};this.getClearAlpha=function(){return ma};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};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(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);
|
|
|
|
-o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);U.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;
|
|
|
|
-else if(a instanceof THREE.ParticleSystem)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),U.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,l,k;a instanceof THREE.MeshDepthMaterial?k="depth":a instanceof THREE.MeshNormalMaterial?k="normal":a instanceof THREE.MeshBasicMaterial?k="basic":a instanceof THREE.MeshLambertMaterial?
|
|
|
|
-k="lambert":a instanceof THREE.MeshPhongMaterial?k="phong":a instanceof THREE.LineBasicMaterial?k="basic":a instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var t,w,p;t=p=n=0;for(w=b.length;t<w;t++)l=b[t],l instanceof THREE.SpotLight&&p++,l instanceof THREE.DirectionalLight&&p++,l instanceof THREE.PointLight&&n++;n+p<=wa?t=p:(t=Math.ceil(wa*p/
|
|
|
|
-(n+p)),n=wa-t);l={directional:t,point:n};n=p=0;for(t=b.length;n<t;n++)w=b[n],w instanceof THREE.SpotLight&&w.castShadow&&p++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var u;a:{t=a.fragmentShader;w=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:l.directional,
|
|
|
|
-maxPointLights:l.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},x,e=[];k?e.push(k):(e.push(t),e.push(w));for(x in c)e.push(x),e.push(c[x]);k=e.join();x=0;for(e=P.length;x<e;x++)if(P[x].code===k){u=P[x].program;break a}x=o.createProgram();e=[Ea?"#define VERTEX_TEXTURES":"",U.gammaInput?"#define GAMMA_INPUT":
|
|
|
|
-"",U.gammaOutput?"#define GAMMA_OUTPUT":"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":
|
|
|
|
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
-l=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",U.gammaInput?"#define GAMMA_INPUT":"",U.gammaOutput?"#define GAMMA_OUTPUT":"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
|
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,Y("fragment",l+t));o.attachShader(x,
|
|
|
|
-Y("vertex",e+w));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");x.uniforms={};x.attributes={};var X,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(X in n)e.push(X);X=e;e=0;for(n=X.length;e<n;e++)t=X[e],x.uniforms[t]=o.getUniformLocation(x,
|
|
|
|
-t);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(X=0;X<c.maxMorphTargets;X++)e.push("morphTarget"+X);for(u in b)e.push(u);u=e;X=0;for(b=u.length;X<b;X++)c=u[X],x.attributes[c]=o.getAttribLocation(x,c);x.id=P.length;P.push({program:x,code:k});U.info.memory.programs=P.length;u=x}a.program=u;u=a.program.attributes;u.position>=0&&o.enableVertexAttribArray(u.position);u.color>=0&&o.enableVertexAttribArray(u.color);u.normal>=0&&o.enableVertexAttribArray(u.normal);
|
|
|
|
-u.tangent>=0&&o.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(o.enableVertexAttribArray(u.skinVertexA),o.enableVertexAttribArray(u.skinVertexB),o.enableVertexAttribArray(u.skinIndex),o.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(h in a.attributes)u[h]!==void 0&&u[h]>=0&&o.enableVertexAttribArray(u[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)X="morphTarget"+h,u[X]>=0&&(o.enableVertexAttribArray(u[X]),
|
|
|
|
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){K(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){B(a,b)};this.render=function(a,b,c,e){var X,V,ca,C,H,aa,Fa,I=a.lights,L=a.fog;W=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&B(a,b);U.info.render.calls=0;U.info.render.vertices=0;U.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
|
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ya);b.projectionMatrix.flattenToArray(Ga);Ca.multiply(b.projectionMatrix,b.matrixWorldInverse);p(Ca);K(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);ca=a.__webglObjects.length;for(e=0;e<ca;e++)if(H=a.__webglObjects[e],aa=H.object,aa.visible)if(!(aa instanceof THREE.Mesh)||!aa.frustumCulled||x(aa)){if(aa.matrixWorld.flattenToArray(aa._objectMatrixArray),
|
|
|
|
-E(aa,b,!0),z(H),H.render=!0,this.sortObjects)aa.renderDepth?H.z=aa.renderDepth:(Aa.copy(aa.position),Ca.multiplyVector3(Aa),H.z=Aa.z)}else H.render=!1;else H.render=!1;this.sortObjects&&a.__webglObjects.sort(u);C=a.__webglObjectsImmediate.length;for(e=0;e<C;e++)H=a.__webglObjectsImmediate[e],aa=H.object,aa.visible&&(aa.matrixAutoUpdate&&aa.matrixWorld.flattenToArray(aa._objectMatrixArray),E(aa,b,!0),w(H));if(a.overrideMaterial){n(a.overrideMaterial.depthTest);D(a.overrideMaterial.blending);for(e=
|
|
|
|
-0;e<ca;e++)if(H=a.__webglObjects[e],H.render)aa=H.object,Fa=H.buffer,k(aa),h(b,I,L,a.overrideMaterial,Fa,aa);for(e=0;e<C;e++)H=a.__webglObjectsImmediate[e],aa=H.object,aa.visible&&($=-1,k(aa),X=l(b,I,L,a.overrideMaterial,aa),aa.immediateRenderCallback?aa.immediateRenderCallback(X,o,va):aa.render(function(b){f(b,X,a.overrideMaterial.shading)}))}else{D(THREE.NormalBlending);for(e=ca-1;e>=0;e--)if(H=a.__webglObjects[e],H.render&&(aa=H.object,Fa=H.buffer,V=H.opaque))k(aa),n(V.depthTest),t(V.depthWrite),
|
|
|
|
-v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),h(b,I,L,V,Fa,aa);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],aa=H.object,aa.visible&&($=-1,V=H.opaque))k(aa),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),X=l(b,I,L,V,aa),aa.immediateRenderCallback?aa.immediateRenderCallback(X,o,va):aa.render(function(a){f(a,X,V.shading)});for(e=0;e<ca;e++)if(H=a.__webglObjects[e],H.render&&(aa=H.object,Fa=H.buffer,V=H.transparent))k(aa),D(V.blending),
|
|
|
|
-n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),h(b,I,L,V,Fa,aa);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],aa=H.object,aa.visible&&($=-1,V=H.transparent))k(aa),D(V.blending),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),X=l(b,I,L,V,aa),aa.immediateRenderCallback?aa.immediateRenderCallback(X,o,va):aa.render(function(a){f(a,X,V.shading)})}a.__webglSprites.length&&y(a,b);c&&c.minFilter!==THREE.NearestFilter&&
|
|
|
|
-c.minFilter!==THREE.LinearFilter&&M(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,l=void 0,k=void 0,n=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),
|
|
|
|
-f instanceof THREE.Mesh){k=f.geometry;if(k.geometryGroups===void 0){var n=k,t=void 0,p=void 0,w=void 0,v=void 0,u=void 0,x=void 0,X=void 0,z={},V=n.morphTargets.length;n.geometryGroups={};t=0;for(p=n.faces.length;t<p;t++)w=n.faces[t],v=w.materialIndex,x=v!==void 0?v:-1,z[x]===void 0&&(z[x]={hash:x,counter:0}),X=z[x].hash+"_"+z[x].counter,n.geometryGroups[X]===void 0&&(n.geometryGroups[X]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V}),u=w instanceof THREE.Face3?3:4,n.geometryGroups[X].vertices+
|
|
|
|
-u>65535&&(z[x].counter+=1,X=z[x].hash+"_"+z[x].counter,n.geometryGroups[X]===void 0&&(n.geometryGroups[X]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V})),w instanceof THREE.Face3?n.geometryGroups[X].faces3.push(t):n.geometryGroups[X].faces4.push(t),n.geometryGroups[X].vertices+=u;n.geometryGroupsList=[];t=void 0;for(t in n.geometryGroups)n.geometryGroups[t].id=la++,n.geometryGroupsList.push(n.geometryGroups[t])}for(l in k.geometryGroups)if(n=k.geometryGroups[l],!n.__webglVertexBuffer){t=
|
|
|
|
-n;t.__webglVertexBuffer=o.createBuffer();t.__webglNormalBuffer=o.createBuffer();t.__webglTangentBuffer=o.createBuffer();t.__webglColorBuffer=o.createBuffer();t.__webglUVBuffer=o.createBuffer();t.__webglUV2Buffer=o.createBuffer();t.__webglSkinVertexABuffer=o.createBuffer();t.__webglSkinVertexBBuffer=o.createBuffer();t.__webglSkinIndicesBuffer=o.createBuffer();t.__webglSkinWeightsBuffer=o.createBuffer();t.__webglFaceBuffer=o.createBuffer();t.__webglLineBuffer=o.createBuffer();if(t.numMorphTargets){w=
|
|
|
|
-p=void 0;t.__webglMorphTargetsBuffers=[];p=0;for(w=t.numMorphTargets;p<w;p++)t.__webglMorphTargetsBuffers.push(o.createBuffer())}U.info.memory.geometries++;v=f;u=v.geometry;p=n.faces3;x=n.faces4;t=p.length*3+x.length*4;w=p.length*1+x.length*2;x=p.length*3+x.length*4;p=b(v,n);X=p.map||p.lightMap||p instanceof THREE.ShaderMaterial?!0:!1;z=p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial?!1:p&&p.shading!==void 0&&p.shading===THREE.SmoothShading?THREE.SmoothShading:
|
|
|
|
-THREE.FlatShading;V=p.vertexColors?p.vertexColors:!1;n.__vertexArray=new Float32Array(t*3);if(z)n.__normalArray=new Float32Array(t*3);if(u.hasTangents)n.__tangentArray=new Float32Array(t*4);if(V)n.__colorArray=new Float32Array(t*3);if(X){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)n.__uvArray=new Float32Array(t*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(t*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(t*
|
|
|
|
-4),n.__skinVertexBArray=new Float32Array(t*4),n.__skinIndexArray=new Float32Array(t*4),n.__skinWeightArray=new Float32Array(t*4);n.__faceArray=new Uint16Array(w*3);n.__lineArray=new Uint16Array(x*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];v=0;for(u=n.numMorphTargets;v<u;v++)n.__morphTargetsArrays.push(new Float32Array(t*3))}n.__needsSmoothNormals=z===THREE.SmoothShading;n.__uvType=X;n.__vertexColorType=V;n.__normalType=z;n.__webglFaceCount=w*3;n.__webglLineCount=x*2;if(p.attributes){if(n.__webglCustomAttributesList===
|
|
|
|
-void 0)n.__webglCustomAttributesList=[];w=void 0;for(w in p.attributes){var v=p.attributes[w],u={},B;for(B in v)u[B]=v[B];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,x=1,u.type==="v2"?x=2:u.type==="v3"?x=3:u.type==="v4"?x=4:u.type==="c"&&(x=3),u.size=x,u.array=new Float32Array(t*x),u.buffer=o.createBuffer(),u.buffer.belongsToAttribute=w,v.needsUpdate=!0,u.__original=v;n.__webglCustomAttributesList.push(u)}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=
|
|
|
|
-!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(k=f.geometry,!k.__webglVertexBuffer)n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,n=k,t=n.vertices.length,n.__vertexArray=new Float32Array(t*3),n.__colorArray=new Float32Array(t*3),n.__webglVertexCount=t,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.Line){if(k=f.geometry,!k.__webglVertexBuffer)n=
|
|
|
|
-k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__webglLineCount=p,c(n,t),k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(k=f.geometry,!k.__webglVertexBuffer))n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),U.info.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=
|
|
|
|
-new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__sortArray=[],n.__webglParticleCount=p,c(n,t),k.__dirtyVertices=!0,k.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(l in k=f.geometry,k.geometryGroups)n=k.geometryGroups[l],R(h.__webglObjects,n,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(k=f.geometry,R(h.__webglObjects,k,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?
|
|
|
|
-h.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite&&h.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];h=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)L(h.__webglObjects,f);else if(f instanceof THREE.Sprite){h=h.__webglSprites;l=f;for(k=h.length-1;k>=0;k--)h[k]===l&&h.splice(k,1)}else(f instanceof THREE.MarchingCubes||
|
|
|
|
-f.immediateRenderCallback)&&L(h.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(B=a.__webglObjects[f].object,l=B.geometry,k=w=p=void 0,B instanceof THREE.Mesh){n=0;for(t=l.geometryGroupsList.length;n<t;n++)if(p=l.geometryGroupsList[n],k=b(B,p),w=k.attributes&&C(k),l.__dirtyVertices||l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||w)if(w=o.DYNAMIC_DRAW,v=!l.dynamic,
|
|
|
|
-p.__inittedArrays){var ca=x=u=void 0,y=void 0,E=void 0,aa=void 0,I=void 0,ma=void 0,K=void 0,W=void 0,J=ca=aa=K=void 0,D=void 0,Q=void 0,G=void 0,fa=void 0,M=void 0,N=y=void 0,O=y=K=void 0,ha=void 0,P=y=G=Q=D=fa=G=Q=D=fa=G=Q=D=fa=G=Q=D=I=void 0,ka=void 0,wa=aa=void 0,S=ca=void 0,ea=void 0,$=void 0,da=J=S=ka=0,qa=0,Y=P=ca=0,Z=I=M=0,F=0,T=0,ga=void 0,ea=p.__vertexArray,ia=p.__uvArray,F=p.__uv2Array,wa=p.__normalArray,E=p.__tangentArray,N=p.__colorArray,O=p.__skinVertexAArray,ha=p.__skinVertexBArray,
|
|
|
|
-ma=p.__skinIndexArray,pa=p.__skinWeightArray,na=p.__morphTargetsArrays,X=p.__webglCustomAttributesList,A=void 0,A=p.__faceArray,T=p.__lineArray,ja=p.__needsSmoothNormals,K=p.__vertexColorType,W=p.__uvType,aa=p.__normalType,ua=B.geometry,ga=ua.__dirtyElements,oa=ua.__dirtyUvs,ra=ua.__dirtyNormals,va=ua.__dirtyTangents,sa=ua.__dirtyColors,$=ua.__dirtyMorphTargets,Da=ua.vertices,z=p.faces3,V=p.faces4,ta=ua.faces,Ca=ua.faceVertexUvs[0],Ga=ua.faceVertexUvs[1],Aa=ua.skinVerticesA,za=ua.skinVerticesB,Ha=
|
|
|
|
-ua.skinIndices,Ea=ua.skinWeights,ya=ua.morphTargets;if(ua.__dirtyVertices){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],D=Da[y.a].position,Q=Da[y.b].position,G=Da[y.c].position,ea[S]=D.x,ea[S+1]=D.y,ea[S+2]=D.z,ea[S+3]=Q.x,ea[S+4]=Q.y,ea[S+5]=Q.z,ea[S+6]=G.x,ea[S+7]=G.y,ea[S+8]=G.z,S+=9;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],D=Da[y.a].position,Q=Da[y.b].position,G=Da[y.c].position,fa=Da[y.d].position,ea[S]=D.x,ea[S+1]=D.y,ea[S+2]=D.z,ea[S+3]=Q.x,ea[S+4]=Q.y,ea[S+5]=Q.z,ea[S+6]=G.x,ea[S+7]=G.y,ea[S+8]=G.z,
|
|
|
|
-ea[S+9]=fa.x,ea[S+10]=fa.y,ea[S+11]=fa.z,S+=12;o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,ea,w)}if($){u=0;for(x=z.length;u<x;u++){y=ta[z[u]];S=0;for(ea=ya.length;S<ea;S++)D=ya[S].vertices[y.a].position,Q=ya[S].vertices[y.b].position,G=ya[S].vertices[y.c].position,$=na[S],$[Z]=D.x,$[Z+1]=D.y,$[Z+2]=D.z,$[Z+3]=Q.x,$[Z+4]=Q.y,$[Z+5]=Q.z,$[Z+6]=G.x,$[Z+7]=G.y,$[Z+8]=G.z;Z+=9}u=0;for(x=V.length;u<x;u++){y=ta[V[u]];S=0;for(ea=ya.length;S<ea;S++)D=ya[S].vertices[y.a].position,
|
|
|
|
-Q=ya[S].vertices[y.b].position,G=ya[S].vertices[y.c].position,fa=ya[S].vertices[y.d].position,$=na[S],$[Z]=D.x,$[Z+1]=D.y,$[Z+2]=D.z,$[Z+3]=Q.x,$[Z+4]=Q.y,$[Z+5]=Q.z,$[Z+6]=G.x,$[Z+7]=G.y,$[Z+8]=G.z,$[Z+9]=fa.x,$[Z+10]=fa.y,$[Z+11]=fa.z;Z+=12}S=0;for(ea=ya.length;S<ea;S++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[S]),o.bufferData(o.ARRAY_BUFFER,na[S],w)}if(Ea.length){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],D=Ea[y.a],Q=Ea[y.b],G=Ea[y.c],pa[I]=D.x,pa[I+1]=D.y,pa[I+2]=D.z,pa[I+3]=D.w,pa[I+
|
|
|
|
-4]=Q.x,pa[I+5]=Q.y,pa[I+6]=Q.z,pa[I+7]=Q.w,pa[I+8]=G.x,pa[I+9]=G.y,pa[I+10]=G.z,pa[I+11]=G.w,D=Ha[y.a],Q=Ha[y.b],G=Ha[y.c],ma[I]=D.x,ma[I+1]=D.y,ma[I+2]=D.z,ma[I+3]=D.w,ma[I+4]=Q.x,ma[I+5]=Q.y,ma[I+6]=Q.z,ma[I+7]=Q.w,ma[I+8]=G.x,ma[I+9]=G.y,ma[I+10]=G.z,ma[I+11]=G.w,D=Aa[y.a],Q=Aa[y.b],G=Aa[y.c],O[I]=D.x,O[I+1]=D.y,O[I+2]=D.z,O[I+3]=1,O[I+4]=Q.x,O[I+5]=Q.y,O[I+6]=Q.z,O[I+7]=1,O[I+8]=G.x,O[I+9]=G.y,O[I+10]=G.z,O[I+11]=1,D=za[y.a],Q=za[y.b],G=za[y.c],ha[I]=D.x,ha[I+1]=D.y,ha[I+2]=D.z,ha[I+3]=1,ha[I+
|
|
|
|
-4]=Q.x,ha[I+5]=Q.y,ha[I+6]=Q.z,ha[I+7]=1,ha[I+8]=G.x,ha[I+9]=G.y,ha[I+10]=G.z,ha[I+11]=1,I+=12;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],D=Ea[y.a],Q=Ea[y.b],G=Ea[y.c],fa=Ea[y.d],pa[I]=D.x,pa[I+1]=D.y,pa[I+2]=D.z,pa[I+3]=D.w,pa[I+4]=Q.x,pa[I+5]=Q.y,pa[I+6]=Q.z,pa[I+7]=Q.w,pa[I+8]=G.x,pa[I+9]=G.y,pa[I+10]=G.z,pa[I+11]=G.w,pa[I+12]=fa.x,pa[I+13]=fa.y,pa[I+14]=fa.z,pa[I+15]=fa.w,D=Ha[y.a],Q=Ha[y.b],G=Ha[y.c],fa=Ha[y.d],ma[I]=D.x,ma[I+1]=D.y,ma[I+2]=D.z,ma[I+3]=D.w,ma[I+4]=Q.x,ma[I+5]=Q.y,ma[I+6]=Q.z,ma[I+
|
|
|
|
-7]=Q.w,ma[I+8]=G.x,ma[I+9]=G.y,ma[I+10]=G.z,ma[I+11]=G.w,ma[I+12]=fa.x,ma[I+13]=fa.y,ma[I+14]=fa.z,ma[I+15]=fa.w,D=Aa[y.a],Q=Aa[y.b],G=Aa[y.c],fa=Aa[y.d],O[I]=D.x,O[I+1]=D.y,O[I+2]=D.z,O[I+3]=1,O[I+4]=Q.x,O[I+5]=Q.y,O[I+6]=Q.z,O[I+7]=1,O[I+8]=G.x,O[I+9]=G.y,O[I+10]=G.z,O[I+11]=1,O[I+12]=fa.x,O[I+13]=fa.y,O[I+14]=fa.z,O[I+15]=1,D=za[y.a],Q=za[y.b],G=za[y.c],y=za[y.d],ha[I]=D.x,ha[I+1]=D.y,ha[I+2]=D.z,ha[I+3]=1,ha[I+4]=Q.x,ha[I+5]=Q.y,ha[I+6]=Q.z,ha[I+7]=1,ha[I+8]=G.x,ha[I+9]=G.y,ha[I+10]=G.z,ha[I+
|
|
|
|
-11]=1,ha[I+12]=y.x,ha[I+13]=y.y,ha[I+14]=y.z,ha[I+15]=1,I+=16;I>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,O,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ha,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ma,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,pa,w))}if(sa&&K){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],I=y.vertexColors,ma=y.color,
|
|
|
|
-I.length===3&&K===THREE.VertexColors?(y=I[0],O=I[1],ha=I[2]):ha=O=y=ma,N[M]=y.r,N[M+1]=y.g,N[M+2]=y.b,N[M+3]=O.r,N[M+4]=O.g,N[M+5]=O.b,N[M+6]=ha.r,N[M+7]=ha.g,N[M+8]=ha.b,M+=9;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],I=y.vertexColors,ma=y.color,I.length===4&&K===THREE.VertexColors?(y=I[0],O=I[1],ha=I[2],I=I[3]):I=ha=O=y=ma,N[M]=y.r,N[M+1]=y.g,N[M+2]=y.b,N[M+3]=O.r,N[M+4]=O.g,N[M+5]=O.b,N[M+6]=ha.r,N[M+7]=ha.g,N[M+8]=ha.b,N[M+9]=I.r,N[M+10]=I.g,N[M+11]=I.b,M+=12;M>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),
|
|
|
|
-o.bufferData(o.ARRAY_BUFFER,N,w))}if(va&&ua.hasTangents){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],K=y.vertexTangents,M=K[0],y=K[1],N=K[2],E[P]=M.x,E[P+1]=M.y,E[P+2]=M.z,E[P+3]=M.w,E[P+4]=y.x,E[P+5]=y.y,E[P+6]=y.z,E[P+7]=y.w,E[P+8]=N.x,E[P+9]=N.y,E[P+10]=N.z,E[P+11]=N.w,P+=12;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],K=y.vertexTangents,M=K[0],y=K[1],N=K[2],K=K[3],E[P]=M.x,E[P+1]=M.y,E[P+2]=M.z,E[P+3]=M.w,E[P+4]=y.x,E[P+5]=y.y,E[P+6]=y.z,E[P+7]=y.w,E[P+8]=N.x,E[P+9]=N.y,E[P+10]=N.z,E[P+11]=N.w,E[P+12]=K.x,
|
|
|
|
-E[P+13]=K.y,E[P+14]=K.z,E[P+15]=K.w,P+=16;o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer);o.bufferData(o.ARRAY_BUFFER,E,w)}if(ra&&aa){u=0;for(x=z.length;u<x;u++)if(y=ta[z[u]],E=y.vertexNormals,aa=y.normal,E.length===3&&ja)for(P=0;P<3;P++)aa=E[P],wa[ca]=aa.x,wa[ca+1]=aa.y,wa[ca+2]=aa.z,ca+=3;else for(P=0;P<3;P++)wa[ca]=aa.x,wa[ca+1]=aa.y,wa[ca+2]=aa.z,ca+=3;u=0;for(x=V.length;u<x;u++)if(y=ta[V[u]],E=y.vertexNormals,aa=y.normal,E.length===4&&ja)for(P=0;P<4;P++)aa=E[P],wa[ca]=aa.x,wa[ca+1]=aa.y,
|
|
|
|
-wa[ca+2]=aa.z,ca+=3;else for(P=0;P<4;P++)wa[ca]=aa.x,wa[ca+1]=aa.y,wa[ca+2]=aa.z,ca+=3;o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer);o.bufferData(o.ARRAY_BUFFER,wa,w)}if(oa&&Ca&&W){u=0;for(x=z.length;u<x;u++)if(ca=z[u],ca=Ca[ca],ca!==void 0)for(P=0;P<3;P++)wa=ca[P],ia[J]=wa.u,ia[J+1]=wa.v,J+=2;u=0;for(x=V.length;u<x;u++)if(ca=V[u],ca=Ca[ca],ca!==void 0)for(P=0;P<4;P++)wa=ca[P],ia[J]=wa.u,ia[J+1]=wa.v,J+=2;J>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ia,w))}if(oa&&
|
|
|
|
-Ga&&W){u=0;for(x=z.length;u<x;u++)if(ca=z[u],J=Ga[ca],J!==void 0)for(P=0;P<3;P++)ca=J[P],F[da]=ca.u,F[da+1]=ca.v,da+=2;u=0;for(x=V.length;u<x;u++)if(ca=V[u],J=Ga[ca],J!==void 0)for(P=0;P<4;P++)ca=J[P],F[da]=ca.u,F[da+1]=ca.v,da+=2;da>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,F,w))}if(ga){u=0;for(x=z.length;u<x;u++)A[qa]=ka,A[qa+1]=ka+1,A[qa+2]=ka+2,qa+=3,T[Y]=ka,T[Y+1]=ka+1,T[Y+2]=ka,T[Y+3]=ka+2,T[Y+4]=ka+1,T[Y+5]=ka+2,Y+=6,ka+=3;u=0;for(x=V.length;u<x;u++)A[qa]=
|
|
|
|
-ka,A[qa+1]=ka+1,A[qa+2]=ka+3,A[qa+3]=ka+1,A[qa+4]=ka+2,A[qa+5]=ka+3,qa+=6,T[Y]=ka,T[Y+1]=ka+1,T[Y+2]=ka,T[Y+3]=ka+3,T[Y+4]=ka+1,T[Y+5]=ka+2,T[Y+6]=ka+2,T[Y+7]=ka+3,Y+=8,ka+=4;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,A,w);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,T,w)}if(X){P=0;for(ka=X.length;P<ka;P++)if(A=X[P],A.__original.needsUpdate){T=F=0;if(A.size===1)if(A.boundTo===void 0||A.boundTo==="vertices"){u=
|
|
|
|
-0;for(x=z.length;u<x;u++)y=ta[z[u]],A.array[F]=A.value[y.a],A.array[F+1]=A.value[y.b],A.array[F+2]=A.value[y.c],F+=3;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],A.array[F]=A.value[y.a],A.array[F+1]=A.value[y.b],A.array[F+2]=A.value[y.c],A.array[F+3]=A.value[y.d],F+=4}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)ga=A.value[T],A.array[F]=ga,A.array[F+1]=ga,A.array[F+2]=ga,F+=3,T+=1;u=0;for(x=V.length;u<x;u++)ga=A.value[T],A.array[F]=ga,A.array[F+1]=ga,A.array[F+2]=ga,A.array[F+3]=ga,F+=4,T+=1}else{if(A.boundTo===
|
|
|
|
-"faceVertices"){u=0;for(x=z.length;u<x;u++)A.array[F]=A.value[T],A.array[F+1]=A.value[T+1],A.array[F+2]=A.value[T+2],F+=3,T+=3;u=0;for(x=V.length;u<x;u++)A.array[F]=A.value[T],A.array[F+1]=A.value[T+1],A.array[F+2]=A.value[T+2],A.array[F+3]=A.value[T+3],F+=4,T+=4}}else if(A.size===2)if(A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+
|
|
|
|
-5]=G.y,F+=6;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],fa=A.value[y.d],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,A.array[F+6]=fa.x,A.array[F+7]=fa.y,F+=8}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ga=A.value[T],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,F+=6,T+=1;u=0;for(x=V.length;u<x;u++)fa=G=Q=D=ga=A.value[T],A.array[F]=D.x,
|
|
|
|
-A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,A.array[F+6]=fa.x,A.array[F+7]=fa.y,F+=8,T+=1}else{if(A.boundTo==="faceVertices"){u=0;for(x=z.length;u<x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,F+=6,T+=3;u=0;for(x=V.length;u<x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],fa=A.value[T+3],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+
|
|
|
|
-4]=G.x,A.array[F+5]=G.y,A.array[F+6]=fa.x,A.array[F+7]=fa.y,F+=8,T+=4}}else if(A.size===3)if(da=A.type==="c"?["r","g","b"]:["x","y","z"],A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+7]=G[da[1]],A.array[F+8]=G[da[2]],F+=9;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],
|
|
|
|
-D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],fa=A.value[y.d],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+7]=G[da[1]],A.array[F+8]=G[da[2]],A.array[F+9]=fa[da[0]],A.array[F+10]=fa[da[1]],A.array[F+11]=fa[da[2]],F+=12,T+=1}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ga=A.value[T],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],
|
|
|
|
-A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+7]=G[da[1]],A.array[F+8]=G[da[2]],F+=9,T+=1;u=0;for(x=V.length;u<x;u++)fa=G=Q=D=ga=A.value[T],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+7]=G[da[1]],A.array[F+8]=G[da[2]],A.array[F+9]=fa[da[0]],A.array[F+10]=fa[da[1]],A.array[F+11]=fa[da[2]],F+=12,T+=1}else{if(A.boundTo==="faceVertices"){u=0;for(x=z.length;u<
|
|
|
|
-x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+7]=G[da[1]],A.array[F+8]=G[da[2]],F+=9,T+=3;u=0;for(x=V.length;u<x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],fa=A.value[T+3],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+
|
|
|
|
-7]=G[da[1]],A.array[F+8]=G[da[2]],A.array[F+9]=fa[da[0]],A.array[F+10]=fa[da[1]],A.array[F+11]=fa[da[2]],F+=12,T+=4}}else if(A.size===4)if(A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,F+=12;u=0;for(x=V.length;u<x;u++)y=
|
|
|
|
-ta[V[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],fa=A.value[y.d],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,A.array[F+12]=fa.x,A.array[F+13]=fa.y,A.array[F+14]=fa.z,A.array[F+15]=fa.w,F+=16}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ga=A.value[T],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+
|
|
|
|
-4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,F+=12,T+=1;u=0;for(x=V.length;u<x;u++)fa=G=Q=D=ga=A.value[T],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,A.array[F+12]=fa.x,A.array[F+13]=fa.y,A.array[F+14]=fa.z,A.array[F+15]=fa.w,F+=16,T+=1}else if(A.boundTo==="faceVertices"){u=
|
|
|
|
-0;for(x=z.length;u<x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,F+=12,T+=3;u=0;for(x=V.length;u<x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],fa=A.value[T+3],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,
|
|
|
|
-A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,A.array[F+12]=fa.x,A.array[F+13]=fa.y,A.array[F+14]=fa.z,A.array[F+15]=fa.w,F+=16,T+=4}o.bindBuffer(o.ARRAY_BUFFER,A.buffer);o.bufferData(o.ARRAY_BUFFER,A.array,w)}}v&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,
|
|
|
|
-delete p.__skinWeightArray)}l.__dirtyVertices=!1;l.__dirtyMorphTargets=!1;l.__dirtyElements=!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=!1;k.attributes&&H(k)}else if(B instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){k=l;B=o.DYNAMIC_DRAW;n=u=v=v=void 0;x=k.vertices;t=k.colors;X=x.length;p=t.length;z=k.__vertexArray;w=k.__colorArray;V=k.__dirtyColors;if(k.__dirtyVertices){for(v=0;v<X;v++)u=x[v].position,n=v*3,z[n]=u.x,z[n+1]=u.y,z[n+2]=u.z;o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
-k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,B)}if(V){for(v=0;v<p;v++)color=t[v],n=v*3,w[n]=color.r,w[n+1]=color.g,w[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,w,B)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(B instanceof THREE.Line){k=b(B,p);w=k.attributes&&C(k);if(l.__dirtyVertices||l.__dirtyColors||w){B=l;n=o.DYNAMIC_DRAW;t=ka=x=ta=void 0;x=B.vertices;p=B.colors;X=x.length;w=p.length;z=B.__vertexArray;v=B.__colorArray;V=B.__dirtyColors;
|
|
|
|
-u=B.__webglCustomAttributesList;J=Y=qa=da=ka=ta=void 0;if(B.__dirtyVertices){for(ta=0;ta<X;ta++)ka=x[ta].position,t=ta*3,z[t]=ka.x,z[t+1]=ka.y,z[t+2]=ka.z;o.bindBuffer(o.ARRAY_BUFFER,B.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,n)}if(V){for(x=0;x<w;x++)color=p[x],t=x*3,v[t]=color.r,v[t+1]=color.g,v[t+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,B.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,v,n)}if(u){ta=0;for(ka=u.length;ta<ka;ta++)if(J=u[ta],J.needsUpdate&&(J.boundTo===void 0||J.boundTo===
|
|
|
|
-"vertices")){t=0;qa=J.value.length;if(J.size===1)for(da=0;da<qa;da++)J.array[da]=J.value[da];else if(J.size===2)for(da=0;da<qa;da++)Y=J.value[da],J.array[t]=Y.x,J.array[t+1]=Y.y,t+=2;else if(J.size===3)if(J.type==="c")for(da=0;da<qa;da++)Y=J.value[da],J.array[t]=Y.r,J.array[t+1]=Y.g,J.array[t+2]=Y.b,t+=3;else for(da=0;da<qa;da++)Y=J.value[da],J.array[t]=Y.x,J.array[t+1]=Y.y,J.array[t+2]=Y.z,t+=3;else if(J.size===4)for(da=0;da<qa;da++)Y=J.value[da],J.array[t]=Y.x,J.array[t+1]=Y.y,J.array[t+2]=Y.z,
|
|
|
|
-J.array[t+3]=Y.w,t+=4;o.bindBuffer(o.ARRAY_BUFFER,J.buffer);o.bufferData(o.ARRAY_BUFFER,J.array,n)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;k.attributes&&H(k)}else if(B instanceof THREE.ParticleSystem)k=b(B,p),w=k.attributes&&C(k),(l.__dirtyVertices||l.__dirtyColors||B.sortParticles||w)&&e(l,o.DYNAMIC_DRAW,B),l.__dirtyVertices=!1,l.__dirtyColors=!1,k.attributes&&H(k)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?
|
|
|
|
-o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ea}};
|
|
|
|
|
|
+function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,h,f,l=a.vertices,k=l.length,n=a.colors,u=n.length,p=a.__vertexArray,w=a.__colorArray,v=a.__sortArray,t=a.__dirtyVertices,x=a.__dirtyColors,fa=a.__webglCustomAttributesList;if(c.sortParticles){Ca.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)h=l[e].position,Ga.copy(h),Ca.multiplyVector3(Ga),v[e]=[Ga.z,e];v.sort(function(a,
|
|
|
|
+b){return b[0]-a[0]});for(e=0;e<k;e++)h=l[v[e][1]].position,f=e*3,p[f]=h.x,p[f+1]=h.y,p[f+2]=h.z;for(e=0;e<u;e++)f=e*3,color=n[v[e][1]],w[f]=color.r,w[f+1]=color.g,w[f+2]=color.b;if(fa){n=0;for(u=fa.length;n<u;n++)if(k=fa[n],k.boundTo===void 0||k.boundTo==="vertices")if(f=0,h=k.value.length,k.size===1)for(e=0;e<h;e++)index=v[e][1],k.array[e]=k.value[index];else if(k.size===2)for(e=0;e<h;e++)index=v[e][1],l=k.value[index],k.array[f]=l.x,k.array[f+1]=l.y,f+=2;else if(k.size===3)if(k.type==="c")for(e=
|
|
|
|
+0;e<h;e++)index=v[e][1],l=k.value[index],k.array[f]=l.r,k.array[f+1]=l.g,k.array[f+2]=l.b,f+=3;else for(e=0;e<h;e++)index=v[e][1],l=k.value[index],k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,f+=3;else if(k.size===4)for(e=0;e<h;e++)index=v[e][1],l=k.value[index],k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,k.array[f+3]=l.w,f+=4}}else{if(t)for(e=0;e<k;e++)h=l[e].position,f=e*3,p[f]=h.x,p[f+1]=h.y,p[f+2]=h.z;if(x)for(e=0;e<u;e++)color=n[e],f=e*3,w[f]=color.r,w[f+1]=color.g,w[f+2]=color.b;if(fa){n=
|
|
|
|
+0;for(u=fa.length;n<u;n++)if(k=fa[n],k.needsUpdate&&(k.boundTo===void 0||k.boundTo==="vertices"))if(h=k.value.length,f=0,k.size===1)for(e=0;e<h;e++)k.array[e]=k.value[e];else if(k.size===2)for(e=0;e<h;e++)l=k.value[e],k.array[f]=l.x,k.array[f+1]=l.y,f+=2;else if(k.size===3)if(k.type==="c")for(e=0;e<h;e++)l=k.value[e],k.array[f]=l.r,k.array[f+1]=l.g,k.array[f+2]=l.b,f+=3;else for(e=0;e<h;e++)l=k.value[e],k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,f+=3;else if(k.size===4)for(e=0;e<h;e++)l=k.value[e],
|
|
|
|
+k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,k.array[f+3]=l.w,f+=4}}if(t||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,p,b);if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,b);if(fa){n=0;for(u=fa.length;n<u;n++)if(k=fa[n],k.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,k.buffer),o.bufferData(o.ARRAY_BUFFER,k.array,b)}}function l(a,b,c,e,f){e.program||V.initMaterial(e,b,c,f);if(e.morphTargets&&
|
|
|
|
+!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(V.maxMorphTargets);for(var h=0,l=V.maxMorphTargets;h<l;h++)f.__webglMorphTargetInfluences[h]=0}var k=!1,h=e.program,l=h.uniforms,n=e.uniforms;h!==qa&&(o.useProgram(h),qa=h,k=!0);if(e.id!==W)W=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,za);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;
|
|
|
|
+if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var u,p,w=0,v=0,t=0,x,y,M,B=fa,A=B.directional.colors,C=B.directional.positions,D=B.point.colors,H=B.point.positions,ca=B.point.distances,I=0,ga=0,c=u=M=0,k=b.length;c<k;c++)if(u=b[c],p=u.color,x=u.position,y=u.intensity,M=u.distance,u instanceof THREE.AmbientLight)V.gammaInput?(w+=p.r*p.r,v+=p.g*p.g,t+=p.b*p.b):(w+=p.r,v+=p.g,t+=p.b);else if(u instanceof THREE.DirectionalLight)M=I*3,V.gammaInput?(A[M]=
|
|
|
|
+p.r*p.r*y*y,A[M+1]=p.g*p.g*y*y,A[M+2]=p.b*p.b*y*y):(A[M]=p.r*y,A[M+1]=p.g*y,A[M+2]=p.b*y),C[M]=x.x,C[M+1]=x.y,C[M+2]=x.z,I+=1;else if(u instanceof THREE.SpotLight)M=I*3,V.gammaInput?(A[M]=p.r*p.r*y*y,A[M+1]=p.g*p.g*y*y,A[M+2]=p.b*p.b*y*y):(A[M]=p.r*y,A[M+1]=p.g*y,A[M+2]=p.b*y),p=1/x.length(),C[M]=x.x*p,C[M+1]=x.y*p,C[M+2]=x.z*p,I+=1;else if(u instanceof THREE.PointLight)u=ga*3,V.gammaInput?(D[u]=p.r*p.r*y*y,D[u+1]=p.g*p.g*y*y,D[u+2]=p.b*p.b*y*y):(D[u]=p.r*y,D[u+1]=p.g*y,D[u+2]=p.b*y),H[u]=x.x,H[u+
|
|
|
|
+1]=x.y,H[u+2]=x.z,ca[ga]=M,ga+=1;c=I*3;for(k=A.length;c<k;c++)A[c]=0;c=ga*3;for(k=D.length;c<k;c++)D[c]=0;B.point.length=ga;B.directional.length=I;B.ambient[0]=w;B.ambient[1]=v;B.ambient[2]=t;b=fa;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=
|
|
|
|
+b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=e.opacity,V.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,
|
|
|
|
+n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=P.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,V.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),
|
|
|
|
+n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)V.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<Fa.length;b++)n.shadowMatrix.value[b]=
|
|
|
|
+Fa[b],n.shadowMap.texture[b]=V.shadowMap[b];n.shadowDarkness.value=V.shadowMapDarkness;n.shadowBias.value=V.shadowMapBias}b=e.uniformsList;n=0;for(c=b.length;n<c;n++)if(v=h.uniforms[b[n][1]])if(w=b[n][0],t=w.type,k=w.value,t==="i")o.uniform1i(v,k);else if(t==="f")o.uniform1f(v,k);else if(t==="v2")o.uniform2f(v,k.x,k.y);else if(t==="v3")o.uniform3f(v,k.x,k.y,k.z);else if(t==="v4")o.uniform4f(v,k.x,k.y,k.z,k.w);else if(t==="c")o.uniform3f(v,k.r,k.g,k.b);else if(t==="fv1")o.uniform1fv(v,k);else if(t===
|
|
|
|
+"fv")o.uniform3fv(v,k);else if(t==="v3v"){if(!w._array)w._array=new Float32Array(3*k.length);t=0;for(x=k.length;t<x;t++)B=t*3,w._array[B]=k[t].x,w._array[B+1]=k[t].y,w._array[B+2]=k[t].z;o.uniform3fv(v,w._array)}else if(t==="m4"){if(!w._array)w._array=new Float32Array(16);k.flattenToArray(w._array);o.uniformMatrix4fv(v,!1,w._array)}else if(t==="m4v"){if(!w._array)w._array=new Float32Array(16*k.length);t=0;for(x=k.length;t<x;t++)k[t].flattenToArrayOffset(w._array,t*16);o.uniformMatrix4fv(v,!1,w._array)}else if(t===
|
|
|
|
+"t"){if(o.uniform1i(v,k),v=w.texture)if(v.image instanceof Array&&v.image.length===6){if(w=v,w.image.length===6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+k);o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);for(k=0;k<6;k++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,w.image[k]);S(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,
|
|
|
|
+w.image.__webglTextureCube)}else v instanceof THREE.WebGLRenderTargetCube?(w=v,o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):K(v,k)}else if(t==="tv"){if(!w._array){w._array=[];t=0;for(x=w.texture.length;t<x;t++)w._array[t]=k+t}o.uniform1iv(v,w._array);t=0;for(x=w.texture.length;t<x;t++)(v=w.texture[t])&&K(v,w._array[t])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&l.cameraPosition!==null&&o.uniform3f(l.cameraPosition,a.position.x,
|
|
|
|
+a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&l.viewMatrix!==null&&o.uniformMatrix4fv(l.viewMatrix,!1,Ba);e.skinning&&(o.uniformMatrix4fv(l.cameraInverseMatrix,!1,Ba),o.uniformMatrix4fv(l.boneGlobalMatrices,!1,f.boneMatrices))}o.uniformMatrix4fv(l.modelViewMatrix,!1,f._modelViewMatrixArray);l.normalMatrix&&o.uniformMatrix3fv(l.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||
|
|
|
|
+e.envMap||e.skinning||f.receiveShadow)&&l.objectMatrix!==null&&o.uniformMatrix4fv(l.objectMatrix,!1,f._objectMatrixArray);return h}function h(a,b,c,e,f,h){if(e.opacity!==0){var k,n,c=l(a,b,c,e,h),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==Z&&(Z=c,a=!0);if(!e.morphTargets&&b.position>=0)a&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=e.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
+f.__webglMorphTargetsBuffers[h.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){k=0;var u=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;k<e.numSupportedMorphTargets&&k<u.length;)o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[u[k]]),o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[k]=
|
|
|
|
+n[u[k]],k++}else{var u=[],p=-1,w=0;n=h.morphTargetInfluences;var v,t=n.length;k=0;for(h.morphTargetBase!==-1&&(u[h.morphTargetBase]=!0);k<e.numSupportedMorphTargets;){for(v=0;v<t;v++)!u[v]&&n[v]>p&&(w=v,p=n[w]);o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[k]=p;u[w]=1;p=-1;k++}}e.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(e.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){k=
|
|
|
|
+0;for(n=f.__webglCustomAttributesList.length;k<n;k++)c=f.__webglCustomAttributesList[k],b[c.buffer.belongsToAttribute]>=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
+f.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));e.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
|
|
|
|
+0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(e.wireframe?
|
|
|
|
+(e=e.wireframeLinewidth,e!==R&&(o.lineWidth(e),R=e),a&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),o.drawElements(o.LINES,f.__webglLineCount,o.UNSIGNED_SHORT,0)):(a&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),o.drawElements(o.TRIANGLES,f.__webglFaceCount,o.UNSIGNED_SHORT,0)),V.info.render.calls++,V.info.render.vertices+=f.__webglFaceCount,V.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,e=e.linewidth,e!==
|
|
|
|
+R&&(o.lineWidth(e),R=e),o.drawArrays(h,0,f.__webglLineCount),V.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),V.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),V.info.render.calls++)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),
|
|
|
|
+o.bufferData(o.ARRAY_BUFFER,a.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,l,k,n,u,p,w,v,t=a.count*3;for(v=0;v<t;v+=9)c=a.normalArray,e=c[v],f=c[v+1],h=c[v+2],l=c[v+3],n=c[v+4],p=c[v+5],k=c[v+6],u=c[v+7],w=c[v+8],e=(e+l+k)/3,f=(f+n+u)/3,h=(h+p+w)/3,c[v]=e,c[v+1]=f,c[v+2]=h,c[v+3]=e,c[v+4]=f,c[v+5]=h,
|
|
|
|
+c[v+6]=e,c[v+7]=f,c[v+8]=h}o.bufferData(o.ARRAY_BUFFER,a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function k(a){if(ma!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ma=a.doubleSided;if(sa!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),sa=a.flipSided}function n(a){da!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),
|
|
|
|
+da=a)}function p(a){ia!==a&&(o.depthMask(a),ia=a)}function v(a,b,c){ea!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ea=a);if(a&&(la!==b||I!==c))o.polygonOffset(b,c),la=b,I=c}function u(a){pa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);pa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);pa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);pa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);pa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-
|
|
|
|
+a.n34);pa[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=pa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function x(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=pa[e].x*b.n14+pa[e].y*b.n24+pa[e].z*b.n34+pa[e].w,a<=c)return!1;return!0}function w(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function y(a){var b=a.object,
|
|
|
|
+c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function t(a,b){return b.z-a.z}function B(a){var b,c,e,p=0,w,v,t,y,fa=a.lights;ha||(ha=new THREE.PerspectiveCamera(V.shadowCameraFov,V.shadowMapWidth/V.shadowMapHeight,V.shadowCameraNear,V.shadowCameraFar));b=0;for(c=
|
|
|
|
+fa.length;b<c;b++)if(e=fa[b],e instanceof THREE.SpotLight&&e.castShadow){W=-1;V.shadowMap[p]||(V.shadowMap[p]=new THREE.WebGLRenderTarget(V.shadowMapWidth,V.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Fa[p]||(Fa[p]=new THREE.Matrix4);w=V.shadowMap[p];v=Fa[p];ha.position.copy(e.position);ha.lookAt(e.target.position);ha.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ha));this.autoUpdateScene&&a.updateMatrixWorld();
|
|
|
|
+ha.matrixWorldInverse.getInverse(ha.matrixWorld);v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(ha.projectionMatrix);v.multiplySelf(ha.matrixWorldInverse);ha.matrixWorldInverse.flattenToArray(Ba);ha.projectionMatrix.flattenToArray(za);Ca.multiply(ha.projectionMatrix,ha.matrixWorldInverse);u(Ca);L(w);o.clearColor(1,1,1,1);V.clear();o.clearColor(ga.r,ga.g,ga.b,ua);v=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(w=0;w<v;w++)t=a.__webglObjects[w],y=t.object,y.visible&&
|
|
|
|
+y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||x(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),D(y,ha,!1),t.render=!0):t.render=!1:t.render=!1;n(!0);E(THREE.NormalBlending);for(w=0;w<v;w++)if(t=a.__webglObjects[w],t.render)y=t.object,buffer=t.buffer,k(y),t=y.customDepthMaterial?y.customDepthMaterial:y.geometry.morphTargets.length?xa:Da,h(ha,fa,null,t,buffer,y);for(w=0;w<e;w++)t=a.__webglObjectsImmediate[w],y=t.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),
|
|
|
|
+Z=-1,D(y,ha,!1),k(y),program=l(ha,fa,null,Da,y),y.immediateRenderCallback?y.immediateRenderCallback(program,o,pa):y.render(function(a){f(a,program,Da.shading)}));p++}}function A(a,b){var c,e,f;c=$.attributes;var h=$.uniforms,l=ta/ya,k,n=[],u=ya*0.5,p=ta*0.5,w=!0;o.useProgram($.program);qa=$.program;Z=da=U=-1;Ra||(o.enableVertexAttribArray($.attributes.position),o.enableVertexAttribArray($.attributes.uv),Ra=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,$.vertexBuffer);
|
|
|
|
+o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,$.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,za);o.activeTexture(o.TEXTURE0);o.uniform1i(h.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(t);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,(f.position.x-u)/u,(p-f.position.y)/p,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/
|
|
|
|
+(f.scaleByViewport?ta:1),n[0]=k*l*f.scale.x,n[1]=k*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),o.uniform1f(h.opacity,f.opacity),o.uniform3f(h.color,f.color.r,f.color.g,f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!w?(o.enable(o.DEPTH_TEST),w=!0):!f.mergeWith3D&&w&&(o.disable(o.DEPTH_TEST),w=!1),E(f.blending),K(f.map,0),o.drawElements(o.TRIANGLES,
|
|
|
|
+6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ia)}function D(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function C(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function H(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function O(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===
|
|
|
|
+b&&a.splice(c,1)}function T(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function E(a){if(a!==U){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,
|
|
|
|
+o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}U=a}}function S(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Y(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Y(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Y(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Y(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,oa(b.magFilter)),
|
|
|
|
+o.texParameteri(a,o.TEXTURE_MIN_FILTER,oa(b.minFilter)))}function K(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=o.createTexture(),V.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.image.width,a.image.height,0,Y(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);S(o.TEXTURE_2D,a,a.image);a.needsUpdate=
|
|
|
|
+!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function N(a,b){o.bindRenderbuffer(o.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,
|
|
|
|
+a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function L(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);S(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=
|
|
|
|
+o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,f,e.__webglTexture,0);N(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),S(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,
|
|
|
|
+0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),N(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,
|
|
|
|
+c=a.width,a=a.height,f=e=0):(b=null,c=ya,a=ta,e=ja,f=ka);b!==G&&(o.bindFramebuffer(o.FRAMEBUFFER,b),o.viewport(e,f,c,a),G=b)}function J(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function X(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&
|
|
|
|
+(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function oa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Y(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;
|
|
|
|
+case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;
|
|
|
|
+case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var V=this,o,Q=[],qa=null,G=null,W=-1,Z=null,na=0,ma=null,sa=null,U=null,da=null,ia=null,ea=null,la=null,I=null,R=null,ja=0,ka=0,ya=0,ta=0,pa=[new THREE.Vector4,new THREE.Vector4,
|
|
|
|
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,za=new Float32Array(16),Ba=new Float32Array(16),Ga=new THREE.Vector4,fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},P=a.canvas!==void 0?a.canvas:document.createElement("canvas"),M=a.stencil!==void 0?a.stencil:!0,ca=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ra=a.antialias!==void 0?a.antialias:!1,ga=a.clearColor!==
|
|
|
|
+void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ua=a.clearAlpha!==void 0?a.clearAlpha:0,va=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=P;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=
|
|
|
|
+0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var ha,Fa=[],a=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(a.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Ia}),xa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Ia,morphTargets:!0});
|
|
|
|
+Da._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=P.getContext("experimental-webgl",{antialias:ra,stencil:M,preserveDrawingBuffer:ca})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ea){console.error(Ea)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);
|
|
|
|
+o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ga.r,ga.g,ga.b,ua);this.context=o;var La=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,$={};$.vertices=new Float32Array(16);$.faces=new Uint16Array(6);M=0;$.vertices[M++]=-1;$.vertices[M++]=-1;$.vertices[M++]=0;$.vertices[M++]=1;$.vertices[M++]=1;$.vertices[M++]=-1;$.vertices[M++]=1;$.vertices[M++]=1;$.vertices[M++]=1;$.vertices[M++]=1;$.vertices[M++]=1;$.vertices[M++]=
|
|
|
|
+0;$.vertices[M++]=-1;$.vertices[M++]=1;$.vertices[M++]=0;M=$.vertices[M++]=0;$.faces[M++]=0;$.faces[M++]=1;$.faces[M++]=2;$.faces[M++]=0;$.faces[M++]=2;$.faces[M++]=3;$.vertexBuffer=o.createBuffer();$.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,$.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,$.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,$.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,$.faces,o.STATIC_DRAW);$.program=o.createProgram();o.attachShader($.program,X("fragment",
|
|
|
|
+THREE.ShaderLib.sprite.fragmentShader));o.attachShader($.program,X("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram($.program);$.attributes={};$.uniforms={};$.attributes.position=o.getAttribLocation($.program,"position");$.attributes.uv=o.getAttribLocation($.program,"uv");$.uniforms.uvOffset=o.getUniformLocation($.program,"uvOffset");$.uniforms.uvScale=o.getUniformLocation($.program,"uvScale");$.uniforms.rotation=o.getUniformLocation($.program,"rotation");$.uniforms.scale=o.getUniformLocation($.program,
|
|
|
|
+"scale");$.uniforms.alignment=o.getUniformLocation($.program,"alignment");$.uniforms.color=o.getUniformLocation($.program,"color");$.uniforms.map=o.getUniformLocation($.program,"map");$.uniforms.opacity=o.getUniformLocation($.program,"opacity");$.uniforms.useScreenCoordinates=o.getUniformLocation($.program,"useScreenCoordinates");$.uniforms.affectedByDistance=o.getUniformLocation($.program,"affectedByDistance");$.uniforms.screenPosition=o.getUniformLocation($.program,"screenPosition");$.uniforms.modelViewMatrix=
|
|
|
|
+o.getUniformLocation($.program,"modelViewMatrix");$.uniforms.projectionMatrix=o.getUniformLocation($.program,"projectionMatrix");var Ra=!1;this.setSize=function(a,b){P.width=a;P.height=b;this.setViewport(0,0,P.width,P.height)};this.setViewport=function(a,b,c,e){ja=a;ka=b;ya=c;ta=e;o.viewport(ja,ka,ya,ta)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ga.setHex(a);ua=
|
|
|
|
+b;o.clearColor(ga.r,ga.g,ga.b,ua)};this.setClearColor=function(a,b){ga.copy(a);ua=b;o.clearColor(ga.r,ga.g,ga.b,ua)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return ua};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};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(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);
|
|
|
|
+o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);V.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),
|
|
|
|
+V.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),V.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,l,k;a instanceof THREE.MeshDepthMaterial?k="depth":a instanceof THREE.MeshNormalMaterial?k="normal":a instanceof THREE.MeshBasicMaterial?k="basic":
|
|
|
|
+a instanceof THREE.MeshLambertMaterial?k="lambert":a instanceof THREE.MeshPhongMaterial?k="phong":a instanceof THREE.LineBasicMaterial?k="basic":a instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var w,u,p;w=p=n=0;for(u=b.length;w<u;w++)l=b[w],l instanceof THREE.SpotLight&&p++,l instanceof THREE.DirectionalLight&&p++,l instanceof THREE.PointLight&&
|
|
|
|
+n++;n+p<=va?w=p:(w=Math.ceil(va*p/(n+p)),n=va-w);l={directional:w,point:n};n=p=0;for(w=b.length;n<w;n++)u=b[n],u instanceof THREE.SpotLight&&u.castShadow&&p++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var t;a:{w=a.fragmentShader;u=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
|
+maxDirLights:l.directional,maxPointLights:l.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},x,e=[];k?e.push(k):(e.push(w),e.push(u));for(x in c)e.push(x),e.push(c[x]);k=e.join();x=0;for(e=Q.length;x<e;x++)if(Q[x].code===k){t=Q[x].program;break a}x=o.createProgram();e=[La?"#define VERTEX_TEXTURES":"",
|
|
|
|
+V.gammaInput?"#define GAMMA_INPUT":"",V.gammaOutput?"#define GAMMA_OUTPUT":"",V.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":
|
|
|
|
+"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
+l=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",V.gammaInput?"#define GAMMA_INPUT":"",V.gammaOutput?"#define GAMMA_OUTPUT":"",V.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
|
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,X("fragment",l+w));o.attachShader(x,
|
|
|
|
+X("vertex",e+u));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");x.uniforms={};x.attributes={};var y,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in n)e.push(y);y=e;e=0;for(n=y.length;e<n;e++)w=y[e],x.uniforms[w]=o.getUniformLocation(x,
|
|
|
|
+w);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<c.maxMorphTargets;y++)e.push("morphTarget"+y);for(t in b)e.push(t);t=e;y=0;for(b=t.length;y<b;y++)c=t[y],x.attributes[c]=o.getAttribLocation(x,c);x.id=Q.length;Q.push({program:x,code:k});V.info.memory.programs=Q.length;t=x}a.program=t;t=a.program.attributes;t.position>=0&&o.enableVertexAttribArray(t.position);t.color>=0&&o.enableVertexAttribArray(t.color);t.normal>=0&&o.enableVertexAttribArray(t.normal);
|
|
|
|
+t.tangent>=0&&o.enableVertexAttribArray(t.tangent);a.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0&&(o.enableVertexAttribArray(t.skinVertexA),o.enableVertexAttribArray(t.skinVertexB),o.enableVertexAttribArray(t.skinIndex),o.enableVertexAttribArray(t.skinWeight));if(a.attributes)for(h in a.attributes)t[h]!==void 0&&t[h]>=0&&o.enableVertexAttribArray(t[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)y="morphTarget"+h,t[y]>=0&&(o.enableVertexAttribArray(t[y]),
|
|
|
|
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){L(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){B(a,b)};this.render=function(a,b,c,e){var fa,M,C,P,H,ca,Ja,I=a.lights,ga=a.fog;W=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&B(a,b);V.info.render.calls=0;V.info.render.vertices=0;V.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
|
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ba);b.projectionMatrix.flattenToArray(za);Ca.multiply(b.projectionMatrix,b.matrixWorldInverse);u(Ca);L(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);C=a.__webglObjects.length;for(e=0;e<C;e++)if(H=a.__webglObjects[e],ca=H.object,ca.visible)if(!(ca instanceof THREE.Mesh)||!ca.frustumCulled||x(ca)){if(ca.matrixWorld.flattenToArray(ca._objectMatrixArray),
|
|
|
|
+D(ca,b,!0),y(H),H.render=!0,this.sortObjects)ca.renderDepth?H.z=ca.renderDepth:(Ga.copy(ca.position),Ca.multiplyVector3(Ga),H.z=Ga.z)}else H.render=!1;else H.render=!1;this.sortObjects&&a.__webglObjects.sort(t);P=a.__webglObjectsImmediate.length;for(e=0;e<P;e++)H=a.__webglObjectsImmediate[e],ca=H.object,ca.visible&&(ca.matrixAutoUpdate&&ca.matrixWorld.flattenToArray(ca._objectMatrixArray),D(ca,b,!0),w(H));if(a.overrideMaterial){n(a.overrideMaterial.depthTest);E(a.overrideMaterial.blending);for(e=
|
|
|
|
+0;e<C;e++)if(H=a.__webglObjects[e],H.render)ca=H.object,Ja=H.buffer,k(ca),h(b,I,ga,a.overrideMaterial,Ja,ca);for(e=0;e<P;e++)H=a.__webglObjectsImmediate[e],ca=H.object,ca.visible&&(Z=-1,k(ca),fa=l(b,I,ga,a.overrideMaterial,ca),ca.immediateRenderCallback?ca.immediateRenderCallback(fa,o,pa):ca.render(function(b){f(b,fa,a.overrideMaterial.shading)}))}else{E(THREE.NormalBlending);for(e=C-1;e>=0;e--)if(H=a.__webglObjects[e],H.render&&(ca=H.object,Ja=H.buffer,M=H.opaque))k(ca),n(M.depthTest),p(M.depthWrite),
|
|
|
|
+v(M.polygonOffset,M.polygonOffsetFactor,M.polygonOffsetUnits),h(b,I,ga,M,Ja,ca);for(e=0;e<P;e++)if(H=a.__webglObjectsImmediate[e],ca=H.object,ca.visible&&(Z=-1,M=H.opaque))k(ca),n(M.depthTest),p(M.depthWrite),v(M.polygonOffset,M.polygonOffsetFactor,M.polygonOffsetUnits),fa=l(b,I,ga,M,ca),ca.immediateRenderCallback?ca.immediateRenderCallback(fa,o,pa):ca.render(function(a){f(a,fa,M.shading)});for(e=0;e<C;e++)if(H=a.__webglObjects[e],H.render&&(ca=H.object,Ja=H.buffer,M=H.transparent))k(ca),E(M.blending),
|
|
|
|
+n(M.depthTest),p(M.depthWrite),v(M.polygonOffset,M.polygonOffsetFactor,M.polygonOffsetUnits),h(b,I,ga,M,Ja,ca);for(e=0;e<P;e++)if(H=a.__webglObjectsImmediate[e],ca=H.object,ca.visible&&(Z=-1,M=H.transparent))k(ca),E(M.blending),n(M.depthTest),p(M.depthWrite),v(M.polygonOffset,M.polygonOffsetFactor,M.polygonOffsetUnits),fa=l(b,I,ga,M,ca),ca.immediateRenderCallback?ca.immediateRenderCallback(fa,o,pa):ca.render(function(a){f(a,fa,M.shading)})}a.__webglSprites.length&&A(a,b);c&&c.minFilter!==THREE.NearestFilter&&
|
|
|
|
+c.minFilter!==THREE.LinearFilter&&J(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,l=void 0,k=void 0,n=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),
|
|
|
|
+f instanceof THREE.Mesh){k=f.geometry;if(k.geometryGroups===void 0){var n=k,w=void 0,p=void 0,u=void 0,v=void 0,t=void 0,x=void 0,y=void 0,M={},fa=n.morphTargets.length;n.geometryGroups={};w=0;for(p=n.faces.length;w<p;w++)u=n.faces[w],v=u.materialIndex,x=v!==void 0?v:-1,M[x]===void 0&&(M[x]={hash:x,counter:0}),y=M[x].hash+"_"+M[x].counter,n.geometryGroups[y]===void 0&&(n.geometryGroups[y]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:fa}),t=u instanceof THREE.Face3?3:4,n.geometryGroups[y].vertices+
|
|
|
|
+t>65535&&(M[x].counter+=1,y=M[x].hash+"_"+M[x].counter,n.geometryGroups[y]===void 0&&(n.geometryGroups[y]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:fa})),u instanceof THREE.Face3?n.geometryGroups[y].faces3.push(w):n.geometryGroups[y].faces4.push(w),n.geometryGroups[y].vertices+=t;n.geometryGroupsList=[];w=void 0;for(w in n.geometryGroups)n.geometryGroups[w].id=na++,n.geometryGroupsList.push(n.geometryGroups[w])}for(l in k.geometryGroups)if(n=k.geometryGroups[l],!n.__webglVertexBuffer){w=
|
|
|
|
+n;w.__webglVertexBuffer=o.createBuffer();w.__webglNormalBuffer=o.createBuffer();w.__webglTangentBuffer=o.createBuffer();w.__webglColorBuffer=o.createBuffer();w.__webglUVBuffer=o.createBuffer();w.__webglUV2Buffer=o.createBuffer();w.__webglSkinVertexABuffer=o.createBuffer();w.__webglSkinVertexBBuffer=o.createBuffer();w.__webglSkinIndicesBuffer=o.createBuffer();w.__webglSkinWeightsBuffer=o.createBuffer();w.__webglFaceBuffer=o.createBuffer();w.__webglLineBuffer=o.createBuffer();if(w.numMorphTargets){u=
|
|
|
|
+p=void 0;w.__webglMorphTargetsBuffers=[];p=0;for(u=w.numMorphTargets;p<u;p++)w.__webglMorphTargetsBuffers.push(o.createBuffer())}V.info.memory.geometries++;v=f;t=v.geometry;p=n.faces3;x=n.faces4;w=p.length*3+x.length*4;u=p.length*1+x.length*2;x=p.length*3+x.length*4;p=b(v,n);y=p.map||p.lightMap||p instanceof THREE.ShaderMaterial?!0:!1;M=p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial?!1:p&&p.shading!==void 0&&p.shading===THREE.SmoothShading?THREE.SmoothShading:
|
|
|
|
+THREE.FlatShading;fa=p.vertexColors?p.vertexColors:!1;n.__vertexArray=new Float32Array(w*3);if(M)n.__normalArray=new Float32Array(w*3);if(t.hasTangents)n.__tangentArray=new Float32Array(w*4);if(fa)n.__colorArray=new Float32Array(w*3);if(y){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)n.__uvArray=new Float32Array(w*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(w*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(w*
|
|
|
|
+4),n.__skinVertexBArray=new Float32Array(w*4),n.__skinIndexArray=new Float32Array(w*4),n.__skinWeightArray=new Float32Array(w*4);n.__faceArray=new Uint16Array(u*3);n.__lineArray=new Uint16Array(x*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];v=0;for(t=n.numMorphTargets;v<t;v++)n.__morphTargetsArrays.push(new Float32Array(w*3))}n.__needsSmoothNormals=M===THREE.SmoothShading;n.__uvType=y;n.__vertexColorType=fa;n.__normalType=M;n.__webglFaceCount=u*3;n.__webglLineCount=x*2;if(p.attributes){if(n.__webglCustomAttributesList===
|
|
|
|
+void 0)n.__webglCustomAttributesList=[];u=void 0;for(u in p.attributes){var v=p.attributes[u],t={},B;for(B in v)t[B]=v[B];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,x=1,t.type==="v2"?x=2:t.type==="v3"?x=3:t.type==="v4"?x=4:t.type==="c"&&(x=3),t.size=x,t.array=new Float32Array(w*x),t.buffer=o.createBuffer(),t.buffer.belongsToAttribute=u,v.needsUpdate=!0,t.__original=v;n.__webglCustomAttributesList.push(t)}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=
|
|
|
|
+!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(k=f.geometry,!k.__webglVertexBuffer)n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),V.info.memory.geometries++,n=k,w=n.vertices.length,n.__vertexArray=new Float32Array(w*3),n.__colorArray=new Float32Array(w*3),n.__webglVertexCount=w,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.Line){if(k=f.geometry,!k.__webglVertexBuffer)n=
|
|
|
|
+k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),V.info.memory.geometries++,n=k,w=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__webglLineCount=p,c(n,w),k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(k=f.geometry,!k.__webglVertexBuffer))n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),V.info.geometries++,n=k,w=f,p=n.vertices.length,n.__vertexArray=
|
|
|
|
+new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__sortArray=[],n.__webglParticleCount=p,c(n,w),k.__dirtyVertices=!0,k.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(l in k=f.geometry,k.geometryGroups)n=k.geometryGroups[l],T(h.__webglObjects,n,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(k=f.geometry,T(h.__webglObjects,k,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?
|
|
|
|
+h.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite&&h.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];h=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)O(h.__webglObjects,f);else if(f instanceof THREE.Sprite){h=h.__webglSprites;l=f;for(k=h.length-1;k>=0;k--)h[k]===l&&h.splice(k,1)}else(f instanceof THREE.MarchingCubes||
|
|
|
|
+f.immediateRenderCallback)&&O(h.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(B=a.__webglObjects[f].object,l=B.geometry,k=u=p=void 0,B instanceof THREE.Mesh){n=0;for(w=l.geometryGroupsList.length;n<w;n++)if(p=l.geometryGroupsList[n],k=b(B,p),u=k.attributes&&C(k),l.__dirtyVertices||l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||u)if(u=o.DYNAMIC_DRAW,v=!l.dynamic,
|
|
|
|
+p.__inittedArrays){var A=x=t=void 0,P=void 0,D=void 0,ca=void 0,I=void 0,ga=void 0,L=void 0,W=void 0,K=A=ca=L=void 0,E=void 0,R=void 0,G=void 0,J=void 0,N=void 0,S=P=void 0,ra=P=L=void 0,ja=void 0,Q=P=G=R=E=J=G=R=E=J=G=R=E=J=G=R=E=I=void 0,ha=void 0,ua=ca=void 0,ka=A=void 0,da=void 0,Z=void 0,aa=K=ka=ha=0,$=0,X=Q=A=0,Y=I=N=0,F=0,U=0,ia=void 0,da=p.__vertexArray,la=p.__uvArray,F=p.__uv2Array,ua=p.__normalArray,D=p.__tangentArray,S=p.__colorArray,ra=p.__skinVertexAArray,ja=p.__skinVertexBArray,ga=p.__skinIndexArray,
|
|
|
|
+ea=p.__skinWeightArray,ma=p.__morphTargetsArrays,y=p.__webglCustomAttributesList,z=void 0,z=p.__faceArray,U=p.__lineArray,ya=p.__needsSmoothNormals,L=p.__vertexColorType,W=p.__uvType,ca=p.__normalType,va=B.geometry,ia=va.__dirtyElements,oa=va.__dirtyUvs,qa=va.__dirtyNormals,sa=va.__dirtyTangents,Ia=va.__dirtyColors,Z=va.__dirtyMorphTargets,ta=va.vertices,M=p.faces3,fa=p.faces4,pa=va.faces,Fa=va.faceVertexUvs[0],Ca=va.faceVertexUvs[1],Da=va.skinVerticesA,xa=va.skinVerticesB,Ba=va.skinIndices,Ea=va.skinWeights,
|
|
|
|
+za=va.morphTargets;if(va.__dirtyVertices){t=0;for(x=M.length;t<x;t++)P=pa[M[t]],E=ta[P.a].position,R=ta[P.b].position,G=ta[P.c].position,da[ka]=E.x,da[ka+1]=E.y,da[ka+2]=E.z,da[ka+3]=R.x,da[ka+4]=R.y,da[ka+5]=R.z,da[ka+6]=G.x,da[ka+7]=G.y,da[ka+8]=G.z,ka+=9;t=0;for(x=fa.length;t<x;t++)P=pa[fa[t]],E=ta[P.a].position,R=ta[P.b].position,G=ta[P.c].position,J=ta[P.d].position,da[ka]=E.x,da[ka+1]=E.y,da[ka+2]=E.z,da[ka+3]=R.x,da[ka+4]=R.y,da[ka+5]=R.z,da[ka+6]=G.x,da[ka+7]=G.y,da[ka+8]=G.z,da[ka+9]=J.x,
|
|
|
|
+da[ka+10]=J.y,da[ka+11]=J.z,ka+=12;o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,da,u)}if(Z){t=0;for(x=M.length;t<x;t++){P=pa[M[t]];ka=0;for(da=za.length;ka<da;ka++)E=za[ka].vertices[P.a].position,R=za[ka].vertices[P.b].position,G=za[ka].vertices[P.c].position,Z=ma[ka],Z[Y]=E.x,Z[Y+1]=E.y,Z[Y+2]=E.z,Z[Y+3]=R.x,Z[Y+4]=R.y,Z[Y+5]=R.z,Z[Y+6]=G.x,Z[Y+7]=G.y,Z[Y+8]=G.z;Y+=9}t=0;for(x=fa.length;t<x;t++){P=pa[fa[t]];ka=0;for(da=za.length;ka<da;ka++)E=za[ka].vertices[P.a].position,
|
|
|
|
+R=za[ka].vertices[P.b].position,G=za[ka].vertices[P.c].position,J=za[ka].vertices[P.d].position,Z=ma[ka],Z[Y]=E.x,Z[Y+1]=E.y,Z[Y+2]=E.z,Z[Y+3]=R.x,Z[Y+4]=R.y,Z[Y+5]=R.z,Z[Y+6]=G.x,Z[Y+7]=G.y,Z[Y+8]=G.z,Z[Y+9]=J.x,Z[Y+10]=J.y,Z[Y+11]=J.z;Y+=12}ka=0;for(da=za.length;ka<da;ka++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[ka]),o.bufferData(o.ARRAY_BUFFER,ma[ka],u)}if(Ea.length){t=0;for(x=M.length;t<x;t++)P=pa[M[t]],E=Ea[P.a],R=Ea[P.b],G=Ea[P.c],ea[I]=E.x,ea[I+1]=E.y,ea[I+2]=E.z,ea[I+3]=E.w,
|
|
|
|
+ea[I+4]=R.x,ea[I+5]=R.y,ea[I+6]=R.z,ea[I+7]=R.w,ea[I+8]=G.x,ea[I+9]=G.y,ea[I+10]=G.z,ea[I+11]=G.w,E=Ba[P.a],R=Ba[P.b],G=Ba[P.c],ga[I]=E.x,ga[I+1]=E.y,ga[I+2]=E.z,ga[I+3]=E.w,ga[I+4]=R.x,ga[I+5]=R.y,ga[I+6]=R.z,ga[I+7]=R.w,ga[I+8]=G.x,ga[I+9]=G.y,ga[I+10]=G.z,ga[I+11]=G.w,E=Da[P.a],R=Da[P.b],G=Da[P.c],ra[I]=E.x,ra[I+1]=E.y,ra[I+2]=E.z,ra[I+3]=1,ra[I+4]=R.x,ra[I+5]=R.y,ra[I+6]=R.z,ra[I+7]=1,ra[I+8]=G.x,ra[I+9]=G.y,ra[I+10]=G.z,ra[I+11]=1,E=xa[P.a],R=xa[P.b],G=xa[P.c],ja[I]=E.x,ja[I+1]=E.y,ja[I+2]=E.z,
|
|
|
|
+ja[I+3]=1,ja[I+4]=R.x,ja[I+5]=R.y,ja[I+6]=R.z,ja[I+7]=1,ja[I+8]=G.x,ja[I+9]=G.y,ja[I+10]=G.z,ja[I+11]=1,I+=12;t=0;for(x=fa.length;t<x;t++)P=pa[fa[t]],E=Ea[P.a],R=Ea[P.b],G=Ea[P.c],J=Ea[P.d],ea[I]=E.x,ea[I+1]=E.y,ea[I+2]=E.z,ea[I+3]=E.w,ea[I+4]=R.x,ea[I+5]=R.y,ea[I+6]=R.z,ea[I+7]=R.w,ea[I+8]=G.x,ea[I+9]=G.y,ea[I+10]=G.z,ea[I+11]=G.w,ea[I+12]=J.x,ea[I+13]=J.y,ea[I+14]=J.z,ea[I+15]=J.w,E=Ba[P.a],R=Ba[P.b],G=Ba[P.c],J=Ba[P.d],ga[I]=E.x,ga[I+1]=E.y,ga[I+2]=E.z,ga[I+3]=E.w,ga[I+4]=R.x,ga[I+5]=R.y,ga[I+
|
|
|
|
+6]=R.z,ga[I+7]=R.w,ga[I+8]=G.x,ga[I+9]=G.y,ga[I+10]=G.z,ga[I+11]=G.w,ga[I+12]=J.x,ga[I+13]=J.y,ga[I+14]=J.z,ga[I+15]=J.w,E=Da[P.a],R=Da[P.b],G=Da[P.c],J=Da[P.d],ra[I]=E.x,ra[I+1]=E.y,ra[I+2]=E.z,ra[I+3]=1,ra[I+4]=R.x,ra[I+5]=R.y,ra[I+6]=R.z,ra[I+7]=1,ra[I+8]=G.x,ra[I+9]=G.y,ra[I+10]=G.z,ra[I+11]=1,ra[I+12]=J.x,ra[I+13]=J.y,ra[I+14]=J.z,ra[I+15]=1,E=xa[P.a],R=xa[P.b],G=xa[P.c],P=xa[P.d],ja[I]=E.x,ja[I+1]=E.y,ja[I+2]=E.z,ja[I+3]=1,ja[I+4]=R.x,ja[I+5]=R.y,ja[I+6]=R.z,ja[I+7]=1,ja[I+8]=G.x,ja[I+9]=G.y,
|
|
|
|
+ja[I+10]=G.z,ja[I+11]=1,ja[I+12]=P.x,ja[I+13]=P.y,ja[I+14]=P.z,ja[I+15]=1,I+=16;I>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ra,u),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ja,u),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ga,u),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ea,u))}if(Ia&&L){t=0;for(x=M.length;t<x;t++)P=pa[M[t]],I=P.vertexColors,
|
|
|
|
+ga=P.color,I.length===3&&L===THREE.VertexColors?(P=I[0],ra=I[1],ja=I[2]):ja=ra=P=ga,S[N]=P.r,S[N+1]=P.g,S[N+2]=P.b,S[N+3]=ra.r,S[N+4]=ra.g,S[N+5]=ra.b,S[N+6]=ja.r,S[N+7]=ja.g,S[N+8]=ja.b,N+=9;t=0;for(x=fa.length;t<x;t++)P=pa[fa[t]],I=P.vertexColors,ga=P.color,I.length===4&&L===THREE.VertexColors?(P=I[0],ra=I[1],ja=I[2],I=I[3]):I=ja=ra=P=ga,S[N]=P.r,S[N+1]=P.g,S[N+2]=P.b,S[N+3]=ra.r,S[N+4]=ra.g,S[N+5]=ra.b,S[N+6]=ja.r,S[N+7]=ja.g,S[N+8]=ja.b,S[N+9]=I.r,S[N+10]=I.g,S[N+11]=I.b,N+=12;N>0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
+p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,S,u))}if(sa&&va.hasTangents){t=0;for(x=M.length;t<x;t++)P=pa[M[t]],L=P.vertexTangents,N=L[0],P=L[1],S=L[2],D[Q]=N.x,D[Q+1]=N.y,D[Q+2]=N.z,D[Q+3]=N.w,D[Q+4]=P.x,D[Q+5]=P.y,D[Q+6]=P.z,D[Q+7]=P.w,D[Q+8]=S.x,D[Q+9]=S.y,D[Q+10]=S.z,D[Q+11]=S.w,Q+=12;t=0;for(x=fa.length;t<x;t++)P=pa[fa[t]],L=P.vertexTangents,N=L[0],P=L[1],S=L[2],L=L[3],D[Q]=N.x,D[Q+1]=N.y,D[Q+2]=N.z,D[Q+3]=N.w,D[Q+4]=P.x,D[Q+5]=P.y,D[Q+6]=P.z,D[Q+7]=P.w,D[Q+8]=S.x,D[Q+9]=S.y,D[Q+10]=S.z,
|
|
|
|
+D[Q+11]=S.w,D[Q+12]=L.x,D[Q+13]=L.y,D[Q+14]=L.z,D[Q+15]=L.w,Q+=16;o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer);o.bufferData(o.ARRAY_BUFFER,D,u)}if(qa&&ca){t=0;for(x=M.length;t<x;t++)if(P=pa[M[t]],D=P.vertexNormals,ca=P.normal,D.length===3&&ya)for(Q=0;Q<3;Q++)ca=D[Q],ua[A]=ca.x,ua[A+1]=ca.y,ua[A+2]=ca.z,A+=3;else for(Q=0;Q<3;Q++)ua[A]=ca.x,ua[A+1]=ca.y,ua[A+2]=ca.z,A+=3;t=0;for(x=fa.length;t<x;t++)if(P=pa[fa[t]],D=P.vertexNormals,ca=P.normal,D.length===4&&ya)for(Q=0;Q<4;Q++)ca=D[Q],ua[A]=ca.x,
|
|
|
|
+ua[A+1]=ca.y,ua[A+2]=ca.z,A+=3;else for(Q=0;Q<4;Q++)ua[A]=ca.x,ua[A+1]=ca.y,ua[A+2]=ca.z,A+=3;o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer);o.bufferData(o.ARRAY_BUFFER,ua,u)}if(oa&&Fa&&W){t=0;for(x=M.length;t<x;t++)if(A=M[t],A=Fa[A],A!==void 0)for(Q=0;Q<3;Q++)ua=A[Q],la[K]=ua.u,la[K+1]=ua.v,K+=2;t=0;for(x=fa.length;t<x;t++)if(A=fa[t],A=Fa[A],A!==void 0)for(Q=0;Q<4;Q++)ua=A[Q],la[K]=ua.u,la[K+1]=ua.v,K+=2;K>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,la,u))}if(oa&&
|
|
|
|
+Ca&&W){t=0;for(x=M.length;t<x;t++)if(A=M[t],K=Ca[A],K!==void 0)for(Q=0;Q<3;Q++)A=K[Q],F[aa]=A.u,F[aa+1]=A.v,aa+=2;t=0;for(x=fa.length;t<x;t++)if(A=fa[t],K=Ca[A],K!==void 0)for(Q=0;Q<4;Q++)A=K[Q],F[aa]=A.u,F[aa+1]=A.v,aa+=2;aa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,F,u))}if(ia){t=0;for(x=M.length;t<x;t++)z[$]=ha,z[$+1]=ha+1,z[$+2]=ha+2,$+=3,U[X]=ha,U[X+1]=ha+1,U[X+2]=ha,U[X+3]=ha+2,U[X+4]=ha+1,U[X+5]=ha+2,X+=6,ha+=3;t=0;for(x=fa.length;t<x;t++)z[$]=ha,z[$+1]=
|
|
|
|
+ha+1,z[$+2]=ha+3,z[$+3]=ha+1,z[$+4]=ha+2,z[$+5]=ha+3,$+=6,U[X]=ha,U[X+1]=ha+1,U[X+2]=ha,U[X+3]=ha+3,U[X+4]=ha+1,U[X+5]=ha+2,U[X+6]=ha+2,U[X+7]=ha+3,X+=8,ha+=4;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,z,u);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,U,u)}if(y){Q=0;for(ha=y.length;Q<ha;Q++)if(z=y[Q],z.__original.needsUpdate){U=F=0;if(z.size===1)if(z.boundTo===void 0||z.boundTo==="vertices"){t=0;for(x=
|
|
|
|
+M.length;t<x;t++)P=pa[M[t]],z.array[F]=z.value[P.a],z.array[F+1]=z.value[P.b],z.array[F+2]=z.value[P.c],F+=3;t=0;for(x=fa.length;t<x;t++)P=pa[fa[t]],z.array[F]=z.value[P.a],z.array[F+1]=z.value[P.b],z.array[F+2]=z.value[P.c],z.array[F+3]=z.value[P.d],F+=4}else if(z.boundTo==="faces"){t=0;for(x=M.length;t<x;t++)ia=z.value[U],z.array[F]=ia,z.array[F+1]=ia,z.array[F+2]=ia,F+=3,U+=1;t=0;for(x=fa.length;t<x;t++)ia=z.value[U],z.array[F]=ia,z.array[F+1]=ia,z.array[F+2]=ia,z.array[F+3]=ia,F+=4,U+=1}else{if(z.boundTo===
|
|
|
|
+"faceVertices"){t=0;for(x=M.length;t<x;t++)z.array[F]=z.value[U],z.array[F+1]=z.value[U+1],z.array[F+2]=z.value[U+2],F+=3,U+=3;t=0;for(x=fa.length;t<x;t++)z.array[F]=z.value[U],z.array[F+1]=z.value[U+1],z.array[F+2]=z.value[U+2],z.array[F+3]=z.value[U+3],F+=4,U+=4}}else if(z.size===2)if(z.boundTo===void 0||z.boundTo==="vertices"){t=0;for(x=M.length;t<x;t++)P=pa[M[t]],E=z.value[P.a],R=z.value[P.b],G=z.value[P.c],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=R.x,z.array[F+3]=R.y,z.array[F+4]=G.x,z.array[F+
|
|
|
|
+5]=G.y,F+=6;t=0;for(x=fa.length;t<x;t++)P=pa[fa[t]],E=z.value[P.a],R=z.value[P.b],G=z.value[P.c],J=z.value[P.d],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=R.x,z.array[F+3]=R.y,z.array[F+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=J.x,z.array[F+7]=J.y,F+=8}else if(z.boundTo==="faces"){t=0;for(x=M.length;t<x;t++)G=R=E=ia=z.value[U],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=R.x,z.array[F+3]=R.y,z.array[F+4]=G.x,z.array[F+5]=G.y,F+=6,U+=1;t=0;for(x=fa.length;t<x;t++)J=G=R=E=ia=z.value[U],z.array[F]=E.x,
|
|
|
|
+z.array[F+1]=E.y,z.array[F+2]=R.x,z.array[F+3]=R.y,z.array[F+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=J.x,z.array[F+7]=J.y,F+=8,U+=1}else{if(z.boundTo==="faceVertices"){t=0;for(x=M.length;t<x;t++)E=z.value[U],R=z.value[U+1],G=z.value[U+2],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=R.x,z.array[F+3]=R.y,z.array[F+4]=G.x,z.array[F+5]=G.y,F+=6,U+=3;t=0;for(x=fa.length;t<x;t++)E=z.value[U],R=z.value[U+1],G=z.value[U+2],J=z.value[U+3],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=R.x,z.array[F+3]=R.y,z.array[F+
|
|
|
|
+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=J.x,z.array[F+7]=J.y,F+=8,U+=4}}else if(z.size===3)if(aa=z.type==="c"?["r","g","b"]:["x","y","z"],z.boundTo===void 0||z.boundTo==="vertices"){t=0;for(x=M.length;t<x;t++)P=pa[M[t]],E=z.value[P.a],R=z.value[P.b],G=z.value[P.c],z.array[F]=E[aa[0]],z.array[F+1]=E[aa[1]],z.array[F+2]=E[aa[2]],z.array[F+3]=R[aa[0]],z.array[F+4]=R[aa[1]],z.array[F+5]=R[aa[2]],z.array[F+6]=G[aa[0]],z.array[F+7]=G[aa[1]],z.array[F+8]=G[aa[2]],F+=9;t=0;for(x=fa.length;t<x;t++)P=pa[fa[t]],
|
|
|
|
+E=z.value[P.a],R=z.value[P.b],G=z.value[P.c],J=z.value[P.d],z.array[F]=E[aa[0]],z.array[F+1]=E[aa[1]],z.array[F+2]=E[aa[2]],z.array[F+3]=R[aa[0]],z.array[F+4]=R[aa[1]],z.array[F+5]=R[aa[2]],z.array[F+6]=G[aa[0]],z.array[F+7]=G[aa[1]],z.array[F+8]=G[aa[2]],z.array[F+9]=J[aa[0]],z.array[F+10]=J[aa[1]],z.array[F+11]=J[aa[2]],F+=12,U+=1}else if(z.boundTo==="faces"){t=0;for(x=M.length;t<x;t++)G=R=E=ia=z.value[U],z.array[F]=E[aa[0]],z.array[F+1]=E[aa[1]],z.array[F+2]=E[aa[2]],z.array[F+3]=R[aa[0]],z.array[F+
|
|
|
|
+4]=R[aa[1]],z.array[F+5]=R[aa[2]],z.array[F+6]=G[aa[0]],z.array[F+7]=G[aa[1]],z.array[F+8]=G[aa[2]],F+=9,U+=1;t=0;for(x=fa.length;t<x;t++)J=G=R=E=ia=z.value[U],z.array[F]=E[aa[0]],z.array[F+1]=E[aa[1]],z.array[F+2]=E[aa[2]],z.array[F+3]=R[aa[0]],z.array[F+4]=R[aa[1]],z.array[F+5]=R[aa[2]],z.array[F+6]=G[aa[0]],z.array[F+7]=G[aa[1]],z.array[F+8]=G[aa[2]],z.array[F+9]=J[aa[0]],z.array[F+10]=J[aa[1]],z.array[F+11]=J[aa[2]],F+=12,U+=1}else{if(z.boundTo==="faceVertices"){t=0;for(x=M.length;t<x;t++)E=z.value[U],
|
|
|
|
+R=z.value[U+1],G=z.value[U+2],z.array[F]=E[aa[0]],z.array[F+1]=E[aa[1]],z.array[F+2]=E[aa[2]],z.array[F+3]=R[aa[0]],z.array[F+4]=R[aa[1]],z.array[F+5]=R[aa[2]],z.array[F+6]=G[aa[0]],z.array[F+7]=G[aa[1]],z.array[F+8]=G[aa[2]],F+=9,U+=3;t=0;for(x=fa.length;t<x;t++)E=z.value[U],R=z.value[U+1],G=z.value[U+2],J=z.value[U+3],z.array[F]=E[aa[0]],z.array[F+1]=E[aa[1]],z.array[F+2]=E[aa[2]],z.array[F+3]=R[aa[0]],z.array[F+4]=R[aa[1]],z.array[F+5]=R[aa[2]],z.array[F+6]=G[aa[0]],z.array[F+7]=G[aa[1]],z.array[F+
|
|
|
|
+8]=G[aa[2]],z.array[F+9]=J[aa[0]],z.array[F+10]=J[aa[1]],z.array[F+11]=J[aa[2]],F+=12,U+=4}}else if(z.size===4)if(z.boundTo===void 0||z.boundTo==="vertices"){t=0;for(x=M.length;t<x;t++)P=pa[M[t]],E=z.value[P.a],R=z.value[P.b],G=z.value[P.c],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=E.z,z.array[F+3]=E.w,z.array[F+4]=R.x,z.array[F+5]=R.y,z.array[F+6]=R.z,z.array[F+7]=R.w,z.array[F+8]=G.x,z.array[F+9]=G.y,z.array[F+10]=G.z,z.array[F+11]=G.w,F+=12;t=0;for(x=fa.length;t<x;t++)P=pa[fa[t]],E=z.value[P.a],
|
|
|
|
+R=z.value[P.b],G=z.value[P.c],J=z.value[P.d],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=E.z,z.array[F+3]=E.w,z.array[F+4]=R.x,z.array[F+5]=R.y,z.array[F+6]=R.z,z.array[F+7]=R.w,z.array[F+8]=G.x,z.array[F+9]=G.y,z.array[F+10]=G.z,z.array[F+11]=G.w,z.array[F+12]=J.x,z.array[F+13]=J.y,z.array[F+14]=J.z,z.array[F+15]=J.w,F+=16}else if(z.boundTo==="faces"){t=0;for(x=M.length;t<x;t++)G=R=E=ia=z.value[U],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=E.z,z.array[F+3]=E.w,z.array[F+4]=R.x,z.array[F+5]=R.y,
|
|
|
|
+z.array[F+6]=R.z,z.array[F+7]=R.w,z.array[F+8]=G.x,z.array[F+9]=G.y,z.array[F+10]=G.z,z.array[F+11]=G.w,F+=12,U+=1;t=0;for(x=fa.length;t<x;t++)J=G=R=E=ia=z.value[U],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=E.z,z.array[F+3]=E.w,z.array[F+4]=R.x,z.array[F+5]=R.y,z.array[F+6]=R.z,z.array[F+7]=R.w,z.array[F+8]=G.x,z.array[F+9]=G.y,z.array[F+10]=G.z,z.array[F+11]=G.w,z.array[F+12]=J.x,z.array[F+13]=J.y,z.array[F+14]=J.z,z.array[F+15]=J.w,F+=16,U+=1}else if(z.boundTo==="faceVertices"){t=0;for(x=M.length;t<
|
|
|
|
+x;t++)E=z.value[U],R=z.value[U+1],G=z.value[U+2],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=E.z,z.array[F+3]=E.w,z.array[F+4]=R.x,z.array[F+5]=R.y,z.array[F+6]=R.z,z.array[F+7]=R.w,z.array[F+8]=G.x,z.array[F+9]=G.y,z.array[F+10]=G.z,z.array[F+11]=G.w,F+=12,U+=3;t=0;for(x=fa.length;t<x;t++)E=z.value[U],R=z.value[U+1],G=z.value[U+2],J=z.value[U+3],z.array[F]=E.x,z.array[F+1]=E.y,z.array[F+2]=E.z,z.array[F+3]=E.w,z.array[F+4]=R.x,z.array[F+5]=R.y,z.array[F+6]=R.z,z.array[F+7]=R.w,z.array[F+8]=G.x,
|
|
|
|
+z.array[F+9]=G.y,z.array[F+10]=G.z,z.array[F+11]=G.w,z.array[F+12]=J.x,z.array[F+13]=J.y,z.array[F+14]=J.z,z.array[F+15]=J.w,F+=16,U+=4}o.bindBuffer(o.ARRAY_BUFFER,z.buffer);o.bufferData(o.ARRAY_BUFFER,z.array,u)}}v&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}l.__dirtyVertices=
|
|
|
|
+!1;l.__dirtyMorphTargets=!1;l.__dirtyElements=!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=!1;k.attributes&&H(k)}else if(B instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){k=l;B=o.DYNAMIC_DRAW;n=t=v=v=void 0;x=k.vertices;w=k.colors;y=x.length;p=w.length;M=k.__vertexArray;u=k.__colorArray;fa=k.__dirtyColors;if(k.__dirtyVertices){for(v=0;v<y;v++)t=x[v].position,n=v*3,M[n]=t.x,M[n+1]=t.y,M[n+2]=t.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,
|
|
|
|
+M,B)}if(fa){for(v=0;v<p;v++)color=w[v],n=v*3,u[n]=color.r,u[n+1]=color.g,u[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,u,B)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(B instanceof THREE.Line){k=b(B,p);u=k.attributes&&C(k);if(l.__dirtyVertices||l.__dirtyColors||u){B=l;n=o.DYNAMIC_DRAW;w=ha=x=pa=void 0;x=B.vertices;p=B.colors;y=x.length;u=p.length;M=B.__vertexArray;v=B.__colorArray;fa=B.__dirtyColors;t=B.__webglCustomAttributesList;K=X=$=aa=ha=pa=
|
|
|
|
+void 0;if(B.__dirtyVertices){for(pa=0;pa<y;pa++)ha=x[pa].position,w=pa*3,M[w]=ha.x,M[w+1]=ha.y,M[w+2]=ha.z;o.bindBuffer(o.ARRAY_BUFFER,B.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,M,n)}if(fa){for(x=0;x<u;x++)color=p[x],w=x*3,v[w]=color.r,v[w+1]=color.g,v[w+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,B.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,v,n)}if(t){pa=0;for(ha=t.length;pa<ha;pa++)if(K=t[pa],K.needsUpdate&&(K.boundTo===void 0||K.boundTo==="vertices")){w=0;$=K.value.length;if(K.size===1)for(aa=
|
|
|
|
+0;aa<$;aa++)K.array[aa]=K.value[aa];else if(K.size===2)for(aa=0;aa<$;aa++)X=K.value[aa],K.array[w]=X.x,K.array[w+1]=X.y,w+=2;else if(K.size===3)if(K.type==="c")for(aa=0;aa<$;aa++)X=K.value[aa],K.array[w]=X.r,K.array[w+1]=X.g,K.array[w+2]=X.b,w+=3;else for(aa=0;aa<$;aa++)X=K.value[aa],K.array[w]=X.x,K.array[w+1]=X.y,K.array[w+2]=X.z,w+=3;else if(K.size===4)for(aa=0;aa<$;aa++)X=K.value[aa],K.array[w]=X.x,K.array[w+1]=X.y,K.array[w+2]=X.z,K.array[w+3]=X.w,w+=4;o.bindBuffer(o.ARRAY_BUFFER,K.buffer);o.bufferData(o.ARRAY_BUFFER,
|
|
|
|
+K.array,n)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;k.attributes&&H(k)}else if(B instanceof THREE.ParticleSystem)k=b(B,p),u=k.attributes&&C(k),(l.__dirtyVertices||l.__dirtyColors||B.sortParticles||u)&&e(l,o.DYNAMIC_DRAW,B),l.__dirtyVertices=!1,l.__dirtyColors=!1,k.attributes&&H(k)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};
|
|
|
|
+this.supportsVertexTextures=function(){return La}};
|
|
THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
|
|
THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
|
|
THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
|
|
THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0};
|
|
@@ -359,19 +359,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
THREE.ColorUtils={adjustHSV:function(a,c,b,e){var l=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,l);l.h=THREE.Math.clamp(l.h+c,0,1);l.s=THREE.Math.clamp(l.s+b,0,1);l.v=THREE.Math.clamp(l.v+e,0,1);a.setHSV(l.h,l.s,l.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,l=a.b,h=Math.max(Math.max(b,e),l),f=Math.min(Math.min(b,e),l);if(f===h)f=b=0;else{var k=h-f,f=k/h,b=b===h?(e-l)/k:e===h?2+(l-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=h;return c}};
|
|
THREE.ColorUtils={adjustHSV:function(a,c,b,e){var l=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,l);l.h=THREE.Math.clamp(l.h+c,0,1);l.s=THREE.Math.clamp(l.s+b,0,1);l.v=THREE.Math.clamp(l.v+e,0,1);a.setHSV(l.h,l.s,l.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,l=a.b,h=Math.max(Math.max(b,e),l),f=Math.min(Math.min(b,e),l);if(f===h)f=b=0;else{var k=h-f,f=k/h,b=b===h?(e-l)/k:e===h?2+(l-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=h;return c}};
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
-THREE.GeometryUtils={merge:function(a,c){for(var b,e,l=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,k=h.vertices,n=a.faces,t=h.faces,v=a.faceVertexUvs[0],p=h.faceVertexUvs[0],x={},w=0;w<a.materials.length;w++)x[a.materials[w].id]=w;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var w=0,z=k.length;w<z;w++){var u=new THREE.Vertex(k[w].position.clone());b&&b.multiplyVector3(u.position);f.push(u)}w=
|
|
|
|
-0;for(z=t.length;w<z;w++){var f=t[w],B,y,E=f.vertexNormals,C=f.vertexColors;f instanceof THREE.Face3?B=new THREE.Face3(f.a+l,f.b+l,f.c+l):f instanceof THREE.Face4&&(B=new THREE.Face4(f.a+l,f.b+l,f.c+l,f.d+l));B.normal.copy(f.normal);e&&e.multiplyVector3(B.normal);k=0;for(u=E.length;k<u;k++)y=E[k].clone(),e&&e.multiplyVector3(y),B.vertexNormals.push(y);B.color.copy(f.color);k=0;for(u=C.length;k<u;k++)y=C[k],B.vertexColors.push(y.clone());if(f.materialIndex!==void 0){k=h.materials[f.materialIndex];
|
|
|
|
-u=x[k.id];if(u===void 0)u=a.materials.length,a.materials.push(k);B.materialIndex=u}B.centroid.copy(f.centroid);b&&b.multiplyVector3(B.centroid);n.push(B)}w=0;for(z=p.length;w<z;w++){b=p[w];e=[];k=0;for(u=b.length;k<u;k++)e.push(new THREE.UV(b[k].u,b[k].v));v.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,l=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
|
|
|
|
-for(b=l.length;a<b;a++){var k=l[a],n,t,v=k.vertexNormals,p=k.vertexColors;k instanceof THREE.Face3?n=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(n=new THREE.Face4(k.a,k.b,k.c,k.d));n.normal.copy(k.normal);e=0;for(f=v.length;e<f;e++)t=v[e],n.vertexNormals.push(t.clone());n.color.copy(k.color);e=0;for(f=p.length;e<f;e++)t=p[e],n.vertexColors.push(t.clone());n.materialIndex=k.materialIndex;n.centroid.copy(k.centroid);c.faces.push(n)}a=0;for(b=h.length;a<b;a++){l=h[a];n=[];e=0;for(f=l.length;e<
|
|
|
|
|
|
+THREE.GeometryUtils={merge:function(a,c){for(var b,e,l=a.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,k=h.vertices,n=a.faces,p=h.faces,v=a.faceVertexUvs[0],u=h.faceVertexUvs[0],x={},w=0;w<a.materials.length;w++)x[a.materials[w].id]=w;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var w=0,y=k.length;w<y;w++){var t=new THREE.Vertex(k[w].position.clone());b&&b.multiplyVector3(t.position);f.push(t)}w=
|
|
|
|
+0;for(y=p.length;w<y;w++){var f=p[w],B,A,D=f.vertexNormals,C=f.vertexColors;f instanceof THREE.Face3?B=new THREE.Face3(f.a+l,f.b+l,f.c+l):f instanceof THREE.Face4&&(B=new THREE.Face4(f.a+l,f.b+l,f.c+l,f.d+l));B.normal.copy(f.normal);e&&e.multiplyVector3(B.normal);k=0;for(t=D.length;k<t;k++)A=D[k].clone(),e&&e.multiplyVector3(A),B.vertexNormals.push(A);B.color.copy(f.color);k=0;for(t=C.length;k<t;k++)A=C[k],B.vertexColors.push(A.clone());if(f.materialIndex!==void 0){k=h.materials[f.materialIndex];
|
|
|
|
+t=x[k.id];if(t===void 0)t=a.materials.length,a.materials.push(k);B.materialIndex=t}B.centroid.copy(f.centroid);b&&b.multiplyVector3(B.centroid);n.push(B)}w=0;for(y=u.length;w<y;w++){b=u[w];e=[];k=0;for(t=b.length;k<t;k++)e.push(new THREE.UV(b[k].u,b[k].v));v.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,l=a.faces,h=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var f=new THREE.Vertex(e[a].position.clone());c.vertices.push(f)}a=0;
|
|
|
|
+for(b=l.length;a<b;a++){var k=l[a],n,p,v=k.vertexNormals,u=k.vertexColors;k instanceof THREE.Face3?n=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(n=new THREE.Face4(k.a,k.b,k.c,k.d));n.normal.copy(k.normal);e=0;for(f=v.length;e<f;e++)p=v[e],n.vertexNormals.push(p.clone());n.color.copy(k.color);e=0;for(f=u.length;e<f;e++)p=u[e],n.vertexColors.push(p.clone());n.materialIndex=k.materialIndex;n.centroid.copy(k.centroid);c.faces.push(n)}a=0;for(b=h.length;a<b;a++){l=h[a];n=[];e=0;for(f=l.length;e<
|
|
f;e++)n.push(new THREE.UV(l[e].u,l[e].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(a,c,b){var e,l,h,f=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();l=THREE.GeometryUtils.random();e+l>1&&(e=1-e,l=1-l);h=1-e-l;f.copy(a);f.multiplyScalar(e);k.copy(c);k.multiplyScalar(l);f.addSelf(k);k.copy(b);k.multiplyScalar(h);f.addSelf(k);return f},randomPointInFace:function(a,c,b){var e,l,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,l=c.vertices[a.b].position,
|
|
f;e++)n.push(new THREE.UV(l[e].u,l[e].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(a,c,b){var e,l,h,f=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();l=THREE.GeometryUtils.random();e+l>1&&(e=1-e,l=1-l);h=1-e-l;f.copy(a);f.multiplyScalar(e);k.copy(c);k.multiplyScalar(l);f.addSelf(k);k.copy(b);k.multiplyScalar(h);f.addSelf(k);return f},randomPointInFace:function(a,c,b){var e,l,h;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,l=c.vertices[a.b].position,
|
|
h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,l,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;l=c.vertices[a.b].position;h=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(e,l,c),f=THREE.GeometryUtils.triangleArea(l,h,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(e,l,c),f=THREE.GeometryUtils.triangleArea(l,h,c));return THREE.GeometryUtils.random()*(b+
|
|
h=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,l,h);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;l=c.vertices[a.b].position;h=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(e,l,c),f=THREE.GeometryUtils.triangleArea(l,h,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(e,l,c),f=THREE.GeometryUtils.triangleArea(l,h,c));return THREE.GeometryUtils.random()*(b+
|
|
-f)<b?THREE.GeometryUtils.randomPointInTriangle(e,l,c):THREE.GeometryUtils.randomPointInTriangle(l,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var f=c+Math.floor((e-c)/2);return t[f]>a?b(c,f-1):t[f]<a?b(f+1,e):f}return b(0,t.length-1)}var e,l,h=a.faces,f=a.vertices,k=h.length,n=0,t=[],v,p,x,w;for(l=0;l<k;l++){e=h[l];if(e instanceof THREE.Face3)v=f[e.a].position,p=f[e.b].position,x=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(v,p,x);else if(e instanceof
|
|
|
|
-THREE.Face4)v=f[e.a].position,p=f[e.b].position,x=f[e.c].position,w=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(v,p,w),e._area2=THREE.GeometryUtils.triangleArea(p,x,w),e._area=e._area1+e._area2;n+=e._area;t[l]=n}e=[];f={};for(l=0;l<c;l++)k=THREE.GeometryUtils.random()*n,k=b(k),e[l]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),f[k]?f[k]+=1:f[k]=1;return e},triangleArea:function(a,c,b){var e,l=THREE.GeometryUtils.__v1;l.sub(a,c);e=l.length();l.sub(a,b);a=l.length();l.sub(c,b);b=l.length();
|
|
|
|
|
|
+f)<b?THREE.GeometryUtils.randomPointInTriangle(e,l,c):THREE.GeometryUtils.randomPointInTriangle(l,h,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var f=c+Math.floor((e-c)/2);return p[f]>a?b(c,f-1):p[f]<a?b(f+1,e):f}return b(0,p.length-1)}var e,l,h=a.faces,f=a.vertices,k=h.length,n=0,p=[],v,u,x,w;for(l=0;l<k;l++){e=h[l];if(e instanceof THREE.Face3)v=f[e.a].position,u=f[e.b].position,x=f[e.c].position,e._area=THREE.GeometryUtils.triangleArea(v,u,x);else if(e instanceof
|
|
|
|
+THREE.Face4)v=f[e.a].position,u=f[e.b].position,x=f[e.c].position,w=f[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(v,u,w),e._area2=THREE.GeometryUtils.triangleArea(u,x,w),e._area=e._area1+e._area2;n+=e._area;p[l]=n}e=[];f={};for(l=0;l<c;l++)k=THREE.GeometryUtils.random()*n,k=b(k),e[l]=THREE.GeometryUtils.randomPointInFace(h[k],a,!0),f[k]?f[k]+=1:f[k]=1;return e},triangleArea:function(a,c,b){var e,l=THREE.GeometryUtils.__v1;l.sub(a,c);e=l.length();l.sub(a,b);a=l.length();l.sub(c,b);b=l.length();
|
|
c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,l=new THREE.Texture(e,c);e.onload=function(){l.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return l},loadTextureCube:function(a,c,b){var e,l=[],h=new THREE.Texture(l,c),c=l.loadCount=0;for(e=a.length;c<e;++c)l[c]=new Image,l[c].onload=function(){l.loadCount+=1;if(l.loadCount===6)h.needsUpdate=!0;b&&b(this)},l[c].crossOrigin="",l[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,l=new THREE.Texture(e,c);e.onload=function(){l.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return l},loadTextureCube:function(a,c,b){var e,l=[],h=new THREE.Texture(l,c),c=l.loadCount=0;for(e=a.length;c<e;++c)l[c]=new Image,l[c].onload=function(){l.loadCount+=1;if(l.loadCount===6)h.needsUpdate=!0;b&&b(this)},l[c].crossOrigin="",l[c].src=a[c];return h},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,l=a.height,h=document.createElement("canvas");h.width=e;h.height=l;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,l).data,n=f.createImageData(e,l),t=n.data,v=0;v<e;v++)for(var p=1;p<l;p++){var x=p-1<0?l-1:p-1,w=(p+1)%l,z=v-1<0?e-1:v-1,u=(v+1)%e,B=[],y=[0,0,k[(p*e+v)*4]/255*c];B.push([-1,0,k[(p*e+z)*4]/255*c]);B.push([-1,-1,k[(x*e+z)*4]/255*c]);B.push([0,-1,k[(x*e+v)*4]/255*c]);B.push([1,-1,k[(x*e+u)*4]/255*c]);
|
|
|
|
-B.push([1,0,k[(p*e+u)*4]/255*c]);B.push([1,1,k[(w*e+u)*4]/255*c]);B.push([0,1,k[(w*e+v)*4]/255*c]);B.push([-1,1,k[(w*e+z)*4]/255*c]);x=[];z=B.length;for(w=0;w<z;w++){var u=B[w],E=B[(w+1)%z],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]],E=[E[0]-y[0],E[1]-y[1],E[2]-y[2]];x.push(b([u[1]*E[2]-u[2]*E[1],u[2]*E[0]-u[0]*E[2],u[0]*E[1]-u[1]*E[0]]))}B=[0,0,0];for(w=0;w<x.length;w++)B[0]+=x[w][0],B[1]+=x[w][1],B[2]+=x[w][2];B[0]/=x.length;B[1]/=x.length;B[2]/=x.length;y=(p*e+v)*4;t[y]=(B[0]+1)/2*255|0;t[y+1]=(B[1]+0.5)*
|
|
|
|
-255|0;t[y+2]=B[2]*255|0;t[y+3]=255}f.putImageData(n,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,l=a.children.length;for(e=0;e<l;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,l=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);l.add(h)}return l}};
|
|
|
|
|
|
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,l=a.height,h=document.createElement("canvas");h.width=e;h.height=l;var f=h.getContext("2d");f.drawImage(a,0,0);for(var k=f.getImageData(0,0,e,l).data,n=f.createImageData(e,l),p=n.data,v=0;v<e;v++)for(var u=1;u<l;u++){var x=u-1<0?l-1:u-1,w=(u+1)%l,y=v-1<0?e-1:v-1,t=(v+1)%e,B=[],A=[0,0,k[(u*e+v)*4]/255*c];B.push([-1,0,k[(u*e+y)*4]/255*c]);B.push([-1,-1,k[(x*e+y)*4]/255*c]);B.push([0,-1,k[(x*e+v)*4]/255*c]);B.push([1,-1,k[(x*e+t)*4]/255*c]);
|
|
|
|
+B.push([1,0,k[(u*e+t)*4]/255*c]);B.push([1,1,k[(w*e+t)*4]/255*c]);B.push([0,1,k[(w*e+v)*4]/255*c]);B.push([-1,1,k[(w*e+y)*4]/255*c]);x=[];y=B.length;for(w=0;w<y;w++){var t=B[w],D=B[(w+1)%y],t=[t[0]-A[0],t[1]-A[1],t[2]-A[2]],D=[D[0]-A[0],D[1]-A[1],D[2]-A[2]];x.push(b([t[1]*D[2]-t[2]*D[1],t[2]*D[0]-t[0]*D[2],t[0]*D[1]-t[1]*D[0]]))}B=[0,0,0];for(w=0;w<x.length;w++)B[0]+=x[w][0],B[1]+=x[w][1],B[2]+=x[w][2];B[0]/=x.length;B[1]/=x.length;B[2]/=x.length;A=(u*e+v)*4;p[A]=(B[0]+1)/2*255|0;p[A+1]=(B[1]+0.5)*
|
|
|
|
+255|0;p[A+2]=B[2]*255|0;p[A+3]=255}f.putImageData(n,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,l=a.children.length;for(e=0;e<l;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,l=new THREE.Object3D;for(b=0;b<e;b++){var h=new THREE.Mesh(a,c[b]);l.add(h)}return l}};
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
|
|
@@ -410,37 +410,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var l=Array.prototype.sl
|
|
THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,l,h){var f=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(l,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
|
|
THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,l,h){var f=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(l,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
|
|
THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
|
|
THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
|
|
THREE.Path.prototype.arc=function(a,c,b,e,l,h){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,l,h));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
|
|
THREE.Path.prototype.arc=function(a,c,b,e,l,h){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,l,h));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
|
|
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,l,h,f,k,n,t,v,p,x,w,z,u;e=0;for(l=this.actions.length;e<l;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];n=h[3];p=h[0];x=h[1];b.length>0?(f=b[b.length-1],w=f.x,z=f.y):(f=this.actions[e-1].args,w=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)u=f/a,h=THREE.Shape.Utils.b2(u,w,p,k),u=THREE.Shape.Utils.b2(u,z,x,
|
|
|
|
-n),b.push(new THREE.Vector2(h,u));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];n=h[5];p=h[0];x=h[1];t=h[2];v=h[3];b.length>0?(f=b[b.length-1],w=f.x,z=f.y):(f=this.actions[e-1].args,w=f[f.length-2],z=f[f.length-1]);for(f=1;f<=a;f++)u=f/a,h=THREE.Shape.Utils.b3(u,w,p,t,k),u=THREE.Shape.Utils.b3(u,z,x,v,n),b.push(new THREE.Vector2(h,u));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];u=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
|
|
|
|
-for(f=1;f<=u;f++)b.push(h.getPointAt(f/u));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];n=h[1];t=h[2];p=h[3];u=h[4];x=!!h[5];v=f[f.length-2];w=f[f.length-1];f.length==0&&(v=w=0);z=u-p;var B=a*2;for(f=1;f<=B;f++)u=f/B,x||(u=1-u),u=p+u*z,h=v+k+t*Math.cos(u),u=w+n+t*Math.sin(u),b.push(new THREE.Vector2(h,u))}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,e,l,h){var f=this.getPoints(),k,n,t,v,p;k=0;for(n=f.length;k<n;k++)t=f[k],v=t.x,p=t.y,t.x=a*v+c*p+b,t.y=e*p+l*v+h;return f};
|
|
|
|
|
|
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,l,h,f,k,n,p,v,u,x,w,y,t;e=0;for(l=this.actions.length;e<l;e++)switch(h=this.actions[e],f=h.action,h=h.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=h[2];n=h[3];u=h[0];x=h[1];b.length>0?(f=b[b.length-1],w=f.x,y=f.y):(f=this.actions[e-1].args,w=f[f.length-2],y=f[f.length-1]);for(f=1;f<=a;f++)t=f/a,h=THREE.Shape.Utils.b2(t,w,u,k),t=THREE.Shape.Utils.b2(t,y,x,
|
|
|
|
+n),b.push(new THREE.Vector2(h,t));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];n=h[5];u=h[0];x=h[1];p=h[2];v=h[3];b.length>0?(f=b[b.length-1],w=f.x,y=f.y):(f=this.actions[e-1].args,w=f[f.length-2],y=f[f.length-1]);for(f=1;f<=a;f++)t=f/a,h=THREE.Shape.Utils.b3(t,w,u,p,k),t=THREE.Shape.Utils.b3(t,y,x,v,n),b.push(new THREE.Vector2(h,t));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[e-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];t=a*h[0].length;f=f.concat(h[0]);h=new THREE.SplineCurve(f);
|
|
|
|
+for(f=1;f<=t;f++)b.push(h.getPointAt(f/t));break;case THREE.PathActions.ARC:f=this.actions[e-1].args;k=h[0];n=h[1];p=h[2];u=h[3];t=h[4];x=!!h[5];v=f[f.length-2];w=f[f.length-1];f.length==0&&(v=w=0);y=t-u;var B=a*2;for(f=1;f<=B;f++)t=f/B,x||(t=1-t),t=u+t*y,h=v+k+p*Math.cos(t),t=w+n+p*Math.sin(t),b.push(new THREE.Vector2(h,t))}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,e,l,h){var f=this.getPoints(),k,n,p,v,u;k=0;for(n=f.length;k<n;k++)p=f[k],v=p.x,u=p.y,p.x=a*v+c*u+b,p.y=e*u+l*v+h;return f};
|
|
THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,l,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],l=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,l);c.stroke();c.closePath();c.strokeStyle="red";e=
|
|
THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,l,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],l=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,l);c.stroke();c.closePath();c.strokeStyle="red";e=
|
|
this.getPoints();a=0;for(b=e.length;a<b;a++)l=e[a],c.beginPath(),c.arc(l.x,l.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
this.getPoints();a=0;for(b=e.length;a<b;a++)l=e[a],c.beginPath(),c.arc(l.x,l.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
THREE.Path.prototype.toShapes=function(){var a,c,b,e,l=[],h=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(l.push(h),h=new THREE.Path),h[b].apply(h,e);h.actions.length!=0&&l.push(h);if(l.length==0)return[];var f,h=[];if(THREE.Shape.Utils.isClockWise(l[0].getPoints())){a=0;for(c=l.length;a<c;a++)e=l[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f&&h.push(f),f=new THREE.Shape,f.actions=e.actions,f.curves=
|
|
THREE.Path.prototype.toShapes=function(){var a,c,b,e,l=[],h=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(l.push(h),h=new THREE.Path),h[b].apply(h,e);h.actions.length!=0&&l.push(h);if(l.length==0)return[];var f,h=[];if(THREE.Shape.Utils.isClockWise(l[0].getPoints())){a=0;for(c=l.length;a<c;a++)e=l[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f&&h.push(f),f=new THREE.Shape,f.actions=e.actions,f.curves=
|
|
e.curves):f.holes.push(e);h.push(f)}else{f=new THREE.Shape;a=0;for(c=l.length;a<c;a++)e=l[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f.actions=e.actions,f.curves=e.curves,h.push(f),f=new THREE.Shape):f.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
e.curves):f.holes.push(e);h.push(f)}else{f=new THREE.Shape;a=0;for(c=l.length;a<c;a++)e=l[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(f.actions=e.actions,f.curves=e.curves,h.push(f),f=new THREE.Shape):f.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),l,h,f,k,n,t,v,p,x,w,z=[];for(n=0;n<c.length;n++){t=c[n];Array.prototype.push.apply(e,t);h=Number.POSITIVE_INFINITY;for(l=0;l<t.length;l++){x=t[l];w=[];for(p=0;p<b.length;p++)v=b[p],v=x.distanceToSquared(v),w.push(v),v<h&&(h=v,f=l,k=p)}l=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:t.length-1;var u=[t[f],b[k],b[l]];p=THREE.FontUtils.Triangulate.area(u);var B=[t[f],t[h],b[k]];x=THREE.FontUtils.Triangulate.area(B);w=k;v=f;k+=1;f+=-1;k<
|
|
|
|
-0&&(k+=b.length);k%=b.length;f<0&&(f+=t.length);f%=t.length;l=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:t.length-1;u=[t[f],b[k],b[l]];u=THREE.FontUtils.Triangulate.area(u);B=[t[f],t[h],b[k]];B=THREE.FontUtils.Triangulate.area(B);p+x>u+B&&(k=w,f=v,k<0&&(k+=b.length),k%=b.length,f<0&&(f+=t.length),f%=t.length,l=k-1>=0?k-1:b.length-1,h=f-1>=0?f-1:t.length-1);p=b.slice(0,k);x=b.slice(k);w=t.slice(f);v=t.slice(0,f);h=[t[f],t[h],b[k]];z.push([t[f],b[k],b[l]]);z.push(h);b=p.concat(w).concat(v).concat(x)}return{shape:b,
|
|
|
|
-isolatedPts:z,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,l=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,f,k,n,t={};h=0;for(f=e.length;h<f;h++)n=e[h].x+":"+e[h].y,t[n]!==void 0&&console.log("Duplicate point",n),t[n]=h;h=0;for(f=b.length;h<f;h++){k=b[h];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=t[n],n!==void 0&&(k[e]=n)}h=0;for(f=l.length;h<f;h++){k=l[h];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=t[n],n!==void 0&&(k[e]=n)}return b.concat(l)},
|
|
|
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),l,h,f,k,n,p,v,u,x,w,y=[];for(n=0;n<c.length;n++){p=c[n];Array.prototype.push.apply(e,p);h=Number.POSITIVE_INFINITY;for(l=0;l<p.length;l++){x=p[l];w=[];for(u=0;u<b.length;u++)v=b[u],v=x.distanceToSquared(v),w.push(v),v<h&&(h=v,f=l,k=u)}l=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:p.length-1;var t=[p[f],b[k],b[l]];u=THREE.FontUtils.Triangulate.area(t);var B=[p[f],p[h],b[k]];x=THREE.FontUtils.Triangulate.area(B);w=k;v=f;k+=1;f+=-1;k<
|
|
|
|
+0&&(k+=b.length);k%=b.length;f<0&&(f+=p.length);f%=p.length;l=k-1>=0?k-1:b.length-1;h=f-1>=0?f-1:p.length-1;t=[p[f],b[k],b[l]];t=THREE.FontUtils.Triangulate.area(t);B=[p[f],p[h],b[k]];B=THREE.FontUtils.Triangulate.area(B);u+x>t+B&&(k=w,f=v,k<0&&(k+=b.length),k%=b.length,f<0&&(f+=p.length),f%=p.length,l=k-1>=0?k-1:b.length-1,h=f-1>=0?f-1:p.length-1);u=b.slice(0,k);x=b.slice(k);w=p.slice(f);v=p.slice(0,f);h=[p[f],p[h],b[k]];y.push([p[f],b[k],b[l]]);y.push(h);b=u.concat(w).concat(v).concat(x)}return{shape:b,
|
|
|
|
+isolatedPts:y,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,l=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,f,k,n,p={};h=0;for(f=e.length;h<f;h++)n=e[h].x+":"+e[h].y,p[n]!==void 0&&console.log("Duplicate point",n),p[n]=h;h=0;for(f=b.length;h<f;h++){k=b[h];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=p[n],n!==void 0&&(k[e]=n)}h=0;for(f=l.length;h<f;h++){k=l[h];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=p[n],n!==void 0&&(k[e]=n)}return b.concat(l)},
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,l){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,l){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
|
|
this.b3p3(a,l)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",l=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=l;THREE.FontUtils.style=h};
|
|
this.b3p3(a,l)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",l=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=l;THREE.FontUtils.style=h};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
|
|
THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
|
|
THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
|
|
-0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++){var t=a.hierarchy[b].keys[e].morphTargets[n];k[t]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var v=
|
|
|
|
-{};for(t in k){for(n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++)if(a.hierarchy[b].keys[e].morphTargets[n]===t){v[t]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(v[t]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=v}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
|
|
|
|
|
|
+0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++){var p=a.hierarchy[b].keys[e].morphTargets[n];k[p]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var v=
|
|
|
|
+{};for(p in k){for(n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++)if(a.hierarchy[b].keys[e].morphTargets[n]===p){v[p]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(v[p]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=v}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
|
|
2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
|
|
2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
|
|
THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,l;for(b=0;b<e;b++){l=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)l.useQuaternion=!0;l.matrixAutoUpdate=!0;if(l.animationCache===void 0)l.animationCache={},l.animationCache.prevKey={pos:0,rot:0,scl:0},l.animationCache.nextKey={pos:0,rot:0,scl:0},l.animationCache.originalMatrix=l instanceof
|
|
THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,l;for(b=0;b<e;b++){l=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)l.useQuaternion=!0;l.matrixAutoUpdate=!0;if(l.animationCache===void 0)l.animationCache={},l.animationCache.prevKey={pos:0,rot:0,scl:0},l.animationCache.nextKey={pos:0,rot:0,scl:0},l.animationCache.originalMatrix=l instanceof
|
|
THREE.Bone?l.skinMatrix:l.matrix;var h=l.animationCache.prevKey;l=l.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];l.pos=this.getNextKeyWith("pos",b,1);l.rot=this.getNextKeyWith("rot",b,1);l.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
THREE.Bone?l.skinMatrix:l.matrix;var h=l.animationCache.prevKey;l=l.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];l.pos=this.getNextKeyWith("pos",b,1);l.rot=this.getNextKeyWith("rot",b,1);l.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,l,h,f,k,n,t,v=this.data.JIT.hierarchy,p,x;this.currentTime+=a*this.timeScale;x=this.currentTime;p=this.currentTime%=this.data.length;t=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,z=this.hierarchy.length;w<z;w++)if(a=this.hierarchy[w],n=a.animationCache,this.JITCompile&&v[w][t]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=v[w][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
|
-!1):(a.matrix=v[w][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var u=0;u<3;u++){b=c[u];f=n.prevKey[b];k=n.nextKey[b];if(k.time<=x){if(p<x)if(this.loop){f=this.data.hierarchy[w].keys[0];for(k=this.getNextKeyWith(b,w,1);k.time<p;)f=k,k=this.getNextKeyWith(b,w,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,w,k.index+1);while(k.time<
|
|
|
|
-p)}n.prevKey[b]=f;n.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(p-f.time)/(k.time-f.time);l=f[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+w),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=l[0]+(h[0]-l[0])*e,b.y=l[1]+(h[1]-l[1])*e,b.z=l[2]+(h[2]-l[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,l,h,f,k,n,p,v=this.data.JIT.hierarchy,u,x;this.currentTime+=a*this.timeScale;x=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,y=this.hierarchy.length;w<y;w++)if(a=this.hierarchy[w],n=a.animationCache,this.JITCompile&&v[w][p]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=v[w][p],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
|
+!1):(a.matrix=v[w][p],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var t=0;t<3;t++){b=c[t];f=n.prevKey[b];k=n.nextKey[b];if(k.time<=x){if(u<x)if(this.loop){f=this.data.hierarchy[w].keys[0];for(k=this.getNextKeyWith(b,w,1);k.time<u;)f=k,k=this.getNextKeyWith(b,w,k.index+1)}else{this.stop();return}else{do f=k,k=this.getNextKeyWith(b,w,k.index+1);while(k.time<
|
|
|
|
+u)}n.prevKey[b]=f;n.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(u-f.time)/(k.time-f.time);l=f[b];h=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+w),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=l[0]+(h[0]-l[0])*e,b.y=l[1]+(h[1]-l[1])*e,b.z=l[2]+(h[2]-l[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
this.getPrevKeyWith("pos",w,f.index-1).pos,this.points[1]=l,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",w,k.index+1).pos,e=e*0.33+0.33,l=this.interpolateCatmullRom(this.points,e),b.x=l[0],b.y=l[1],b.z=l[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
|
|
this.getPrevKeyWith("pos",w,f.index-1).pos,this.points[1]=l,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",w,k.index+1).pos,e=e*0.33+0.33,l=this.interpolateCatmullRom(this.points,e),b.x=l[0],b.y=l[1],b.z=l[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
|
|
-"rot")THREE.Quaternion.slerp(l,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=l[0]+(h[0]-l[0])*e,b.y=l[1]+(h[1]-l[1])*e,b.z=l[2]+(h[2]-l[2])*e}}if(this.JITCompile&&v[0][t]===void 0){this.hierarchy[0].update(null,!0);for(w=0;w<this.hierarchy.length;w++)v[w][t]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
|
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],l,h,f,k,n,t;l=(a.length-1)*c;h=Math.floor(l);l-=h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];n=a[b[2]];t=a[b[3]];b=l*l;f=l*b;e[0]=this.interpolate(h[0],k[0],n[0],t[0],l,b,f);e[1]=this.interpolate(h[1],k[1],n[1],t[1],l,b,f);e[2]=this.interpolate(h[2],k[2],n[2],t[2],l,b,f);return e};
|
|
|
|
|
|
+"rot")THREE.Quaternion.slerp(l,h,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=l[0]+(h[0]-l[0])*e,b.y=l[1]+(h[1]-l[1])*e,b.z=l[2]+(h[2]-l[2])*e}}if(this.JITCompile&&v[0][p]===void 0){this.hierarchy[0].update(null,!0);for(w=0;w<this.hierarchy.length;w++)v[w][p]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
|
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],l,h,f,k,n,p;l=(a.length-1)*c;h=Math.floor(l);l-=h;b[0]=h===0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];n=a[b[2]];p=a[b[3]];b=l*l;f=l*b;e[0]=this.interpolate(h[0],k[0],n[0],p[0],l,b,f);e[1]=this.interpolate(h[1],k[1],n[1],p[1],l,b,f);e[2]=this.interpolate(h[2],k[2],n[2],p[2],l,b,f);return e};
|
|
THREE.Animation.prototype.interpolate=function(a,c,b,e,l,h,f){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*f+(-3*(c-b)-2*a-e)*h+a*l+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
|
|
THREE.Animation.prototype.interpolate=function(a,c,b,e,l,h,f){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*f+(-3*(c-b)-2*a-e)*h+a*l+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
|
|
THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
@@ -462,7 +462,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
|
|
(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
|
|
this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
|
|
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function l(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,l=b.getControlPointsArray(),k=b.getLength(),B=l.length,y=0;h=B-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:l[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:l[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<B-1;h++)y=e*k.chunks[h]/k.total,b.keys[h]={time:y,pos:l[h]};f.hierarchy[0]=
|
|
|
|
|
|
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function l(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,l=b.getControlPointsArray(),k=b.getLength(),B=l.length,A=0;h=B-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:l[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:l[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<B-1;h++)A=e*k.chunks[h]/k.total,b.keys[h]={time:A,pos:l[h]};f.hierarchy[0]=
|
|
b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
|
|
this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
|
|
@@ -480,76 +480,76 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,l=new THREE.Vector3,h=new THREE.Matrix4,f=!1,k=1,n=0,t=0,v=0,p=0,x=0,w=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
|
-this.rotateHorizontally(c*p);this.rotateVertically(c*x)}c=a*this.movementSpeed;this.object.translateZ(-c*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*t);this.object.translateY(c*v);f&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();l.copy(this.forward);e.set(0,1,0);b.cross(e,
|
|
|
|
|
|
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,l=new THREE.Vector3,h=new THREE.Matrix4,f=!1,k=1,n=0,p=0,v=0,u=0,x=0,w=window.innerWidth/2,y=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
|
+this.rotateHorizontally(c*u);this.rotateVertically(c*x)}c=a*this.movementSpeed;this.object.translateZ(-c*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*p);this.object.translateY(c*v);f&&(this.roll+=this.rollSpeed*a*k);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();l.copy(this.forward);e.set(0,1,0);b.cross(e,
|
|
l).normalize();e.cross(l,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=l.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=l.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=l.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
l).normalize();e.cross(l,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=l.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=l.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=l.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-w)/window.innerWidth;x=(a.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
|
-function(a){switch(a.keyCode){case 38:case 87:n=1;break;case 37:case 65:t=-1;break;case 40:case 83:n=-1;break;case 39:case 68:t=1;break;case 81:f=!0;k=1;break;case 69:f=!0;k=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:n=0;break;case 37:case 65:t=0;break;case 40:case 83:n=0;break;case 39:case 68:t=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:v=0;break;case 70:v=0}},!1)};
|
|
|
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){u=(a.clientX-w)/window.innerWidth;x=(a.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
|
+function(a){switch(a.keyCode){case 38:case 87:n=1;break;case 37:case 65:p=-1;break;case 40:case 83:n=-1;break;case 39:case 68:p=1;break;case 81:f=!0;k=1;break;case 69:f=!0;k=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:n=0;break;case 37:case 65:p=0;break;case 40:case 83:n=0;break;case 39:case 68:p=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:v=0;break;case 70:v=0}},!1)};
|
|
THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
|
|
THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
|
|
-new THREE.Vector3(0,0,0);var l=!1,h=e.NONE,f=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector2,v=new THREE.Vector2,p=new THREE.Vector2,x=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
|
|
|
|
|
|
+new THREE.Vector3(0,0,0);var l=!1,h=e.NONE,f=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector2,v=new THREE.Vector2,u=new THREE.Vector2,x=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
|
|
b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),h=e.length();h>1?e.normalize():e.z=Math.sqrt(1-h*h);f.copy(b.object.position).subSelf(b.target);h=b.object.up.clone().setLength(e.y);h.addSelf(b.object.up.clone().crossSelf(f).setLength(e.x));h.addSelf(f.setLength(e.z));return h};this.rotateCamera=function(){var a=Math.acos(k.dot(n)/k.length()/n.length());if(a){var c=(new THREE.Vector3).cross(k,n).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(f);
|
|
b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),h=e.length();h>1?e.normalize():e.z=Math.sqrt(1-h*h);f.copy(b.object.position).subSelf(b.target);h=b.object.up.clone().setLength(e.y);h.addSelf(b.object.up.clone().crossSelf(f).setLength(e.x));h.addSelf(f.setLength(e.z));return h};this.rotateCamera=function(){var a=Math.acos(k.dot(n)/k.length()/n.length());if(a){var c=(new THREE.Vector3).cross(k,n).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(f);
|
|
-e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?k=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(v.y-t.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?t=v:t.y+=(v.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=x.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
|
|
|
|
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=x:p.addSelf(a.sub(x,p).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
|
|
|
|
-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&&(l&&(k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),t=v=b.getMouseOnScreen(a.clientX,a.clientY),p=x=b.getMouseOnScreen(a.clientX,a.clientY),l=!1),h!==e.NONE&&(h===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?v=b.getMouseOnScreen(a.clientX,
|
|
|
|
-a.clientY):h===e.PAN&&!b.noPan&&(x=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),h===e.NONE))h=a.button,h===e.ROTATE?k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?t=v=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=x=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
|
|
|
|
+e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?k=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(v.y-p.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?p=v:p.y+=(v.y-p.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=x.clone().subSelf(u);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
|
|
|
|
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?u=x:u.addSelf(a.sub(x,u).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
|
|
|
|
+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&&(l&&(k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),p=v=b.getMouseOnScreen(a.clientX,a.clientY),u=x=b.getMouseOnScreen(a.clientX,a.clientY),l=!1),h!==e.NONE&&(h===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?v=b.getMouseOnScreen(a.clientX,
|
|
|
|
+a.clientY):h===e.PAN&&!b.noPan&&(x=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),h===e.NONE))h=a.button,h===e.ROTATE?k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):h===e.ZOOM&&!b.noZoom?p=v=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(u=x=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
h=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&h===e.NONE){if(a.keyCode===b.keys[e.ROTATE])h=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)h=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)h=e.PAN;h!==e.NONE&&(l=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&h!==e.NONE)h=e.NONE},!1)};
|
|
h=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&h===e.NONE){if(a.keyCode===b.keys[e.ROTATE])h=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)h=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)h=e.PAN;h!==e.NONE&&(l=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&h!==e.NONE)h=e.NONE},!1)};
|
|
-THREE.CubeGeometry=function(a,c,b,e,l,h,f,k){function n(a,b,c,f,k,n,p,u){var v,w,x=e||1,y=l||1,z=k/2,o=n/2,B=t.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",y=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",x=h||1;var C=x+1,E=y+1;k/=x;var W=n/y;for(w=0;w<E;w++)for(n=0;n<C;n++){var $=new THREE.Vector3;$[a]=(n*k-z)*c;$[b]=(w*W-o)*f;$[v]=p;t.vertices.push(new THREE.Vertex($))}for(w=0;w<y;w++)for(n=0;n<x;n++)t.faces.push(new THREE.Face4(n+
|
|
|
|
-C*w+B,n+C*(w+1)+B,n+1+C*(w+1)+B,n+1+C*w+B,null,null,u)),t.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var t=this,v=a/2,p=c/2,x=b/2,w,z,u,B,y,E;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(w=0;w<6;w++)this.materials.push(f)}w=0;B=1;z=2;y=3;u=4;E=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var C in k)this.sides[C]!=
|
|
|
|
-void 0&&(this.sides[C]=k[C]);this.sides.px&&n("z","y",-1,-1,b,c,v,w);this.sides.nx&&n("z","y",1,-1,b,c,-v,B);this.sides.py&&n("x","z",1,1,a,b,p,z);this.sides.ny&&n("x","z",1,-1,a,b,-p,y);this.sides.pz&&n("x","y",1,-1,a,c,x,u);this.sides.nz&&n("x","y",-1,-1,a,c,-x,E);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
|
-THREE.CylinderGeometry=function(a,c,b,e,l,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,l=l||1,k,n,t=[],v=[];for(n=0;n<=l;n++){var p=[],x=[],w=n/l,z=w*(c-a)+a;for(k=0;k<=e;k++){var u=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(u*Math.PI*2),-w*b+f,z*Math.cos(u*Math.PI*2))));p.push(this.vertices.length-1);x.push(new THREE.UV(u,w))}t.push(p);v.push(x)}for(n=0;n<l;n++)for(k=0;k<e;k++){var b=t[n][k],p=t[n+1][k],x=t[n+1][k+1],w=t[n][k+1],z=
|
|
|
|
-this.vertices[b].position.clone().setY(0).normalize(),u=this.vertices[p].position.clone().setY(0).normalize(),B=this.vertices[x].position.clone().setY(0).normalize(),y=this.vertices[w].position.clone().setY(0).normalize(),E=v[n][k].clone(),C=v[n+1][k].clone(),H=v[n+1][k+1].clone(),L=v[n][k+1].clone();this.faces.push(new THREE.Face4(b,p,x,w,[z,u,B,y]));this.faceVertexUvs[0].push([E,C,H,L])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=t[0][k],p=t[0][k+
|
|
|
|
-1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),B=new THREE.Vector3(0,1,0),E=v[0][k].clone(),C=v[0][k+1].clone(),H=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(b,p,x,[z,u,B])),this.faceVertexUvs[0].push([E,C,H])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)b=t[n][k+1],p=t[n][k],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),B=new THREE.Vector3(0,-1,0),E=v[n][k+1].clone(),C=v[n][k].clone(),
|
|
|
|
-H=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(b,p,x,[z,u,B])),this.faceVertexUvs[0].push([E,C,H])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
|
|
|
+THREE.CubeGeometry=function(a,c,b,e,l,h,f,k){function n(a,b,c,f,k,n,u,w){var t,v,x=e||1,y=l||1,B=k/2,o=n/2,A=p.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")t="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")t="y",y=h||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")t="x",x=h||1;var C=x+1,D=y+1;k/=x;var W=n/y;for(v=0;v<D;v++)for(n=0;n<C;n++){var Z=new THREE.Vector3;Z[a]=(n*k-B)*c;Z[b]=(v*W-o)*f;Z[t]=u;p.vertices.push(new THREE.Vertex(Z))}for(v=0;v<y;v++)for(n=0;n<x;n++)p.faces.push(new THREE.Face4(n+
|
|
|
|
+C*v+A,n+C*(v+1)+A,n+1+C*(v+1)+A,n+1+C*v+A,null,null,w)),p.faceVertexUvs[0].push([new THREE.UV(n/x,v/y),new THREE.UV(n/x,(v+1)/y),new THREE.UV((n+1)/x,(v+1)/y),new THREE.UV((n+1)/x,v/y)])}THREE.Geometry.call(this);var p=this,v=a/2,u=c/2,x=b/2,w,y,t,B,A,D;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(w=0;w<6;w++)this.materials.push(f)}w=0;B=1;y=2;A=3;t=4;D=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var C in k)this.sides[C]!=
|
|
|
|
+void 0&&(this.sides[C]=k[C]);this.sides.px&&n("z","y",-1,-1,b,c,v,w);this.sides.nx&&n("z","y",1,-1,b,c,-v,B);this.sides.py&&n("x","z",1,1,a,b,u,y);this.sides.ny&&n("x","z",1,-1,a,b,-u,A);this.sides.pz&&n("x","y",1,-1,a,c,x,t);this.sides.nz&&n("x","y",-1,-1,a,c,-x,D);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
|
+THREE.CylinderGeometry=function(a,c,b,e,l,h){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,e=e||8,l=l||1,k,n,p=[],v=[];for(n=0;n<=l;n++){var u=[],x=[],w=n/l,y=w*(c-a)+a;for(k=0;k<=e;k++){var t=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(t*Math.PI*2),-w*b+f,y*Math.cos(t*Math.PI*2))));u.push(this.vertices.length-1);x.push(new THREE.UV(t,w))}p.push(u);v.push(x)}for(n=0;n<l;n++)for(k=0;k<e;k++){var b=p[n][k],u=p[n+1][k],x=p[n+1][k+1],w=p[n][k+1],y=
|
|
|
|
+this.vertices[b].position.clone().setY(0).normalize(),t=this.vertices[u].position.clone().setY(0).normalize(),B=this.vertices[x].position.clone().setY(0).normalize(),A=this.vertices[w].position.clone().setY(0).normalize(),D=v[n][k].clone(),C=v[n+1][k].clone(),H=v[n+1][k+1].clone(),O=v[n][k+1].clone();this.faces.push(new THREE.Face4(b,u,x,w,[y,t,B,A]));this.faceVertexUvs[0].push([D,C,H,O])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)b=p[0][k],u=p[0][k+
|
|
|
|
+1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),B=new THREE.Vector3(0,1,0),D=v[0][k].clone(),C=v[0][k+1].clone(),H=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(b,u,x,[y,t,B])),this.faceVertexUvs[0].push([D,C,H])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k<e;k++)b=p[n][k+1],u=p[n][k],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,-1,0),B=new THREE.Vector3(0,-1,0),D=v[n][k+1].clone(),C=v[n][k].clone(),
|
|
|
|
+H=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(b,u,x,[y,t,B])),this.faceVertexUvs[0].push([D,C,H])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,l;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)l=a[b],this.addShape(l,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,l;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)l=a[b],this.addShape(l,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,k=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);k.set(f.y,-f.x);l.copy(a).addSelf(h);n.copy(a).addSelf(k);if(l.equals(n))return k.clone();
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,k=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);k.set(f.y,-f.x);l.copy(a).addSelf(h);n.copy(a).addSelf(k);if(l.equals(n))return k.clone();
|
|
-l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0&&(console.log("Either infinite or no solutions!"),k===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));k/=h;if(k<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function l(a){for(K=a.length;--K>=0;){la=K;ja=K-1;ja<0&&(ja=a.length-
|
|
|
|
-1);for(var b=0,c=w+v*2,b=0;b<c;b++){var e=o*b,f=o*(b+1),h=sa+la+e,l=sa+la+f,p=h,e=sa+ja+e,f=sa+ja+f,t=l;p+=N;e+=N;f+=N;t+=N;J.faces.push(new THREE.Face4(p,e,f,t,null,null,H));H&&(p=b/c,e=(b+1)/c,f=k+n*2,h=(J.vertices[h].position.z+n)/f,l=(J.vertices[l].position.z+n)/f,J.faceVertexUvs[0].push([new THREE.UV(h,p),new THREE.UV(l,p),new THREE.UV(l,e),new THREE.UV(h,e)]))}}}function h(a,b,c){J.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=N;b+=N;c+=N;J.faces.push(new THREE.Face3(a,
|
|
|
|
-b,c,null,null,C));if(C){var e=L.maxY,f=L.maxX,h=J.vertices[b].position.x,b=J.vertices[b].position.y,k=J.vertices[c].position.x,c=J.vertices[c].position.y;J.faceVertexUvs[0].push([new THREE.UV(J.vertices[a].position.x/f,J.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:n-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
|
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,z=c.bendPath,u=c.extrudePath,B,y=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,C=c.material,H=c.extrudeMaterial,L=this.shapebb;if(u)B=u.getPoints(x),w=B.length,y=!0,p=!1;p||(t=n=v=0);var R,D,O,J=this,N=this.vertices.length;z&&a.addWrapPath(z);x=E?a.extractAllSpacedPoints(x):a.extractAllPoints(x);z=x.shape;x=x.holes;if(u=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();D=0;for(O=x.length;D<O;D++)R=x[D],THREE.Shape.Utils.isClockWise(R)&&
|
|
|
|
-(x[D]=R.reverse());u=!1}u=THREE.Shape.Utils.triangulateShape(z,x);E=z;D=0;for(O=x.length;D<O;D++)R=x[D],z=z.concat(R);var K,M,Y,oa,Z,U,o=z.length,P=u.length,ra=[];K=0;M=E.length;la=M-1;for(ja=K+1;K<M;K++,la++,ja++)la===M&&(la=0),ja===M&&(ja=0),ra[K]=e(E[K],E[la],E[ja]);var G=[],W,$=ra.concat();D=0;for(O=x.length;D<O;D++){R=x[D];W=[];K=0;M=R.length;la=M-1;for(ja=K+1;K<M;K++,la++,ja++)la===M&&(la=0),ja===M&&(ja=0),W[K]=e(R[K],R[la],R[ja]);G.push(W);$=$.concat(W)}for(Y=0;Y<v;Y++){oa=Y/v;Z=n*(1-oa);oa=
|
|
|
|
-t*Math.sin(oa*Math.PI/2);K=0;for(M=E.length;K<M;K++)U=b(E[K],ra[K],oa),h(U.x,U.y,-Z);D=0;for(O=x.length;D<O;D++){R=x[D];W=G[D];K=0;for(M=R.length;K<M;K++)U=b(R[K],W[K],oa),h(U.x,U.y,-Z)}}oa=t;for(K=0;K<o;K++)U=p?b(z[K],$[K],oa):z[K],y?h(U.x,U.y+B[0].y,B[0].x):h(U.x,U.y,0);for(Y=1;Y<=w;Y++)for(K=0;K<o;K++)U=p?b(z[K],$[K],oa):z[K],y?h(U.x,U.y+B[Y-1].y,B[Y-1].x):h(U.x,U.y,k/w*Y);for(Y=v-1;Y>=0;Y--){oa=Y/v;Z=n*(1-oa);oa=t*Math.sin(oa*Math.PI/2);K=0;for(M=E.length;K<M;K++)U=b(E[K],ra[K],oa),h(U.x,U.y,
|
|
|
|
-k+Z);D=0;for(O=x.length;D<O;D++){R=x[D];W=G[D];K=0;for(M=R.length;K<M;K++)U=b(R[K],W[K],oa),y?h(U.x,U.y+B[w-1].y,B[w-1].x+Z):h(U.x,U.y,k+Z)}}if(p){p=o*0;for(K=0;K<P;K++)t=u[K],f(t[2]+p,t[1]+p,t[0]+p);p=o*(w+v*2);for(K=0;K<P;K++)t=u[K],f(t[0]+p,t[1]+p,t[2]+p)}else{for(K=0;K<P;K++)t=u[K],f(t[2],t[1],t[0]);for(K=0;K<P;K++)t=u[K],f(t[0]+o*w,t[1]+o*w,t[2]+o*w)}var la,ja,sa=0;l(E);sa+=E.length;D=0;for(O=x.length;D<O;D++)R=x[D],l(R),sa+=R.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
|
|
|
+l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0&&(console.log("Either infinite or no solutions!"),k===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));k/=h;if(k<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function l(a){for(L=a.length;--L>=0;){na=L;ma=L-1;ma<0&&(ma=a.length-
|
|
|
|
+1);for(var b=0,c=w+v*2,b=0;b<c;b++){var e=o*b,f=o*(b+1),h=sa+na+e,l=sa+na+f,p=h,e=sa+ma+e,f=sa+ma+f,u=l;p+=N;e+=N;f+=N;u+=N;K.faces.push(new THREE.Face4(p,e,f,u,null,null,H));H&&(p=b/c,e=(b+1)/c,f=k+n*2,h=(K.vertices[h].position.z+n)/f,l=(K.vertices[l].position.z+n)/f,K.faceVertexUvs[0].push([new THREE.UV(h,p),new THREE.UV(l,p),new THREE.UV(l,e),new THREE.UV(h,e)]))}}}function h(a,b,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=N;b+=N;c+=N;K.faces.push(new THREE.Face3(a,
|
|
|
|
+b,c,null,null,C));if(C){var e=O.maxY,f=O.maxX,h=K.vertices[b].position.x,b=K.vertices[b].position.y,k=K.vertices[c].position.x,c=K.vertices[c].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[a].position.x/f,K.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:n-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
|
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,y=c.bendPath,t=c.extrudePath,B,A=!1,D=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,C=c.material,H=c.extrudeMaterial,O=this.shapebb;if(t)B=t.getPoints(x),w=B.length,A=!0,u=!1;u||(p=n=v=0);var T,E,S,K=this,N=this.vertices.length;y&&a.addWrapPath(y);x=D?a.extractAllSpacedPoints(x):a.extractAllPoints(x);y=x.shape;x=x.holes;if(t=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();E=0;for(S=x.length;E<S;E++)T=x[E],THREE.Shape.Utils.isClockWise(T)&&
|
|
|
|
+(x[E]=T.reverse());t=!1}t=THREE.Shape.Utils.triangulateShape(y,x);D=y;E=0;for(S=x.length;E<S;E++)T=x[E],y=y.concat(T);var L,J,X,oa,Y,V,o=y.length,Q=t.length,qa=[];L=0;J=D.length;na=J-1;for(ma=L+1;L<J;L++,na++,ma++)na===J&&(na=0),ma===J&&(ma=0),qa[L]=e(D[L],D[na],D[ma]);var G=[],W,Z=qa.concat();E=0;for(S=x.length;E<S;E++){T=x[E];W=[];L=0;J=T.length;na=J-1;for(ma=L+1;L<J;L++,na++,ma++)na===J&&(na=0),ma===J&&(ma=0),W[L]=e(T[L],T[na],T[ma]);G.push(W);Z=Z.concat(W)}for(X=0;X<v;X++){oa=X/v;Y=n*(1-oa);oa=
|
|
|
|
+p*Math.sin(oa*Math.PI/2);L=0;for(J=D.length;L<J;L++)V=b(D[L],qa[L],oa),h(V.x,V.y,-Y);E=0;for(S=x.length;E<S;E++){T=x[E];W=G[E];L=0;for(J=T.length;L<J;L++)V=b(T[L],W[L],oa),h(V.x,V.y,-Y)}}oa=p;for(L=0;L<o;L++)V=u?b(y[L],Z[L],oa):y[L],A?h(V.x,V.y+B[0].y,B[0].x):h(V.x,V.y,0);for(X=1;X<=w;X++)for(L=0;L<o;L++)V=u?b(y[L],Z[L],oa):y[L],A?h(V.x,V.y+B[X-1].y,B[X-1].x):h(V.x,V.y,k/w*X);for(X=v-1;X>=0;X--){oa=X/v;Y=n*(1-oa);oa=p*Math.sin(oa*Math.PI/2);L=0;for(J=D.length;L<J;L++)V=b(D[L],qa[L],oa),h(V.x,V.y,
|
|
|
|
+k+Y);E=0;for(S=x.length;E<S;E++){T=x[E];W=G[E];L=0;for(J=T.length;L<J;L++)V=b(T[L],W[L],oa),A?h(V.x,V.y+B[w-1].y,B[w-1].x+Y):h(V.x,V.y,k+Y)}}if(u){u=o*0;for(L=0;L<Q;L++)p=t[L],f(p[2]+u,p[1]+u,p[0]+u);u=o*(w+v*2);for(L=0;L<Q;L++)p=t[L],f(p[0]+u,p[1]+u,p[2]+u)}else{for(L=0;L<Q;L++)p=t[L],f(p[2],p[1],p[0]);for(L=0;L<Q;L++)p=t[L],f(p[0]+o*w,p[1]+o*w,p[2]+o*w)}var na,ma,sa=0;l(D);sa+=D.length;E=0;for(S=x.length;E<S;E++)T=x[E],l(T),sa+=T.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return l.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=l.vertices[a].position,f=l.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var l=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return l.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=l.vertices[a].position,f=l.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var l=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var n=e(h.faces[k].a,h.faces[k].b),t=e(h.faces[k].b,h.faces[k].c),v=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,n,v,a);b(h.faces[k].b,t,
|
|
|
|
-n,a);b(h.faces[k].c,v,t,a);b(n,t,v,a)}h.faces=a.faces}l.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
|
|
|
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var n=e(h.faces[k].a,h.faces[k].b),p=e(h.faces[k].b,h.faces[k].c),v=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,n,v,a);b(h.faces[k].b,p,
|
|
|
|
+n,a);b(h.faces[k].c,v,p,a);b(n,p,v,a)}h.faces=a.faces}l.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],l=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(k=0;k<b.length;k++)n<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),l[k]=this.vertices.length-1):l=h;n==0&&(h=e);
|
|
THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],l=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(k=0;k<b.length;k++)n<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),l[k]=this.vertices.length-1):l=h;n==0&&(h=e);
|
|
for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(l[k],l[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,k/a.length),new THREE.UV(1-n/this.angle,(k+1)/a.length),new THREE.UV(1-(n-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(n-c)/this.angle,k/a.length)]);e=l;l=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(l[k],l[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,k/a.length),new THREE.UV(1-n/this.angle,(k+1)/a.length),new THREE.UV(1-(n-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(n-c)/this.angle,k/a.length)]);e=l;l=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
|
|
THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
|
|
f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,l(a,b),l(a,c),k),e(l(a,b),b,l(b,c),k),e(l(a,c),l(b,c),c,k),e(l(a,b),l(b,c),l(a,c),k))}function l(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===
|
|
f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,l(a,b),l(a,c),k),e(l(a,b),b,l(b,c),k),e(l(a,c),l(b,c),c,k),e(l(a,b),l(b,c),l(a,c),k))}function l(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===
|
|
1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var k=[],n=this.vertices;e(n[0],n[2],n[4],c);e(n[0],n[4],n[3],c);e(n[0],n[3],n[5],c);e(n[0],n[5],n[2],c);e(n[1],n[2],n[5],c);e(n[1],n[5],n[3],c);e(n[1],n[3],n[4],c);e(n[1],n[4],n[2],c);this.boundingSphere=
|
|
1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var k=[],n=this.vertices;e(n[0],n[2],n[4],c);e(n[0],n[4],n[3],c);e(n[0],n[3],n[5],c);e(n[0],n[5],n[2],c);e(n[1],n[2],n[5],c);e(n[1],n[5],n[3],c);e(n[1],n[3],n[4],c);e(n[1],n[4],n[2],c);this.boundingSphere=
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
-THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var l,h=a/2,f=c/2,b=b||1,e=e||1,k=b+1,n=e+1;a/=b;var t=c/e;for(l=0;l<n;l++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(l*t-f),0)));for(l=0;l<e;l++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*l,c+k*(l+1),c+1+k*(l+1),c+1+k*l)),this.faceVertexUvs[0].push([new THREE.UV(c/b,l/e),new THREE.UV(c/b,(l+1)/e),new THREE.UV((c+1)/b,(l+1)/e),new THREE.UV((c+1)/b,l/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
|
|
+THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var l,h=a/2,f=c/2,b=b||1,e=e||1,k=b+1,n=e+1;a/=b;var p=c/e;for(l=0;l<n;l++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(l*p-f),0)));for(l=0;l<e;l++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*l,c+k*(l+1),c+1+k*(l+1),c+1+k*l)),this.faceVertexUvs[0].push([new THREE.UV(c/b,l/e),new THREE.UV(c/b,(l+1)/e),new THREE.UV((c+1)/b,(l+1)/e),new THREE.UV((c+1)/b,l/e)]);this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,l=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var k=a*Math.cos(e*l),n=a*Math.sin(e*l),t=[],v=0;for(e=0;e<h;e++){var p=2*e/h,x=n*Math.sin(p*l),p=n*Math.cos(p*l);(b==0||b==f)&&e>0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,x)))-1);t.push(v)}c.push(t)}for(var w,z,u,l=c.length,b=0;b<l;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){t=e==h-1;f=c[b][t?0:e+1];k=c[b][t?h-1:e];n=c[b-1][t?
|
|
|
|
-h-1:e];t=c[b-1][t?0:e+1];x=b/(l-1);w=(b-1)/(l-1);z=(e+1)/h;var p=e/h,v=new THREE.UV(1-z,x),x=new THREE.UV(1-p,x),p=new THREE.UV(1-p,w),B=new THREE.UV(1-z,w);b<c.length-1&&(w=this.vertices[f].position.clone(),z=this.vertices[k].position.clone(),u=this.vertices[n].position.clone(),w.normalize(),z.normalize(),u.normalize(),this.faces.push(new THREE.Face3(f,k,n,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([v,x,p]));b>1&&(w=
|
|
|
|
-this.vertices[f].position.clone(),z=this.vertices[n].position.clone(),u=this.vertices[t].position.clone(),w.normalize(),z.normalize(),u.normalize(),this.faces.push(new THREE.Face3(f,n,t,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([v,p,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
|
|
|
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,l=Math.PI,h=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){e=b/f;var k=a*Math.cos(e*l),n=a*Math.sin(e*l),p=[],v=0;for(e=0;e<h;e++){var u=2*e/h,x=n*Math.sin(u*l),u=n*Math.cos(u*l);(b==0||b==f)&&e>0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,k,x)))-1);p.push(v)}c.push(p)}for(var w,y,t,l=c.length,b=0;b<l;b++)if(h=c[b].length,b>0)for(e=0;e<h;e++){p=e==h-1;f=c[b][p?0:e+1];k=c[b][p?h-1:e];n=c[b-1][p?
|
|
|
|
+h-1:e];p=c[b-1][p?0:e+1];x=b/(l-1);w=(b-1)/(l-1);y=(e+1)/h;var u=e/h,v=new THREE.UV(1-y,x),x=new THREE.UV(1-u,x),u=new THREE.UV(1-u,w),B=new THREE.UV(1-y,w);b<c.length-1&&(w=this.vertices[f].position.clone(),y=this.vertices[k].position.clone(),t=this.vertices[n].position.clone(),w.normalize(),y.normalize(),t.normalize(),this.faces.push(new THREE.Face3(f,k,n,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(t.x,t.y,t.z)])),this.faceVertexUvs[0].push([v,x,u]));b>1&&(w=
|
|
|
|
+this.vertices[f].position.clone(),y=this.vertices[n].position.clone(),t=this.vertices[p].position.clone(),w.normalize(),y.normalize(),t.normalize(),this.faces.push(new THREE.Face3(f,n,p,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(t.x,t.y,t.z)])),this.faceVertexUvs[0].push([v,u,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
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 e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
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 e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
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]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},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=
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},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,e=0,l=String(a).split(""),h=l.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(l[a],c,b,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,l){var h=[],f,k,n,t,v,p,x,w,z,u,B=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));n=c.length;for(a=0;a<n;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;t=c[a++]*b;h.push(new THREE.Vector2(k,
|
|
|
|
-t));l.moveTo(k,t);break;case "l":k=c[a++]*b+e;t=c[a++]*b;h.push(new THREE.Vector2(k,t));l.lineTo(k,t);break;case "q":k=c[a++]*b+e;t=c[a++]*b;x=c[a++]*b+e;w=c[a++]*b;l.quadraticCurveTo(x,w,k,t);if(f=h[h.length-1]){v=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var y=f/divisions,E=THREE.Shape.Utils.b2(y,v,x,k),y=THREE.Shape.Utils.b2(y,p,w,t);h.push(new THREE.Vector2(E,y))}}break;case "b":if(k=c[a++]*b+e,t=c[a++]*b,x=c[a++]*b+e,w=c[a++]*-b,z=c[a++]*b+e,u=c[a++]*-b,l.bezierCurveTo(k,t,
|
|
|
|
-x,w,z,u),f=h[h.length-1]){v=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)y=f/divisions,E=THREE.Shape.Utils.b3(y,v,x,z,k),y=THREE.Shape.Utils.b3(y,p,w,u,t),h.push(new THREE.Vector2(E,y))}}}return{offset:B.ha*b,points:h,path:l}}}};
|
|
|
|
-(function(a){var c=function(a){for(var c=a.length,l=0,h=c-1,f=0;f<c;h=f++)l+=a[h].x*a[f].y-a[f].x*a[h].y;return l*0.5};a.Triangulate=function(a,e){var l=a.length;if(l<3)return null;var h=[],f=[],k=[],n,t,v;if(c(a)>0)for(t=0;t<l;t++)f[t]=t;else for(t=0;t<l;t++)f[t]=l-1-t;var p=2*l;for(t=l-1;l>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}n=t;l<=n&&(n=0);t=n+1;l<=t&&(t=0);v=t+1;l<=v&&(v=0);var x;a:{x=a;var w=n,z=t,u=v,B=l,y=f,E=void 0,C=void 0,H=void 0,
|
|
|
|
-L=void 0,R=void 0,D=void 0,O=void 0,J=void 0,N=void 0,C=x[y[w]].x,H=x[y[w]].y,L=x[y[z]].x,R=x[y[z]].y,D=x[y[u]].x,O=x[y[u]].y;if(1.0E-10>(L-C)*(O-H)-(R-H)*(D-C))x=!1;else{for(E=0;E<B;E++)if(!(E==w||E==z||E==u)){var J=x[y[E]].x,N=x[y[E]].y,K=void 0,M=void 0,Y=void 0,oa=void 0,Z=void 0,U=void 0,o=void 0,P=void 0,ra=void 0,G=void 0,W=void 0,$=void 0,K=Y=Z=void 0,K=D-L,M=O-R,Y=C-D,oa=H-O,Z=L-C,U=R-H,o=J-C,P=N-H,ra=J-L,G=N-R,W=J-D,$=N-O,K=K*G-M*ra,Z=Z*P-U*o,Y=Y*$-oa*W;if(K>=0&&Y>=0&&Z>=0){x=!1;break a}}x=
|
|
|
|
-!0}}if(x){h.push([a[f[n]],a[f[t]],a[f[v]]]);k.push([f[n],f[t],f[v]]);n=t;for(v=t+1;v<l;n++,v++)f[n]=f[v];l--;p=2*l}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
|
|
|
+this.getFace(),b=this.size/c.resolution,e=0,l=String(a).split(""),h=l.length,f=[],a=0;a<h;a++){var k=new THREE.Path,k=this.extractGlyphPoints(l[a],c,b,e,k);e+=k.offset;f.push(k.path)}return{paths:f,offset:e/2}},extractGlyphPoints:function(a,c,b,e,l){var h=[],f,k,n,p,v,u,x,w,y,t,B=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));n=c.length;for(a=0;a<n;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;p=c[a++]*b;h.push(new THREE.Vector2(k,
|
|
|
|
+p));l.moveTo(k,p);break;case "l":k=c[a++]*b+e;p=c[a++]*b;h.push(new THREE.Vector2(k,p));l.lineTo(k,p);break;case "q":k=c[a++]*b+e;p=c[a++]*b;x=c[a++]*b+e;w=c[a++]*b;l.quadraticCurveTo(x,w,k,p);if(f=h[h.length-1]){v=f.x;u=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var A=f/divisions,D=THREE.Shape.Utils.b2(A,v,x,k),A=THREE.Shape.Utils.b2(A,u,w,p);h.push(new THREE.Vector2(D,A))}}break;case "b":if(k=c[a++]*b+e,p=c[a++]*b,x=c[a++]*b+e,w=c[a++]*-b,y=c[a++]*b+e,t=c[a++]*-b,l.bezierCurveTo(k,p,
|
|
|
|
+x,w,y,t),f=h[h.length-1]){v=f.x;u=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)A=f/divisions,D=THREE.Shape.Utils.b3(A,v,x,y,k),A=THREE.Shape.Utils.b3(A,u,w,t,p),h.push(new THREE.Vector2(D,A))}}}return{offset:B.ha*b,points:h,path:l}}}};
|
|
|
|
+(function(a){var c=function(a){for(var c=a.length,l=0,h=c-1,f=0;f<c;h=f++)l+=a[h].x*a[f].y-a[f].x*a[h].y;return l*0.5};a.Triangulate=function(a,e){var l=a.length;if(l<3)return null;var h=[],f=[],k=[],n,p,v;if(c(a)>0)for(p=0;p<l;p++)f[p]=p;else for(p=0;p<l;p++)f[p]=l-1-p;var u=2*l;for(p=l-1;l>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return h}n=p;l<=n&&(n=0);p=n+1;l<=p&&(p=0);v=p+1;l<=v&&(v=0);var x;a:{x=a;var w=n,y=p,t=v,B=l,A=f,D=void 0,C=void 0,H=void 0,
|
|
|
|
+O=void 0,T=void 0,E=void 0,S=void 0,K=void 0,N=void 0,C=x[A[w]].x,H=x[A[w]].y,O=x[A[y]].x,T=x[A[y]].y,E=x[A[t]].x,S=x[A[t]].y;if(1.0E-10>(O-C)*(S-H)-(T-H)*(E-C))x=!1;else{for(D=0;D<B;D++)if(!(D==w||D==y||D==t)){var K=x[A[D]].x,N=x[A[D]].y,L=void 0,J=void 0,X=void 0,oa=void 0,Y=void 0,V=void 0,o=void 0,Q=void 0,qa=void 0,G=void 0,W=void 0,Z=void 0,L=X=Y=void 0,L=E-O,J=S-T,X=C-E,oa=H-S,Y=O-C,V=T-H,o=K-C,Q=N-H,qa=K-O,G=N-T,W=K-E,Z=N-S,L=L*G-J*qa,Y=Y*Q-V*o,X=X*Z-oa*W;if(L>=0&&X>=0&&Y>=0){x=!1;break a}}x=
|
|
|
|
+!0}}if(x){h.push([a[f[n]],a[f[p]],a[f[v]]]);k.push([f[n],f[p],f[v]]);n=p;for(v=p+1;v<l;n++,v++)f[n]=f[v];l--;u=2*l}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
THREE.TorusGeometry=function(a,c,b,e,l){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=l||Math.PI*2;l=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;l.x=this.radius*Math.cos(h);l.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
|
|
THREE.TorusGeometry=function(a,c,b,e,l){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=l||Math.PI*2;l=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;l.x=this.radius*Math.cos(h);l.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
|
|
this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(l).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var l=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,n=new THREE.Face4(l,h,f,k,[c[l],c[h],c[f],c[k]]);n.normal.addSelf(c[l]);n.normal.addSelf(c[h]);n.normal.addSelf(c[f]);n.normal.addSelf(c[k]);n.normal.normalize();this.faces.push(n);
|
|
this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(l).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var l=(this.segmentsT+1)*b+e-1,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,n=new THREE.Face4(l,h,f,k,[c[l],c[h],c[f],c[k]]);n.normal.addSelf(c[l]);n.normal.addSelf(c[h]);n.normal.addSelf(c[f]);n.normal.addSelf(c[k]);n.normal.normalize();this.faces.push(n);
|
|
this.faceVertexUvs[0].push([a[l].clone(),a[h].clone(),a[f].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
this.faceVertexUvs[0].push([a[l].clone(),a[h].clone(),a[f].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
THREE.TorusKnotGeometry=function(a,c,b,e,l,h,f){function k(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=l||2;this.q=h||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
|
|
THREE.TorusKnotGeometry=function(a,c,b,e,l,h,f){function k(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=l||2;this.q=h||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
|
|
this.segmentsT;++c){var n=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,l=k(n,f,this.q,this.p,this.radius,this.heightScale),n=k(n+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=n.x-l.x;b.y=n.y-l.y;b.z=n.z-l.z;e.x=n.x+l.x;e.y=n.y+l.y;e.z=n.z+l.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();n=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);l.x+=n*e.x+f*h.x;l.y+=n*e.y+f*h.y;l.z+=n*e.z+f*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(l.x,l.y,
|
|
this.segmentsT;++c){var n=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,l=k(n,f,this.q,this.p,this.radius,this.heightScale),n=k(n+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=n.x-l.x;b.y=n.y-l.y;b.z=n.z-l.z;e.x=n.x+l.x;e.y=n.y+l.y;e.z=n.z+l.z;h.cross(b,e);e.cross(h,b);h.normalize();e.normalize();n=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);l.x+=n*e.x+f*h.x;l.y+=n*e.y+f*h.y;l.z+=n*e.z+f*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(l.x,l.y,
|
|
-l.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,l=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),v=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(l,b,e,h));this.faceVertexUvs[0].push([f,n,t,v])}this.computeCentroids();
|
|
|
|
|
|
+l.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,l=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][h],h=this.grid[a][h],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),v=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(l,b,e,h));this.faceVertexUvs[0].push([f,n,p,v])}this.computeCentroids();
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,n){var p=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(f.useOldVertexColors){p.vertexColors=[];for(var t,u,w,v=0;v<4;v++){w=n[v];t=new THREE.Color;t.setRGB(0,0,0);for(var y=0;y<w.length;y++)u=k.vertexColors[w[y]-1],t.r+=u.r,t.g+=u.g,t.b+=u.b;t.r/=w.length;t.g/=w.length;t.b/=w.length;p.vertexColors[v]=t}}l.push(p);(!f.supportUVs||x.length!=0)&&h.push([x[a],x[b],x[c],x[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
|
-b)}var e=[],l=[],h=[],f=this,k=a.vertices,e=a.faces,n=k.concat(),t=[],v={},p={},x=[],w,z,u,B,y,E=a.faceVertexUvs[0];w=0;for(z=E.length;w<z;w++){u=0;for(B=E[w].length;u<B;u++)y=e[w]["abcd".charAt(u)],x[y]||(x[y]=E[w][u])}var C;w=0;for(z=e.length;w<z;w++)if(y=e[w],t.push(y.centroid),n.push(new THREE.Vertex(y.centroid)),f.supportUVs&&x.length!=0){C=new THREE.UV;if(y instanceof THREE.Face3)C.u=x[y.a].u+x[y.b].u+x[y.c].u,C.v=x[y.a].v+x[y.b].v+x[y.c].v,C.u/=3,C.v/=3;else if(y instanceof THREE.Face4)C.u=
|
|
|
|
-x[y.a].u+x[y.b].u+x[y.c].u+x[y.d].u,C.v=x[y.a].v+x[y.b].v+x[y.c].v+x[y.d].v,C.u/=4,C.v/=4;x.push(C)}z=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,k,l={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.a),c(l,k,e)):h instanceof THREE.Face4&&(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.d),c(l,k,e),k=b(h.d,h.a),c(l,k,e));return l}(a);var H=0,E=k.length,L,R,D={},O={},J=function(a,
|
|
|
|
-b){D[a]===void 0&&(D[a]=[]);D[a].push(b)},N=function(a,b){O[a]===void 0&&(O[a]={});O[a][b]=null};for(w in z){C=z[w];L=w.split("_");R=L[0];L=L[1];J(R,[R,L]);J(L,[R,L]);u=0;for(B=C.length;u<B;u++)y=C[u],N(R,y,w),N(L,y,w);C.length<2&&(p[w]=!0)}for(w in z)if(C=z[w],y=C[0],C=C[1],L=w.split("_"),R=L[0],L=L[1],B=new THREE.Vector3,p[w]?(B.addSelf(k[R].position),B.addSelf(k[L].position),B.multiplyScalar(0.5)):(B.addSelf(t[y]),B.addSelf(t[C]),B.addSelf(k[R].position),B.addSelf(k[L].position),B.multiplyScalar(0.25)),
|
|
|
|
-v[w]=E+e.length+H,n.push(new THREE.Vertex(B)),H++,f.supportUVs&&x.length!=0)C=new THREE.UV,C.u=x[R].u+x[L].u,C.v=x[R].v+x[L].v,C.u/=2,C.v/=2,x.push(C);var K,M;L=["123","12","2","23"];B=["123","23","3","31"];var J=["123","31","1","12"],N=["1234","12","2","23"],Y=["1234","23","3","34"],oa=["1234","34","4","41"],Z=["1234","41","1","12"];w=0;for(z=t.length;w<z;w++)y=e[w],C=E+w,y instanceof THREE.Face3?(H=b(y.a,y.b),R=b(y.b,y.c),K=b(y.c,y.a),c(C,v[H],y.b,v[R],y,L),c(C,v[R],y.c,v[K],y,B),c(C,v[K],y.a,v[H],
|
|
|
|
-y,J)):y instanceof THREE.Face4?(H=b(y.a,y.b),R=b(y.b,y.c),K=b(y.c,y.d),M=b(y.d,y.a),c(C,v[H],y.b,v[R],y,N),c(C,v[R],y.c,v[K],y,Y),c(C,v[K],y.d,v[M],y,oa),c(C,v[M],y.a,v[H],y,Z)):console.log("face should be a face!",y);e=n;n=new THREE.Vector3;v=new THREE.Vector3;w=0;for(z=k.length;w<z;w++)if(D[w]!==void 0){n.set(0,0,0);v.set(0,0,0);y=new THREE.Vector3(0,0,0);C=0;for(u in O[w])n.addSelf(t[u]),C++;H=0;E=D[w].length;for(u=0;u<E;u++)p[b(D[w][u][0],D[w][u][1])]&&H++;if(H!=2){n.divideScalar(C);for(u=0;u<
|
|
|
|
-E;u++)C=D[w][u],C=k[C[0]].position.clone().addSelf(k[C[1]].position).divideScalar(2),v.addSelf(C);v.divideScalar(E);y.addSelf(k[w].position);y.multiplyScalar(E-3);y.addSelf(n);y.addSelf(v.multiplyScalar(2));y.divideScalar(E);e[w].position=y}}a.vertices=e;a.faces=l;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,n){var p=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(f.useOldVertexColors){p.vertexColors=[];for(var t,w,u,v=0;v<4;v++){u=n[v];t=new THREE.Color;t.setRGB(0,0,0);for(var y=0;y<u.length;y++)w=k.vertexColors[u[y]-1],t.r+=w.r,t.g+=w.g,t.b+=w.b;t.r/=u.length;t.g/=u.length;t.b/=u.length;p.vertexColors[v]=t}}l.push(p);(!f.supportUVs||x.length!=0)&&h.push([x[a],x[b],x[c],x[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
|
+b)}var e=[],l=[],h=[],f=this,k=a.vertices,e=a.faces,n=k.concat(),p=[],v={},u={},x=[],w,y,t,B,A,D=a.faceVertexUvs[0];w=0;for(y=D.length;w<y;w++){t=0;for(B=D[w].length;t<B;t++)A=e[w]["abcd".charAt(t)],x[A]||(x[A]=D[w][t])}var C;w=0;for(y=e.length;w<y;w++)if(A=e[w],p.push(A.centroid),n.push(new THREE.Vertex(A.centroid)),f.supportUVs&&x.length!=0){C=new THREE.UV;if(A instanceof THREE.Face3)C.u=x[A.a].u+x[A.b].u+x[A.c].u,C.v=x[A.a].v+x[A.b].v+x[A.c].v,C.u/=3,C.v/=3;else if(A instanceof THREE.Face4)C.u=
|
|
|
|
+x[A.a].u+x[A.b].u+x[A.c].u+x[A.d].u,C.v=x[A.a].v+x[A.b].v+x[A.c].v+x[A.d].v,C.u/=4,C.v/=4;x.push(C)}y=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,k,l={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.a),c(l,k,e)):h instanceof THREE.Face4&&(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.d),c(l,k,e),k=b(h.d,h.a),c(l,k,e));return l}(a);var H=0,D=k.length,O,T,E={},S={},K=function(a,
|
|
|
|
+b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},N=function(a,b){S[a]===void 0&&(S[a]={});S[a][b]=null};for(w in y){C=y[w];O=w.split("_");T=O[0];O=O[1];K(T,[T,O]);K(O,[T,O]);t=0;for(B=C.length;t<B;t++)A=C[t],N(T,A,w),N(O,A,w);C.length<2&&(u[w]=!0)}for(w in y)if(C=y[w],A=C[0],C=C[1],O=w.split("_"),T=O[0],O=O[1],B=new THREE.Vector3,u[w]?(B.addSelf(k[T].position),B.addSelf(k[O].position),B.multiplyScalar(0.5)):(B.addSelf(p[A]),B.addSelf(p[C]),B.addSelf(k[T].position),B.addSelf(k[O].position),B.multiplyScalar(0.25)),
|
|
|
|
+v[w]=D+e.length+H,n.push(new THREE.Vertex(B)),H++,f.supportUVs&&x.length!=0)C=new THREE.UV,C.u=x[T].u+x[O].u,C.v=x[T].v+x[O].v,C.u/=2,C.v/=2,x.push(C);var L,J;O=["123","12","2","23"];B=["123","23","3","31"];var K=["123","31","1","12"],N=["1234","12","2","23"],X=["1234","23","3","34"],oa=["1234","34","4","41"],Y=["1234","41","1","12"];w=0;for(y=p.length;w<y;w++)A=e[w],C=D+w,A instanceof THREE.Face3?(H=b(A.a,A.b),T=b(A.b,A.c),L=b(A.c,A.a),c(C,v[H],A.b,v[T],A,O),c(C,v[T],A.c,v[L],A,B),c(C,v[L],A.a,v[H],
|
|
|
|
+A,K)):A instanceof THREE.Face4?(H=b(A.a,A.b),T=b(A.b,A.c),L=b(A.c,A.d),J=b(A.d,A.a),c(C,v[H],A.b,v[T],A,N),c(C,v[T],A.c,v[L],A,X),c(C,v[L],A.d,v[J],A,oa),c(C,v[J],A.a,v[H],A,Y)):console.log("face should be a face!",A);e=n;n=new THREE.Vector3;v=new THREE.Vector3;w=0;for(y=k.length;w<y;w++)if(E[w]!==void 0){n.set(0,0,0);v.set(0,0,0);A=new THREE.Vector3(0,0,0);C=0;for(t in S[w])n.addSelf(p[t]),C++;H=0;D=E[w].length;for(t=0;t<D;t++)u[b(E[w][t][0],E[w][t][1])]&&H++;if(H!=2){n.divideScalar(C);for(t=0;t<
|
|
|
|
+D;t++)C=E[w][t],C=k[C[0]].position.clone().addSelf(k[C[1]].position).divideScalar(2),v.addSelf(C);v.divideScalar(D);A.addSelf(k[w].position);A.multiplyScalar(D-3);A.addSelf(n);A.addSelf(v.multiplyScalar(2));A.divideScalar(D);e[w].position=A}}a.vertices=e;a.faces=l;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
@@ -557,123 +557,123 @@ a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this
|
|
if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}k&&a[b].offset.set(k[0],k[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[b].wrapS=h[l[0]];if(h[l[1]]!==void 0)a[b].wrapT=h[l[1]]}e(a[b],c+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,k,n;k="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
|
|
if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}k&&a[b].offset.set(k[0],k[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[b].wrapS=h[l[0]];if(h[l[1]]!==void 0)a[b].wrapT=h[l[1]]}e(a[b],c+"/"+f)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,k,n;k="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
|
|
if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
|
|
if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=h(a.colorDiffuse);
|
|
else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&l(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&l(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&l(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=h(a.colorSpecular);if(a.colorAmbient)f.ambient=h(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&l(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&l(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&l(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
-a.mapSpecular&&c&&l(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var t=THREE.ShaderUtils.lib.normal,v=THREE.UniformsUtils.clone(t.uniforms),p=f.color;k=f.specular;n=f.ambient;var x=f.shininess;v.tNormal.texture=f.normalMap;if(a.mapNormalFactor)v.uNormalScale.value=a.mapNormalFactor;if(f.map)v.tDiffuse.texture=f.map,v.enableDiffuse.value=!0;if(f.specularMap)v.tSpecular.texture=f.specularMap,v.enableSpecular.value=!0;if(f.lightMap)v.tAO.texture=
|
|
|
|
-f.lightMap,v.enableAO.value=!0;v.uDiffuseColor.value.setHex(p);v.uSpecularColor.value.setHex(k);v.uAmbientColor.value.setHex(n);v.uShininess.value=x;if(f.opacity)v.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:v,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
|
|
|
+a.mapSpecular&&c&&l(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var p=THREE.ShaderUtils.lib.normal,v=THREE.UniformsUtils.clone(p.uniforms),u=f.color;k=f.specular;n=f.ambient;var x=f.shininess;v.tNormal.texture=f.normalMap;if(a.mapNormalFactor)v.uNormalScale.value=a.mapNormalFactor;if(f.map)v.tDiffuse.texture=f.map,v.enableDiffuse.value=!0;if(f.specularMap)v.tSpecular.texture=f.specularMap,v.enableSpecular.value=!0;if(f.lightMap)v.tAO.texture=
|
|
|
|
+f.lightMap,v.enableAO.value=!0;v.uDiffuseColor.value.setHex(u);v.uSpecularColor.value.setHex(k);v.uAmbientColor.value.setHex(n);v.uShininess.value=x;if(f.opacity)v.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:v,lights:!0,fog:!0})}else f=new THREE[k](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var l=a,a=l.model,c=l.callback,b=l.texture_path,e=l.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),l=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
|
|
THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var l=a,a=l.model,c=l.callback,b=l.texture_path,e=l.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),l=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
|
|
c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(l)};
|
|
c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(l)};
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,l,h){var f=new XMLHttpRequest,k=e+"/"+a,n=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,l,c):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(n==0&&(n=f.getResponseHeader("Content-Length")),h({total:n,loaded:f.responseText.length})):f.readyState==2&&(n=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,l,h){var f=new XMLHttpRequest,k=e+"/"+a,n=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,l,c):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(n==0&&(n=f.getResponseHeader("Content-Length")),h({total:n,loaded:f.responseText.length})):f.readyState==2&&(n=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
|
|
f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var l=function(b){function c(a,b){var e=v(a,b),f=v(a,b+1),h=v(a,b+2),k=v(a,b+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=v(a,b),e=v(a,b+1),f=v(a,b+2);return(v(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=v(a,b);return(v(a,b+1)<<8)+c}function t(a,b){var c=v(a,b);return c>127?c-256:c}function v(a,b){return a.charCodeAt(b)&255}function p(b){var c,
|
|
|
|
-e,f;c=k(a,b);e=k(a,b+R);f=k(a,b+D);b=l(a,b+O);y.faces.push(new THREE.Face3(c,e,f,null,null,b))}function x(b){var c,e,f,h,o,p,t;c=k(a,b);e=k(a,b+R);f=k(a,b+D);h=l(a,b+O);o=k(a,b+J);p=k(a,b+N);t=k(a,b+K);var b=H[p*3],u=H[p*3+1];p=H[p*3+2];var v=H[t*3],w=H[t*3+1];t=H[t*3+2];y.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,w,t)],null,h))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+M);f=k(a,b+Y);h=k(a,b+oa);b=l(a,b+Z);y.faces.push(new THREE.Face4(c,
|
|
|
|
-e,f,h,null,null,b))}function z(b){var c,e,f,h,p,t,u,v,w;c=k(a,b);e=k(a,b+M);f=k(a,b+Y);h=k(a,b+oa);p=l(a,b+Z);t=k(a,b+U);u=k(a,b+o);v=k(a,b+P);w=k(a,b+ra);var b=H[u*3],x=H[u*3+1];u=H[u*3+2];var X=H[v*3],z=H[v*3+1];v=H[v*3+2];var V=H[w*3],B=H[w*3+1];w=H[w*3+2];y.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(H[t*3],H[t*3+1],H[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3(X,z,v),new THREE.Vector3(V,B,w)],null,p))}function u(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+W);b=L[c*2];h=L[c*2+
|
|
|
|
-1];c=L[e*2];var l=y.faceVertexUvs[0];e=L[e*2+1];var n=L[f*2];f=L[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(n,f));l.push(o)}function B(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+$);f=k(a,b+la);h=k(a,b+ja);b=L[c*2];l=L[c*2+1];c=L[e*2];n=L[e*2+1];e=L[f*2];var o=y.faceVertexUvs[0];f=L[f*2+1];var p=L[h*2];h=L[h*2+1];var t=[];t.push(new THREE.UV(b,l));t.push(new THREE.UV(c,n));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}var y=this,E=0,C,H=[],L=[],
|
|
|
|
-R,D,O,J,N,K,M,Y,oa,Z,U,o,P,ra,G,W,$,la,ja,sa,T,ea,ga,na,ia;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);C={signature:a.substr(E,8),header_bytes:v(a,E+8),vertex_coordinate_bytes:v(a,E+9),normal_coordinate_bytes:v(a,E+10),uv_coordinate_bytes:v(a,E+11),vertex_index_bytes:v(a,E+12),normal_index_bytes:v(a,E+13),uv_index_bytes:v(a,E+14),material_index_bytes:v(a,E+15),nvertices:k(a,E+16),nnormals:k(a,E+16+4),nuvs:k(a,E+16+8),ntri_flat:k(a,E+16+12),ntri_smooth:k(a,E+16+16),ntri_flat_uv:k(a,
|
|
|
|
-E+16+20),ntri_smooth_uv:k(a,E+16+24),nquad_flat:k(a,E+16+28),nquad_smooth:k(a,E+16+32),nquad_flat_uv:k(a,E+16+36),nquad_smooth_uv:k(a,E+16+40)};E+=C.header_bytes;R=C.vertex_index_bytes;D=C.vertex_index_bytes*2;O=C.vertex_index_bytes*3;J=C.vertex_index_bytes*3+C.material_index_bytes;N=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;K=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;M=C.vertex_index_bytes;Y=C.vertex_index_bytes*2;oa=C.vertex_index_bytes*3;Z=C.vertex_index_bytes*
|
|
|
|
-4;U=C.vertex_index_bytes*4+C.material_index_bytes;o=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;P=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ra=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;G=C.uv_index_bytes;W=C.uv_index_bytes*2;$=C.uv_index_bytes;la=C.uv_index_bytes*2;ja=C.uv_index_bytes*3;b=C.vertex_index_bytes*3+C.material_index_bytes;ia=C.vertex_index_bytes*4+C.material_index_bytes;sa=C.ntri_flat*b;T=C.ntri_smooth*(b+C.normal_index_bytes*
|
|
|
|
-3);ea=C.ntri_flat_uv*(b+C.uv_index_bytes*3);ga=C.ntri_smooth_uv*(b+C.normal_index_bytes*3+C.uv_index_bytes*3);na=C.nquad_flat*ia;b=C.nquad_smooth*(ia+C.normal_index_bytes*4);ia=C.nquad_flat_uv*(ia+C.uv_index_bytes*4);E+=function(b){for(var e,h,k,l=C.vertex_coordinate_bytes*3,n=b+C.nvertices*l;b<n;b+=l)e=c(a,b),h=c(a,b+C.vertex_coordinate_bytes),k=c(a,b+C.vertex_coordinate_bytes*2),y.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,k)));return C.nvertices*l}(E);E+=function(b){for(var c,e,f,h=C.normal_coordinate_bytes*
|
|
|
|
-3,k=b+C.nnormals*h;b<k;b+=h)c=t(a,b),e=t(a,b+C.normal_coordinate_bytes),f=t(a,b+C.normal_coordinate_bytes*2),H.push(c/127,e/127,f/127);return C.nnormals*h}(E);E+=function(b){for(var e,h,k=C.uv_coordinate_bytes*2,l=b+C.nuvs*k;b<l;b+=k)e=c(a,b),h=c(a,b+C.uv_coordinate_bytes),L.push(e,h);return C.nuvs*k}(E);sa=E+sa;T=sa+T;ea=T+ea;ga=ea+ga;na=ga+na;b=na+b;ia=b+ia;(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes,e=c+C.uv_index_bytes*3,f=a+C.ntri_flat_uv*e;for(b=a;b<f;b+=e)p(b),u(b+c);
|
|
|
|
-return f-a})(T);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=c+C.uv_index_bytes*3,f=a+C.ntri_smooth_uv*e;for(b=a;b<f;b+=e)x(b),u(b+c);return f-a})(ea);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes,e=c+C.uv_index_bytes*4,f=a+C.nquad_flat_uv*e;for(b=a;b<f;b+=e)w(b),B(b+c);return f-a})(b);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,e=c+C.uv_index_bytes*4,f=a+C.nquad_smooth_uv*e;for(b=a;b<
|
|
|
|
-f;b+=e)z(b),B(b+c);return f-a})(ia);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes,e=a+C.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(E);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=a+C.ntri_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(sa);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes,e=a+C.nquad_flat*c;for(b=a;b<e;b+=c)w(b);return e-a})(ga);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
|
|
|
|
-4,e=a+C.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})(na);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};l.prototype=new THREE.Geometry;l.prototype.constructor=l;c(new l(b))};
|
|
|
|
-THREE.ColladaLoader=function(){function a(a,e,l){T=a;e=e||na;l!==void 0&&(a=l.split("/"),a.pop(),Ga=a.length<1?"":a.join("/")+"/");I=c("//dae:library_images/dae:image",f,"image");ua=c("//dae:library_materials/dae:material",O,"material");va=c("//dae:library_effects/dae:effect",Y,"effect");ka=c("//dae:library_geometries/dae:geometry",B,"geometry");ha=c("//dae:library_controllers/dae:controller",k,"controller");Q=c("//dae:library_animations/dae:animation",Z,"animation");Ca=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
-v,"visual_scene");ya=[];Aa=[];(a=T.evaluate(".//dae:scene/dae:instance_visual_scene",T,ra,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ga=Ca[a]):ga=null;ea=new THREE.Object3D;for(a=0;a<ga.nodes.length;a++)ea.add(h(ga.nodes[a]));b();for(var n in Q);n={scene:ea,morphs:ya,skins:Aa,dae:{images:I,materials:ua,effects:va,geometries:ka,controllers:ha,animations:Q,visualScenes:Ca,scene:ga}};e&&e(n);return n}function c(a,b,c){for(var a=T.evaluate(a,
|
|
|
|
-T,ra,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in Q)for(var f=Q[e],h=0;h<f.sampler.length;h++){var k=f.sampler[h];k.create();a=Math.min(a,k.startTime);b=Math.max(b,k.endTime);c=Math.max(c,k.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=
|
|
|
|
-a.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function l(a,c,f){var h=ha[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=b(),c=ga.getChildById(c.skeleton[0],!0)||ga.getChildBySid(c.skeleton[0],!0),l,n,o,p,t=new THREE.Vector3,
|
|
|
|
-u;for(l=0;l<a.vertices.length;l++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(f=0;f<k.frames;f++){var v=[],w=[];for(l=0;l<a.vertices.length;l++)w.push(new THREE.Vertex(new THREE.Vector3));e(c,v,f);l=v;n=h.skin;for(p=0;p<l.length;p++)if(o=l[p],u=-1,o.type=="JOINT"){for(var x=0;x<n.joints.length;x++)if(o.sid==n.joints[x]){u=x;break}if(u>=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x<n.weights.length;x++)for(var y=
|
|
|
|
-0;y<n.weights[x].length;y++){var z=n.weights[x][y];z.joint==u&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<v.length;l++)if(v[l].type=="JOINT")for(n=0;n<v[l].weights.length;n++)o=v[l].weights[n],p=o.index,o=o.weight,u=a.vertices[p],p=w[p],t.x=u.position.x,t.y=u.position.y,t.z=u.position.z,v[l].skinningMatrix.multiplyVector3(t),p.position.x+=t.x*o,p.position.y+=t.y*o,p.position.z+=t.z*o;a.morphTargets.push({name:"target_"+f,vertices:w})}}}function h(a){var b=
|
|
|
|
-new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var k=ha[a.controllers[f].url];switch(k.type){case "skin":if(ka[k.skin.source]){var n=new u;n.url=k.skin.source;n.instance_material=a.controllers[f].instance_material;a.geometries.push(n);c=a.controllers[f]}else if(ha[k.skin.source]&&(e=k=ha[k.skin.source],k.morph&&ka[k.morph.source]))n=new u,n.url=k.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n);break;case "morph":if(ka[k.morph.source])n=new u,
|
|
|
|
-n.url=k.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var k=a.geometries[f],n=k.instance_material,k=ka[k.url],o={},p=0,t;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(n)for(j=0;j<n.length;j++){t=n[j];var v=va[ua[t.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;t=o[t.symbol]=
|
|
|
|
-v.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)p=k.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)l(k,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(k,n),n.skeleton=c.skeleton,n.skinController=ha[c.url],n.skinInstanceController=c,n.name="skin_"+Aa.length,Aa.push(n);else if(e!==void 0){o=k;p=e instanceof w?ha[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
|
|
|
|
-else{p=p.morph;for(v=0;v<p.targets.length;v++){var x=ka[p.targets[v]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:x.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(k,n);n.name="morph_"+ya.length;ya.push(n)}else n=new THREE.Mesh(k,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
|
-b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function v(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
|
|
-[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function w(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function u(){this.url="";this.instance_material=[]}function B(){this.id="";this.mesh=null}function y(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function C(){this.material="";this.count=
|
|
|
|
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function H(){this.source="";this.stride=this.count=0;this.params=[]}function L(){this.input={}}function R(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function O(){this.name=this.id="";this.instance_effect=null}function J(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function N(a,
|
|
|
|
-b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=null}function M(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Y(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function oa(){this.url=""}function Z(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function U(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
|
-this.dotSyntax=this.sid=null}function o(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function P(a){var b=a.getAttribute("id");if(ia[b]!=void 0)return ia[b];ia[b]=(new D(b)).parse(a);return ia[b]}function ra(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function G(a){for(var a=$(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function W(a){for(var a=$(a),b=[],c=
|
|
|
|
-0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function $(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ja(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function sa(a,b){var c="";c+=ja(a.x,b)+",";c+=ja(a.y,b)+",";c+=ja(a.z,b);return c}var T=null,ea=null,ga,
|
|
|
|
-na=null,ia={},I={},Q={},ha={},ka={},ua={},va={},Ca,Ga,ya,Aa,Ja=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new t).parse(c);this.type=
|
|
|
|
-c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new D).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
|
|
|
|
-f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new R).parse(e))}}return b};t.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=
|
|
|
|
-G(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new D).parse(h);b[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};t.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
|
|
|
|
-(new R).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};t.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var k=a.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "input":f.push((new R).parse(k));break;case "v":c=W(k.textContent);break;case "vcount":e=W(k.textContent)}}for(h=k=0;h<e.length;h++){for(var l=e[h],n=[],o=0;o<l;o++){for(var p={},t=0;t<f.length;t++){var u=
|
|
|
|
-f[t],v=c[k+u.offset];switch(u.semantic){case "JOINT":p.joint=v;break;case "WEIGHT":p.weight=b[u.source].data[v]}}n.push(p);k+=f.length}for(o=0;o<n.length;o++)n[o].index=h;this.weights.push(n)}};v.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};v.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};v.prototype.parse=function(a){this.id=
|
|
|
|
-a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,k=f.indexOf("(")>=0,l;if(h)e=f.split("."),f=e.shift(),e.shift();else if(k){l=f.split("(");f=l.shift();
|
|
|
|
-for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:k,arrIndices:l},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};p.prototype.getTransformBySid=
|
|
|
|
-function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
|
|
|
|
-1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new w).parse(b));break;case "instance_geometry":this.geometries.push((new u).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=T.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",T,ra,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;
|
|
|
|
-case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in Q)for(var f=Q[e],h=0;h<f.channel.length;h++){var k=f.channel[h],l=f.sampler[h];e=k.target.split("/")[0];if(e==this.id)l.create(),k.sampler=l,c=Math.min(c,l.startTime),b=Math.max(b,l.endTime),a.push(k)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=
|
|
|
|
-1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},n=h=void 0,h=0;h<this.channels.length;h++)n=this.channels[h],f[n.sid]=n;k=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(l=this.transforms[h],n=f[l.sid],n!==void 0){for(var o=n.sampler,t,n=0;n<o.input.length-1;n++)if(o.input[n+1]>b){t=o.output[n];break}k=t!==void 0?t instanceof THREE.Matrix4?
|
|
|
|
-k.multiply(k,t):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);b=k;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};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};x.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=G(a.textContent);this.updateMatrix();return this};
|
|
|
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var l=function(b){function c(a,b){var e=v(a,b),f=v(a,b+1),h=v(a,b+2),k=v(a,b+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=v(a,b),e=v(a,b+1),f=v(a,b+2);return(v(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=v(a,b);return(v(a,b+1)<<8)+c}function p(a,b){var c=v(a,b);return c>127?c-256:c}function v(a,b){return a.charCodeAt(b)&255}function u(b){var c,
|
|
|
|
+e,f;c=k(a,b);e=k(a,b+T);f=k(a,b+E);b=l(a,b+S);A.faces.push(new THREE.Face3(c,e,f,null,null,b))}function x(b){var c,e,f,h,o,p,t;c=k(a,b);e=k(a,b+T);f=k(a,b+E);h=l(a,b+S);o=k(a,b+K);p=k(a,b+N);t=k(a,b+L);var b=H[p*3],u=H[p*3+1];p=H[p*3+2];var w=H[t*3],v=H[t*3+1];t=H[t*3+2];A.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(w,v,t)],null,h))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+J);f=k(a,b+X);h=k(a,b+oa);b=l(a,b+Y);A.faces.push(new THREE.Face4(c,
|
|
|
|
+e,f,h,null,null,b))}function y(b){var c,e,f,h,p,t,u,w,v;c=k(a,b);e=k(a,b+J);f=k(a,b+X);h=k(a,b+oa);p=l(a,b+Y);t=k(a,b+V);u=k(a,b+o);w=k(a,b+Q);v=k(a,b+qa);var b=H[u*3],x=H[u*3+1];u=H[u*3+2];var fa=H[w*3],P=H[w*3+1];w=H[w*3+2];var M=H[v*3],y=H[v*3+1];v=H[v*3+2];A.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(H[t*3],H[t*3+1],H[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3(fa,P,w),new THREE.Vector3(M,y,v)],null,p))}function t(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+W);b=O[c*2];h=O[c*
|
|
|
|
+2+1];c=O[e*2];var l=A.faceVertexUvs[0];e=O[e*2+1];var n=O[f*2];f=O[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(n,f));l.push(o)}function B(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+Z);f=k(a,b+na);h=k(a,b+ma);b=O[c*2];l=O[c*2+1];c=O[e*2];n=O[e*2+1];e=O[f*2];var o=A.faceVertexUvs[0];f=O[f*2+1];var p=O[h*2];h=O[h*2+1];var t=[];t.push(new THREE.UV(b,l));t.push(new THREE.UV(c,n));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}var A=this,D=0,C,H=[],O=
|
|
|
|
+[],T,E,S,K,N,L,J,X,oa,Y,V,o,Q,qa,G,W,Z,na,ma,sa,U,da,ia,ea,la;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(A,e,b);C={signature:a.substr(D,8),header_bytes:v(a,D+8),vertex_coordinate_bytes:v(a,D+9),normal_coordinate_bytes:v(a,D+10),uv_coordinate_bytes:v(a,D+11),vertex_index_bytes:v(a,D+12),normal_index_bytes:v(a,D+13),uv_index_bytes:v(a,D+14),material_index_bytes:v(a,D+15),nvertices:k(a,D+16),nnormals:k(a,D+16+4),nuvs:k(a,D+16+8),ntri_flat:k(a,D+16+12),ntri_smooth:k(a,D+16+16),ntri_flat_uv:k(a,
|
|
|
|
+D+16+20),ntri_smooth_uv:k(a,D+16+24),nquad_flat:k(a,D+16+28),nquad_smooth:k(a,D+16+32),nquad_flat_uv:k(a,D+16+36),nquad_smooth_uv:k(a,D+16+40)};D+=C.header_bytes;T=C.vertex_index_bytes;E=C.vertex_index_bytes*2;S=C.vertex_index_bytes*3;K=C.vertex_index_bytes*3+C.material_index_bytes;N=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;L=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;J=C.vertex_index_bytes;X=C.vertex_index_bytes*2;oa=C.vertex_index_bytes*3;Y=C.vertex_index_bytes*
|
|
|
|
+4;V=C.vertex_index_bytes*4+C.material_index_bytes;o=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;Q=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;qa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;G=C.uv_index_bytes;W=C.uv_index_bytes*2;Z=C.uv_index_bytes;na=C.uv_index_bytes*2;ma=C.uv_index_bytes*3;b=C.vertex_index_bytes*3+C.material_index_bytes;la=C.vertex_index_bytes*4+C.material_index_bytes;sa=C.ntri_flat*b;U=C.ntri_smooth*(b+C.normal_index_bytes*
|
|
|
|
+3);da=C.ntri_flat_uv*(b+C.uv_index_bytes*3);ia=C.ntri_smooth_uv*(b+C.normal_index_bytes*3+C.uv_index_bytes*3);ea=C.nquad_flat*la;b=C.nquad_smooth*(la+C.normal_index_bytes*4);la=C.nquad_flat_uv*(la+C.uv_index_bytes*4);D+=function(b){for(var e,h,k,l=C.vertex_coordinate_bytes*3,n=b+C.nvertices*l;b<n;b+=l)e=c(a,b),h=c(a,b+C.vertex_coordinate_bytes),k=c(a,b+C.vertex_coordinate_bytes*2),A.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,k)));return C.nvertices*l}(D);D+=function(b){for(var c,e,f,h=C.normal_coordinate_bytes*
|
|
|
|
+3,k=b+C.nnormals*h;b<k;b+=h)c=p(a,b),e=p(a,b+C.normal_coordinate_bytes),f=p(a,b+C.normal_coordinate_bytes*2),H.push(c/127,e/127,f/127);return C.nnormals*h}(D);D+=function(b){for(var e,h,k=C.uv_coordinate_bytes*2,l=b+C.nuvs*k;b<l;b+=k)e=c(a,b),h=c(a,b+C.uv_coordinate_bytes),O.push(e,h);return C.nuvs*k}(D);sa=D+sa;U=sa+U;da=U+da;ia=da+ia;ea=ia+ea;b=ea+b;la=b+la;(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes,e=c+C.uv_index_bytes*3,f=a+C.ntri_flat_uv*e;for(b=a;b<f;b+=e)u(b),t(b+c);
|
|
|
|
+return f-a})(U);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=c+C.uv_index_bytes*3,f=a+C.ntri_smooth_uv*e;for(b=a;b<f;b+=e)x(b),t(b+c);return f-a})(da);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes,e=c+C.uv_index_bytes*4,f=a+C.nquad_flat_uv*e;for(b=a;b<f;b+=e)w(b),B(b+c);return f-a})(b);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,e=c+C.uv_index_bytes*4,f=a+C.nquad_smooth_uv*e;for(b=a;b<
|
|
|
|
+f;b+=e)y(b),B(b+c);return f-a})(la);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes,e=a+C.ntri_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})(D);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=a+C.ntri_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(sa);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes,e=a+C.nquad_flat*c;for(b=a;b<e;b+=c)w(b);return e-a})(ia);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
|
|
|
|
+4,e=a+C.nquad_smooth*c;for(b=a;b<e;b+=c)y(b);return e-a})(ea);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};l.prototype=new THREE.Geometry;l.prototype.constructor=l;c(new l(b))};
|
|
|
|
+THREE.ColladaLoader=function(){function a(a,e,l){U=a;e=e||ea;l!==void 0&&(a=l.split("/"),a.pop(),Ca=a.length<1?"":a.join("/")+"/");I=c("//dae:library_images/dae:image",f,"image");ya=c("//dae:library_materials/dae:material",S,"material");ta=c("//dae:library_effects/dae:effect",X,"effect");ka=c("//dae:library_geometries/dae:geometry",B,"geometry");ja=c("//dae:library_controllers/dae:controller",k,"controller");R=c("//dae:library_animations/dae:animation",Y,"animation");pa=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
+v,"visual_scene");za=[];Ba=[];(a=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,qa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ia=pa[a]):ia=null;da=new THREE.Object3D;for(a=0;a<ia.nodes.length;a++)da.add(h(ia.nodes[a]));b();for(var n in R);n={scene:da,morphs:za,skins:Ba,dae:{images:I,materials:ya,effects:ta,geometries:ka,controllers:ja,animations:R,visualScenes:pa,scene:ia}};e&&e(n);return n}function c(a,b,c){for(var a=U.evaluate(a,
|
|
|
|
+U,qa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in R)for(var f=R[e],h=0;h<f.sampler.length;h++){var k=f.sampler[h];k.create();a=Math.min(a,k.startTime);b=Math.max(b,k.endTime);c=Math.max(c,k.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=
|
|
|
|
+a.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function l(a,c,f){var h=ja[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=b(),c=ia.getChildById(c.skeleton[0],!0)||ia.getChildBySid(c.skeleton[0],!0),l,n,o,p,t=new THREE.Vector3,
|
|
|
|
+u;for(l=0;l<a.vertices.length;l++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(f=0;f<k.frames;f++){var w=[],v=[];for(l=0;l<a.vertices.length;l++)v.push(new THREE.Vertex(new THREE.Vector3));e(c,w,f);l=w;n=h.skin;for(p=0;p<l.length;p++)if(o=l[p],u=-1,o.type=="JOINT"){for(var x=0;x<n.joints.length;x++)if(o.sid==n.joints[x]){u=x;break}if(u>=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x<n.weights.length;x++)for(var y=
|
|
|
|
+0;y<n.weights[x].length;y++){var A=n.weights[x][y];A.joint==u&&o.weights.push(A)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<w.length;l++)if(w[l].type=="JOINT")for(n=0;n<w[l].weights.length;n++)o=w[l].weights[n],p=o.index,o=o.weight,u=a.vertices[p],p=v[p],t.x=u.position.x,t.y=u.position.y,t.z=u.position.z,w[l].skinningMatrix.multiplyVector3(t),p.position.x+=t.x*o,p.position.y+=t.y*o,p.position.z+=t.z*o;a.morphTargets.push({name:"target_"+f,vertices:v})}}}function h(a){var b=
|
|
|
|
+new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var k=ja[a.controllers[f].url];switch(k.type){case "skin":if(ka[k.skin.source]){var n=new t;n.url=k.skin.source;n.instance_material=a.controllers[f].instance_material;a.geometries.push(n);c=a.controllers[f]}else if(ja[k.skin.source]&&(e=k=ja[k.skin.source],k.morph&&ka[k.morph.source]))n=new t,n.url=k.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n);break;case "morph":if(ka[k.morph.source])n=new t,
|
|
|
|
+n.url=k.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var k=a.geometries[f],n=k.instance_material,k=ka[k.url],o={},p=0,u;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(n)for(j=0;j<n.length;j++){u=n[j];var v=ta[ya[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=o[u.symbol]=
|
|
|
|
+v.material;p++}n=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)p=k.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)l(k,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(k,n),n.skeleton=c.skeleton,n.skinController=ja[c.url],n.skinInstanceController=c,n.name="skin_"+Ba.length,Ba.push(n);else if(e!==void 0){o=k;p=e instanceof w?ja[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
|
|
|
|
+else{p=p.morph;for(v=0;v<p.targets.length;v++){var x=ka[p.targets[v]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:x.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(k,n);n.name="morph_"+za.length;za.push(n)}else n=new THREE.Mesh(k,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
|
+b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function v(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function u(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
|
|
+[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function w(){this.url="";this.skeleton=[];this.instance_material=[]}function y(){this.target=this.symbol=""}function t(){this.url="";this.instance_material=[]}function B(){this.id="";this.mesh=null}function A(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function D(){}function C(){this.material="";this.count=
|
|
|
|
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function H(){this.source="";this.stride=this.count=0;this.params=[]}function O(){this.input={}}function T(){this.semantic="";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function S(){this.name=this.id="";this.instance_effect=null}function K(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function N(a,
|
|
|
|
+b){this.type=a;this.effect=b;this.material=null}function L(a){this.effect=a;this.format=this.init_from=null}function J(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function X(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function oa(){this.url=""}function Y(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function V(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
|
+this.dotSyntax=this.sid=null}function o(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function Q(a){var b=a.getAttribute("id");if(la[b]!=void 0)return la[b];la[b]=(new E(b)).parse(a);return la[b]}function qa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function G(a){for(var a=Z(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function W(a){for(var a=Z(a),b=[],c=
|
|
|
|
+0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function Z(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function na(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ma(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function sa(a,b){var c="";c+=ma(a.x,b)+",";c+=ma(a.y,b)+",";c+=ma(a.z,b);return c}var U=null,da=null,ia,
|
|
|
|
+ea=null,la={},I={},R={},ja={},ka={},ya={},ta={},pa,Ca,za,Ba,Ga=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new p).parse(c);this.type=
|
|
|
|
+c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new E).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
|
|
|
|
+f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new T).parse(e))}}return b};p.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=
|
|
|
|
+G(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new E).parse(h);b[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};p.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
|
|
|
|
+(new T).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};p.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var k=a.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "input":f.push((new T).parse(k));break;case "v":c=W(k.textContent);break;case "vcount":e=W(k.textContent)}}for(h=k=0;h<e.length;h++){for(var l=e[h],n=[],o=0;o<l;o++){for(var p={},t=0;t<f.length;t++){var u=
|
|
|
|
+f[t],w=c[k+u.offset];switch(u.semantic){case "JOINT":p.joint=w;break;case "WEIGHT":p.weight=b[u.source].data[w]}}n.push(p);k+=f.length}for(o=0;o<n.length;o++)n[o].index=h;this.weights.push(n)}};v.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};v.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};v.prototype.parse=function(a){this.id=
|
|
|
|
+a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new u).parse(c))}}return this};u.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,k=f.indexOf("(")>=0,l;if(h)e=f.split("."),f=e.shift(),e.shift();else if(k){l=f.split("(");f=l.shift();
|
|
|
|
+for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:k,arrIndices:l},c}return null};u.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};u.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};u.prototype.getTransformBySid=
|
|
|
|
+function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};u.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
|
|
|
|
+1)switch(b.nodeName){case "node":this.nodes.push((new u).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new w).parse(b));break;case "instance_geometry":this.geometries.push((new t).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=U.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",U,qa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new u).parse(b));break;
|
|
|
|
+case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in R)for(var f=R[e],h=0;h<f.channel.length;h++){var k=f.channel[h],l=f.sampler[h];e=k.target.split("/")[0];if(e==this.id)l.create(),k.sampler=l,c=Math.min(c,l.startTime),b=Math.max(b,l.endTime),a.push(k)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=
|
|
|
|
+1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},n=h=void 0,h=0;h<this.channels.length;h++)n=this.channels[h],f[n.sid]=n;k=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(l=this.transforms[h],n=f[l.sid],n!==void 0){for(var o=n.sampler,p,n=0;n<o.input.length-1;n++)if(o.input[n+1]>b){p=o.output[n];break}k=p!==void 0?p instanceof THREE.Matrix4?
|
|
|
|
+k.multiply(k,p):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);b=k;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};u.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};x.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=G(a.textContent);this.updateMatrix();return this};
|
|
x.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
|
|
x.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
|
|
-this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};w.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=T.evaluate(".//dae:instance_material",c,ra,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
-null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};u.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=T.evaluate(".//dae:instance_material",
|
|
|
|
-c,ra,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new y(this)).parse(c)}}return this};y.prototype.parse=function(a){function b(a,c){var e=sa(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=
|
|
|
|
-0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":P(e);break;case "vertices":this.vertices=(new L).parse(e);break;case "triangles":this.primitives.push((new C).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new E).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=ia[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+
|
|
|
|
-1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};y.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,k=a.p,l=a.inputs,n,o,p,t=0,u=3,v=[];for(f=0;f<l.length;f++)switch(n=l[f],
|
|
|
|
-n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<k.length;){var w=[],x=[],y={},z=[];a.vcount&&(u=a.vcount[t++]);for(f=0;f<u;f++)for(h=0;h<l.length;h++)switch(n=l[h],source=ia[n.source],o=k[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=sa(b.vertices[o].position);w.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],
|
|
|
|
-source.data[p+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;u==3?B=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):u==4&&(B=new THREE.Face4(w[0],w[1],w[2],w[3],[x[0],x[1],x[2],x[3]],z.length?z:new THREE.Color));B.daeMaterial=a.material;b.faces.push(B);for(h=0;h<v.length;h++)f=y[v[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=l.length*u}};E.prototype=new C;E.prototype.constructor=E;C.prototype.setVertices=
|
|
|
|
-function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};C.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=la(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new R).parse(a.childNodes[b]));break;case "vcount":this.vcount=W(c.textContent);break;case "p":this.p=W(c.textContent)}}return this};H.prototype.parse=
|
|
|
|
-function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};L.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new R).parse(a.childNodes[b]),this.input[input.semantic]=
|
|
|
|
-input);return this};R.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=$(c.textContent),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?
|
|
|
|
-!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=G(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=W(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=$(c.textContent);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new H).parse(c.childNodes[e]);break}}}return this};D.prototype.read=function(){var a=[],b=this.accessor.params[0];
|
|
|
|
-switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};O.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
|
|
|
|
-"instance_effect"){this.instance_effect=(new oa).parse(a.childNodes[b]);break}return this};J.prototype.isColor=function(){return this.texture==null};J.prototype.isTexture=function(){return this.texture!=null};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=G(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),
|
|
|
|
-this.texcoord=c.getAttribute("texcoord")}}return this};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new J).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=T.evaluate(".//dae:float",c,ra,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();
|
|
|
|
-e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};N.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 e=this[c];if(e instanceof J)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=I[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ga+e.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=e.color.getHex():b||(a[c]=e.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=Ja;return this.material=new THREE.MeshLambertMaterial(a)};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=
|
|
|
|
-c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};M.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;
|
|
|
|
-break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};Y.prototype.create=function(){if(this.shader==null)return null};Y.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};Y.prototype.parseNewparam=
|
|
|
|
-function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new K(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new M(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};Y.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
|
-break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};Y.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new N(c.nodeName,this)).parse(c)}}};oa.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Z.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
|
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new D).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new U(this)).parse(c))}}return this};U.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
|
|
|
|
-b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new R).parse(c))}}return this};
|
|
|
|
|
|
+this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};w.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=U.evaluate(".//dae:instance_material",c,qa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
+null))for(var e=c.iterateNext();e;)this.instance_material.push((new y).parse(e)),e=c.iterateNext()}}return this};y.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};t.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=U.evaluate(".//dae:instance_material",
|
|
|
|
+c,qa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new y).parse(b)),b=a.iterateNext();break}}return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new A(this)).parse(c)}}return this};A.prototype.parse=function(a){function b(a,c){var e=sa(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=
|
|
|
|
+0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":Q(e);break;case "vertices":this.vertices=(new O).parse(e);break;case "triangles":this.primitives.push((new C).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new D).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=la[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+
|
|
|
|
+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,k=a.p,l=a.inputs,n,o,p,t=0,u=3,w=[];for(f=0;f<l.length;f++)switch(n=l[f],
|
|
|
|
+n.semantic){case "TEXCOORD":w.push(n.set)}for(;e<k.length;){var v=[],x=[],y={},A=[];a.vcount&&(u=a.vcount[t++]);for(f=0;f<u;f++)for(h=0;h<l.length;h++)switch(n=l[h],source=la[n.source],o=k[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=sa(b.vertices[o].position);v.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],
|
|
|
|
+source.data[p+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;u==3?B=new THREE.Face3(v[0],v[1],v[2],[x[0],x[1],x[2]],A.length?A:new THREE.Color):u==4&&(B=new THREE.Face4(v[0],v[1],v[2],v[3],[x[0],x[1],x[2],x[3]],A.length?A:new THREE.Color));B.daeMaterial=a.material;b.faces.push(B);for(h=0;h<w.length;h++)f=y[w[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=l.length*u}};D.prototype=new C;D.prototype.constructor=D;C.prototype.setVertices=
|
|
|
|
+function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};C.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=na(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new T).parse(a.childNodes[b]));break;case "vcount":this.vcount=W(c.textContent);break;case "p":this.p=W(c.textContent)}}return this};H.prototype.parse=
|
|
|
|
+function(a){this.params=[];this.source=a.getAttribute("source");this.count=na(a,"count",0);this.stride=na(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};O.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new T).parse(a.childNodes[b]),this.input[input.semantic]=
|
|
|
|
+input);return this};T.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=na(a,"set",-1);this.offset=na(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=Z(c.textContent),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?
|
|
|
|
+!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=G(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=W(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=Z(c.textContent);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new H).parse(c.childNodes[e]);break}}}return this};E.prototype.read=function(){var a=[],b=this.accessor.params[0];
|
|
|
|
+switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};S.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
|
|
|
|
+"instance_effect"){this.instance_effect=(new oa).parse(a.childNodes[b]);break}return this};K.prototype.isColor=function(){return this.texture==null};K.prototype.isTexture=function(){return this.texture!=null};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=G(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),
|
|
|
|
+this.texcoord=c.getAttribute("texcoord")}}return this};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new K).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=U.evaluate(".//dae:float",c,qa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();
|
|
|
|
+e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};N.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 e=this[c];if(e instanceof K)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=I[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ca+e.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=e.color.getHex():b||(a[c]=e.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=Ga;return this.material=new THREE.MeshLambertMaterial(a)};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=
|
|
|
|
+c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;
|
|
|
|
+break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};X.prototype.create=function(){if(this.shader==null)return null};X.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};X.prototype.parseNewparam=
|
|
|
|
+function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new L(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new J(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};X.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
|
|
|
|
+break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};X.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new N(c.nodeName,this)).parse(c)}}};oa.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Y.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
|
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new E).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new V(this)).parse(c))}}return this};V.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
|
|
|
|
+b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new T).parse(c))}}return this};
|
|
o.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
o.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
|
|
Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
|
|
-200))na=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ja=a},applySkin:l,geometries:ka}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
|
|
|
+200))ea=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ga=a},applySkin:l,geometries:ka}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
THREE.JSONLoader.prototype.load=function(a,c,b){var e,l=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){l.createModel(a.data,c,b);l.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
THREE.JSONLoader.prototype.load=function(a,c,b){var e,l=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){l.createModel(a.data,c,b);l.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
|
|
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,l=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,l,t,v,p,x,w,z,u,B,y,E,C,H=a.faces;p=a.vertices;var L=a.normals,R=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];t=0;for(v=p.length;t<v;)x=new THREE.Vertex,x.position.x=p[t++]*b,x.position.y=
|
|
|
|
-p[t++]*b,x.position.z=p[t++]*b,e.vertices.push(x);t=0;for(v=H.length;t<v;){b=H[t++];p=b&1;l=b&2;c=b&4;k=b&8;w=b&16;x=b&32;u=b&64;b&=128;p?(B=new THREE.Face4,B.a=H[t++],B.b=H[t++],B.c=H[t++],B.d=H[t++],p=4):(B=new THREE.Face3,B.a=H[t++],B.b=H[t++],B.c=H[t++],p=3);if(l)l=H[t++],B.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<D;c++)y=a.uvs[c],z=H[t++],C=y[z*2],z=y[z*2+1],e.faceUvs[c][l]=new THREE.UV(C,z);if(k)for(c=0;c<D;c++){y=a.uvs[c];E=[];for(k=0;k<p;k++)z=H[t++],C=y[z*2],z=y[z*2+1],E[k]=new THREE.UV(C,
|
|
|
|
-z);e.faceVertexUvs[c][l]=E}if(w)w=H[t++]*3,k=new THREE.Vector3,k.x=L[w++],k.y=L[w++],k.z=L[w],B.normal=k;if(x)for(c=0;c<p;c++)w=H[t++]*3,k=new THREE.Vector3,k.x=L[w++],k.y=L[w++],k.z=L[w],B.vertexNormals.push(k);if(u)x=H[t++],x=new THREE.Color(R[x]),B.color=x;if(b)for(c=0;c<p;c++)x=H[t++],x=new THREE.Color(R[x]),B.vertexColors.push(x);e.faces.push(B)}}})(l);(function(){var b,c,k,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)k=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(k,
|
|
|
|
-l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)k=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(k,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,k,l,t,v,p,x,w,z;c=0;for(k=a.morphTargets.length;c<k;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];w=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;l=0;for(t=z.length;l<t;l+=3)v=z[l]*b,p=z[l+1]*
|
|
|
|
-b,x=z[l+2]*b,w.push(new THREE.Vertex(new THREE.Vector3(v,p,x)))}}if(a.morphColors!==void 0){c=0;for(k=a.morphColors.length;c<k;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];t=e.morphColors[c].colors;v=a.morphColors[c].colors;b=0;for(l=v.length;b<l;b+=3)p=new THREE.Color(16755200),p.setRGB(v[b],v[b+1],v[b+2]),t.push(p)}}})(l);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
|
|
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,l=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,l,p,v,u,x,w,y,t,B,A,D,C,H=a.faces;u=a.vertices;var O=a.normals,T=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];p=0;for(v=u.length;p<v;)x=new THREE.Vertex,x.position.x=u[p++]*b,x.position.y=
|
|
|
|
+u[p++]*b,x.position.z=u[p++]*b,e.vertices.push(x);p=0;for(v=H.length;p<v;){b=H[p++];u=b&1;l=b&2;c=b&4;k=b&8;w=b&16;x=b&32;t=b&64;b&=128;u?(B=new THREE.Face4,B.a=H[p++],B.b=H[p++],B.c=H[p++],B.d=H[p++],u=4):(B=new THREE.Face3,B.a=H[p++],B.b=H[p++],B.c=H[p++],u=3);if(l)l=H[p++],B.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<E;c++)A=a.uvs[c],y=H[p++],C=A[y*2],y=A[y*2+1],e.faceUvs[c][l]=new THREE.UV(C,y);if(k)for(c=0;c<E;c++){A=a.uvs[c];D=[];for(k=0;k<u;k++)y=H[p++],C=A[y*2],y=A[y*2+1],D[k]=new THREE.UV(C,
|
|
|
|
+y);e.faceVertexUvs[c][l]=D}if(w)w=H[p++]*3,k=new THREE.Vector3,k.x=O[w++],k.y=O[w++],k.z=O[w],B.normal=k;if(x)for(c=0;c<u;c++)w=H[p++]*3,k=new THREE.Vector3,k.x=O[w++],k.y=O[w++],k.z=O[w],B.vertexNormals.push(k);if(t)x=H[p++],x=new THREE.Color(T[x]),B.color=x;if(b)for(c=0;c<u;c++)x=H[p++],x=new THREE.Color(T[x]),B.vertexColors.push(x);e.faces.push(B)}}})(l);(function(){var b,c,k,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)k=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(k,
|
|
|
|
+l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)k=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(k,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,k,l,p,v,u,x,w,y;c=0;for(k=a.morphTargets.length;c<k;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];w=e.morphTargets[c].vertices;y=a.morphTargets[c].vertices;l=0;for(p=y.length;l<p;l+=3)v=y[l]*b,u=y[l+1]*
|
|
|
|
+b,x=y[l+2]*b,w.push(new THREE.Vertex(new THREE.Vector3(v,u,x)))}}if(a.morphColors!==void 0){c=0;for(k=a.morphColors.length;c<k;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];p=e.morphColors[c].colors;v=a.morphColors[c].colors;b=0;for(l=v.length;b<l;b+=3)u=new THREE.Color(16755200),u.setRGB(v[b],v[b+1],v[b+2]),p.push(u)}}})(l);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var l=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:l+"/"+a}function k(){for(w in M.objects)if(!P.objects[w])if(E=M.objects[w],E.geometry!==void 0){if(R=P.geometries[E.geometry]){var a=!1;for(G=0;G<E.materials.length;G++)N=P.materials[E.materials[G]],a=N instanceof THREE.ShaderMaterial;a&&R.computeTangents();C=E.position;r=E.rotation;q=E.quaternion;
|
|
|
|
-s=E.scale;q=0;N.length==0&&(N=new THREE.MeshFaceMaterial);N.length>1&&(N=new THREE.MeshFaceMaterial);object=new THREE.Mesh(R,N);object.name=w;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;P.scene.add(object);P.objects[w]=object;E.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(a));if(E.castsShadow)a=
|
|
|
|
-new THREE.ShadowVolume(R),P.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(a={type:E.trigger,object:E},P.triggers[object.name]=a)}}else C=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
|
|
|
|
-E.visible!==void 0?E.visible:!1,P.scene.add(object),P.objects[w]=object,P.empties[w]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(a={type:E.trigger,object:E},P.triggers[object.name]=a)}function n(a){return function(c){P.geometries[a]=c;k();oa-=1;b.onLoadComplete();v()}}function t(a){return function(b){P.geometries[a]=b}}function v(){b.callbackProgress({totalModels:U,totalTextures:o,loadedModels:U-oa,loadedTextures:o-Z},P);b.onLoadProgress();oa==0&&Z==0&&c(P)}var p,x,w,z,u,B,y,E,C,H,L,R,D,O,
|
|
|
|
-J,N,K,M,Y,oa,Z,U,o,P;M=a.data;J=new THREE.BinaryLoader;Y=new THREE.JSONLoader;Z=oa=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(w in M.objects)if(E=M.objects[w],E.meshCollider){a=!0;break}if(a)P.scene.collisions=new THREE.CollisionSystem;if(M.transform){a=M.transform.position;H=M.transform.rotation;var ra=M.transform.scale;a&&P.scene.position.set(a[0],a[1],a[2]);H&&P.scene.rotation.set(H[0],H[1],H[2]);ra&&
|
|
|
|
-P.scene.scale.set(ra[0],ra[1],ra[2]);(a||H||ra)&&P.scene.updateMatrix()}a=function(){Z-=1;v();b.onLoadComplete()};for(u in M.cameras)H=M.cameras[u],H.type=="perspective"?D=new THREE.PerspectiveCamera(H.fov,H.aspect,H.near,H.far):H.type=="ortho"&&(D=new THREE.OrthographicCamera(H.left,H.right,H.top,H.bottom,H.near,H.far)),C=H.position,H=H.target,D.position.set(C[0],C[1],C[2]),D.target=new THREE.Vector3(H[0],H[1],H[2]),P.cameras[u]=D;for(z in M.lights)u=M.lights[z],D=u.color!==void 0?u.color:16777215,
|
|
|
|
-H=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(C=u.direction,K=new THREE.DirectionalLight(D,H),K.position.set(C[0],C[1],C[2]),K.position.normalize()):u.type=="point"?(C=u.position,d=u.distance,K=new THREE.PointLight(D,H,d),K.position.set(C[0],C[1],C[2])):u.type=="ambient"&&(K=new THREE.AmbientLight(D)),P.scene.add(K),P.lights[z]=K;for(B in M.fogs)z=M.fogs[B],z.type=="linear"?O=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(O=new THREE.FogExp2(0,z.density)),H=z.color,O.color.setRGB(H[0],
|
|
|
|
-H[1],H[2]),P.fogs[B]=O;if(P.cameras&&M.defaults.camera)P.currentCamera=P.cameras[M.defaults.camera];if(P.fogs&&M.defaults.fog)P.scene.fog=P.fogs[M.defaults.fog];H=M.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(H[0],H[1],H[2]);P.bgColorAlpha=M.defaults.bgalpha;for(p in M.geometries)if(B=M.geometries[p],B.type=="bin_mesh"||B.type=="ascii_mesh")oa+=1,b.onLoadStart();U=oa;for(p in M.geometries)B=M.geometries[p],B.type=="cube"?(R=new THREE.CubeGeometry(B.width,B.height,B.depth,B.segmentsWidth,
|
|
|
|
-B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),P.geometries[p]=R):B.type=="plane"?(R=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),P.geometries[p]=R):B.type=="sphere"?(R=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),P.geometries[p]=R):B.type=="cylinder"?(R=new THREE.CylinderGeometry(B.topRad,B.botRad,B.height,B.radSegs,B.heightSegs),P.geometries[p]=R):B.type=="torus"?(R=new THREE.TorusGeometry(B.radius,B.tube,B.segmentsR,B.segmentsT),P.geometries[p]=
|
|
|
|
-R):B.type=="icosahedron"?(R=new THREE.IcosahedronGeometry(B.subdivisions),P.geometries[p]=R):B.type=="bin_mesh"?J.load(e(B.url,M.urlBaseType),n(p)):B.type=="ascii_mesh"?Y.load(e(B.url,M.urlBaseType),n(p)):B.type=="embedded_mesh"&&(B=M.embeds[B.id])&&Y.createModel(B,t(p),"");for(y in M.textures)if(p=M.textures[y],p.url instanceof Array){Z+=p.url.length;for(J=0;J<p.url.length;J++)b.onLoadStart()}else Z+=1,b.onLoadStart();o=Z;for(y in M.textures){p=M.textures[y];if(p.mapping!=void 0&&THREE[p.mapping]!=
|
|
|
|
-void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){J=[];for(var G=0;G<p.url.length;G++)J[G]=e(p.url[G],M.urlBaseType);J=THREE.ImageUtils.loadTextureCube(J,p.mapping,a)}else{J=THREE.ImageUtils.loadTexture(e(p.url,M.urlBaseType),p.mapping,a);if(THREE[p.minFilter]!=void 0)J.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)J.magFilter=THREE[p.magFilter];if(p.repeat){J.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=1)J.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)J.wrapT=THREE.RepeatWrapping}p.offset&&
|
|
|
|
-J.offset.set(p.offset[0],p.offset[1]);if(p.wrap){Y={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Y[p.wrap[0]]!==void 0)J.wrapS=Y[p.wrap[0]];if(Y[p.wrap[1]]!==void 0)J.wrapT=Y[p.wrap[1]]}}P.textures[y]=J}for(x in M.materials){y=M.materials[x];for(L in y.parameters)if(L=="envMap"||L=="map"||L=="lightMap")y.parameters[L]=P.textures[y.parameters[L]];else if(L=="shading")y.parameters[L]=y.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")y.parameters[L]=
|
|
|
|
-THREE[y.parameters[L]]?THREE[y.parameters[L]]:THREE.NormalBlending;else if(L=="combine")y.parameters[L]=y.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(y.parameters[L]=="face")y.parameters[L]=THREE.FaceColors;else if(y.parameters[L])y.parameters[L]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;if(y.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);
|
|
|
|
-J=y.parameters.color;Y=y.parameters.specular;B=y.parameters.ambient;O=y.parameters.shininess;a.tNormal.texture=P.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=P.textures[y.parameters.specularMap],a.enableSpecular.value=!0;
|
|
|
|
-a.uDiffuseColor.value.setHex(J);a.uSpecularColor.value.setHex(Y);a.uAmbientColor.value.setHex(B);a.uShininess.value=O;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);P.materials[x]=y}k();b.callbackSync(P);v()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
|
|
|
|
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var l=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:l+"/"+a}function k(){for(w in J.objects)if(!Q.objects[w])if(D=J.objects[w],D.geometry!==void 0){if(T=Q.geometries[D.geometry]){var a=!1;for(G=0;G<D.materials.length;G++)N=Q.materials[D.materials[G]],a=N instanceof THREE.ShaderMaterial;a&&T.computeTangents();C=D.position;r=D.rotation;q=D.quaternion;
|
|
|
|
+s=D.scale;q=0;N.length==0&&(N=new THREE.MeshFaceMaterial);N.length>1&&(N=new THREE.MeshFaceMaterial);object=new THREE.Mesh(T,N);object.name=w;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;Q.scene.add(object);Q.objects[w]=object;D.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(a));if(D.castsShadow)a=
|
|
|
|
+new THREE.ShadowVolume(T),Q.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(a={type:D.trigger,object:D},Q.triggers[object.name]=a)}}else C=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
|
|
|
|
+D.visible!==void 0?D.visible:!1,Q.scene.add(object),Q.objects[w]=object,Q.empties[w]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(a={type:D.trigger,object:D},Q.triggers[object.name]=a)}function n(a){return function(c){Q.geometries[a]=c;k();oa-=1;b.onLoadComplete();v()}}function p(a){return function(b){Q.geometries[a]=b}}function v(){b.callbackProgress({totalModels:V,totalTextures:o,loadedModels:V-oa,loadedTextures:o-Y},Q);b.onLoadProgress();oa==0&&Y==0&&c(Q)}var u,x,w,y,t,B,A,D,C,H,O,T,E,S,
|
|
|
|
+K,N,L,J,X,oa,Y,V,o,Q;J=a.data;K=new THREE.BinaryLoader;X=new THREE.JSONLoader;Y=oa=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(w in J.objects)if(D=J.objects[w],D.meshCollider){a=!0;break}if(a)Q.scene.collisions=new THREE.CollisionSystem;if(J.transform){a=J.transform.position;H=J.transform.rotation;var qa=J.transform.scale;a&&Q.scene.position.set(a[0],a[1],a[2]);H&&Q.scene.rotation.set(H[0],H[1],H[2]);qa&&
|
|
|
|
+Q.scene.scale.set(qa[0],qa[1],qa[2]);(a||H||qa)&&Q.scene.updateMatrix()}a=function(){Y-=1;v();b.onLoadComplete()};for(t in J.cameras)H=J.cameras[t],H.type=="perspective"?E=new THREE.PerspectiveCamera(H.fov,H.aspect,H.near,H.far):H.type=="ortho"&&(E=new THREE.OrthographicCamera(H.left,H.right,H.top,H.bottom,H.near,H.far)),C=H.position,H=H.target,E.position.set(C[0],C[1],C[2]),E.target=new THREE.Vector3(H[0],H[1],H[2]),Q.cameras[t]=E;for(y in J.lights)t=J.lights[y],E=t.color!==void 0?t.color:16777215,
|
|
|
|
+H=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(C=t.direction,L=new THREE.DirectionalLight(E,H),L.position.set(C[0],C[1],C[2]),L.position.normalize()):t.type=="point"?(C=t.position,d=t.distance,L=new THREE.PointLight(E,H,d),L.position.set(C[0],C[1],C[2])):t.type=="ambient"&&(L=new THREE.AmbientLight(E)),Q.scene.add(L),Q.lights[y]=L;for(B in J.fogs)y=J.fogs[B],y.type=="linear"?S=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(S=new THREE.FogExp2(0,y.density)),H=y.color,S.color.setRGB(H[0],
|
|
|
|
+H[1],H[2]),Q.fogs[B]=S;if(Q.cameras&&J.defaults.camera)Q.currentCamera=Q.cameras[J.defaults.camera];if(Q.fogs&&J.defaults.fog)Q.scene.fog=Q.fogs[J.defaults.fog];H=J.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(H[0],H[1],H[2]);Q.bgColorAlpha=J.defaults.bgalpha;for(u in J.geometries)if(B=J.geometries[u],B.type=="bin_mesh"||B.type=="ascii_mesh")oa+=1,b.onLoadStart();V=oa;for(u in J.geometries)B=J.geometries[u],B.type=="cube"?(T=new THREE.CubeGeometry(B.width,B.height,B.depth,B.segmentsWidth,
|
|
|
|
+B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),Q.geometries[u]=T):B.type=="plane"?(T=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),Q.geometries[u]=T):B.type=="sphere"?(T=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),Q.geometries[u]=T):B.type=="cylinder"?(T=new THREE.CylinderGeometry(B.topRad,B.botRad,B.height,B.radSegs,B.heightSegs),Q.geometries[u]=T):B.type=="torus"?(T=new THREE.TorusGeometry(B.radius,B.tube,B.segmentsR,B.segmentsT),Q.geometries[u]=
|
|
|
|
+T):B.type=="icosahedron"?(T=new THREE.IcosahedronGeometry(B.subdivisions),Q.geometries[u]=T):B.type=="bin_mesh"?K.load(e(B.url,J.urlBaseType),n(u)):B.type=="ascii_mesh"?X.load(e(B.url,J.urlBaseType),n(u)):B.type=="embedded_mesh"&&(B=J.embeds[B.id])&&X.createModel(B,p(u),"");for(A in J.textures)if(u=J.textures[A],u.url instanceof Array){Y+=u.url.length;for(K=0;K<u.url.length;K++)b.onLoadStart()}else Y+=1,b.onLoadStart();o=Y;for(A in J.textures){u=J.textures[A];if(u.mapping!=void 0&&THREE[u.mapping]!=
|
|
|
|
+void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){K=[];for(var G=0;G<u.url.length;G++)K[G]=e(u.url[G],J.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,u.mapping,a)}else{K=THREE.ImageUtils.loadTexture(e(u.url,J.urlBaseType),u.mapping,a);if(THREE[u.minFilter]!=void 0)K.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)K.magFilter=THREE[u.magFilter];if(u.repeat){K.repeat.set(u.repeat[0],u.repeat[1]);if(u.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}u.offset&&
|
|
|
|
+K.offset.set(u.offset[0],u.offset[1]);if(u.wrap){X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(X[u.wrap[0]]!==void 0)K.wrapS=X[u.wrap[0]];if(X[u.wrap[1]]!==void 0)K.wrapT=X[u.wrap[1]]}}Q.textures[A]=K}for(x in J.materials){A=J.materials[x];for(O in A.parameters)if(O=="envMap"||O=="map"||O=="lightMap")A.parameters[O]=Q.textures[A.parameters[O]];else if(O=="shading")A.parameters[O]=A.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")A.parameters[O]=
|
|
|
|
+THREE[A.parameters[O]]?THREE[A.parameters[O]]:THREE.NormalBlending;else if(O=="combine")A.parameters[O]=A.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(O=="vertexColors")if(A.parameters[O]=="face")A.parameters[O]=THREE.FaceColors;else if(A.parameters[O])A.parameters[O]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=!0;if(A.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(u.uniforms);
|
|
|
|
+K=A.parameters.color;X=A.parameters.specular;B=A.parameters.ambient;S=A.parameters.shininess;a.tNormal.texture=Q.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)a.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)a.tDiffuse.texture=A.parameters.map,a.enableDiffuse.value=!0;if(A.parameters.lightMap)a.tAO.texture=A.parameters.lightMap,a.enableAO.value=!0;if(A.parameters.specularMap)a.tSpecular.texture=Q.textures[A.parameters.specularMap],a.enableSpecular.value=!0;
|
|
|
|
+a.uDiffuseColor.value.setHex(K);a.uSpecularColor.value.setHex(X);a.uAmbientColor.value.setHex(B);a.uShininess.value=S;if(A.parameters.opacity)a.uOpacity.value=A.parameters.opacity;A=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:a,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);Q.materials[x]=A}k();b.callbackSync(Q);v()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
|
|
THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,l=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,l=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
|
|
c,l,h,f,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,l=0;l<8;l++){for(var h=0,f=0;f<c;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);b[8*f+l]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(l=f=0;l<c;l++)k=a.charCodeAt(l+e),h[l]=f-k,k==0&&f++;return[b,h]};
|
|
c,l,h,f,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,l=0;l<8;l++){for(var h=0,f=0;f<c;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);b[8*f+l]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(l=f=0;l<c;l++)k=a.charCodeAt(l+e),h[l]=f-k,k==0&&f++;return[b,h]};
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,l,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),t=[],v=[];(function(a,f,n){for(var t,u,v,y=a.length;n<y;n+=f)t=a[n],u=a[n+1],v=a[n+2],t=t/16383*b,u=u/16383*b,v=v/16383*b,t+=e,u+=l,v+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,v)))})(f[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,v.push(e,1-f)})(f[0],8,3);(function(a,
|
|
|
|
-b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,t.push(e,f,h)})(f[0],8,5);(function(a){var b,e,f,h,l,n,E,C,H,L=a.length;for(b=0;b<L;b+=3){e=a[b];f=a[b+1];h=a[b+2];l=c;C=e;H=f;n=h;E=e;var R=f,D=h,O=l.materials[0],J=t[R*3],N=t[R*3+1],R=t[R*3+2],K=t[D*3],M=t[D*3+1],D=t[D*3+2];E=new THREE.Vector3(t[E*3],t[E*3+1],t[E*3+2]);R=new THREE.Vector3(J,N,R);D=new THREE.Vector3(K,M,D);l.faces.push(new THREE.Face3(C,H,n,[E,R,D],null,O));l=v[e*2];e=v[e*2+
|
|
|
|
-1];n=v[f*2];E=v[f*2+1];C=v[h*2];H=v[h*2+1];h=c.faceVertexUvs[0];f=n;n=E;E=[];E.push(new THREE.UV(l,e));E.push(new THREE.UV(f,n));E.push(new THREE.UV(C,H));h.push(E)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
|
|
|
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,l,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),p=[],v=[];(function(a,f,n){for(var p,t,v,A=a.length;n<A;n+=f)p=a[n],t=a[n+1],v=a[n+2],p=p/16383*b,t=t/16383*b,v=v/16383*b,p+=e,t+=l,v+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,t,v)))})(f[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,v.push(e,1-f)})(f[0],8,3);(function(a,
|
|
|
|
+b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,p.push(e,f,h)})(f[0],8,5);(function(a){var b,e,f,h,l,n,D,C,H,O=a.length;for(b=0;b<O;b+=3){e=a[b];f=a[b+1];h=a[b+2];l=c;C=e;H=f;n=h;D=e;var T=f,E=h,S=l.materials[0],K=p[T*3],N=p[T*3+1],T=p[T*3+2],L=p[E*3],J=p[E*3+1],E=p[E*3+2];D=new THREE.Vector3(p[D*3],p[D*3+1],p[D*3+2]);T=new THREE.Vector3(K,N,T);E=new THREE.Vector3(L,J,E);l.faces.push(new THREE.Face3(C,H,n,[D,T,E],null,S));l=v[e*2];e=v[e*2+
|
|
|
|
+1];n=v[f*2];D=v[f*2+1];C=v[h*2];H=v[h*2+1];h=c.faceVertexUvs[0];f=n;n=D;D=[];D.push(new THREE.UV(l,e));D.push(new THREE.UV(f,n));D.push(new THREE.UV(C,H));h.push(D)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
|
|
b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,l){return a+(c-a)*l};this.VIntX=function(a,c,l,h,f,k,n,t,v,p){f=(f-v)/(p-v);v=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=n;c[h+2]=t;l[h]=this.lerp(v[a],v[a+3],f);l[h+1]=this.lerp(v[a+1],v[a+4],f);l[h+2]=this.lerp(v[a+2],v[a+5],f)};this.VIntY=function(a,c,l,h,f,k,n,t,v,p){f=(f-v)/(p-v);v=this.normal_cache;c[h]=k;c[h+1]=n+f*this.delta;c[h+
|
|
|
|
-2]=t;c=a+this.yd*3;l[h]=this.lerp(v[a],v[c],f);l[h+1]=this.lerp(v[a+1],v[c+1],f);l[h+2]=this.lerp(v[a+2],v[c+2],f)};this.VIntZ=function(a,c,l,h,f,k,n,t,v,p){f=(f-v)/(p-v);v=this.normal_cache;c[h]=k;c[h+1]=n;c[h+2]=t+f*this.delta;c=a+this.zd*3;l[h]=this.lerp(v[a],v[c],f);l[h+1]=this.lerp(v[a+1],v[c+1],f);l[h+2]=this.lerp(v[a+2],v[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
|
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,l,h,f,k){var n=h+1,t=h+this.yd,v=h+this.zd,p=n+this.yd,x=n+this.zd,w=h+this.yd+this.zd,z=n+this.yd+this.zd,u=0,B=this.field[h],y=this.field[n],E=this.field[t],C=this.field[p],H=this.field[v],L=this.field[x],R=this.field[w],D=this.field[z];B<f&&(u|=1);y<f&&(u|=2);E<f&&(u|=8);C<f&&(u|=4);H<f&&(u|=16);L<f&&(u|=32);R<f&&(u|=128);D<f&&(u|=64);var O=THREE.edgeTable[u];if(O===0)return 0;
|
|
|
|
-var J=this.delta,N=a+J,K=c+J,J=l+J;O&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,l,B,y));O&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,f,N,c,l,y,C));O&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,f,a,K,l,E,C));O&8&&(this.compNorm(h),this.compNorm(t),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,l,B,E));O&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,f,a,c,J,H,L));
|
|
|
|
-O&32&&(this.compNorm(x),this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,f,N,c,J,L,D));O&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,f,a,K,J,R,D));O&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,f,a,c,J,H,R));O&256&&(this.compNorm(h),this.compNorm(v),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,l,B,H));O&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,f,N,c,l,y,L));O&1024&&(this.compNorm(p),
|
|
|
|
-this.compNorm(z),this.VIntZ(p*3,this.vlist,this.nlist,30,f,N,K,l,C,D));O&2048&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*3,this.vlist,this.nlist,33,f,a,K,l,E,R));u<<=4;for(f=h=0;THREE.triTable[u+f]!=-1;)a=u+f,c=a+1,l=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[l],k),f+=3,h++;return h};this.posnormtriv=function(a,c,l,h,f,k){var n=this.count*3;this.positionArray[n]=a[l];this.positionArray[n+1]=a[l+1];this.positionArray[n+2]=a[l+2];this.positionArray[n+
|
|
|
|
|
|
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,l){return a+(c-a)*l};this.VIntX=function(a,c,l,h,f,k,n,p,v,u){f=(f-v)/(u-v);v=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=n;c[h+2]=p;l[h]=this.lerp(v[a],v[a+3],f);l[h+1]=this.lerp(v[a+1],v[a+4],f);l[h+2]=this.lerp(v[a+2],v[a+5],f)};this.VIntY=function(a,c,l,h,f,k,n,p,v,u){f=(f-v)/(u-v);v=this.normal_cache;c[h]=k;c[h+1]=n+f*this.delta;c[h+
|
|
|
|
+2]=p;c=a+this.yd*3;l[h]=this.lerp(v[a],v[c],f);l[h+1]=this.lerp(v[a+1],v[c+1],f);l[h+2]=this.lerp(v[a+2],v[c+2],f)};this.VIntZ=function(a,c,l,h,f,k,n,p,v,u){f=(f-v)/(u-v);v=this.normal_cache;c[h]=k;c[h+1]=n;c[h+2]=p+f*this.delta;c=a+this.zd*3;l[h]=this.lerp(v[a],v[c],f);l[h+1]=this.lerp(v[a+1],v[c+1],f);l[h+2]=this.lerp(v[a+2],v[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
|
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,l,h,f,k){var n=h+1,p=h+this.yd,v=h+this.zd,u=n+this.yd,x=n+this.zd,w=h+this.yd+this.zd,y=n+this.yd+this.zd,t=0,B=this.field[h],A=this.field[n],D=this.field[p],C=this.field[u],H=this.field[v],O=this.field[x],T=this.field[w],E=this.field[y];B<f&&(t|=1);A<f&&(t|=2);D<f&&(t|=8);C<f&&(t|=4);H<f&&(t|=16);O<f&&(t|=32);T<f&&(t|=128);E<f&&(t|=64);var S=THREE.edgeTable[t];if(S===0)return 0;
|
|
|
|
+var K=this.delta,N=a+K,L=c+K,K=l+K;S&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,l,B,A));S&2&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,3,f,N,c,l,A,C));S&4&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,6,f,a,L,l,D,C));S&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,l,B,D));S&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,f,a,c,K,H,O));
|
|
|
|
+S&32&&(this.compNorm(x),this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,f,N,c,K,O,E));S&64&&(this.compNorm(w),this.compNorm(y),this.VIntX(w*3,this.vlist,this.nlist,18,f,a,L,K,T,E));S&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,f,a,c,K,H,T));S&256&&(this.compNorm(h),this.compNorm(v),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,l,B,H));S&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,f,N,c,l,A,O));S&1024&&(this.compNorm(u),
|
|
|
|
+this.compNorm(y),this.VIntZ(u*3,this.vlist,this.nlist,30,f,N,L,l,C,E));S&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,f,a,L,l,D,T));t<<=4;for(f=h=0;THREE.triTable[t+f]!=-1;)a=t+f,c=a+1,l=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[l],k),f+=3,h++;return h};this.posnormtriv=function(a,c,l,h,f,k){var n=this.count*3;this.positionArray[n]=a[l];this.positionArray[n+1]=a[l+1];this.positionArray[n+2]=a[l+2];this.positionArray[n+
|
|
3]=a[h];this.positionArray[n+4]=a[h+1];this.positionArray[n+5]=a[h+2];this.positionArray[n+6]=a[f];this.positionArray[n+7]=a[f+1];this.positionArray[n+8]=a[f+2];this.normalArray[n]=c[l];this.normalArray[n+1]=c[l+1];this.normalArray[n+2]=c[l+2];this.normalArray[n+3]=c[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[f];this.normalArray[n+7]=c[f+1];this.normalArray[n+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
|
|
3]=a[h];this.positionArray[n+4]=a[h+1];this.positionArray[n+5]=a[h+2];this.positionArray[n+6]=a[f];this.positionArray[n+7]=a[f+1];this.positionArray[n+8]=a[f+2];this.normalArray[n]=c[l];this.normalArray[n+1]=c[l+1];this.normalArray[n+2]=c[l+2];this.normalArray[n+3]=c[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[f];this.normalArray[n+7]=c[f+1];this.normalArray[n+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(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;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,l,h,f){var k=this.size*Math.sqrt(h/f),n=l*this.size,t=c*this.size,v=a*this.size,p=Math.floor(n-k);p<1&&(p=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var x=Math.floor(t-k);x<1&&(x=1);t=Math.floor(t+k);t>this.size-1&&(t=this.size-1);var w=Math.floor(v-k);w<1&&(w=1);k=Math.floor(v+k);
|
|
|
|
-k>this.size-1&&(k=this.size-1);for(var z,u,B,y,E,C;p<n;p++){v=this.size2*p;u=p/this.size-l;E=u*u;for(u=x;u<t;u++){B=v+this.size*u;z=u/this.size-c;C=z*z;for(z=w;z<k;z++)y=z/this.size-a,y=h/(1.0E-6+y*y+C+E)-f,y>0&&(this.field[B+z]+=y)}}};this.addPlaneX=function(a,c){var l,h,f,k,n,t=this.size,v=this.yd,p=this.zd,x=this.field,w=t*Math.sqrt(a/c);w>t&&(w=t);for(l=0;l<w;l++)if(h=l/t,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<t;h++){n=l+h*v;for(f=0;f<t;f++)x[p*f+n]+=k}};this.addPlaneY=function(a,c){var l,h,f,k,
|
|
|
|
-n,t,v=this.size,p=this.yd,x=this.zd,w=this.field,z=v*Math.sqrt(a/c);z>v&&(z=v);for(h=0;h<z;h++)if(l=h/v,l*=l,k=a/(1.0E-4+l)-c,k>0){n=h*p;for(l=0;l<v;l++){t=n+l;for(f=0;f<v;f++)w[x*f+t]+=k}}};this.addPlaneZ=function(a,c){var l,h,f,k,n,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(l=f/size,l*=l,k=a/(1.0E-4+l)-c,k>0){n=zd*f;for(h=0;h<size;h++){t=n+h*yd;for(l=0;l<size;l++)field[t+l]+=k}}};this.reset=function(){var a;for(a=
|
|
|
|
-0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,l,h,f,k,n,t,v,p,x=this.size-2;for(f=1;f<x;f++){p=this.size2*f;t=(f-this.halfsize)/this.halfsize;for(h=1;h<x;h++){v=p+this.size*h;n=(h-this.halfsize)/this.halfsize;for(l=1;l<x;l++)k=(l-this.halfsize)/this.halfsize,c=v+l,this.polygonize(k,n,t,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,l=[];this.render(function(h){var f,k,n,t,v,p,x,w;for(f=0;f<h.count;f++)x=
|
|
|
|
-f*3,v=x+1,w=x+2,k=h.positionArray[x],n=h.positionArray[v],t=h.positionArray[w],p=new THREE.Vector3(k,n,t),k=h.normalArray[x],n=h.normalArray[v],t=h.normalArray[w],x=new THREE.Vector3(k,n,t),x.normalize(),v=new THREE.Vertex(p),c.vertices.push(v),l.push(x);nfaces=h.count/3;for(f=0;f<nfaces;f++)x=(a+f)*3,v=x+1,w=x+2,p=l[x],k=l[v],n=l[w],x=new THREE.Face3(x,v,w,[p,k,n]),c.faces.push(x);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
|
|
|
|
|
|
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,l,h,f){var k=this.size*Math.sqrt(h/f),n=l*this.size,p=c*this.size,v=a*this.size,u=Math.floor(n-k);u<1&&(u=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var x=Math.floor(p-k);x<1&&(x=1);p=Math.floor(p+k);p>this.size-1&&(p=this.size-1);var w=Math.floor(v-k);w<1&&(w=1);k=Math.floor(v+k);
|
|
|
|
+k>this.size-1&&(k=this.size-1);for(var y,t,B,A,D,C;u<n;u++){v=this.size2*u;t=u/this.size-l;D=t*t;for(t=x;t<p;t++){B=v+this.size*t;y=t/this.size-c;C=y*y;for(y=w;y<k;y++)A=y/this.size-a,A=h/(1.0E-6+A*A+C+D)-f,A>0&&(this.field[B+y]+=A)}}};this.addPlaneX=function(a,c){var l,h,f,k,n,p=this.size,v=this.yd,u=this.zd,x=this.field,w=p*Math.sqrt(a/c);w>p&&(w=p);for(l=0;l<w;l++)if(h=l/p,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<p;h++){n=l+h*v;for(f=0;f<p;f++)x[u*f+n]+=k}};this.addPlaneY=function(a,c){var l,h,f,k,
|
|
|
|
+n,p,v=this.size,u=this.yd,x=this.zd,w=this.field,y=v*Math.sqrt(a/c);y>v&&(y=v);for(h=0;h<y;h++)if(l=h/v,l*=l,k=a/(1.0E-4+l)-c,k>0){n=h*u;for(l=0;l<v;l++){p=n+l;for(f=0;f<v;f++)w[x*f+p]+=k}}};this.addPlaneZ=function(a,c){var l,h,f,k,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(f=0;f<dist;f++)if(l=f/size,l*=l,k=a/(1.0E-4+l)-c,k>0){n=zd*f;for(h=0;h<size;h++){p=n+h*yd;for(l=0;l<size;l++)field[p+l]+=k}}};this.reset=function(){var a;for(a=
|
|
|
|
+0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,l,h,f,k,n,p,v,u,x=this.size-2;for(f=1;f<x;f++){u=this.size2*f;p=(f-this.halfsize)/this.halfsize;for(h=1;h<x;h++){v=u+this.size*h;n=(h-this.halfsize)/this.halfsize;for(l=1;l<x;l++)k=(l-this.halfsize)/this.halfsize,c=v+l,this.polygonize(k,n,p,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,l=[];this.render(function(h){var f,k,n,p,v,u,x,w;for(f=0;f<h.count;f++)x=
|
|
|
|
+f*3,v=x+1,w=x+2,k=h.positionArray[x],n=h.positionArray[v],p=h.positionArray[w],u=new THREE.Vector3(k,n,p),k=h.normalArray[x],n=h.normalArray[v],p=h.normalArray[w],x=new THREE.Vector3(k,n,p),x.normalize(),v=new THREE.Vertex(u),c.vertices.push(v),l.push(x);nfaces=h.count/3;for(f=0;f<nfaces;f++)x=(a+f)*3,v=x+1,w=x+2,u=l[x],k=l[v],n=l[w],x=new THREE.Face3(x,v,w,[u,k,n]),c.faces.push(x);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
|
|
THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
@@ -703,20 +703,20 @@ THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.
|
|
THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,l,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(l=this.colliders[c],e=this.rayCast(a,l),e<Number.MAX_VALUE)l.distance=e,e>h?this.hits.push(l):this.hits.unshift(l),h=e;return this.hits};
|
|
THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,l,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(l=this.colliders[c],e=this.rayCast(a,l),e<Number.MAX_VALUE)l.distance=e,e>h?this.hits.push(l):this.hits.unshift(l),h=e;return this.hits};
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
|
|
THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
|
|
THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,l,h=0;h<c.numFaces;h++){var f=c.mesh.geometry.faces[h],k=c.mesh.geometry.vertices[f.a].position,n=c.mesh.geometry.vertices[f.b].position,t=c.mesh.geometry.vertices[f.c].position,v=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,k,n,t,e,this.collisionNormal,c.mesh),f<e&&(e=f,l=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
|
-f instanceof THREE.Face4&&(f=this.rayTriangle(b,k,n,v,e,this.collisionNormal,c.mesh),f<e&&(e=f,l=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,n,t,v,e,this.collisionNormal,c.mesh),f<e&&(e=f,l=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:l}};
|
|
|
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,l,h=0;h<c.numFaces;h++){var f=c.mesh.geometry.faces[h],k=c.mesh.geometry.vertices[f.a].position,n=c.mesh.geometry.vertices[f.b].position,p=c.mesh.geometry.vertices[f.c].position,v=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,k,n,p,e,this.collisionNormal,c.mesh),f<e&&(e=f,l=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
|
+f instanceof THREE.Face4&&(f=this.rayTriangle(b,k,n,v,e,this.collisionNormal,c.mesh),f<e&&(e=f,l=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,n,p,v,e,this.collisionNormal,c.mesh),f<e&&(e=f,l=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:l}};
|
|
THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,l,h,f){var k=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(b,c);n.sub(e,b);h.cross(k,n);k=h.dot(a.direction);if(!(k<0))if(f.doubleSided||f.flipSided)h.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;f=h.dot(c)-h.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=k*l))return Number.MAX_VALUE;f/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(f);k.addSelf(a.origin);Math.abs(h.x)>
|
|
THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,l,h,f){var k=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(b,c);n.sub(e,b);h.cross(k,n);k=h.dot(a.direction);if(!(k<0))if(f.doubleSided||f.flipSided)h.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;f=h.dot(c)-h.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=k*l))return Number.MAX_VALUE;f/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(f);k.addSelf(a.origin);Math.abs(h.x)>
|
|
Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-c.y,h=b.y-c.y,l=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,l=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-c.x,h=b.x-c.x,l=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,l=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=h*e-b*l;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*l)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return f};
|
|
Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-c.y,h=b.y-c.y,l=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,l=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-c.x,h=b.x-c.x,l=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,h=b.x-c.x,l=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=h*e-b*l;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*l)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return f};
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
|
|
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,l=0,h=0,f=0,k=0,n=0,t=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,t=!1,f=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,t=!1,f=1);b.origin.y<c.min.y?(l=c.min.y-b.origin.y,l/=b.direction.y,t=!1,k=-1):b.origin.y>c.max.y&&(l=c.max.y-b.origin.y,l/=b.direction.y,
|
|
|
|
-t=!1,k=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,t=!1,n=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,t=!1,n=1);if(t)return-1;t=0;l>e&&(t=1,e=l);h>e&&(t=2,e=h);switch(t){case 0:k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
|
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,l=0,h=0,f=0,k=0,n=0,p=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,p=!1,f=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,p=!1,f=1);b.origin.y<c.min.y?(l=c.min.y-b.origin.y,l/=b.direction.y,p=!1,k=-1):b.origin.y>c.max.y&&(l=c.max.y-b.origin.y,l/=b.direction.y,
|
|
|
|
+p=!1,k=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,p=!1,n=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,p=!1,n=1);if(p)return-1;p=0;l>e&&(p=1,e=l);h>e&&(p=2,e=h);switch(p){case 0:k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
|
|
e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:f=b.origin.x+b.direction.x*e;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
|
|
THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,l=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,k=new THREE.Matrix4,n,t,v,p;l.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),w=new THREE.WebGLRenderTarget(512,512,a),z=new THREE.PerspectiveCamera(53,
|
|
|
|
-1,1,1E4);z.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:x},mapRight:{type:"t",value:1,texture:w}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
|
|
-var u=new THREE.Scene;u.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));u.add(z);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;w.width=a;w.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||t!==b.near||v!==b.far||p!==b.fov){n=b.aspect;t=b.near;v=b.far;p=b.fov;var E=b.projectionMatrix.clone(),C=125/30*0.5,H=C*t/125,L=t*Math.tan(p*Math.PI/360),R;f.n14=C;k.n14=-C;C=-L*n+H;R=L*n+H;E.n11=2*t/(R-C);E.n13=(R+C)/(R-C);l.projectionMatrix.copy(E);C=-L*n-H;
|
|
|
|
-R=L*n-H;E.n11=2*t/(R-C);E.n13=(R+C)/(R-C);h.projectionMatrix.copy(E)}l.matrixWorld.copy(b.matrixWorld).multiplySelf(k);l.position.copy(b.position);l.near=b.near;l.far=b.far;e.call(c,a,l,x,!0);h.matrixWorld.copy(b.matrixWorld).multiplySelf(f);h.position.copy(b.position);h.near=b.near;h.far=b.far;e.call(c,a,h,w,!0);u.updateMatrixWorld();e.call(c,u,z)}};
|
|
|
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,l=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,f=new THREE.Matrix4,k=new THREE.Matrix4,n,p,v,u;l.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),w=new THREE.WebGLRenderTarget(512,512,a),y=new THREE.PerspectiveCamera(53,
|
|
|
|
+1,1,1E4);y.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:x},mapRight:{type:"t",value:1,texture:w}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
|
|
+var t=new THREE.Scene;t.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));t.add(y);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;w.width=a;w.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||p!==b.near||v!==b.far||u!==b.fov){n=b.aspect;p=b.near;v=b.far;u=b.fov;var D=b.projectionMatrix.clone(),C=125/30*0.5,H=C*p/125,O=p*Math.tan(u*Math.PI/360),T;f.n14=C;k.n14=-C;C=-O*n+H;T=O*n+H;D.n11=2*p/(T-C);D.n13=(T+C)/(T-C);l.projectionMatrix.copy(D);C=-O*n-H;
|
|
|
|
+T=O*n-H;D.n11=2*p/(T-C);D.n13=(T+C)/(T-C);h.projectionMatrix.copy(D)}l.matrixWorld.copy(b.matrixWorld).multiplySelf(k);l.position.copy(b.position);l.near=b.near;l.far=b.far;e.call(c,a,l,x,!0);h.matrixWorld.copy(b.matrixWorld).multiplySelf(f);h.position.copy(b.position);h.near=b.near;h.far=b.far;e.call(c,a,h,w,!0);t.updateMatrixWorld();e.call(c,t,y)}};
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,l,h,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);l=a/2;h=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,l,h,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);l=a/2;h=e};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
|
|
b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);k.projectionMatrix=f.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,l,h);e.call(c,a,f);this.setViewport(l,0,l,h);e.call(c,a,k,!1)}};
|
|
b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);k.projectionMatrix=f.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,l,h);e.call(c,a,f);this.setViewport(l,0,l,h);e.call(c,a,k,!1)}};
|