|
@@ -73,12 +73,12 @@ P.positionScreen.x)))ga=n[p]=n[p]||new THREE.RenderableFace3,p++,l=ga,l.v1.copy(
|
|
|
ca.positionScreen.y)-(Q.positionScreen.y-ca.positionScreen.y)*(ga.positionScreen.x-ca.positionScreen.x))))na=q[o]=q[o]||new THREE.RenderableFace4,o++,l=na,l.v1.copy(P),l.v2.copy(Q),l.v3.copy(ca),l.v4.copy(ga);else continue;l.normalWorld.copy(y.normal);aa.multiplyVector3(l.normalWorld);l.centroidWorld.copy(y.centroid);T.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);C.multiplyVector3(l.centroidScreen);ca=y.vertexNormals;for(P=0,Q=ca.length;P<Q;P++)ga=l.vertexNormalsWorld[P],
|
|
|
ga.copy(ca[P]),aa.multiplyVector3(ga);for(P=0,Q=Ra.length;P<Q;P++)if(na=Ra[P][F])for(ca=0,ga=na.length;ca<ga;ca++)l.uvs[P][ca]=na[ca];l.material=S;l.faceMaterial=null!==y.materialIndex?$[y.materialIndex]:null;l.z=l.centroidScreen.z;v.elements.push(l)}}else if(ba instanceof THREE.Line){A.multiply(C,T);F=ba.geometry.vertices;P=b();P.positionScreen.copy(F[0].position);A.multiplyVector4(P.positionScreen);for(B=1,y=F.length;B<y;B++)if(P=b(),P.positionScreen.copy(F[B].position),A.multiplyVector4(P.positionScreen),
|
|
|
Q=k[i-2],J.copy(P.positionScreen),N.copy(Q.positionScreen),d(J,N))J.multiplyScalar(1/J.w),N.multiplyScalar(1/N.w),ba=s[r]=s[r]||new THREE.RenderableLine,r++,m=ba,m.v1.positionScreen.copy(J),m.v2.positionScreen.copy(N),m.z=Math.max(J.z,N.z),m.material=S,v.elements.push(m)}for(a=0,j=v.sprites.length;a<j;a++)if(ba=v.sprites[a].object,T=ba.matrixWorld,ba instanceof THREE.Particle&&(D.set(T.n14,T.n24,T.n34,1),C.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=ba.rotation.z,t.scale.x=ba.scale.x*Math.abs(t.x-(D.x+f.projectionMatrix.n11)/(D.w+f.projectionMatrix.n14)),t.scale.y=ba.scale.y*Math.abs(t.y-(D.y+f.projectionMatrix.n22)/(D.w+f.projectionMatrix.n24)),t.material=ba.material,v.elements.push(t);e&&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,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),e=a*b,h=d*f;this.w=e*g-h*c;this.x=e*c+h*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
|
|
|
-this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},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);
|
|
|
-this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
|
|
|
-this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,e=this.y,h=this.z,i=this.w,k=i*c+e*f-h*d,l=i*d+h*c-g*f,p=i*f+g*d-e*c,c=-g*
|
|
|
-c-e*d-h*f;b.x=k*i+c*-g+l*-h-p*-e;b.y=l*i+c*-e+p*-g-k*-h;b.z=p*i+c*-h+k*-e-l*-g;return b}};
|
|
|
+t.x=D.x/D.w,t.y=D.y/D.w,t.z=D.z,t.rotation=ba.rotation.z,t.scale.x=ba.scale.x*Math.abs(t.x-(D.x+f.projectionMatrix.n11)/(D.w+f.projectionMatrix.n14)),t.scale.y=ba.scale.y*Math.abs(t.y-(D.y+f.projectionMatrix.n22)/(D.w+f.projectionMatrix.n24)),t.material=ba.material,v.elements.push(t);e&&v.elements.sort(c);return v}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=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},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),e=a*b,h=d*f;this.w=e*g-h*c;this.x=e*c+h*g;this.y=d*b*g+a*f*c;this.z=a*f*
|
|
|
+g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},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);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=
|
|
|
+this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=
|
|
|
+a);var c=a.x,d=a.y,f=a.z,g=this.x,e=this.y,h=this.z,i=this.w,k=i*c+e*f-h*d,l=i*d+h*c-g*f,p=i*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=k*i+c*-g+l*-h-p*-e;b.y=l*i+c*-e+p*-g-k*-h;b.z=p*i+c*-h+k*-e-l*-g;return b}};
|
|
|
THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>f?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(1<=Math.abs(f))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(0.0010>Math.abs(f))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
|