|
@@ -20,9 +20,9 @@ THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a
|
|
|
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
|
|
|
THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);r=o.dot(b);s=q.add(a,m.copy(b).multiplyScalar(r));return t=c.distanceTo(s)}function d(a,b,c,d){o.sub(d,b);q.sub(c,b);m.sub(a,b);u=o.dot(o);x=o.dot(q);v=o.dot(m);A=q.dot(q);D=q.dot(m);E=1/(u*A-x*x);C=(A*v-x*D)*E;F=(u*D-x*v)*E;return 0<=C&&0<=F&&1>C+F}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,c,d=[];for(b=0,
|
|
|
c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(a){for(var b,m=[],o=0,q=a.children.length;o<q;o++)Array.prototype.push.apply(m,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=
|
|
|
-c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return m;var r,j=a.geometry,s=j.vertices,t;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,q=j.faces.length;o<q;o++)if(b=j.faces[o],i.copy(this.origin),l.copy(this.direction),
|
|
|
-t=a.matrixWorld,k=t.multiplyVector3(k.copy(b.centroid)).subSelf(i),r=k.dot(l),!(0>=r)&&(e=t.multiplyVector3(e.copy(s[b.a].position)),f=t.multiplyVector3(f.copy(s[b.b].position)),g=t.multiplyVector3(g.copy(s[b.c].position)),b instanceof THREE.Face4&&(h=t.multiplyVector3(h.copy(s[b.d].position))),p=a.matrixRotationWorld.multiplyVector3(p.copy(b.normal)),r=l.dot(p),a.doubleSided||(a.flipSided?0<r:0>r)))if(r=p.dot(k.sub(e,i))/r,n.add(i,l.multiplyScalar(r)),b instanceof THREE.Face3)d(n,e,f,g)&&(b={distance:i.distanceTo(n),
|
|
|
-point:n.clone(),face:b,object:a},m.push(b));else if(b instanceof THREE.Face4&&(d(n,e,f,h)||d(n,f,g,h)))b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b)}return m};var o=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,r,s,t,u,x,v,A,D,E,C,F};
|
|
|
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return m;var r,j,s=a.geometry,t=s.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,q=s.faces.length;o<q;o++)if(b=s.faces[o],i.copy(this.origin),l.copy(this.direction),
|
|
|
+y=a.matrixWorld,k=y.multiplyVector3(k.copy(b.centroid)).subSelf(i),p=a.matrixRotationWorld.multiplyVector3(p.copy(b.normal)),r=l.dot(p),!(1.0E-4>Math.abs(r))&&(j=p.dot(k)/r,!(0>j)&&(a.doubleSided||(a.flipSided?0<r:0>r))))if(n.add(i,l.multiplyScalar(j)),b instanceof THREE.Face3)e=y.multiplyVector3(e.copy(t[b.a].position)),f=y.multiplyVector3(f.copy(t[b.b].position)),g=y.multiplyVector3(g.copy(t[b.c].position)),d(n,e,f,g)&&(b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b));else if(b instanceof
|
|
|
+THREE.Face4&&(e=y.multiplyVector3(e.copy(t[b.a].position)),f=y.multiplyVector3(f.copy(t[b.b].position)),g=y.multiplyVector3(g.copy(t[b.c].position)),h=y.multiplyVector3(h.copy(t[b.d].position)),d(n,e,f,h)||d(n,f,g,h)))b={distance:i.distanceTo(n),point:n.clone(),face:b,object:a},m.push(b)}return m};var o=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,r,s,t,u,x,v,A,D,E,C,F};
|
|
|
THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,k,p){h=!1;b=f;c=g;d=k;e=p;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
|
|
|
function(f,g,k,p,n,o){h?(h=!1,b=f<k?f<n?f:n:k<n?k:n,c=g<p?g<o?g:o:p<o?p:o,d=f>k?f>n?f:n:k>n?k:n,e=g>p?g>o?g:o:p>o?p:o):(b=f<k?f<n?f<b?f:b:n<b?n:b:k<n?k<b?k:b:n<b?n:b,c=g<p?g<o?g<c?g:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=f>k?f>n?f>d?f:d:n>d?n:d:k>n?k>d?k:d:n>d?n:d,e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
|
|
|
f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
@@ -31,7 +31,7 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
|
|
|
THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,l,k,p,n,o,q,m){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,l||0,void 0!==k?k:1,p||0,n||0,o||0,q||0,void 0!==m?m:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,l,k,p,n,o,q,m){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=p;this.n41=n;this.n42=o;this.n43=q;this.n44=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,p=a.n32,n=a.n33,o=a.n34,q=a.n41,m=a.n42,r=a.n43,
|
|
|
-s=a.n44,t=b.n11,u=b.n12,x=b.n13,v=b.n14,A=b.n21,D=b.n22,E=b.n23,C=b.n24,F=b.n31,K=b.n32,L=b.n33,R=b.n34,N=b.n41,P=b.n42,B=b.n43,j=b.n44;this.n11=c*t+d*A+e*F+f*N;this.n12=c*u+d*D+e*K+f*P;this.n13=c*x+d*E+e*L+f*B;this.n14=c*v+d*C+e*R+f*j;this.n21=g*t+h*A+i*F+l*N;this.n22=g*u+h*D+i*K+l*P;this.n23=g*x+h*E+i*L+l*B;this.n24=g*v+h*C+i*R+l*j;this.n31=k*t+p*A+n*F+o*N;this.n32=k*u+p*D+n*K+o*P;this.n33=k*x+p*E+n*L+o*B;this.n34=k*v+p*C+n*R+o*j;this.n41=q*t+m*A+r*F+s*N;this.n42=q*u+m*D+r*K+s*P;this.n43=q*x+m*
|
|
|
+s=a.n44,t=b.n11,u=b.n12,x=b.n13,v=b.n14,A=b.n21,D=b.n22,E=b.n23,C=b.n24,F=b.n31,K=b.n32,L=b.n33,R=b.n34,O=b.n41,P=b.n42,B=b.n43,j=b.n44;this.n11=c*t+d*A+e*F+f*O;this.n12=c*u+d*D+e*K+f*P;this.n13=c*x+d*E+e*L+f*B;this.n14=c*v+d*C+e*R+f*j;this.n21=g*t+h*A+i*F+l*O;this.n22=g*u+h*D+i*K+l*P;this.n23=g*x+h*E+i*L+l*B;this.n24=g*v+h*C+i*R+l*j;this.n31=k*t+p*A+n*F+o*O;this.n32=k*u+p*D+n*K+o*P;this.n33=k*x+p*E+n*L+o*B;this.n34=k*v+p*C+n*R+o*j;this.n41=q*t+m*A+r*F+s*O;this.n42=q*u+m*D+r*K+s*P;this.n43=q*x+m*
|
|
|
E+r*L+s*B;this.n44=q*v+m*C+r*R+s*j;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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 b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
|
|
|
c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
|
|
@@ -65,13 +65,13 @@ this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWor
|
|
|
THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
|
|
|
var e,f,g=[],h,i,l=[],k,p,n=[],o,q=[],m,r,s=[],t,u,x=[],v={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,D=new THREE.Vector4,E=new THREE.Matrix4,C=new THREE.Matrix4,F=new THREE.Frustum,K=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);E.multiply(b.projectionMatrix,b.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);E.multiply(b.matrixWorld,
|
|
|
b.projectionMatrixInverse);E.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(b,d){f=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||F.contains(b))?(E.multiplyVector3(A.copy(b.position)),e=a(),e.object=
|
|
|
-b,e.z=A.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,f){var g=e.near,j=e.far,H,A,y,I,O,T,aa,ga,fa,S,ba,$,ca,ia,La,ja;u=r=o=p=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
+b,e.z=A.z,v.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,v.sprites.push(e)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,f){var g=e.near,j=e.far,H,A,y,I,N,T,aa,ga,fa,S,ba,$,ca,ia,La,ja;u=r=o=p=0;v.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);E.multiply(e.projectionMatrix,e.matrixWorldInverse);F.setFromMatrix(E);v=this.projectGraph(a,!1);for(a=0,H=v.objects.length;a<H;a++)if(fa=v.objects[a].object,S=fa.matrixWorld,$=fa.material,i=0,fa instanceof THREE.Mesh){ba=fa.geometry;ca=fa.geometry.materials;I=ba.vertices;ia=ba.faces;La=ba.faceVertexUvs;ba=fa.matrixRotationWorld.extractRotation(S);for(A=0,y=I.length;A<y;A++)h=b(),h.positionWorld.copy(I[A].position),S.multiplyVector3(h.positionWorld),
|
|
|
-h.positionScreen.copy(h.positionWorld),E.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<j;for(I=0,A=ia.length;I<A;I++){y=ia[I];if(y instanceof THREE.Face3)if(O=l[y.a],T=l[y.b],aa=l[y.c],O.visible&&T.visible&&aa.visible&&(fa.doubleSided||fa.flipSided!=0>(aa.positionScreen.x-O.positionScreen.x)*(T.positionScreen.y-O.positionScreen.y)-(aa.positionScreen.y-O.positionScreen.y)*(T.positionScreen.x-
|
|
|
-O.positionScreen.x)))ga=n[p]=n[p]||new THREE.RenderableFace3,p++,k=ga,k.v1.copy(O),k.v2.copy(T),k.v3.copy(aa);else continue;else if(y instanceof THREE.Face4)if(O=l[y.a],T=l[y.b],aa=l[y.c],ga=l[y.d],O.visible&&T.visible&&aa.visible&&ga.visible&&(fa.doubleSided||fa.flipSided!=(0>(ga.positionScreen.x-O.positionScreen.x)*(T.positionScreen.y-O.positionScreen.y)-(ga.positionScreen.y-O.positionScreen.y)*(T.positionScreen.x-O.positionScreen.x)||0>(T.positionScreen.x-aa.positionScreen.x)*(ga.positionScreen.y-
|
|
|
-aa.positionScreen.y)-(T.positionScreen.y-aa.positionScreen.y)*(ga.positionScreen.x-aa.positionScreen.x))))ja=q[o]=q[o]||new THREE.RenderableFace4,o++,k=ja,k.v1.copy(O),k.v2.copy(T),k.v3.copy(aa),k.v4.copy(ga);else continue;k.normalWorld.copy(y.normal);ba.multiplyVector3(k.normalWorld);k.centroidWorld.copy(y.centroid);S.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);E.multiplyVector3(k.centroidScreen);aa=y.vertexNormals;for(O=0,T=aa.length;O<T;O++)ga=k.vertexNormalsWorld[O],
|
|
|
-ga.copy(aa[O]),ba.multiplyVector3(ga);for(O=0,T=La.length;O<T;O++)if(ja=La[O][I])for(aa=0,ga=ja.length;aa<ga;aa++)k.uvs[O][aa]=ja[aa];k.material=$;k.faceMaterial=null!==y.materialIndex?ca[y.materialIndex]:null;k.z=k.centroidScreen.z;v.elements.push(k)}}else if(fa instanceof THREE.Line){C.multiply(E,S);I=fa.geometry.vertices;O=b();O.positionScreen.copy(I[0].position);C.multiplyVector4(O.positionScreen);for(A=1,y=I.length;A<y;A++)if(O=b(),O.positionScreen.copy(I[A].position),C.multiplyVector4(O.positionScreen),
|
|
|
-T=l[i-2],K.copy(O.positionScreen),L.copy(T.positionScreen),d(K,L))K.multiplyScalar(1/K.w),L.multiplyScalar(1/L.w),fa=s[r]=s[r]||new THREE.RenderableLine,r++,m=fa,m.v1.positionScreen.copy(K),m.v2.positionScreen.copy(L),m.z=Math.max(K.z,L.z),m.material=$,v.elements.push(m)}for(a=0,H=v.sprites.length;a<H;a++)if(fa=v.sprites[a].object,S=fa.matrixWorld,fa instanceof THREE.Particle&&(D.set(S.n14,S.n24,S.n34,1),E.multiplyVector4(D),D.z/=D.w,0<D.z&&1>D.z))g=x[u]=x[u]||new THREE.RenderableParticle,u++,t=g,
|
|
|
+h.positionScreen.copy(h.positionWorld),E.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<j;for(I=0,A=ia.length;I<A;I++){y=ia[I];if(y instanceof THREE.Face3)if(N=l[y.a],T=l[y.b],aa=l[y.c],N.visible&&T.visible&&aa.visible&&(fa.doubleSided||fa.flipSided!=0>(aa.positionScreen.x-N.positionScreen.x)*(T.positionScreen.y-N.positionScreen.y)-(aa.positionScreen.y-N.positionScreen.y)*(T.positionScreen.x-
|
|
|
+N.positionScreen.x)))ga=n[p]=n[p]||new THREE.RenderableFace3,p++,k=ga,k.v1.copy(N),k.v2.copy(T),k.v3.copy(aa);else continue;else if(y instanceof THREE.Face4)if(N=l[y.a],T=l[y.b],aa=l[y.c],ga=l[y.d],N.visible&&T.visible&&aa.visible&&ga.visible&&(fa.doubleSided||fa.flipSided!=(0>(ga.positionScreen.x-N.positionScreen.x)*(T.positionScreen.y-N.positionScreen.y)-(ga.positionScreen.y-N.positionScreen.y)*(T.positionScreen.x-N.positionScreen.x)||0>(T.positionScreen.x-aa.positionScreen.x)*(ga.positionScreen.y-
|
|
|
+aa.positionScreen.y)-(T.positionScreen.y-aa.positionScreen.y)*(ga.positionScreen.x-aa.positionScreen.x))))ja=q[o]=q[o]||new THREE.RenderableFace4,o++,k=ja,k.v1.copy(N),k.v2.copy(T),k.v3.copy(aa),k.v4.copy(ga);else continue;k.normalWorld.copy(y.normal);ba.multiplyVector3(k.normalWorld);k.centroidWorld.copy(y.centroid);S.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);E.multiplyVector3(k.centroidScreen);aa=y.vertexNormals;for(N=0,T=aa.length;N<T;N++)ga=k.vertexNormalsWorld[N],
|
|
|
+ga.copy(aa[N]),ba.multiplyVector3(ga);for(N=0,T=La.length;N<T;N++)if(ja=La[N][I])for(aa=0,ga=ja.length;aa<ga;aa++)k.uvs[N][aa]=ja[aa];k.material=$;k.faceMaterial=null!==y.materialIndex?ca[y.materialIndex]:null;k.z=k.centroidScreen.z;v.elements.push(k)}}else if(fa instanceof THREE.Line){C.multiply(E,S);I=fa.geometry.vertices;N=b();N.positionScreen.copy(I[0].position);C.multiplyVector4(N.positionScreen);for(A=1,y=I.length;A<y;A++)if(N=b(),N.positionScreen.copy(I[A].position),C.multiplyVector4(N.positionScreen),
|
|
|
+T=l[i-2],K.copy(N.positionScreen),L.copy(T.positionScreen),d(K,L))K.multiplyScalar(1/K.w),L.multiplyScalar(1/L.w),fa=s[r]=s[r]||new THREE.RenderableLine,r++,m=fa,m.v1.positionScreen.copy(K),m.v2.positionScreen.copy(L),m.z=Math.max(K.z,L.z),m.material=$,v.elements.push(m)}for(a=0,H=v.sprites.length;a<H;a++)if(fa=v.sprites[a].object,S=fa.matrixWorld,fa instanceof THREE.Particle&&(D.set(S.n14,S.n24,S.n34,1),E.multiplyVector4(D),D.z/=D.w,0<D.z&&1>D.z))g=x[u]=x[u]||new THREE.RenderableParticle,u++,t=g,
|
|
|
t.x=D.x/D.w,t.y=D.y/D.w,t.z=D.z,t.rotation=fa.rotation.z,t.scale.x=fa.scale.x*Math.abs(t.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14)),t.scale.y=fa.scale.y*Math.abs(t.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24)),t.material=fa.material,v.elements.push(t);f&&v.elements.sort(c);return v}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,void 0!==d?d:1)};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
|
|
|
this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);
|
|
@@ -89,8 +89,8 @@ b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;for(a=0,b=this.faces.length;a<
|
|
|
this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
|
|
|
d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
|
|
|
b,c,d,e,f,B){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=g[e];p=g[f];n=g[B];o=i.x-h.x;q=l.x-h.x;m=i.y-h.y;r=l.y-h.y;s=i.z-h.z;t=l.z-h.z;u=p.u-k.u;x=n.u-k.u;v=p.v-k.v;A=n.v-k.v;D=1/(u*A-x*v);K.set((A*o-v*q)*D,(A*m-v*r)*D,(A*s-v*t)*D);L.set((u*q-x*o)*D,(u*r-x*m)*D,(u*t-x*s)*D);C[b].addSelf(K);C[c].addSelf(K);C[d].addSelf(K);F[b].addSelf(L);F[c].addSelf(L);F[d].addSelf(L)}var b,c,d,e,f,g,h,i,l,k,p,n,o,q,m,r,s,t,u,x,v,A,D,E,C=[],F=[],K=new THREE.Vector3,L=new THREE.Vector3,
|
|
|
-R=new THREE.Vector3,N=new THREE.Vector3,P=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,F[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var B=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)P.copy(f.vertexNormals[d]),e=f[B[d]],
|
|
|
-E=C[e],R.copy(E),R.subSelf(P.multiplyScalar(P.dot(E))).normalize(),N.cross(f.vertexNormals[d],E),e=N.dot(F[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox?(this.boundingBox.min.copy(a),this.boundingBox.max.copy(a)):this.boundingBox={min:a.clone(),max:a.clone()};for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=
|
|
|
+R=new THREE.Vector3,O=new THREE.Vector3,P=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,F[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var B=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)P.copy(f.vertexNormals[d]),e=f[B[d]],
|
|
|
+E=C[e],R.copy(E),R.subSelf(P.multiplyScalar(P.dot(E))).normalize(),O.cross(f.vertexNormals[d],E),e=O.dot(F[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox?(this.boundingBox.min.copy(a),this.boundingBox.max.copy(a)):this.boundingBox={min:a.clone(),max:a.clone()};for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=
|
|
|
this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere={radius:b}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*
|
|
|
e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
|
|
|
THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,l,k,p,n;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){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;l=this.points[c[0]];k=this.points[c[1]];
|
|
@@ -155,7 +155,7 @@ THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var
|
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
|
|
|
THREE.DOMRenderer=function(){var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var i,l,k,p,n,o,q,m;a=b.projectScene(c,d);for(i=0,l=a.length;i<l;i++)if(n=a[i],n instanceof THREE.RenderableParticle){q=n.x*e+e;m=n.y*f+f;for(k=0,p=n.material.length;k<p;k++)if(o=n.material[k],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=q+"px",o.style.top=m+"px"}}};
|
|
|
THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}u=a}}function d(a){if(x!=a)m.strokeStyle=x=a}function e(a){if(v!=a)m.fillStyle=v=a}var a=a||{},f=this,g,h,i,l=new THREE.Projector,k=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
-p,n,o,q,m=k.getContext("2d"),r=new THREE.Color(0),s=0,t=1,u=0,x=null,v=null,A=null,D=null,E=null,C,F,K,L,R=new THREE.RenderableVertex,N=new THREE.RenderableVertex,P,B,j,H,V,y,I,O,T,aa,ga,fa,S=new THREE.Color,ba=new THREE.Color,$=new THREE.Color,ca=new THREE.Color,ia=new THREE.Color,La=[],ja=[],za,qa,Ga,Fa,ab,gb,Ra,Sa,bb,Wa,Aa=new THREE.Rectangle,Ma=new THREE.Rectangle,xa=new THREE.Rectangle,Sb=!1,Z=new THREE.Color,Q=new THREE.Color,jb=new THREE.Color,Ia=new THREE.Vector3,gc,hc,Lc,cb,ic,uc,a=16;gc=
|
|
|
+p,n,o,q,m=k.getContext("2d"),r=new THREE.Color(0),s=0,t=1,u=0,x=null,v=null,A=null,D=null,E=null,C,F,K,L,R=new THREE.RenderableVertex,O=new THREE.RenderableVertex,P,B,j,H,V,y,I,N,T,aa,ga,fa,S=new THREE.Color,ba=new THREE.Color,$=new THREE.Color,ca=new THREE.Color,ia=new THREE.Color,La=[],ja=[],za,qa,Ga,Fa,ab,gb,Ra,Sa,bb,Wa,Aa=new THREE.Rectangle,Ma=new THREE.Rectangle,xa=new THREE.Rectangle,Sb=!1,Z=new THREE.Color,Q=new THREE.Color,jb=new THREE.Color,Ia=new THREE.Vector3,gc,hc,Lc,cb,ic,uc,a=16;gc=
|
|
|
document.createElement("canvas");gc.width=gc.height=2;hc=gc.getContext("2d");hc.fillStyle="rgba(0,0,0,1)";hc.fillRect(0,0,2,2);Lc=hc.getImageData(0,0,2,2);cb=Lc.data;ic=document.createElement("canvas");ic.width=ic.height=a;uc=ic.getContext("2d");uc.translate(-a/2,-a/2);uc.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;n=b;o=Math.floor(p/2);q=Math.floor(n/2);k.width=p;k.height=n;Aa.set(-o,
|
|
|
-q,o,q);Ma.set(-o,-q,o,q);t=1;u=0;E=D=A=v=x=null};this.setClearColor=function(a,b){r.copy(a);s=b;Ma.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;Ma.set(-o,-q,o,q)};this.clear=function(){m.setTransform(1,0,0,-1,o,q);Ma.isEmpty()||(Ma.minSelf(Aa),Ma.inflate(2),1>s&&m.clearRect(Math.floor(Ma.getX()),Math.floor(Ma.getY()),Math.floor(Ma.getWidth()),Math.floor(Ma.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
|
|
|
r.b)+","+s+")"),m.fillRect(Math.floor(Ma.getX()),Math.floor(Ma.getY()),Math.floor(Ma.getWidth()),Math.floor(Ma.getHeight()))),Ma.empty())};this.render=function(a,k){function n(a){var b,c,d,e;Z.setRGB(0,0,0);Q.setRGB(0,0,0);jb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(Z.r+=e.r,Z.g+=e.g,Z.b+=e.b):d instanceof THREE.DirectionalLight?(Q.r+=e.r,Q.g+=e.g,Q.b+=e.b):d instanceof THREE.PointLight&&(jb.r+=e.r,jb.g+=e.g,jb.b+=e.b)}function p(a,b,c,d){var e,f,
|
|
@@ -168,11 +168,11 @@ P=a.positionScreen.x;B=a.positionScreen.y;j=d.positionScreen.x;H=d.positionScree
|
|
|
Math.min(m.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(m.color.b*ba.b,1)),$.r=Math.max(0,Math.min(m.color.r*$.r,1)),$.g=Math.max(0,Math.min(m.color.g*$.g,1)),$.b=Math.max(0,Math.min(m.color.b*$.b,1)),ca.r=Math.max(0,Math.min(m.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(m.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(m.color.b*ca.b,1)),ia.r=0.5*($.r+ca.r),ia.g=0.5*($.g+ca.g),ia.b=0.5*($.b+ca.b),Ga=vc(ba,$,ca,ia),Yb(P,B,j,H,V,y,0,0,1,0,0,1,Ga)):(S.r=Z.r,S.g=Z.g,S.b=Z.b,p(i,Q.centroidWorld,Q.normalWorld,S),
|
|
|
S.r=Math.max(0,Math.min(m.color.r*S.r,1)),S.g=Math.max(0,Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),m.wireframe?Eb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(S)):m.wireframe?Eb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(m.color);else if(m instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,ba.r=ba.g=ba.b=1-Tb(a.positionScreen.z,za,qa),$.r=$.g=$.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(e.positionScreen.z,za,
|
|
|
qa),ia.r=0.5*($.r+ca.r),ia.g=0.5*($.g+ca.g),ia.b=0.5*($.b+ca.b),Ga=vc(ba,$,ca,ia),Yb(P,B,j,H,V,y,0,0,1,0,0,1,Ga);else if(m instanceof THREE.MeshNormalMaterial)S.r=Zb(Q.normalWorld.x),S.g=Zb(Q.normalWorld.y),S.b=Zb(Q.normalWorld.z),m.wireframe?Eb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(S)}function u(a,d,e,g,h,l,m,Q,n){f.info.render.vertices+=4;f.info.render.faces++;b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap)t(a,d,g,0,1,3,m,Q,n),t(h,e,l,1,2,3,m,Q,n);else if(P=a.positionScreen.x,
|
|
|
-B=a.positionScreen.y,j=d.positionScreen.x,H=d.positionScreen.y,V=e.positionScreen.x,y=e.positionScreen.y,I=g.positionScreen.x,O=g.positionScreen.y,T=h.positionScreen.x,aa=h.positionScreen.y,ga=l.positionScreen.x,fa=l.positionScreen.y,Q instanceof THREE.MeshBasicMaterial)v(P,B,j,H,V,y,I,O),Q.wireframe?Eb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):zb(Q.color);else if(Q instanceof THREE.MeshLambertMaterial)Sb?!Q.wireframe&&Q.shading==THREE.SmoothShading&&4==m.vertexNormalsWorld.length?
|
|
|
+B=a.positionScreen.y,j=d.positionScreen.x,H=d.positionScreen.y,V=e.positionScreen.x,y=e.positionScreen.y,I=g.positionScreen.x,N=g.positionScreen.y,T=h.positionScreen.x,aa=h.positionScreen.y,ga=l.positionScreen.x,fa=l.positionScreen.y,Q instanceof THREE.MeshBasicMaterial)v(P,B,j,H,V,y,I,N),Q.wireframe?Eb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):zb(Q.color);else if(Q instanceof THREE.MeshLambertMaterial)Sb?!Q.wireframe&&Q.shading==THREE.SmoothShading&&4==m.vertexNormalsWorld.length?
|
|
|
(ba.r=$.r=ca.r=ia.r=Z.r,ba.g=$.g=ca.g=ia.g=Z.g,ba.b=$.b=ca.b=ia.b=Z.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],ba),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],$),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],ca),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ia),ba.r=Math.max(0,Math.min(Q.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(Q.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(Q.color.b*ba.b,1)),$.r=Math.max(0,Math.min(Q.color.r*$.r,1)),$.g=Math.max(0,Math.min(Q.color.g*$.g,1)),$.b=Math.max(0,
|
|
|
-Math.min(Q.color.b*$.b,1)),ca.r=Math.max(0,Math.min(Q.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(Q.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(Q.color.b*ca.b,1)),ia.r=Math.max(0,Math.min(Q.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(Q.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(Q.color.b*ia.b,1)),Ga=vc(ba,$,ca,ia),x(P,B,j,H,I,O),Yb(P,B,j,H,I,O,0,0,1,0,0,1,Ga),x(T,aa,V,y,ga,fa),Yb(T,aa,V,y,ga,fa,1,0,1,1,0,1,Ga)):(S.r=Z.r,S.g=Z.g,S.b=Z.b,p(i,m.centroidWorld,m.normalWorld,S),S.r=Math.max(0,Math.min(Q.color.r*
|
|
|
-S.r,1)),S.g=Math.max(0,Math.min(Q.color.g*S.g,1)),S.b=Math.max(0,Math.min(Q.color.b*S.b,1)),v(P,B,j,H,V,y,I,O),Q.wireframe?Eb(S,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):zb(S)):(v(P,B,j,H,V,y,I,O),Q.wireframe?Eb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):zb(Q.color));else if(Q instanceof THREE.MeshNormalMaterial)S.r=Zb(m.normalWorld.x),S.g=Zb(m.normalWorld.y),S.b=Zb(m.normalWorld.z),v(P,B,j,H,V,y,I,O),Q.wireframe?Eb(S,Q.wireframeLinewidth,Q.wireframeLinecap,
|
|
|
-Q.wireframeLinejoin):zb(S);else if(Q instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,ba.r=ba.g=ba.b=1-Tb(a.positionScreen.z,za,qa),$.r=$.g=$.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(g.positionScreen.z,za,qa),ia.r=ia.g=ia.b=1-Tb(e.positionScreen.z,za,qa),Ga=vc(ba,$,ca,ia),x(P,B,j,H,I,O),Yb(P,B,j,H,I,O,0,0,1,0,0,1,Ga),x(T,aa,V,y,ga,fa),Yb(T,aa,V,y,ga,fa,1,0,1,1,0,1,Ga)}function x(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function v(a,
|
|
|
+Math.min(Q.color.b*$.b,1)),ca.r=Math.max(0,Math.min(Q.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(Q.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(Q.color.b*ca.b,1)),ia.r=Math.max(0,Math.min(Q.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(Q.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(Q.color.b*ia.b,1)),Ga=vc(ba,$,ca,ia),x(P,B,j,H,I,N),Yb(P,B,j,H,I,N,0,0,1,0,0,1,Ga),x(T,aa,V,y,ga,fa),Yb(T,aa,V,y,ga,fa,1,0,1,1,0,1,Ga)):(S.r=Z.r,S.g=Z.g,S.b=Z.b,p(i,m.centroidWorld,m.normalWorld,S),S.r=Math.max(0,Math.min(Q.color.r*
|
|
|
+S.r,1)),S.g=Math.max(0,Math.min(Q.color.g*S.g,1)),S.b=Math.max(0,Math.min(Q.color.b*S.b,1)),v(P,B,j,H,V,y,I,N),Q.wireframe?Eb(S,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):zb(S)):(v(P,B,j,H,V,y,I,N),Q.wireframe?Eb(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):zb(Q.color));else if(Q instanceof THREE.MeshNormalMaterial)S.r=Zb(m.normalWorld.x),S.g=Zb(m.normalWorld.y),S.b=Zb(m.normalWorld.z),v(P,B,j,H,V,y,I,N),Q.wireframe?Eb(S,Q.wireframeLinewidth,Q.wireframeLinecap,
|
|
|
+Q.wireframeLinejoin):zb(S);else if(Q instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,ba.r=ba.g=ba.b=1-Tb(a.positionScreen.z,za,qa),$.r=$.g=$.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(g.positionScreen.z,za,qa),ia.r=ia.g=ia.b=1-Tb(e.positionScreen.z,za,qa),Ga=vc(ba,$,ca,ia),x(P,B,j,H,I,N),Yb(P,B,j,H,I,N,0,0,1,0,0,1,Ga),x(T,aa,V,y,ga,fa),Yb(T,aa,V,y,ga,fa,1,0,1,1,0,1,Ga)}function x(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function v(a,
|
|
|
b,c,d,e,f,g,Z){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,Z);m.lineTo(a,b);m.closePath()}function Eb(a,b,c,e){if(A!=b)m.lineWidth=A=b;if(D!=c)m.lineCap=D=c;if(E!=e)m.lineJoin=E=e;d(a.getContextStyle());m.stroke();xa.inflate(2*b)}function zb(a){e(a.getContextStyle());m.fill()}function Mc(a,b,c,d,f,g,Z,h,j,i,Q,l,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==La[k.id]){var n=k.wrapS==THREE.RepeatWrapping,p=k.wrapT==THREE.RepeatWrapping;La[k.id]=m.createPattern(k.image,
|
|
|
n&&p?"repeat":n&&!p?"repeat-x":!n&&p?"repeat-y":"no-repeat");k.needsUpdate=!1}e(La[k.id]);var n=k.offset.x/k.repeat.x,p=k.offset.y/k.repeat.y,jb=k.image.width*k.repeat.x,o=k.image.height*k.repeat.y,Z=(Z+n)*jb,h=(h+p)*o,c=c-a,d=d-b,f=f-a,g=g-b,j=(j+n)*jb-Z,i=(i+p)*o-h,Q=(Q+n)*jb-Z,l=(l+p)*o-h,n=j*l-Q*i;if(0==n){if(void 0===ja[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),ja[k.id]=b.getImageData(0,0,k.image.width,
|
|
|
k.image.height).data;b=ja[k.id];Z=4*(Math.floor(Z)+Math.floor(h)*k.image.width);S.setRGB(b[Z]/255,b[Z+1]/255,b[Z+2]/255);zb(S)}else n=1/n,k=(l*c-i*f)*n,i=(l*d-i*g)*n,c=(j*f-Q*c)*n,d=(j*g-Q*d)*n,a=a-k*Z-c*h,Z=b-i*Z-d*h,m.save(),m.transform(k,i,c,d,a,Z),m.fill(),m.restore()}}function Yb(a,b,c,d,e,f,g,Z,h,j,i,k,Q){var l,n;l=Q.width-1;n=Q.height-1;g*=l;Z*=n;c-=a;d-=b;e-=a;f-=b;h=h*l-g;j=j*n-Z;i=i*l-g;k=k*n-Z;n=1/(h*k-i*j);l=(k*c-j*e)*n;j=(k*d-j*f)*n;c=(h*e-i*c)*n;d=(h*f-i*d)*n;a=a-l*g-c*Z;b=b-j*g-d*Z;
|
|
@@ -180,18 +180,18 @@ m.save();m.transform(l,j,c,d,a,b);m.clip();m.drawImage(Q,0,0);m.restore()}functi
|
|
|
i?255:i;cb[13]=0>k?0:255<k?255:k;cb[14]=0>d?0:255<d?255:d;hc.putImageData(Lc,0,0);uc.drawImage(gc,0,0);return ic}function Tb(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Zb(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Fb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xc,Xc,Na,hb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,q);f.info.render.vertices=0;f.info.render.faces=0;g=l.projectScene(a,k,this.sortElements);h=g.elements;i=
|
|
|
g.lights;(Sb=0<i.length)&&n(i);for(xc=0,Xc=h.length;xc<Xc;xc++)if(Na=h[xc],hb=Na.material,hb=hb instanceof THREE.MeshFaceMaterial?Na.faceMaterial:hb,!(null==hb||0==hb.opacity)){xa.empty();if(Na instanceof THREE.RenderableParticle)C=Na,C.x*=o,C.y*=q,r(C,Na,hb,a);else if(Na instanceof THREE.RenderableLine)C=Na.v1,F=Na.v2,C.positionScreen.x*=o,C.positionScreen.y*=q,F.positionScreen.x*=o,F.positionScreen.y*=q,xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(F.positionScreen.x,F.positionScreen.y),
|
|
|
Aa.intersects(xa)&&s(C,F,Na,hb,a);else if(Na instanceof THREE.RenderableFace3)C=Na.v1,F=Na.v2,K=Na.v3,C.positionScreen.x*=o,C.positionScreen.y*=q,F.positionScreen.x*=o,F.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,hb.overdraw&&(Fb(C.positionScreen,F.positionScreen),Fb(F.positionScreen,K.positionScreen),Fb(K.positionScreen,C.positionScreen)),xa.add3Points(C.positionScreen.x,C.positionScreen.y,F.positionScreen.x,F.positionScreen.y,K.positionScreen.x,K.positionScreen.y),Aa.intersects(xa)&&
|
|
|
-t(C,F,K,0,1,2,Na,hb,a);else if(Na instanceof THREE.RenderableFace4)C=Na.v1,F=Na.v2,K=Na.v3,L=Na.v4,C.positionScreen.x*=o,C.positionScreen.y*=q,F.positionScreen.x*=o,F.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,L.positionScreen.x*=o,L.positionScreen.y*=q,R.positionScreen.copy(F.positionScreen),N.positionScreen.copy(L.positionScreen),hb.overdraw&&(Fb(C.positionScreen,F.positionScreen),Fb(F.positionScreen,L.positionScreen),Fb(L.positionScreen,C.positionScreen),Fb(K.positionScreen,
|
|
|
-R.positionScreen),Fb(K.positionScreen,N.positionScreen)),xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(F.positionScreen.x,F.positionScreen.y),xa.addPoint(K.positionScreen.x,K.positionScreen.y),xa.addPoint(L.positionScreen.x,L.positionScreen.y),Aa.intersects(xa)&&u(C,F,K,L,R,N,Na,hb,a);Ma.addRectangle(xa)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
+t(C,F,K,0,1,2,Na,hb,a);else if(Na instanceof THREE.RenderableFace4)C=Na.v1,F=Na.v2,K=Na.v3,L=Na.v4,C.positionScreen.x*=o,C.positionScreen.y*=q,F.positionScreen.x*=o,F.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,L.positionScreen.x*=o,L.positionScreen.y*=q,R.positionScreen.copy(F.positionScreen),O.positionScreen.copy(L.positionScreen),hb.overdraw&&(Fb(C.positionScreen,F.positionScreen),Fb(F.positionScreen,L.positionScreen),Fb(L.positionScreen,C.positionScreen),Fb(K.positionScreen,
|
|
|
+R.positionScreen),Fb(K.positionScreen,O.positionScreen)),xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(F.positionScreen.x,F.positionScreen.y),xa.addPoint(K.positionScreen.x,K.positionScreen.y),xa.addPoint(L.positionScreen.x,L.positionScreen.y),Aa.intersects(xa)&&u(C,F,K,L,R,O,Na,hb,a);Ma.addRectangle(xa)}m.setTransform(1,0,0,1,0,0)}};
|
|
|
THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,k;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),0>=k||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(C.sub(i,b).normalize()),0>=k||(k*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=k&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function b(a){null==F[a]&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"path"),0==P&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,n,o,q,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,x=new THREE.Color,v=new THREE.Color,A=new THREE.Color,D=new THREE.Color,E,C=new THREE.Vector3,F=[],K=[],L,R,N,P=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
+"path"),0==P&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,n,o,q,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,x=new THREE.Color,v=new THREE.Color,A=new THREE.Color,D=new THREE.Color,E,C=new THREE.Vector3,F=[],K=[],L,R,O,P=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
faces:0}};this.setQuality=function(a){switch(a){case "high":P=1;break;case "low":P=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;n=k/2;i.setAttribute("viewBox",-p+" "+-n+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-p,-n,p,n)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(k,j){var l,C,y,I;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,j,this.sortElements);f=e.elements;
|
|
|
-g=e.lights;N=R=0;if(u=0<g.length){v.setRGB(0,0,0);A.setRGB(0,0,0);D.setRGB(0,0,0);for(l=0,C=g.length;l<C;l++)I=g[l],y=I.color,I instanceof THREE.AmbientLight?(v.r+=y.r,v.g+=y.g,v.b+=y.b):I instanceof THREE.DirectionalLight?(A.r+=y.r,A.g+=y.g,A.b+=y.b):I instanceof THREE.PointLight&&(D.r+=y.r,D.g+=y.g,D.b+=y.b)}for(l=0,C=f.length;l<C;l++)if(y=f[l],I=y.material,I=I instanceof THREE.MeshFaceMaterial?y.faceMaterial:I,!(null==I||0==I.opacity))if(t.empty(),y instanceof THREE.RenderableParticle)o=y,o.x*=
|
|
|
-p,o.y*=-n;else if(y instanceof THREE.RenderableLine){if(o=y.v1,q=y.v2,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){y=o;var O=q,T=N++;null==K[T]&&(K[T]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==P&&K[T].setAttribute("shape-rendering","crispEdges"));L=K[T];L.setAttribute("x1",y.positionScreen.x);L.setAttribute("y1",y.positionScreen.y);
|
|
|
-L.setAttribute("x2",O.positionScreen.x);L.setAttribute("y2",O.positionScreen.y);I instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+I.color.getContextStyle()+"; stroke-width: "+I.linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.linecap+"; stroke-linejoin: "+I.linejoin),i.appendChild(L))}}else if(y instanceof THREE.RenderableFace3){if(o=y.v1,q=y.v2,m=y.v3,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=
|
|
|
-p,m.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),s.intersects(t)){var O=o,T=q,aa=m;d.info.render.vertices+=3;d.info.render.faces++;L=b(R++);L.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?x.copy(I.color):I instanceof THREE.MeshLambertMaterial?
|
|
|
+g=e.lights;O=R=0;if(u=0<g.length){v.setRGB(0,0,0);A.setRGB(0,0,0);D.setRGB(0,0,0);for(l=0,C=g.length;l<C;l++)I=g[l],y=I.color,I instanceof THREE.AmbientLight?(v.r+=y.r,v.g+=y.g,v.b+=y.b):I instanceof THREE.DirectionalLight?(A.r+=y.r,A.g+=y.g,A.b+=y.b):I instanceof THREE.PointLight&&(D.r+=y.r,D.g+=y.g,D.b+=y.b)}for(l=0,C=f.length;l<C;l++)if(y=f[l],I=y.material,I=I instanceof THREE.MeshFaceMaterial?y.faceMaterial:I,!(null==I||0==I.opacity))if(t.empty(),y instanceof THREE.RenderableParticle)o=y,o.x*=
|
|
|
+p,o.y*=-n;else if(y instanceof THREE.RenderableLine){if(o=y.v1,q=y.v2,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){y=o;var N=q,T=O++;null==K[T]&&(K[T]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==P&&K[T].setAttribute("shape-rendering","crispEdges"));L=K[T];L.setAttribute("x1",y.positionScreen.x);L.setAttribute("y1",y.positionScreen.y);
|
|
|
+L.setAttribute("x2",N.positionScreen.x);L.setAttribute("y2",N.positionScreen.y);I instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+I.color.getContextStyle()+"; stroke-width: "+I.linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.linecap+"; stroke-linejoin: "+I.linejoin),i.appendChild(L))}}else if(y instanceof THREE.RenderableFace3){if(o=y.v1,q=y.v2,m=y.v3,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=
|
|
|
+p,m.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),s.intersects(t)){var N=o,T=q,aa=m;d.info.render.vertices+=3;d.info.render.faces++;L=b(R++);L.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?x.copy(I.color):I instanceof THREE.MeshLambertMaterial?
|
|
|
u?(x.r=v.r,x.g=v.g,x.b=v.b,a(g,y.centroidWorld,y.normalWorld,x),x.r=Math.max(0,Math.min(I.color.r*x.r,1)),x.g=Math.max(0,Math.min(I.color.g*x.g,1)),x.b=Math.max(0,Math.min(I.color.b*x.b,1))):x.copy(I.color):I instanceof THREE.MeshDepthMaterial?(E=1-I.__2near/(I.__farPlusNear-y.z*I.__farMinusNear),x.setRGB(E,E,E)):I instanceof THREE.MeshNormalMaterial&&x.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));I.wireframe?L.setAttribute("style","fill: none; stroke: "+x.getContextStyle()+"; stroke-width: "+
|
|
|
I.wireframeLinewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframeLinecap+"; stroke-linejoin: "+I.wireframeLinejoin):L.setAttribute("style","fill: "+x.getContextStyle()+"; fill-opacity: "+I.opacity);i.appendChild(L)}}else if(y instanceof THREE.RenderableFace4&&(o=y.v1,q=y.v2,m=y.v3,r=y.v4,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=p,m.positionScreen.y*=-n,r.positionScreen.x*=p,r.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,
|
|
|
-o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(t))){var O=o,T=q,aa=m,F=r;d.info.render.vertices+=4;d.info.render.faces++;L=b(R++);L.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?
|
|
|
+o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(t))){var N=o,T=q,aa=m,F=r;d.info.render.vertices+=4;d.info.render.faces++;L=b(R++);L.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?
|
|
|
x.copy(I.color):I instanceof THREE.MeshLambertMaterial?u?(x.r=v.r,x.g=v.g,x.b=v.b,a(g,y.centroidWorld,y.normalWorld,x),x.r=Math.max(0,Math.min(I.color.r*x.r,1)),x.g=Math.max(0,Math.min(I.color.g*x.g,1)),x.b=Math.max(0,Math.min(I.color.b*x.b,1))):x.copy(I.color):I instanceof THREE.MeshDepthMaterial?(E=1-I.__2near/(I.__farPlusNear-y.z*I.__farMinusNear),x.setRGB(E,E,E)):I instanceof THREE.MeshNormalMaterial&&x.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));I.wireframe?L.setAttribute("style",
|
|
|
"fill: none; stroke: "+x.getContextStyle()+"; stroke-width: "+I.wireframeLinewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframeLinecap+"; stroke-linejoin: "+I.wireframeLinejoin):L.setAttribute("style","fill: "+x.getContextStyle()+"; fill-opacity: "+I.opacity);i.appendChild(L)}}};
|
|
|
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",
|
|
@@ -233,20 +233,20 @@ var i=a.colors,k=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,p=a
|
|
|
void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],
|
|
|
h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}else{if(p)for(d=0;d<g;d++)e=h[d].position,f=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;if(o)for(d=0;d<k;d++)e=i[d],f=3*d,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===
|
|
|
h.type)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-m,b);if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)V=null,I=O=ba=S=fa=-1,a[d].render(b,c,Fa,ab),V=null,I=O=ba=S=fa=-1}function i(a,b,c,d,e,f,g,h){var j,i,k,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(j=a[m],j.render){i=j.object;k=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&
|
|
|
+m,b);if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)V=null,I=N=ba=S=fa=-1,a[d].render(b,c,Fa,ab),V=null,I=N=ba=S=fa=-1}function i(a,b,c,d,e,f,g,h){var j,i,k,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(j=a[m],j.render){i=j.object;k=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&
|
|
|
B.setBlending(j.blending);B.setDepthTest(j.depthTest);s(j.depthWrite);t(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}B.setObjectFaces(i);k instanceof THREE.BufferGeometry?B.renderBufferDirect(d,e,f,j,k,i):B.renderBuffer(d,e,f,j,k,i)}}function l(a,b,c,d,e,f,g){for(var h,j,i=0,k=a.length;i<k;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&B.setBlending(h.blending);B.setDepthTest(h.depthTest);s(h.depthWrite);t(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}B.renderImmediateObject(c,
|
|
|
d,e,h,j)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){d.program||B.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=
|
|
|
new Float32Array(B.maxMorphTargets);for(var f=0,g=B.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==V&&(j.useProgram(f),V=f,h=!0);if(d.id!==I)I=d.id,h=!0;if(h){j.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||
|
|
|
-d instanceof THREE.MeshLambertMaterial||d.lights){var k,l,m=0,n=0,p=0,o,q,r=bb,s=r.directional.colors,t=r.directional.positions,O=r.point.colors,u=r.point.positions,v=r.point.distances,y=0,C=0,T=q=0;for(c=0,h=b.length;c<h;c++)if(k=b[c],l=k.color,o=k.intensity,q=k.distance,k instanceof THREE.AmbientLight)B.gammaInput?(m+=l.r*l.r,n+=l.g*l.g,p+=l.b*l.b):(m+=l.r,n+=l.g,p+=l.b);else if(k instanceof THREE.DirectionalLight)q=3*y,B.gammaInput?(s[q]=l.r*l.r*o*o,s[q+1]=l.g*l.g*o*o,s[q+2]=l.b*l.b*o*o):(s[q]=
|
|
|
-l.r*o,s[q+1]=l.g*o,s[q+2]=l.b*o),k=k.matrixWorld.getPosition(),l=1/k.length(),t[q]=k.x*l,t[q+1]=k.y*l,t[q+2]=k.z*l,y+=1;else if(k instanceof THREE.SpotLight&&!k.onlyShadow)q=3*y,B.gammaInput?(s[q]=l.r*l.r*o*o,s[q+1]=l.g*l.g*o*o,s[q+2]=l.b*l.b*o*o):(s[q]=l.r*o,s[q+1]=l.g*o,s[q+2]=l.b*o),k=k.matrixWorld.getPosition(),l=1/k.length(),t[q]=k.x*l,t[q+1]=k.y*l,t[q+2]=k.z*l,y+=1;else if(k instanceof THREE.PointLight)T=3*C,B.gammaInput?(O[T]=l.r*l.r*o*o,O[T+1]=l.g*l.g*o*o,O[T+2]=l.b*l.b*o*o):(O[T]=l.r*o,O[T+
|
|
|
-1]=l.g*o,O[T+2]=l.b*o),k=k.matrixWorld.getPosition(),u[T]=k.x,u[T+1]=k.y,u[T+2]=k.z,v[C]=q,C+=1;for(c=3*y,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=O.length;c<h;c++)O[c]=0;r.point.length=C;r.directional.length=y;r.ambient[0]=m;r.ambient[1]=n;r.ambient[2]=p;b=bb;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=
|
|
|
+d instanceof THREE.MeshLambertMaterial||d.lights){var k,l,m=0,n=0,p=0,o,q,r=bb,s=r.directional.colors,t=r.directional.positions,N=r.point.colors,u=r.point.positions,y=r.point.distances,v=0,C=0,T=q=0;for(c=0,h=b.length;c<h;c++)if(k=b[c],l=k.color,o=k.intensity,q=k.distance,k instanceof THREE.AmbientLight)B.gammaInput?(m+=l.r*l.r,n+=l.g*l.g,p+=l.b*l.b):(m+=l.r,n+=l.g,p+=l.b);else if(k instanceof THREE.DirectionalLight)q=3*v,B.gammaInput?(s[q]=l.r*l.r*o*o,s[q+1]=l.g*l.g*o*o,s[q+2]=l.b*l.b*o*o):(s[q]=
|
|
|
+l.r*o,s[q+1]=l.g*o,s[q+2]=l.b*o),k=k.matrixWorld.getPosition(),l=1/k.length(),t[q]=k.x*l,t[q+1]=k.y*l,t[q+2]=k.z*l,v+=1;else if(k instanceof THREE.SpotLight&&!k.onlyShadow)q=3*v,B.gammaInput?(s[q]=l.r*l.r*o*o,s[q+1]=l.g*l.g*o*o,s[q+2]=l.b*l.b*o*o):(s[q]=l.r*o,s[q+1]=l.g*o,s[q+2]=l.b*o),k=k.matrixWorld.getPosition(),l=1/k.length(),t[q]=k.x*l,t[q+1]=k.y*l,t[q+2]=k.z*l,v+=1;else if(k instanceof THREE.PointLight)T=3*C,B.gammaInput?(N[T]=l.r*l.r*o*o,N[T+1]=l.g*l.g*o*o,N[T+2]=l.b*l.b*o*o):(N[T]=l.r*o,N[T+
|
|
|
+1]=l.g*o,N[T+2]=l.b*o),k=k.matrixWorld.getPosition(),u[T]=k.x,u[T+1]=k.y,u[T+2]=k.z,y[C]=q,C+=1;for(c=3*v,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=N.length;c<h;c++)N[c]=0;r.point.length=C;r.directional.length=v;r.ambient[0]=m;r.ambient[1]=n;r.ambient[2]=p;b=bb;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=
|
|
|
b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,B.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,
|
|
|
i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=E.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,B.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),
|
|
|
i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)B.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;
|
|
|
if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<B.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=B.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=B.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=B.shadowMapDarkness;i.shadowBias.value=B.shadowMapBias}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(h=b[i][0],p=h.type,m=h.value,"i"===p)j.uniform1i(n,m);else if("f"===p)j.uniform1f(n,m);else if("v2"===p)j.uniform2f(n,m.x,m.y);else if("v3"===
|
|
|
p)j.uniform3f(n,m.x,m.y,m.z);else if("v4"===p)j.uniform4f(n,m.x,m.y,m.z,m.w);else if("c"===p)j.uniform3f(n,m.r,m.g,m.b);else if("fv1"===p)j.uniform1fv(n,m);else if("fv"===p)j.uniform3fv(n,m);else if("v3v"===p){if(!h._array)h._array=new Float32Array(3*m.length);for(p=0,r=m.length;p<r;p++)s=3*p,h._array[s]=m[p].x,h._array[s+1]=m[p].y,h._array[s+2]=m[p].z;j.uniform3fv(n,h._array)}else if("m4"===p){if(!h._array)h._array=new Float32Array(16);m.flattenToArray(h._array);j.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===
|
|
|
p){if(!h._array)h._array=new Float32Array(16*m.length);for(p=0,r=m.length;p<r;p++)m[p].flattenToArrayOffset(h._array,16*p);j.uniformMatrix4fv(n,!1,h._array)}else if("t"===p){if(j.uniform1i(n,m),n=h.texture)if(n.image instanceof Array&&6===n.image.length){if(h=n,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+m);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);m=[];for(n=0;6>n;n++){p=m;r=n;if(B.autoScaleCubemaps){if(s=
|
|
|
-h.image[n],O=Aa,!(s.width<=O&&s.height<=O))u=Math.max(s.width,s.height),t=Math.floor(s.width*O/u),O=Math.floor(s.height*O/u),u=document.createElement("canvas"),u.width=t,u.height=O,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,O),s=u}else s=h.image[n];p[r]=s}n=m[0];p=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=D(h.format);s=D(h.type);x(j.TEXTURE_CUBE_MAP,h,p);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,m[n]);h.generateMipmaps&&p&&j.generateMipmap(j.TEXTURE_CUBE_MAP);
|
|
|
+h.image[n],N=Aa,!(s.width<=N&&s.height<=N))u=Math.max(s.width,s.height),t=Math.floor(s.width*N/u),N=Math.floor(s.height*N/u),u=document.createElement("canvas"),u.width=t,u.height=N,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,N),s=u}else s=h.image[n];p[r]=s}n=m[0];p=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=D(h.format);s=D(h.type);x(j.TEXTURE_CUBE_MAP,h,p);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,m[n]);h.generateMipmaps&&p&&j.generateMipmap(j.TEXTURE_CUBE_MAP);
|
|
|
h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):B.setTexture(n,m)}else if("tv"===p){if(!h._array){h._array=[];for(p=0,r=h.texture.length;p<r;p++)h._array[p]=m+p}j.uniform1iv(n,h._array);for(p=0,r=h.texture.length;p<r;p++)(n=h.texture[p])&&B.setTexture(n,h._array[p])}(d instanceof
|
|
|
THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition&&j.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,
|
|
|
!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a){ba!==a&&
|
|
@@ -255,21 +255,21 @@ D(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,D(b.wrapT)),j.texParameteri(a,j.T
|
|
|
j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function A(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
|
|
|
default:return j.LINEAR}}function D(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
|
|
|
case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
|
|
|
-var a=a||{},E=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.precision?a.precision:"mediump",F=void 0!==a.antialias?a.antialias:!1,K=void 0!==a.stencil?a.stencil:!0,L=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,R=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),N=void 0!==a.clearAlpha?a.clearAlpha:0,P=void 0!==a.maxLights?a.maxLights:4;this.domElement=E;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
|
|
|
+var a=a||{},E=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.precision?a.precision:"mediump",F=void 0!==a.antialias?a.antialias:!1,K=void 0!==a.stencil?a.stencil:!0,L=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,R=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),O=void 0!==a.clearAlpha?a.clearAlpha:0,P=void 0!==a.maxLights?a.maxLights:4;this.domElement=E;this.context=null;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.shadowMapEnabled=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info=
|
|
|
-{memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var B=this,j,H=[],V=null,y=null,I=-1,O=null,T=0,aa=null,ga=null,fa=null,S=null,ba=null,$=null,ca=null,ia=null,La=null,ja=0,za=0,qa=0,Ga=0,Fa=0,ab=0,gb=new THREE.Frustum,Ra=new THREE.Matrix4,Sa=new THREE.Vector4,bb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=E.getContext("experimental-webgl",{antialias:F,stencil:K,
|
|
|
+{memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var B=this,j,H=[],V=null,y=null,I=-1,N=null,T=0,aa=null,ga=null,fa=null,S=null,ba=null,$=null,ca=null,ia=null,La=null,ja=0,za=0,qa=0,Ga=0,Fa=0,ab=0,gb=new THREE.Frustum,Ra=new THREE.Matrix4,Sa=new THREE.Vector4,bb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=E.getContext("experimental-webgl",{antialias:F,stencil:K,
|
|
|
preserveDrawingBuffer:L})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,
|
|
|
-j.ONE_MINUS_SRC_ALPHA);j.clearColor(R.r,R.g,R.b,N);this.context=j;var Wa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.TEXTURE_SIZE);var Aa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Wa};this.setSize=function(a,b){E.width=a;E.height=b;this.setViewport(0,0,E.width,E.height)};this.setViewport=function(a,b,c,d){ja=a;za=b;qa=c;Ga=d;j.viewport(ja,za,qa,Ga)};this.setScissor=function(a,b,c,d){j.scissor(a,
|
|
|
-b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){R.setHex(a);N=b;j.clearColor(R.r,R.g,R.b,N)};this.setClearColor=function(a,b){R.copy(a);N=b;j.clearColor(R.r,R.g,R.b,N)};this.getClearColor=function(){return R};this.getClearAlpha=function(){return N};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=
|
|
|
+j.ONE_MINUS_SRC_ALPHA);j.clearColor(R.r,R.g,R.b,O);this.context=j;var Wa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.TEXTURE_SIZE);var Aa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Wa};this.setSize=function(a,b){E.width=a;E.height=b;this.setViewport(0,0,E.width,E.height)};this.setViewport=function(a,b,c,d){ja=a;za=b;qa=c;Ga=d;j.viewport(ja,za,qa,Ga)};this.setScissor=function(a,b,c,d){j.scissor(a,
|
|
|
+b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){R.setHex(a);O=b;j.clearColor(R.r,R.g,R.b,O)};this.setClearColor=function(a,b){R.copy(a);O=b;j.clearColor(R.r,R.g,R.b,O)};this.getClearColor=function(){return R};this.getClearAlpha=function(){return O};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=
|
|
|
function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);
|
|
|
j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);
|
|
|
if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);B.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=
|
|
|
-a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),B.info.memory.textures--};this.updateShadowMap=function(a,b){V=null;I=O=ba=S=fa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
|
|
|
+a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),B.info.memory.textures--};this.updateShadowMap=function(a,b){V=null;I=N=ba=S=fa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
|
|
|
a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,k,l,m,n,p=3*a.count;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],i=c[n+4],l=c[n+5],h=c[n+6],k=c[n+7],m=c[n+8],d=(d+g+h)/3,e=(e+i+k)/3,f=
|
|
|
-(f+l+m)/3,c[n]=d,c[n+1]=e,c[n+2]=f,c[n+3]=d,c[n+4]=e,c[n+5]=f,c[n+6]=d,c[n+7]=e,c[n+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=m(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==O&&(O=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;
|
|
|
+(f+l+m)/3,c[n]=d,c[n+1]=e,c[n+2]=f,c[n+3]=d,c[n+4]=e,c[n+5]=f,c[n+6]=d,c[n+7]=e,c[n+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=m(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==N&&(N=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;
|
|
|
for(c=f.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer),j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer),j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer),j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,
|
|
|
!1,0,8*f[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*f[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,f[d].count,j.UNSIGNED_SHORT,2*f[d].start),B.info.render.calls++,B.info.render.vertices+=f[d].count,B.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,
|
|
|
-b,c,d,e,f){if(0!==d.opacity){var g,h,c=m(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==O&&(O=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+b,c,d,e,f){if(0!==d.opacity){var g,h,c=m(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==N&&(N=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],k=-1,l=0;h=f.morphTargetInfluences;var n,p=h.length;g=0;for(-1!==f.morphTargetBase&&(i[f.morphTargetBase]=
|
|
|
!0);g<d.numSupportedMorphTargets;){for(n=0;n<p;n++)!i[n]&&h[n]>k&&(l=n,k=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[l]=1;k=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],
|
|
|
0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&
|
|
@@ -278,16 +278,16 @@ j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFE
|
|
|
e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),B.info.render.calls++,B.info.render.vertices+=e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==La&&(j.lineWidth(d),La=d),j.drawArrays(f,0,e.__webglLineCount),B.info.render.calls++):f instanceof
|
|
|
THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),B.info.render.calls++,B.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),B.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,k,m,n=a.lights,p=a.fog;I=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();
|
|
|
h(this.renderPluginsPre,a,b);B.info.render.calls=0;B.info.render.vertices=0;B.info.render.faces=0;B.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Ra.multiply(b.projectionMatrix,b.matrixWorldInverse);gb.setFromMatrix(Ra);this.setRenderTarget(c);
|
|
|
-(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,f.render=!1,k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||gb.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);r(k,b);var o=f,q=o.object,O=o.buffer,u=void 0,u=u=void 0,u=q.material;if(u instanceof THREE.MeshFaceMaterial){if(u=O.materialIndex,0<=u)u=q.geometry.materials[u],u.transparent?
|
|
|
+(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,f.render=!1,k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||gb.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);r(k,b);var o=f,q=o.object,N=o.buffer,u=void 0,u=u=void 0,u=q.material;if(u instanceof THREE.MeshFaceMaterial){if(u=N.materialIndex,0<=u)u=q.geometry.materials[u],u.transparent?
|
|
|
(o.transparent=u,o.opaque=null):(o.opaque=u,o.transparent=null)}else if(u)u.transparent?(o.transparent=u,o.opaque=null):(o.opaque=u,o.transparent=null);f.render=!0;if(this.sortObjects)k.renderDepth?f.z=k.renderDepth:(Sa.copy(k.position),Ra.multiplyVector3(Sa),f.z=Sa.z)}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,k.visible)k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),r(k,b),k=f.object.material,k.transparent?(f.transparent=
|
|
|
k,f.opaque=null):(f.opaque=k,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),s(a.overrideMaterial.depthWrite),t(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,n,p,!0,a.overrideMaterial),l(a.__webglObjectsImmediate,"",b,n,p,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,p,
|
|
|
!1),l(a.__webglObjectsImmediate,"opaque",b,n,p,!1),i(a.__webglObjects,!1,"transparent",b,n,p,!0),l(a.__webglObjectsImmediate,"transparent",b,n,p,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),
|
|
|
-j.bindTexture(j.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,e){var f=m(a,b,c,d,e);O=-1;B.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,gb):e.render(function(a){B.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,l=void 0,m=void 0;if(!g.__webglInit)if(g.__webglInit=
|
|
|
-!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(l=g.geometry,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var r=l,s=void 0,O=void 0,t=void 0,u=void 0,I=void 0,x=void 0,v=void 0,y={},C=r.morphTargets.length;r.geometryGroups={};for(s=0,O=r.faces.length;s<O;s++)t=r.faces[s],u=t.materialIndex,
|
|
|
-x=void 0!==u?u:-1,void 0===y[x]&&(y[x]={hash:x,counter:0}),v=y[x].hash+"_"+y[x].counter,void 0===r.geometryGroups[v]&&(r.geometryGroups[v]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C}),I=t instanceof THREE.Face3?3:4,65535<r.geometryGroups[v].vertices+I&&(y[x].counter+=1,v=y[x].hash+"_"+y[x].counter,void 0===r.geometryGroups[v]&&(r.geometryGroups[v]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C})),t instanceof THREE.Face3?r.geometryGroups[v].faces3.push(s):
|
|
|
-r.geometryGroups[v].faces4.push(s),r.geometryGroups[v].vertices+=I;r.geometryGroupsList=[];var E=void 0;for(E in r.geometryGroups)r.geometryGroups[E].id=T++,r.geometryGroupsList.push(r.geometryGroups[E])}for(i in l.geometryGroups)if(m=l.geometryGroups[i],!m.__webglVertexBuffer){var A=m;A.__webglVertexBuffer=j.createBuffer();A.__webglNormalBuffer=j.createBuffer();A.__webglTangentBuffer=j.createBuffer();A.__webglColorBuffer=j.createBuffer();A.__webglUVBuffer=j.createBuffer();A.__webglUV2Buffer=j.createBuffer();
|
|
|
-A.__webglSkinVertexABuffer=j.createBuffer();A.__webglSkinVertexBBuffer=j.createBuffer();A.__webglSkinIndicesBuffer=j.createBuffer();A.__webglSkinWeightsBuffer=j.createBuffer();A.__webglFaceBuffer=j.createBuffer();A.__webglLineBuffer=j.createBuffer();if(A.numMorphTargets){var D=void 0,H=void 0;A.__webglMorphTargetsBuffers=[];for(D=0,H=A.numMorphTargets;D<H;D++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}B.info.memory.geometries++;var F=m,S=g,aa=S.geometry,K=F.faces3,N=F.faces4,L=3*K.length+
|
|
|
-4*N.length,fa=1*K.length+2*N.length,ba=3*K.length+4*N.length,$=c(S,F),P=e($),ca=d($),R=$.vertexColors?$.vertexColors:!1;F.__vertexArray=new Float32Array(3*L);if(ca)F.__normalArray=new Float32Array(3*L);if(aa.hasTangents)F.__tangentArray=new Float32Array(4*L);if(R)F.__colorArray=new Float32Array(3*L);if(P){if(0<aa.faceUvs.length||0<aa.faceVertexUvs.length)F.__uvArray=new Float32Array(2*L);if(1<aa.faceUvs.length||1<aa.faceVertexUvs.length)F.__uv2Array=new Float32Array(2*L)}if(S.geometry.skinWeights.length&&
|
|
|
+j.bindTexture(j.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,e){var f=m(a,b,c,d,e);N=-1;B.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,gb):e.render(function(a){B.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,l=void 0,m=void 0;if(!g.__webglInit)if(g.__webglInit=
|
|
|
+!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(l=g.geometry,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var r=l,s=void 0,t=void 0,N=void 0,u=void 0,I=void 0,v=void 0,x=void 0,y={},C=r.morphTargets.length;r.geometryGroups={};for(s=0,t=r.faces.length;s<t;s++)N=r.faces[s],u=N.materialIndex,
|
|
|
+v=void 0!==u?u:-1,void 0===y[v]&&(y[v]={hash:v,counter:0}),x=y[v].hash+"_"+y[v].counter,void 0===r.geometryGroups[x]&&(r.geometryGroups[x]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C}),I=N instanceof THREE.Face3?3:4,65535<r.geometryGroups[x].vertices+I&&(y[v].counter+=1,x=y[v].hash+"_"+y[v].counter,void 0===r.geometryGroups[x]&&(r.geometryGroups[x]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:C})),N instanceof THREE.Face3?r.geometryGroups[x].faces3.push(s):
|
|
|
+r.geometryGroups[x].faces4.push(s),r.geometryGroups[x].vertices+=I;r.geometryGroupsList=[];var E=void 0;for(E in r.geometryGroups)r.geometryGroups[E].id=T++,r.geometryGroupsList.push(r.geometryGroups[E])}for(i in l.geometryGroups)if(m=l.geometryGroups[i],!m.__webglVertexBuffer){var A=m;A.__webglVertexBuffer=j.createBuffer();A.__webglNormalBuffer=j.createBuffer();A.__webglTangentBuffer=j.createBuffer();A.__webglColorBuffer=j.createBuffer();A.__webglUVBuffer=j.createBuffer();A.__webglUV2Buffer=j.createBuffer();
|
|
|
+A.__webglSkinVertexABuffer=j.createBuffer();A.__webglSkinVertexBBuffer=j.createBuffer();A.__webglSkinIndicesBuffer=j.createBuffer();A.__webglSkinWeightsBuffer=j.createBuffer();A.__webglFaceBuffer=j.createBuffer();A.__webglLineBuffer=j.createBuffer();if(A.numMorphTargets){var D=void 0,H=void 0;A.__webglMorphTargetsBuffers=[];for(D=0,H=A.numMorphTargets;D<H;D++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}B.info.memory.geometries++;var F=m,S=g,aa=S.geometry,K=F.faces3,O=F.faces4,L=3*K.length+
|
|
|
+4*O.length,fa=1*K.length+2*O.length,ba=3*K.length+4*O.length,$=c(S,F),P=e($),ca=d($),R=$.vertexColors?$.vertexColors:!1;F.__vertexArray=new Float32Array(3*L);if(ca)F.__normalArray=new Float32Array(3*L);if(aa.hasTangents)F.__tangentArray=new Float32Array(4*L);if(R)F.__colorArray=new Float32Array(3*L);if(P){if(0<aa.faceUvs.length||0<aa.faceVertexUvs.length)F.__uvArray=new Float32Array(2*L);if(1<aa.faceUvs.length||1<aa.faceVertexUvs.length)F.__uv2Array=new Float32Array(2*L)}if(S.geometry.skinWeights.length&&
|
|
|
S.geometry.skinIndices.length)F.__skinVertexAArray=new Float32Array(4*L),F.__skinVertexBArray=new Float32Array(4*L),F.__skinIndexArray=new Float32Array(4*L),F.__skinWeightArray=new Float32Array(4*L);F.__faceArray=new Uint16Array(3*fa);F.__lineArray=new Uint16Array(2*ba);if(F.numMorphTargets){F.__morphTargetsArrays=[];for(var ga=0,ia=F.numMorphTargets;ga<ia;ga++)F.__morphTargetsArrays.push(new Float32Array(3*L))}F.__webglFaceCount=3*fa;F.__webglLineCount=2*ba;if($.attributes){if(void 0===F.__webglCustomAttributesList)F.__webglCustomAttributesList=
|
|
|
[];var V=void 0;for(V in $.attributes){var La=$.attributes[V],ja={},za;for(za in La)ja[za]=La[za];if(!ja.__webglInitialized||ja.createUniqueBuffers){ja.__webglInitialized=!0;var qa=1;"v2"===ja.type?qa=2:"v3"===ja.type?qa=3:"v4"===ja.type?qa=4:"c"===ja.type&&(qa=3);ja.size=qa;ja.array=new Float32Array(L*qa);ja.buffer=j.createBuffer();ja.buffer.belongsToAttribute=V;La.needsUpdate=!0;ja.__original=La}F.__webglCustomAttributesList.push(ja)}}F.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=
|
|
|
!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=!0}}}else if(g instanceof THREE.Ribbon){if(l=g.geometry,!l.__webglVertexBuffer){var Fa=l;Fa.__webglVertexBuffer=j.createBuffer();Fa.__webglColorBuffer=j.createBuffer();B.info.memory.geometries++;var Ga=l,Aa=Ga.vertices.length;Ga.__vertexArray=new Float32Array(3*Aa);Ga.__colorArray=new Float32Array(3*Aa);Ga.__webglVertexCount=Aa;l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(l=
|
|
@@ -506,8 +506,8 @@ c.target.addSelf(b);c.staticMoving?k=p:k.addSelf(a.sub(p,k).multiplyScalar(c.dyn
|
|
|
c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=l=c.getMouseOnScreen(a.clientX,a.clientY),k=p=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==e&&(0===e&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,
|
|
|
a.clientY):2===e&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===e))e=a.button,0===e&&!c.noRotate?g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?i=l=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(k=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
|
|
|
e=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===e&&(a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2),-1!==e&&(d=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==e&&(e=-1)},!1)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,m){var n,p=d||1,o=e||1,q=h/2,r=i/2,j=l.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",o=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",p=f||1;var s=p+1,t=o+1,u=h/p,I=i/o,O=new THREE.Vector3;O[n]=0<k?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var T=new THREE.Vector3;T[a]=(i*u-q)*c;T[b]=(h*I-r)*g;T[n]=k;l.vertices.push(new THREE.Vertex(T))}for(h=0;h<o;h++)for(i=0;i<p;i++)a=
|
|
|
-new THREE.Face4(i+s*h+j,i+s*(h+1)+j,i+1+s*(h+1)+j,i+1+s*h+j),a.normal.copy(O),a.vertexNormals.push(O.clone(),O.clone(),O.clone(),O.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/p,h/o),new THREE.UV(i/p,(h+1)/o),new THREE.UV((i+1)/p,(h+1)/o),new THREE.UV((i+1)/p,h/o)])}THREE.Geometry.call(this);var l=this,k=a/2,p=b/2,n=c/2,o,q,m,r,s,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;q=2;s=
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,m){var n,p=d||1,o=e||1,q=h/2,r=i/2,j=l.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",o=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",p=f||1;var s=p+1,t=o+1,u=h/p,I=i/o,N=new THREE.Vector3;N[n]=0<k?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var T=new THREE.Vector3;T[a]=(i*u-q)*c;T[b]=(h*I-r)*g;T[n]=k;l.vertices.push(new THREE.Vertex(T))}for(h=0;h<o;h++)for(i=0;i<p;i++)a=
|
|
|
+new THREE.Face4(i+s*h+j,i+s*(h+1)+j,i+1+s*(h+1)+j,i+1+s*h+j),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/p,h/o),new THREE.UV(i/p,(h+1)/o),new THREE.UV((i+1)/p,(h+1)/o),new THREE.UV((i+1)/p,h/o)])}THREE.Geometry.call(this);var l=this,k=a/2,p=b/2,n=c/2,o,q,m,r,s,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;q=2;s=
|
|
|
3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var u in h)void 0!==this.sides[u]&&(this.sides[u]=h[u]);this.sides.px&&i("z","y",-1,-1,c,b,k,o);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,n,m);this.sides.nz&&i("x","y",-1,-1,a,b,-n,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,l=[],k=[];for(i=0;i<=e;i++){var p=[],n=[],o=i/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=q*Math.sin(2*m*Math.PI),s=-o*c+g,t=q*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,t)));p.push(this.vertices.length-1);n.push(new THREE.UV(m,o))}l.push(p);k.push(n)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],p=l[i+1][h],
|
|
@@ -520,9 +520,9 @@ h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);0===f
|
|
|
0,c=o+2*k,b=0;b<c;b++){var d=P*b,e=P*(b+1),f=ga+y+d,g=ga+y+e,j=f,d=ga+I+d,e=ga+I+e,l=g,j=j+F,d=d+F,e=e+F,l=l+F;C.faces.push(new THREE.Face4(j,d,e,l,null,null,x));void 0!==x&&(j=b/c,d=(b+1)/c,e=h+2*i,f=(C.vertices[f].position.z+i)/e,g=(C.vertices[g].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=F;b+=F;c+=F;C.faces.push(new THREE.Face3(a,
|
|
|
b,c,null,null,u));if(void 0!==u){var d=v.minX,e=v.minY,f=v.maxY,g=v.maxX,h=C.vertices[b].position.x-d,b=C.vertices[b].position.y-e,i=C.vertices[c].position.x-d,c=C.vertices[c].position.y-e;C.faceVertexUvs[0].push([new THREE.UV((C.vertices[a].position.x-d)/g,(C.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(i/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:
|
|
|
3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,m=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,u=b.material,x=b.extrudeMaterial,v=this.shapebb;if(m)r=m.getPoints(n),o=r.length,s=!0,p=!1;p||(l=i=k=0);var A,D,E,C=this,F=this.vertices.length;q&&a.addWrapPath(q);n=t?a.extractAllSpacedPoints(n):a.extractAllPoints(n);q=n.shape;n=n.holes;if(m=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();for(D=
|
|
|
-0,E=n.length;D<E;D++)A=n[D],THREE.Shape.Utils.isClockWise(A)&&(n[D]=A.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(q,n);t=q;for(D=0,E=n.length;D<E;D++)A=n[D],q=q.concat(A);for(var K,L,R,N,P=q.length,B=m.length,j=[],H=0,V=t.length,y=V-1,I=H+1;H<V;H++,y++,I++)y===V&&(y=0),I===V&&(I=0),j[H]=d(t[H],t[y],t[I]);var O=[],T,aa=j.concat();for(D=0,E=n.length;D<E;D++){A=n[D];T=[];for(H=0,V=A.length,y=V-1,I=H+1;H<V;H++,y++,I++)y===V&&(y=0),I===V&&(I=0),T[H]=d(A[H],A[y],A[I]);O.push(T);aa=aa.concat(T)}for(K=
|
|
|
-0;K<k;K++){L=K/k;R=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(H=0,V=t.length;H<V;H++)N=c(t[H],j[H],L),f(N.x,N.y,-R);for(D=0,E=n.length;D<E;D++){A=n[D];T=O[D];for(H=0,V=A.length;H<V;H++)N=c(A[H],T[H],L),f(N.x,N.y,-R)}}L=l;for(H=0;H<P;H++)N=p?c(q[H],aa[H],L):q[H],s?f(N.x,N.y+r[0].y,r[0].x):f(N.x,N.y,0);for(K=1;K<=o;K++)for(H=0;H<P;H++)N=p?c(q[H],aa[H],L):q[H],s?f(N.x,N.y+r[K-1].y,r[K-1].x):f(N.x,N.y,h/o*K);for(K=k-1;0<=K;K--){L=K/k;R=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(H=0,V=t.length;H<V;H++)N=c(t[H],
|
|
|
-j[H],L),f(N.x,N.y,h+R);for(D=0,E=n.length;D<E;D++){A=n[D];T=O[D];for(H=0,V=A.length;H<V;H++)N=c(A[H],T[H],L),s?f(N.x,N.y+r[o-1].y,r[o-1].x+R):f(N.x,N.y,h+R)}}if(p){p=0*P;for(H=0;H<B;H++)l=m[H],g(l[2]+p,l[1]+p,l[0]+p);p=P*(o+2*k);for(H=0;H<B;H++)l=m[H],g(l[0]+p,l[1]+p,l[2]+p)}else{for(H=0;H<B;H++)l=m[H],g(l[2],l[1],l[0]);for(H=0;H<B;H++)l=m[H],g(l[0]+P*o,l[1]+P*o,l[2]+P*o)}var ga=0;e(t);ga+=t.length;for(D=0,E=n.length;D<E;D++)A=n[D],e(A),ga+=A.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+0,E=n.length;D<E;D++)A=n[D],THREE.Shape.Utils.isClockWise(A)&&(n[D]=A.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(q,n);t=q;for(D=0,E=n.length;D<E;D++)A=n[D],q=q.concat(A);for(var K,L,R,O,P=q.length,B=m.length,j=[],H=0,V=t.length,y=V-1,I=H+1;H<V;H++,y++,I++)y===V&&(y=0),I===V&&(I=0),j[H]=d(t[H],t[y],t[I]);var N=[],T,aa=j.concat();for(D=0,E=n.length;D<E;D++){A=n[D];T=[];for(H=0,V=A.length,y=V-1,I=H+1;H<V;H++,y++,I++)y===V&&(y=0),I===V&&(I=0),T[H]=d(A[H],A[y],A[I]);N.push(T);aa=aa.concat(T)}for(K=
|
|
|
+0;K<k;K++){L=K/k;R=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(H=0,V=t.length;H<V;H++)O=c(t[H],j[H],L),f(O.x,O.y,-R);for(D=0,E=n.length;D<E;D++){A=n[D];T=N[D];for(H=0,V=A.length;H<V;H++)O=c(A[H],T[H],L),f(O.x,O.y,-R)}}L=l;for(H=0;H<P;H++)O=p?c(q[H],aa[H],L):q[H],s?f(O.x,O.y+r[0].y,r[0].x):f(O.x,O.y,0);for(K=1;K<=o;K++)for(H=0;H<P;H++)O=p?c(q[H],aa[H],L):q[H],s?f(O.x,O.y+r[K-1].y,r[K-1].x):f(O.x,O.y,h/o*K);for(K=k-1;0<=K;K--){L=K/k;R=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(H=0,V=t.length;H<V;H++)O=c(t[H],
|
|
|
+j[H],L),f(O.x,O.y,h+R);for(D=0,E=n.length;D<E;D++){A=n[D];T=N[D];for(H=0,V=A.length;H<V;H++)O=c(A[H],T[H],L),s?f(O.x,O.y+r[o-1].y,r[o-1].x+R):f(O.x,O.y,h+R)}}if(p){p=0*P;for(H=0;H<B;H++)l=m[H],g(l[2]+p,l[1]+p,l[0]+p);p=P*(o+2*k);for(H=0;H<B;H++)l=m[H],g(l[0]+p,l[1]+p,l[2]+p)}else{for(H=0;H<B;H++)l=m[H],g(l[2],l[1],l[0]);for(H=0;H<B;H++)l=m[H],g(l[0]+P*o,l[1]+P*o,l[2]+P*o)}var ga=0;e(t);ga+=t.length;for(D=0,E=n.length;D<E;D++)A=n[D],e(A),ga+=A.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.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-0.5*((Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI),0.5-f.y/2),new THREE.UV(1-
|
|
|
0.5*((Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI),0.5-g.y/2),new THREE.UV(1-0.5*((Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI),0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,f);c(0,5,1,
|
|
@@ -546,7 +546,7 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
|
|
|
k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,i,k);if(g=f[f.length-1]){p=g.x;n=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,u=THREE.Shape.Utils.b2(t,p,o,i),t=THREE.Shape.Utils.b2(t,n,q,k);f.push(new THREE.Vector2(u,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,o=b[a++]*c+d,q=b[a++]*-c,m=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,k,o,q,m,r),g=f[f.length-1]){p=g.x;n=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,u=THREE.Shape.Utils.b3(t,p,o,
|
|
|
m,i),t=THREE.Shape.Utils.b3(t,n,q,r,k),f.push(new THREE.Vector2(u,t))}}}return{offset:s.ha*c,points:f,path:e}}}};
|
|
|
(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,l,k;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var p=2*e;for(l=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);k=l+1;e<=k&&(k=0);var n;a:{n=a;var o=i,q=l,m=k,r=e,s=g,t=void 0,u=void 0,x=void 0,v=void 0,A=void 0,
|
|
|
-D=void 0,E=void 0,C=void 0,F=void 0,u=n[s[o]].x,x=n[s[o]].y,v=n[s[q]].x,A=n[s[q]].y,D=n[s[m]].x,E=n[s[m]].y;if(1.0E-10>(v-u)*(E-x)-(A-x)*(D-u))n=!1;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==m)){var C=n[s[t]].x,F=n[s[t]].y,K=void 0,L=void 0,R=void 0,N=void 0,P=void 0,B=void 0,j=void 0,H=void 0,V=void 0,y=void 0,I=void 0,O=void 0,K=R=P=void 0,K=D-v,L=E-A,R=u-D,N=x-E,P=v-u,B=A-x,j=C-u,H=F-x,V=C-v,y=F-A,I=C-D,O=F-E,K=K*y-L*V,P=P*H-B*j,R=R*O-N*I;if(0<=K&&0<=R&&0<=P){n=!1;break a}}n=!0}}if(n){f.push([a[g[i]],
|
|
|
+D=void 0,E=void 0,C=void 0,F=void 0,u=n[s[o]].x,x=n[s[o]].y,v=n[s[q]].x,A=n[s[q]].y,D=n[s[m]].x,E=n[s[m]].y;if(1.0E-10>(v-u)*(E-x)-(A-x)*(D-u))n=!1;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==m)){var C=n[s[t]].x,F=n[s[t]].y,K=void 0,L=void 0,R=void 0,O=void 0,P=void 0,B=void 0,j=void 0,H=void 0,V=void 0,y=void 0,I=void 0,N=void 0,K=R=P=void 0,K=D-v,L=E-A,R=u-D,O=x-E,P=v-u,B=A-x,j=C-u,H=F-x,V=C-v,y=F-A,I=C-D,N=F-E,K=K*y-L*V,P=P*H-B*j,R=R*N-O*I;if(0<=K&&0<=R&&0<=P){n=!1;break a}}n=!0}}if(n){f.push([a[g[i]],
|
|
|
a[g[l]],a[g[k]]]);h.push([g[i],g[l],g[k]]);for(i=l,k=l+1;k<e;i++,k++)g[i]=g[k];e--;p=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
|
|
|
this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
@@ -559,8 +559,8 @@ THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){v
|
|
|
b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},p={},n=[],o,q,m,r,s,t=a.faceVertexUvs[0];for(o=0,q=t.length;o<q;o++)for(m=0,r=t[o].length;m<r;m++)s=d[o]["abcd".charAt(m)],n[s]||(n[s]=t[o][m]);var u;for(o=0,q=d.length;o<q;o++)if(s=d[o],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=n.length){u=new THREE.UV;if(s instanceof THREE.Face3)u.u=n[s.a].u+n[s.b].u+n[s.c].u,u.v=n[s.a].v+n[s.b].v+n[s.c].v,u.u/=3,u.v/=3;else if(s instanceof THREE.Face4)u.u=
|
|
|
n[s.a].u+n[s.b].u+n[s.c].u+n[s.d].u,u.v=n[s.a].v+n[s.b].v+n[s.c].v+n[s.d].v,u.u/=4,u.v/=4;n.push(u)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var x=0,t=h.length,v,A,D={},E={},C=function(a,
|
|
|
b){void 0===D[a]&&(D[a]=[]);D[a].push(b)},F=function(a,b){void 0===E[a]&&(E[a]={});E[a][b]=null};for(o in q){u=q[o];v=o.split("_");A=v[0];v=v[1];C(A,[A,v]);C(v,[A,v]);for(m=0,r=u.length;m<r;m++)s=u[m],F(A,s,o),F(v,s,o);2>u.length&&(p[o]=!0)}for(o in q)if(u=q[o],s=u[0],u=u[1],v=o.split("_"),A=v[0],v=v[1],r=new THREE.Vector3,p[o]?(r.addSelf(h[A].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(l[s]),r.addSelf(l[u]),r.addSelf(h[A].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
|
|
|
-k[o]=t+d.length+x,i.push(new THREE.Vertex(r)),x++,g.supportUVs&&0!=n.length)u=new THREE.UV,u.u=n[A].u+n[v].u,u.v=n[A].v+n[v].v,u.u/=2,u.v/=2,n.push(u);var K,L;v=["123","12","2","23"];r=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],R=["1234","23","3","34"],N=["1234","34","4","41"],P=["1234","41","1","12"];for(o=0,q=l.length;o<q;o++)s=d[o],u=t+o,s instanceof THREE.Face3?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.a),b(u,k[x],s.b,k[A],s,v),b(u,k[A],s.c,k[K],s,r),b(u,k[K],s.a,k[x],
|
|
|
-s,C)):s instanceof THREE.Face4?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.d),L=c(s.d,s.a),b(u,k[x],s.b,k[A],s,F),b(u,k[A],s.c,k[K],s,R),b(u,k[K],s.d,k[L],s,N),b(u,k[L],s.a,k[x],s,P)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==D[o]){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);u=0;for(m in E[o])i.addSelf(l[m]),u++;x=0;t=D[o].length;for(m=0;m<t;m++)p[c(D[o][m][0],D[o][m][1])]&&x++;if(2!=x){i.divideScalar(u);for(m=0;m<
|
|
|
+k[o]=t+d.length+x,i.push(new THREE.Vertex(r)),x++,g.supportUVs&&0!=n.length)u=new THREE.UV,u.u=n[A].u+n[v].u,u.v=n[A].v+n[v].v,u.u/=2,u.v/=2,n.push(u);var K,L;v=["123","12","2","23"];r=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],R=["1234","23","3","34"],O=["1234","34","4","41"],P=["1234","41","1","12"];for(o=0,q=l.length;o<q;o++)s=d[o],u=t+o,s instanceof THREE.Face3?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.a),b(u,k[x],s.b,k[A],s,v),b(u,k[A],s.c,k[K],s,r),b(u,k[K],s.a,k[x],
|
|
|
+s,C)):s instanceof THREE.Face4?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.d),L=c(s.d,s.a),b(u,k[x],s.b,k[A],s,F),b(u,k[A],s.c,k[K],s,R),b(u,k[K],s.d,k[L],s,O),b(u,k[L],s.a,k[x],s,P)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==D[o]){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);u=0;for(m in E[o])i.addSelf(l[m]),u++;x=0;t=D[o].length;for(m=0;m<t;m++)p[c(D[o][m][0],D[o][m][1])]&&x++;if(2!=x){i.divideScalar(u);for(m=0;m<
|
|
|
t;m++)u=D[o][m],u=h[u[0]].position.clone().addSelf(h[u[1]].position).divideScalar(2),k.addSelf(u);k.divideScalar(t);s.addSelf(h[o].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(t);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;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.prototype={constructor:THREE.Loader,crossOrigin:"",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 b="Loaded ",b=a.total?b+((100*a.loaded/a.total).toFixed(0)+
|
|
@@ -580,12 +580,12 @@ f.responseType="arraybuffer";f.send(null)};
|
|
|
THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,l,k,p,n,o,q,m,r,s,t,u,x,v;function A(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,e,f,g,h,i,j,l,k=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=k[3*d];f=k[3*d+1];g=k[3*d+2];h=H[2*e];e=H[2*e+1];i=H[2*f];j=H[2*f+1];f=H[2*g];l=H[2*g+1];g=P.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));
|
|
|
m.push(new THREE.UV(f,l));g.push(m)}}function F(b,c){var d,e,f,g,h,i,j,l,k,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=H[2*e];e=H[2*e+1];j=H[2*f];k=H[2*f+1];l=H[2*g];m=H[2*g+1];g=H[2*h];f=H[2*h+1];h=P.faceVertexUvs[0];var n=[];n.push(new THREE.UV(i,e));n.push(new THREE.UV(j,k));n.push(new THREE.UV(l,m));n.push(new THREE.UV(g,f));h.push(n)}}function K(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*
|
|
|
d+1],g=c[3*d+2],h=i[d],P.faces.push(new THREE.Face3(e,f,g,null,null,h))}function L(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],P.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function R(b,c,d,e){for(var f,g,h,i,l,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];l=d[3*e];k=d[3*e+1];m=d[3*e+2];i=o[e];var n=j[3*k],p=j[3*k+1];k=
|
|
|
-j[3*k+2];var q=j[3*m],r=j[3*m+1];m=j[3*m+2];P.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(j[3*l],j[3*l+1],j[3*l+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(q,r,m)],null,i))}}function N(b,c,d,e){for(var f,g,h,i,k,l,m,o,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];l=d[4*e];m=d[4*e+1];o=d[4*e+2];n=d[4*e+3];k=p[e];var q=j[3*m],r=j[3*m+1];m=j[3*m+2];var s=j[3*o],t=j[3*o+1];o=j[3*o+2];var u=j[3*n],v=j[3*
|
|
|
+j[3*k+2];var q=j[3*m],r=j[3*m+1];m=j[3*m+2];P.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(j[3*l],j[3*l+1],j[3*l+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(q,r,m)],null,i))}}function O(b,c,d,e){for(var f,g,h,i,k,l,m,o,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];l=d[4*e];m=d[4*e+1];o=d[4*e+2];n=d[4*e+3];k=p[e];var q=j[3*m],r=j[3*m+1];m=j[3*m+2];var s=j[3*o],t=j[3*o+1];o=j[3*o+2];var u=j[3*n],v=j[3*
|
|
|
n+1];n=j[3*n+2];P.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(j[3*l],j[3*l+1],j[3*l+2]),new THREE.Vector3(q,r,m),new THREE.Vector3(s,t,o),new THREE.Vector3(u,v,n)],null,k))}}var P=this,B=0,j=[],H=[],V,y;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,B,12);e=D(a,B+12);D(a,B+13);D(a,B+14);D(a,B+15);i=D(a,B+16);l=D(a,B+17);k=D(a,B+18);p=D(a,B+19);n=E(a,B+20);
|
|
|
o=E(a,B+20+4);q=E(a,B+20+8);b=E(a,B+20+12);m=E(a,B+20+16);r=E(a,B+20+20);s=E(a,B+20+24);t=E(a,B+20+28);u=E(a,B+20+32);x=E(a,B+20+36);v=E(a,B+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");B+=e;c=3*i+p;y=4*i+p;e=b*c;V=m*(c+3*l);i=r*(c+3*k);p=s*(c+3*l+3*k);c=t*y;l=u*(y+4*l);k=x*(y+4*k);B+=function(b){var b=new Float32Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],P.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
|
|
|
n*Float32Array.BYTES_PER_ELEMENT}(B);B+=function(b){if(o){var b=new Int8Array(a,b,3*o),c,d,e,f;for(c=0;c<o;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],j.push(d/127,e/127,f/127)}return 3*o*Int8Array.BYTES_PER_ELEMENT}(B);B+=A(3*o);B+=function(b){if(q){var b=new Float32Array(a,b,2*q),c,d,e;for(c=0;c<q;c++)d=b[2*c],e=b[2*c+1],H.push(d,e)}return 2*q*Float32Array.BYTES_PER_ELEMENT}(B);e=B+e+A(2*b);V=e+V+A(2*m);i=V+i+A(2*r);p=i+p+A(2*s);c=p+c+A(2*t);l=c+l+A(2*u);k=l+k+A(2*x);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
|
|
|
-K(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);C(r,b)}})(V);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;R(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);C(s,c)}})(i);(function(a){if(x){var b=a+4*x*Uint32Array.BYTES_PER_ELEMENT;L(x,a,b+4*x*Uint32Array.BYTES_PER_ELEMENT);F(x,b)}})(l);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;N(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);F(v,c)}})(k);b&&K(b,B,B+3*b*
|
|
|
-Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;R(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&L(t,p,p+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;N(u,a,b,b+4*u*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
+K(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);C(r,b)}})(V);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;R(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);C(s,c)}})(i);(function(a){if(x){var b=a+4*x*Uint32Array.BYTES_PER_ELEMENT;L(x,a,b+4*x*Uint32Array.BYTES_PER_ELEMENT);F(x,b)}})(l);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT,c=b+4*v*Uint32Array.BYTES_PER_ELEMENT;O(v,a,b,c+4*v*Uint32Array.BYTES_PER_ELEMENT);F(v,c)}})(k);b&&K(b,B,B+3*b*
|
|
|
+Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;R(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&L(t,p,p+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;O(u,a,b,b+4*u*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
THREE.ColladaLoader=function(){function a(a,d,e){S=a;d=d||ca;void 0!==e&&(a=e.split("/"),a.pop(),Ra=1>a.length?"":a.join("/")+"/");if((a=S.evaluate("//dae:asset",S,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":Ma=i.textContent.charAt(0)}}if(!Aa.convertUpAxis||Ma===Aa.upAxis)xa=null;else switch(Ma){case "X":xa="Y"===Aa.upAxis?
|
|
|
"XtoY":"XtoZ";break;case "Y":xa="X"===Aa.upAxis?"YtoX":"YtoZ";break;case "Z":xa="X"===Aa.upAxis?"ZtoX":"ZtoY"}La=b("//dae:library_images/dae:image",g,"image");Ga=b("//dae:library_materials/dae:material",E,"material");Fa=b("//dae:library_effects/dae:effect",R,"effect");qa=b("//dae:library_geometries/dae:geometry",r,"geometry");za=b("//dae:library_controllers/dae:controller",h,"controller");ja=b("//dae:library_animations/dae:animation",P,"animation");gb=b(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
k,"visual_scene");Sa=[];bb=[];(a=S.evaluate(".//dae:scene/dae:instance_visual_scene",S,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),$=gb[a]):$=null;ba=new THREE.Object3D;for(a=0;a<$.nodes.length;a++)ba.add(f($.nodes[a]));ab=[];c(ba);a={scene:ba,morphs:Sa,skins:bb,animations:ab,dae:{images:La,materials:Ga,effects:Fa,geometries:qa,controllers:za,animations:ja,visualScenes:gb,scene:$}};d&&d(a);return a}function b(a,b,c){for(var a=S.evaluate(a,
|
|
@@ -601,9 +601,9 @@ n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vert
|
|
|
b.position.subSelf(c));for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){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 n(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function u(){this.material="";this.count=
|
|
|
0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function x(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function A(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}
|
|
|
-function F(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=null}function L(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function R(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function N(){this.url=""}function P(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function B(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
|
|
|
-this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function j(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function H(a){this.targets=[];this.time=a}function V(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function y(a){for(var a=O(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function I(a){for(var a=O(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],
|
|
|
-10));return b}function O(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function T(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function aa(a,b){if(Aa.convertUpAxis&&Ma!==Aa.upAxis)switch(xa){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=
|
|
|
+function F(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=null}function L(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function R(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function O(){this.url=""}function P(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function B(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
|
|
|
+this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function j(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function H(a){this.targets=[];this.time=a}function V(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function y(a){for(var a=N(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function I(a){for(var a=N(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],
|
|
|
+10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function T(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function aa(a,b){if(Aa.convertUpAxis&&Ma!==Aa.upAxis)switch(xa){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=
|
|
|
b*c}}function ga(a,b){var c=[a[b],a[b+1],a[b+2]];aa(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function fa(a){if(Aa.convertUpAxis){var b=[a[0],a[4],a[8]];aa(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];aa(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];aa(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];aa(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];aa(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];aa(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],
|
|
|
a[11]];aa(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var S=null,ba=null,$,ca=null,ia={},La={},ja={},za={},qa={},Ga={},Fa={},ab,gb,Ra,Sa,bb,Wa=THREE.SmoothShading,Aa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Ma="Y",xa=null,Sb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==
|
|
|
c.nodeName)this.init_from=c.textContent}return this};h.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 l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,
|
|
@@ -631,9 +631,9 @@ return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inp
|
|
|
0;for(p=d.length;o<p;o++){e=d[o];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<n.length;e++)r=q[n[e]],r=4<m?[r[0],r[o+1],r[o+2]]:4===m?[r[0],r[1],r[2],r[3]]:[r[0],r[1],r[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(r)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};t.prototype=new u;t.prototype.constructor=t;u.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};u.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=T(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 A).parse(a.childNodes[b]));break;case "vcount":this.vcount=I(c.textContent);break;case "p":this.p=I(c.textContent)}}return this};x.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=T(a,"count",0);this.stride=
|
|
|
T(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new A).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};A.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
-"");this.set=T(a,"set",-1);this.offset=T(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)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 d=O(c.textContent),e=[],f=0;f<d.length;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=y(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
-I(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new x).parse(c.childNodes[d]);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),c=fa(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new N).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return null==this.texture};C.prototype.isTexture=function(){return null!=this.texture};
|
|
|
+"");this.set=T(a,"set",-1);this.offset=T(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)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 d=N(c.textContent),e=[],f=0;f<d.length;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=y(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
+I(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new x).parse(c.childNodes[d]);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),c=fa(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new O).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return null==this.texture};C.prototype.isTexture=function(){return null!=this.texture};
|
|
|
C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=y(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"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};C.prototype.parseTexture=function(a){if(!a.childNodes)return this;
|
|
|
a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};F.prototype.parse=
|
|
|
function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=S.evaluate(".//dae:float",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
|
|
@@ -642,7 +642,7 @@ e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.
|
|
|
a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};R.prototype.create=function(){if(null==this.shader)return null};R.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(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
R.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new K(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new L(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};R.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
|
|
|
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};R.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};N.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};P.prototype.parse=function(a){this.id=
|
|
|
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};R.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};O.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};P.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new D).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new j(this)).parse(c));break;case "channel":this.channel.push((new B(this)).parse(c))}}return this};B.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=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};j.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(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new A).parse(c))}}return this};
|
|
|
j.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();this.strideOut=c.accessor.stride;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=
|
|
@@ -662,18 +662,18 @@ q=a.morphTargets[c].vertices;for(i=0,l=q.length;i<l;i+=3)k=q[i]*b,p=q[i+1]*b,n=q
|
|
|
d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status)try{var e=JSON.parse(d.responseText);void 0===e.metadata||void 0===e.metadata.formatVersion||3!==e.metadata.formatVersion?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
|
|
|
d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
|
|
|
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:l+"/"+a}function e(){var a;for(n in N.objects)if(!y.objects[n])if(s=N.objects[n],void 0!==s.geometry){if(F=y.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)R=y.materials[s.materials[I]],a=R instanceof THREE.ShaderMaterial;a&&F.computeTangents();x=s.position;v=s.rotation;A=s.quaternion;D=s.scale;A=0;0==R.length&&(R=new THREE.MeshFaceMaterial);1<R.length&&(R=new THREE.MeshFaceMaterial);
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:l+"/"+a}function e(){var a;for(n in O.objects)if(!y.objects[n])if(s=O.objects[n],void 0!==s.geometry){if(F=y.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)R=y.materials[s.materials[I]],a=R instanceof THREE.ShaderMaterial;a&&F.computeTangents();x=s.position;v=s.rotation;A=s.quaternion;D=s.scale;A=0;0==R.length&&(R=new THREE.MeshFaceMaterial);1<R.length&&(R=new THREE.MeshFaceMaterial);
|
|
|
a=new THREE.Mesh(F,R);a.name=n;a.position.set(x[0],x[1],x[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(D[0],D[1],D[2]);a.visible=s.visible;y.scene.add(a);y.objects[n]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);y.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(F),y.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&"none"!=s.trigger.toLowerCase()&&(b=
|
|
|
{type:s.trigger,object:s},y.triggers[a.name]=b)}}else x=s.position,v=s.rotation,A=s.quaternion,D=s.scale,A=0,a=new THREE.Object3D,a.name=n,a.position.set(x[0],x[1],x[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(D[0],D[1],D[2]),a.visible=void 0!==s.visible?s.visible:!1,y.scene.add(a),y.objects[n]=a,y.empties[n]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},y.triggers[a.name]=b)}function f(a){return function(b){y.geometries[a]=
|
|
|
-b;e();B-=1;i.onLoadComplete();h()}}function g(a){return function(b){y.geometries[a]=b}}function h(){i.callbackProgress({totalModels:H,totalTextures:V,loadedModels:H-B,loadedTextures:V-j},y);i.onLoadProgress();0==B&&0==j&&b(y)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),k,p,n,o,q,m,r,s,t,u,x,v,A,D,E,C,F,K,L,R,N,P,B,j,H,V,y;N=a;c=new THREE.BinaryLoader;P=new THREE.JSONLoader;j=B=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
-empties:{}};a=!1;for(n in N.objects)if(s=N.objects[n],s.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(N.transform)a=N.transform.position,t=N.transform.rotation,E=N.transform.scale,a&&y.scene.position.set(a[0],a[1],a[2]),t&&y.scene.rotation.set(t[0],t[1],t[2]),E&&y.scene.scale.set(E[0],E[1],E[2]),(a||t||E)&&y.scene.updateMatrix();a=function(){j-=1;h();i.onLoadComplete()};for(q in N.cameras)E=N.cameras[q],"perspective"==E.type?K=new THREE.PerspectiveCamera(E.fov,E.aspect,
|
|
|
-E.near,E.far):"ortho"==E.type&&(K=new THREE.OrthographicCamera(E.left,E.right,E.top,E.bottom,E.near,E.far)),x=E.position,t=E.target,E=E.up,K.position.set(x[0],x[1],x[2]),K.target=new THREE.Vector3(t[0],t[1],t[2]),E&&K.up.set(E[0],E[1],E[2]),y.cameras[q]=K;for(o in N.lights)t=N.lights[o],q=void 0!==t.color?t.color:16777215,K=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(x=t.direction,u=new THREE.DirectionalLight(q,K),u.position.set(x[0],x[1],x[2]),u.position.normalize()):"point"==t.type?
|
|
|
-(x=t.position,u=t.distance,u=new THREE.PointLight(q,K,u),u.position.set(x[0],x[1],x[2])):"ambient"==t.type&&(u=new THREE.AmbientLight(q)),y.scene.add(u),y.lights[o]=u;for(m in N.fogs)o=N.fogs[m],"linear"==o.type?L=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(L=new THREE.FogExp2(0,o.density)),E=o.color,L.color.setRGB(E[0],E[1],E[2]),y.fogs[m]=L;if(y.cameras&&N.defaults.camera)y.currentCamera=y.cameras[N.defaults.camera];if(y.fogs&&N.defaults.fog)y.scene.fog=y.fogs[N.defaults.fog];E=N.defaults.bgcolor;
|
|
|
-y.bgColor=new THREE.Color;y.bgColor.setRGB(E[0],E[1],E[2]);y.bgColorAlpha=N.defaults.bgalpha;for(k in N.geometries)if(m=N.geometries[k],"bin_mesh"==m.type||"ascii_mesh"==m.type)B+=1,i.onLoadStart();H=B;for(k in N.geometries)m=N.geometries[k],"cube"==m.type?(F=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),y.geometries[k]=F):"plane"==m.type?(F=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=
|
|
|
-F):"sphere"==m.type?(F=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=F):"cylinder"==m.type?(F=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),y.geometries[k]=F):"torus"==m.type?(F=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),y.geometries[k]=F):"icosahedron"==m.type?(F=new THREE.IcosahedronGeometry(m.subdivisions),y.geometries[k]=F):"bin_mesh"==m.type?c.load(d(m.url,N.urlBaseType),f(k)):"ascii_mesh"==m.type?P.load(d(m.url,
|
|
|
-N.urlBaseType),f(k)):"embedded_mesh"==m.type&&(m=N.embeds[m.id])&&P.createModel(m,g(k),"");for(r in N.textures)if(k=N.textures[r],k.url instanceof Array){j+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else j+=1,i.onLoadStart();V=j;for(r in N.textures){k=N.textures[r];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(var I=0;I<k.url.length;I++)m[I]=d(k.url[I],N.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=
|
|
|
-THREE.ImageUtils.loadTexture(d(k.url,N.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])m.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==L[k.wrap[0]])m.wrapS=L[k.wrap[0]];
|
|
|
-if(void 0!==L[k.wrap[1]])m.wrapT=L[k.wrap[1]]}}y.textures[r]=m}for(p in N.materials){r=N.materials[p];for(C in r.parameters)if("envMap"==C||"map"==C||"lightMap"==C)r.parameters[C]=y.textures[r.parameters[C]];else if("shading"==C)r.parameters[C]="flat"==r.parameters[C]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==C)r.parameters[C]=THREE[r.parameters[C]]?THREE[r.parameters[C]]:THREE.NormalBlending;else if("combine"==C)r.parameters[C]="MixOperation"==r.parameters[C]?THREE.MixOperation:THREE.MultiplyOperation;
|
|
|
+b;e();B-=1;i.onLoadComplete();h()}}function g(a){return function(b){y.geometries[a]=b}}function h(){i.callbackProgress({totalModels:H,totalTextures:V,loadedModels:H-B,loadedTextures:V-j},y);i.onLoadProgress();0==B&&0==j&&b(y)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),k,p,n,o,q,m,r,s,t,u,x,v,A,D,E,C,F,K,L,R,O,P,B,j,H,V,y;O=a;c=new THREE.BinaryLoader;P=new THREE.JSONLoader;j=B=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
+empties:{}};a=!1;for(n in O.objects)if(s=O.objects[n],s.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(O.transform)a=O.transform.position,t=O.transform.rotation,E=O.transform.scale,a&&y.scene.position.set(a[0],a[1],a[2]),t&&y.scene.rotation.set(t[0],t[1],t[2]),E&&y.scene.scale.set(E[0],E[1],E[2]),(a||t||E)&&y.scene.updateMatrix();a=function(){j-=1;h();i.onLoadComplete()};for(q in O.cameras)E=O.cameras[q],"perspective"==E.type?K=new THREE.PerspectiveCamera(E.fov,E.aspect,
|
|
|
+E.near,E.far):"ortho"==E.type&&(K=new THREE.OrthographicCamera(E.left,E.right,E.top,E.bottom,E.near,E.far)),x=E.position,t=E.target,E=E.up,K.position.set(x[0],x[1],x[2]),K.target=new THREE.Vector3(t[0],t[1],t[2]),E&&K.up.set(E[0],E[1],E[2]),y.cameras[q]=K;for(o in O.lights)t=O.lights[o],q=void 0!==t.color?t.color:16777215,K=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(x=t.direction,u=new THREE.DirectionalLight(q,K),u.position.set(x[0],x[1],x[2]),u.position.normalize()):"point"==t.type?
|
|
|
+(x=t.position,u=t.distance,u=new THREE.PointLight(q,K,u),u.position.set(x[0],x[1],x[2])):"ambient"==t.type&&(u=new THREE.AmbientLight(q)),y.scene.add(u),y.lights[o]=u;for(m in O.fogs)o=O.fogs[m],"linear"==o.type?L=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(L=new THREE.FogExp2(0,o.density)),E=o.color,L.color.setRGB(E[0],E[1],E[2]),y.fogs[m]=L;if(y.cameras&&O.defaults.camera)y.currentCamera=y.cameras[O.defaults.camera];if(y.fogs&&O.defaults.fog)y.scene.fog=y.fogs[O.defaults.fog];E=O.defaults.bgcolor;
|
|
|
+y.bgColor=new THREE.Color;y.bgColor.setRGB(E[0],E[1],E[2]);y.bgColorAlpha=O.defaults.bgalpha;for(k in O.geometries)if(m=O.geometries[k],"bin_mesh"==m.type||"ascii_mesh"==m.type)B+=1,i.onLoadStart();H=B;for(k in O.geometries)m=O.geometries[k],"cube"==m.type?(F=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),y.geometries[k]=F):"plane"==m.type?(F=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=
|
|
|
+F):"sphere"==m.type?(F=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=F):"cylinder"==m.type?(F=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),y.geometries[k]=F):"torus"==m.type?(F=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),y.geometries[k]=F):"icosahedron"==m.type?(F=new THREE.IcosahedronGeometry(m.subdivisions),y.geometries[k]=F):"bin_mesh"==m.type?c.load(d(m.url,O.urlBaseType),f(k)):"ascii_mesh"==m.type?P.load(d(m.url,
|
|
|
+O.urlBaseType),f(k)):"embedded_mesh"==m.type&&(m=O.embeds[m.id])&&P.createModel(m,g(k),"");for(r in O.textures)if(k=O.textures[r],k.url instanceof Array){j+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else j+=1,i.onLoadStart();V=j;for(r in O.textures){k=O.textures[r];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(var I=0;I<k.url.length;I++)m[I]=d(k.url[I],O.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=
|
|
|
+THREE.ImageUtils.loadTexture(d(k.url,O.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])m.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==L[k.wrap[0]])m.wrapS=L[k.wrap[0]];
|
|
|
+if(void 0!==L[k.wrap[1]])m.wrapT=L[k.wrap[1]]}}y.textures[r]=m}for(p in O.materials){r=O.materials[p];for(C in r.parameters)if("envMap"==C||"map"==C||"lightMap"==C)r.parameters[C]=y.textures[r.parameters[C]];else if("shading"==C)r.parameters[C]="flat"==r.parameters[C]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==C)r.parameters[C]=THREE[r.parameters[C]]?THREE[r.parameters[C]]:THREE.NormalBlending;else if("combine"==C)r.parameters[C]="MixOperation"==r.parameters[C]?THREE.MixOperation:THREE.MultiplyOperation;
|
|
|
else if("vertexColors"==C)if("face"==r.parameters[C])r.parameters[C]=THREE.FaceColors;else if(r.parameters[C])r.parameters[C]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);m=r.parameters.color;L=r.parameters.specular;c=r.parameters.ambient;P=r.parameters.shininess;a.tNormal.texture=y.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=y.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(c);a.uShininess.value=P;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;r=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
|
|
|
vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else r=new THREE[r.type](r.parameters);y.materials[p]=r}e();i.callbackSync(y);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
@@ -728,9 +728,9 @@ THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.creat
|
|
|
b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
|
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,k=a(THREE.ShaderFlares.lensFlare)):(l=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};n={};p.vertex=b.getAttribLocation(k,"position");p.uv=b.getAttribLocation(k,"uv");n.renderType=b.getUniformLocation(k,"renderType");n.map=b.getUniformLocation(k,"map");n.occlusionMap=b.getUniformLocation(k,"occlusionMap");n.opacity=b.getUniformLocation(k,"opacity");n.color=b.getUniformLocation(k,
|
|
|
"color");n.scale=b.getUniformLocation(k,"scale");n.rotation=b.getUniformLocation(k,"rotation");n.screenPosition=b.getUniformLocation(k,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var u=new THREE.Vector3,x=s/e,v=0.5*e,A=0.5*s,D=16/s,E=new THREE.Vector2(D*x,D),C=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),K=n,D=p;b.useProgram(k);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(D.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var L,R,N,P,B;for(L=0;L<t;L++)if(D=16/s,E.set(D*x,D),P=a[L],u.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(u),d.projectionMatrix.multiplyVector3(u),C.copy(u),F.x=C.x*v+v,F.y=C.y*A+A,l||0<F.x&&F.x<e&&0<F.y&&F.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(D.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var L,R,O,P,B;for(L=0;L<t;L++)if(D=16/s,E.set(D*x,D),P=a[L],u.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(u),d.projectionMatrix.multiplyVector3(u),C.copy(u),F.x=C.x*v+v,F.y=C.y*A+A,l||0<F.x&&F.x<e&&0<F.y&&F.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
|
|
|
h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,E.x,E.y);b.uniform3f(K.screenPosition,C.x,C.y,C.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(K.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
|
|
|
-6,b.UNSIGNED_SHORT,0);P.positionScreen.copy(C);P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(R=0,N=P.lensFlares.length;R<N;R++)if(B=P.lensFlares[R],0.001<B.opacity&&0.001<B.scale)C.x=B.x,C.y=B.y,C.z=B.z,D=B.size*B.scale/s,E.x=D*x,E.y=D,b.uniform3f(K.screenPosition,C.x,C.y,C.z),b.uniform2f(K.scale,E.x,E.y),b.uniform1f(K.rotation,B.rotation),b.uniform1f(K.opacity,B.opacity),b.uniform3f(K.color,B.color.r,B.color.g,B.color.b),c.setBlending(B.blending),
|
|
|
+6,b.UNSIGNED_SHORT,0);P.positionScreen.copy(C);P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(R=0,O=P.lensFlares.length;R<O;R++)if(B=P.lensFlares[R],0.001<B.opacity&&0.001<B.scale)C.x=B.x,C.y=B.y,C.z=B.z,D=B.size*B.scale/s,E.x=D*x,E.y=D,b.uniform3f(K.screenPosition,C.x,C.y,C.z),b.uniform2f(K.scale,E.x,E.y),b.uniform1f(K.rotation,B.rotation),b.uniform1f(K.opacity,B.opacity),b.uniform3f(K.color,B.color.r,B.color.g,B.color.b),c.setBlending(B.blending),
|
|
|
c.setTexture(B.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f=new THREE.Frustum,g=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(c){a=c.context;b=c;var c=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(c.uniforms);d=new THREE.ShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:f});e=new THREE.ShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:f,morphTargets:!0});d._shadowPass=!0;e._shadowPass=!0};this.render=
|
|
|
function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,l,k,p,n,o,q,m,r=0,s=h.lights;c||(c=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(i=0,l=s.length;i<l;i++)if(q=s[i],q.castShadow&&q instanceof THREE.SpotLight){this.shadowMap[r]||(this.shadowMap[r]=new THREE.WebGLRenderTarget(b.shadowMapWidth,
|