提交 965b199d 编写于 作者: A alteredq

And some more strict equality checking.

上级 f166079d
此差异已折叠。
此差异已折叠。
// ThreeDOM.js r46dev - http://github.com/mrdoob/three.js
var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,g;if(c==0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),g=c*(1-
THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,g;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),g=c*(1-
b*e),b=c*(1-b*(1-e)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
equals:function(a){return a.x==this.x&&a.y==this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
equals:function(a){return a.x===this.x&&a.y===this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
......@@ -15,8 +15,8 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(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},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a*c-b*d)*e;return f>0&&a>0&&f+a<1}for(var d,e=[],g=0,f=a.children.length;g<f;g++)Array.prototype.push.apply(e,this.intersectObject(a.children[g]));if(a instanceof THREE.Particle){g=b(this.origin,this.direction,a.matrixWorld.getPosition());if(g==null||g>a.scale.x)return[];d={distance:g,point:a.position,face:null,object:a};e.push(d)}else if(a instanceof THREE.Mesh){g=b(this.origin,
this.direction,a.matrixWorld.getPosition());if(g==null||g>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return e;for(var h,k,i,j,l,n,m,p,q=a.geometry,s=q.vertices,g=0,f=q.faces.length;g<f;g++)if(d=q.faces[g],m=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(d.centroid.clone()).subSelf(m),n=h.dot(p),!(n<=0)&&(h=j.multiplyVector3(s[d.a].position.clone()),k=j.multiplyVector3(s[d.b].position.clone()),i=j.multiplyVector3(s[d.c].position.clone()),
c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a*c-b*d)*e;return f>0&&a>0&&f+a<1}for(var d,e=[],g=0,f=a.children.length;g<f;g++)Array.prototype.push.apply(e,this.intersectObject(a.children[g]));if(a instanceof THREE.Particle){g=b(this.origin,this.direction,a.matrixWorld.getPosition());if(g===null||g>a.scale.x)return[];d={distance:g,point:a.position,face:null,object:a};e.push(d)}else if(a instanceof THREE.Mesh){g=
b(this.origin,this.direction,a.matrixWorld.getPosition());if(g===null||g>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return e;for(var h,k,i,j,l,n,m,p,q=a.geometry,s=q.vertices,g=0,f=q.faces.length;g<f;g++)if(d=q.faces[g],m=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(d.centroid.clone()).subSelf(m),n=h.dot(p),!(n<=0)&&(h=j.multiplyVector3(s[d.a].position.clone()),k=j.multiplyVector3(s[d.b].position.clone()),i=j.multiplyVector3(s[d.c].position.clone()),
j=d instanceof THREE.Face4?j.multiplyVector3(s[d.d].position.clone()):null,l=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(l),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=l.dot((new THREE.Vector3).sub(h,m))/n,m=m.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(m,h,k,i)&&(d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d));else if(d instanceof THREE.Face4&&(c(m,h,k,j)||c(m,k,i,j)))d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d)}return e}};
THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};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,j,l){h=!1;b=f;c=g;d=j;e=l;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,j,l,n,m){h?(h=!1,b=f<j?f<n?f:n:j<n?j:n,c=g<l?g<m?g:m:l<m?l:m,d=f>j?f>n?f:n:j>n?j:n,e=g>l?g>m?g:m:l>m?l:m):(b=f<j?f<n?f<b?f:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<l?g<m?g<c?g:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c,d=f>j?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>l?g>m?g>e?g:e:m>e?m:e:l>m?l>e?l:e:m>e?m: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>
......@@ -44,7 +44,7 @@ c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Mat
a.n23*e;this.n33=a.n33*e}};
THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,j=a.n31,l=a.n32,n=a.n33,m=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*m*q-i*n*q+i*l*s-h*m*s-k*l*r+h*n*r;b.n12=g*n*q-e*m*q-g*l*s+d*m*s+e*l*r-d*n*r;b.n13=e*i*q-g*k*q+g*h*s-d*i*s-e*h*r+d*k*r;b.n14=g*k*l-e*i*l-g*h*n+d*i*n+e*h*m-d*k*m;b.n21=i*n*p-k*m*p-i*j*s+f*m*s+k*j*r-f*n*r;b.n22=e*m*p-g*n*p+g*j*s-c*m*s-e*j*r+c*n*r;b.n23=g*k*p-e*i*p-g*f*s+c*i*s+e*f*r-c*k*r;b.n24=
e*i*j-g*k*j+g*f*n-c*i*n-e*f*m+c*k*m;b.n31=h*m*p-i*l*p+i*j*q-f*m*q-h*j*r+f*l*r;b.n32=g*l*p-d*m*p-g*j*q+c*m*q+d*j*r-c*l*r;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*r+c*h*r;b.n34=g*h*j-d*i*j-g*f*l+c*i*l+d*f*m-c*h*m;b.n41=k*l*p-h*n*p-k*j*q+f*n*q+h*j*s-f*l*s;b.n42=d*n*p-e*l*p+e*j*q-c*n*q-d*j*s+c*l*s;b.n43=e*h*p-d*k*p-e*f*q+c*k*q+d*f*s-c*h*s;b.n44=d*k*j-e*h*j+e*f*l-c*k*l-d*f*n+c*h*n;b.multiplyScalar(1/a.determinant());return b};
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*j;c[8]=a*l;return b};
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*j;c[8]=a*l;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,k,i;f=new THREE.Matrix4;h=b-a;k=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
......@@ -67,7 +67,7 @@ K.multiplyVector4(t.positionScreen),y=k[h-2],E.copy(t.positionScreen),F.copy(y.p
L,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,D.push(r);g&&D.sort(b);return D}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?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),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*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=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-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,e=a.z,g=this.x,f=this.y,h=this.z,k=this.w,i=k*c+f*e-h*d,j=k*d+h*c-g*e,l=k*e+g*d-f*c,c=-g*
c-f*d-h*e;b.x=i*k+c*-g+j*-h-l*-f;b.y=j*k+c*-f+l*-g-i*-h;b.z=l*k+c*-h+i*-f-j*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)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;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,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=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -364,6 +364,6 @@ THREE.Car = function () {
function cubicEaseOut( k ) { return --k * k * k + 1; }
function circularEaseOut( k ) { return Math.sqrt( 1 - --k * k ); }
function sinusoidalEaseOut( k ) { return Math.sin( k * Math.PI / 2 ); }
function exponentialEaseOut( k ) { return k == 1 ? 1 : - Math.pow( 2, - 10 * k ) + 1; }
function exponentialEaseOut( k ) { return k === 1 ? 1 : - Math.pow( 2, - 10 * k ) + 1; }
};
......@@ -62,7 +62,7 @@ THREE.Color.prototype = {
var i, f, p, q, t;
if ( v == 0 ) {
if ( v === 0 ) {
this.r = this.g = this.b = 0;
......
......@@ -169,7 +169,7 @@ THREE.Geometry.prototype = {
// create internal buffers for reuse when calling this method repeatedly
// (otherwise memory allocation / deallocation every frame is big resource hog)
if ( this.__tmpVertices == undefined ) {
if ( this.__tmpVertices === undefined ) {
this.__tmpVertices = new Array( this.vertices.length );
vertices = this.__tmpVertices;
......@@ -443,6 +443,7 @@ THREE.Geometry.prototype = {
* Duplicated vertices are removed
* and faces' vertices are updated.
*/
mergeVertices: function() {
var verticesMap = {}; // Hashmap for looking up vertice by position coordinates (and making sure they are unique)
......@@ -450,47 +451,55 @@ THREE.Geometry.prototype = {
var v, key;
var precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001
var precision = Math.pow(10, precisionPoints)
var precision = Math.pow( 10, precisionPoints );
var i,il, face;
for (i=0,il=this.vertices.length;i<il;i++) {
for ( i = 0, il = this.vertices.length; i < il; i ++ ) {
v = this.vertices[ i ].position;
key = [ Math.round( v.x * precision ), Math.round( v.y * precision ), Math.round( v.z * precision ) ].join( '_' );
if ( verticesMap[ key ] === undefined ) {
v = this.vertices[i].position;
key = [Math.round(v.x * precision), Math.round(v.y* precision), Math.round(v.z* precision)].join('_');
verticesMap[ key ] = i;
unique.push( this.vertices[ i ] );
changes[ i ] = unique.length - 1;
if (verticesMap[key]===undefined) {
verticesMap[key] = i;
unique.push(this.vertices[i]);
changes[i] = unique.length - 1;
} else {
//console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);
changes[i] = changes[verticesMap[key]];
changes[ i ] = changes[ verticesMap[ key ] ];
}
};
// Start to patch face indices.
// Start to patch face indices
for( i = 0, il = this.faces.length; i < il; i ++ ) {
face = this.faces[ i ];
if ( face instanceof THREE.Face3 ) {
face.a = changes[face.a];
face.b = changes[face.b];
face.c = changes[face.c];
} if ( face instanceof THREE.Face4 ) {
face.a = changes[ face.a ];
face.b = changes[ face.b ];
face.c = changes[ face.c ];
} else if ( face instanceof THREE.Face4 ) {
face.a = changes[face.a];
face.b = changes[face.b];
face.c = changes[face.c];
face.d = changes[face.d];
face.a = changes[ face.a ];
face.b = changes[ face.b ];
face.c = changes[ face.c ];
face.d = changes[ face.d ];
}
}
// Use unique set of vertices
this.vertices = unique;
}
......
......@@ -818,7 +818,8 @@ THREE.Matrix4.makeInvert3x3 = function ( m1 ) {
idet;
// no inverse
if ( det == 0 ) {
if ( det === 0 ) {
console.error( 'THREE.Matrix4.makeInvert3x3: Matrix not invertible.' );
......
......@@ -84,24 +84,24 @@ THREE.Quaternion.prototype = {
return this;
},
setFromRotationMatrix: function ( m ) {
// Adapted from: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
function copySign(a, b) {
return b < 0 ? -Math.abs(a) : Math.abs(a);
}
var absQ = Math.pow(m.determinant(), 1.0 / 3.0);
this.w = Math.sqrt( Math.max( 0, absQ + m.n11 + m.n22 + m.n33 ) ) / 2;
this.x = Math.sqrt( Math.max( 0, absQ + m.n11 - m.n22 - m.n33 ) ) / 2;
this.y = Math.sqrt( Math.max( 0, absQ - m.n11 + m.n22 - m.n33 ) ) / 2;
this.z = Math.sqrt( Math.max( 0, absQ - m.n11 - m.n22 + m.n33 ) ) / 2;
this.w = Math.sqrt( Math.max( 0, absQ + m.n11 + m.n22 + m.n33 ) ) / 2;
this.x = Math.sqrt( Math.max( 0, absQ + m.n11 - m.n22 - m.n33 ) ) / 2;
this.y = Math.sqrt( Math.max( 0, absQ - m.n11 + m.n22 - m.n33 ) ) / 2;
this.z = Math.sqrt( Math.max( 0, absQ - m.n11 - m.n22 + m.n33 ) ) / 2;
this.x = copySign( this.x, ( m.n32 - m.n23 ) );
this.y = copySign( this.y, ( m.n13 - m.n31 ) );
this.z = copySign( this.z, ( m.n21 - m.n12 ) );
this.normalize();
return this;
},
calculateW : function () {
this.w = - Math.sqrt( Math.abs( 1.0 - this.x * this.x - this.y * this.y - this.z * this.z ) );
......@@ -130,7 +130,7 @@ THREE.Quaternion.prototype = {
var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );
if ( l == 0 ) {
if ( l === 0 ) {
this.x = 0;
this.y = 0;
......@@ -174,7 +174,7 @@ THREE.Quaternion.prototype = {
this.y = -q1.x * q2.z + q1.y * q2.w + q1.z * q2.x + q1.w * q2.y;
this.z = q1.x * q2.y - q1.y * q2.x + q1.z * q2.w + q1.w * q2.z;
this.w = -q1.x * q2.x - q1.y * q2.y - q1.z * q2.z + q1.w * q2.w;
return this;
},
......@@ -219,7 +219,7 @@ THREE.Quaternion.slerp = function ( qa, qb, qm, t ) {
var halfTheta = Math.acos( cosHalfTheta ),
sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );
if ( Math.abs( sinHalfTheta ) < 0.001 ) {
if ( Math.abs( sinHalfTheta ) < 0.001 ) {
qm.w = 0.5 * ( qa.w + qb.w );
qm.x = 0.5 * ( qa.x + qb.x );
......@@ -231,7 +231,7 @@ THREE.Quaternion.slerp = function ( qa, qb, qm, t ) {
}
var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,
ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;
ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;
qm.w = ( qa.w * ratioA + qb.w * ratioB );
qm.x = ( qa.x * ratioA + qb.x * ratioB );
......
......@@ -50,7 +50,7 @@ THREE.Ray.prototype = {
var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
if ( distance == null || distance > object.scale.x ) {
if ( distance === null || distance > object.scale.x ) {
return [];
......@@ -73,7 +73,7 @@ THREE.Ray.prototype = {
var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
if ( distance == null || distance > object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) ) ) {
if ( distance === null || distance > object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) ) ) {
return intersects;
......
......@@ -32,7 +32,7 @@ THREE.Spline = function ( points ) {
intPoint = Math.floor( point );
weight = point - intPoint;
c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1;
c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;
c[ 1 ] = intPoint;
c[ 2 ] = intPoint > this.points.length - 2 ? intPoint : intPoint + 1;
c[ 3 ] = intPoint > this.points.length - 3 ? intPoint : intPoint + 2;
......
......@@ -156,7 +156,7 @@ THREE.Vector2.prototype = {
equals: function( v ) {
return ( ( v.x == this.x ) && ( v.y == this.y ) );
return ( ( v.x === this.x ) && ( v.y === this.y ) );
}
......
......@@ -33,7 +33,7 @@ THREE.ColorUtils = {
var saturation;
var value = max;
if ( min == max ) {
if ( min === max ) {
hue = 0;
saturation = 0;
......@@ -43,11 +43,11 @@ THREE.ColorUtils = {
var delta = ( max - min );
saturation = delta / max;
if ( r == max ) {
if ( r === max ) {
hue = ( g - b ) / delta;
} else if ( g == max ) {
} else if ( g === max ) {
hue = 2 + ( ( b - r ) / delta );
......
......@@ -28,8 +28,8 @@ THREE.ImageUtils = {
images[ i ] = new Image();
images[ i ].onload = function () {
images.loadCount += 1;
if ( images.loadCount == 6 ) texture.needsUpdate = true;
images.loadCount += 1;
if ( images.loadCount === 6 ) texture.needsUpdate = true;
if ( callback ) callback( this );
};
......
......@@ -37,17 +37,17 @@ THREE.Animation.prototype.play = function( loop, startTimeMS ) {
var h, hl = this.hierarchy.length,
object;
for ( h = 0; h < hl; h++ ) {
object = this.hierarchy[ h ];
if ( this.interpolationType !== THREE.AnimationHandler.CATMULLROM_FORWARD ) {
object.useQuaternion = true;
}
object.matrixAutoUpdate = true;
if ( object.animationCache === undefined ) {
......@@ -89,15 +89,15 @@ THREE.Animation.prototype.play = function( loop, startTimeMS ) {
THREE.Animation.prototype.pause = function() {
if( this.isPaused ) {
THREE.AnimationHandler.addToUpdate( this );
} else {
THREE.AnimationHandler.removeFromUpdate( this );
}
this.isPaused = !this.isPaused;
};
......@@ -110,31 +110,31 @@ THREE.Animation.prototype.stop = function() {
this.isPlaying = false;
this.isPaused = false;
THREE.AnimationHandler.removeFromUpdate( this );
// reset JIT matrix and remove cache
for ( var h = 0; h < this.hierarchy.length; h++ ) {
if ( this.hierarchy[ h ].animationCache !== undefined ) {
if( this.hierarchy[ h ] instanceof THREE.Bone ) {
this.hierarchy[ h ].skinMatrix = this.hierarchy[ h ].animationCache.originalMatrix;
} else {
this.hierarchy[ h ].matrix = this.hierarchy[ h ].animationCache.originalMatrix;
}
delete this.hierarchy[ h ].animationCache;
}
}
};
......@@ -161,10 +161,10 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
var JIThierarchy = this.data.JIT.hierarchy;
var currentTime, unloopedCurrentTime;
var currentPoint, forwardPoint, angle;
// update
this.currentTime += deltaTimeMS * this.timeScale;
unloopedCurrentTime = this.currentTime;
......@@ -178,43 +178,43 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
object = this.hierarchy[ h ];
animationCache = object.animationCache;
// use JIT?
if ( this.JITCompile && JIThierarchy[ h ][ frame ] !== undefined ) {
if( object instanceof THREE.Bone ) {
object.skinMatrix = JIThierarchy[ h ][ frame ];
object.matrixAutoUpdate = false;
object.matrixWorldNeedsUpdate = false;
} else {
object.matrix = JIThierarchy[ h ][ frame ];
object.matrixAutoUpdate = false;
object.matrixWorldNeedsUpdate = true;
}
// use interpolation
} else {
// make sure so original matrix and not JIT matrix is set
if ( this.JITCompile ) {
if( object instanceof THREE.Bone ) {
object.skinMatrix = object.animationCache.originalMatrix;
} else {
object.matrix = object.animationCache.originalMatrix;
}
}
......@@ -244,10 +244,10 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
nextKey = this.getNextKeyWith( type, h, 1 );
while( nextKey.time < currentTime ) {
prevKey = nextKey;
nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );
}
} else {
......@@ -286,7 +286,7 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
if ( scale < 0 || scale > 1 ) {
console.log( "THREE.Animation.update: Warning! Scale out of bounds:" + scale + " on bone " + h );
console.log( "THREE.Animation.update: Warning! Scale out of bounds:" + scale + " on bone " + h );
scale = scale < 0 ? 0 : 1;
}
......@@ -295,17 +295,17 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
if ( type === "pos" ) {
vector = object.position;
vector = object.position;
if( this.interpolationType === THREE.AnimationHandler.LINEAR ) {
vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
} else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
this.points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ];
this.points[ 1 ] = prevXYZ;
this.points[ 2 ] = nextXYZ;
......@@ -314,23 +314,23 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
scale = scale * 0.33 + 0.33;
currentPoint = this.interpolateCatmullRom( this.points, scale );
vector.x = currentPoint[ 0 ];
vector.y = currentPoint[ 1 ];
vector.z = currentPoint[ 2 ];
if( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
forwardPoint = this.interpolateCatmullRom( this.points, scale * 1.01 );
forwardPoint = this.interpolateCatmullRom( this.points, scale * 1.01 );
this.target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] );
this.target.subSelf( vector );
this.target.y = 0;
this.target.normalize();
angle = Math.atan2( this.target.x, this.target.z );
object.rotation.set( 0, angle, 0 );
}
}
......@@ -342,7 +342,7 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
} else if( type === "scl" ) {
vector = object.scale;
vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
......@@ -358,25 +358,25 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
// update JIT?
if ( this.JITCompile ) {
if ( JIThierarchy[ 0 ][ frame ] === undefined ) {
this.hierarchy[ 0 ].update( undefined, true );
for ( var h = 0; h < this.hierarchy.length; h++ ) {
if( this.hierarchy[ h ] instanceof THREE.Bone ) {
JIThierarchy[ h ][ frame ] = this.hierarchy[ h ].skinMatrix.clone();
} else {
JIThierarchy[ h ][ frame ] = this.hierarchy[ h ].matrix.clone();
}
}
}
}
......@@ -384,18 +384,18 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
};
// Catmull-Rom spline
THREE.Animation.prototype.interpolateCatmullRom = function ( points, scale ) {
var c = [], v3 = [],
point, intPoint, weight, w2, w3,
pa, pb, pc, pd;
point = ( points.length - 1 ) * scale;
intPoint = Math.floor( point );
weight = point - intPoint;
c[ 0 ] = intPoint == 0 ? intPoint : intPoint - 1;
c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;
c[ 1 ] = intPoint;
c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1;
c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2;
......@@ -407,11 +407,11 @@ THREE.Animation.prototype.interpolateCatmullRom = function ( points, scale ) {
w2 = weight * weight;
w3 = weight * w2;
v3[ 0 ] = this.interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 );
v3[ 1 ] = this.interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 );
v3[ 2 ] = this.interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 );
return v3;
};
......@@ -430,16 +430,16 @@ THREE.Animation.prototype.interpolate = function( p0, p1, p2, p3, t, t2, t3 ) {
// Get next key with
THREE.Animation.prototype.getNextKeyWith = function( type, h, key ) {
var keys = this.data.hierarchy[ h ].keys;
if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
key = key < keys.length - 1 ? key : keys.length - 1;
} else {
key = key % keys.length;
}
......@@ -461,16 +461,16 @@ THREE.Animation.prototype.getNextKeyWith = function( type, h, key ) {
// Get previous key with
THREE.Animation.prototype.getPrevKeyWith = function( type, h, key ) {
var keys = this.data.hierarchy[ h ].keys;
if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
key = key > 0 ? key : 0;
} else {
key = key >= 0 ? key : key + keys.length;
}
......
......@@ -74,16 +74,16 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
height_half = height / 2,
offset = scope.vertices.length;
if ( ( u == 'x' && v == 'y' ) || ( u == 'y' && v == 'x' ) ) {
if ( ( u === 'x' && v === 'y' ) || ( u === 'y' && v === 'x' ) ) {
w = 'z';
} else if ( ( u == 'x' && v == 'z' ) || ( u == 'z' && v == 'x' ) ) {
} else if ( ( u === 'x' && v === 'z' ) || ( u === 'z' && v === 'x' ) ) {
w = 'y';
gridY = segmentsDepth || 1;
} else if ( ( u == 'z' && v == 'y' ) || ( u == 'y' && v == 'z' ) ) {
} else if ( ( u === 'z' && v === 'y' ) || ( u === 'y' && v === 'z' ) ) {
w = 'x';
gridX = segmentsDepth || 1;
......
......@@ -30,7 +30,7 @@
THREE.ExtrudeGeometry = function( shapes, options ) {
if( typeof( shapes ) == "undefined" ) {
if( typeof( shapes ) === "undefined" ) {
shapes = [];
return;
......@@ -312,11 +312,11 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
// We should not reach these conditions
if ( v_dot_w_hat == 0 ) {
if ( v_dot_w_hat === 0 ) {
console.log( "Either infinite or no solutions!" );
if ( q_sub_p_dot_w_hat == 0 ) {
if ( q_sub_p_dot_w_hat === 0 ) {
console.log( "Its finite solutions." );
......@@ -348,8 +348,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
for ( i = 0, il = contour.length, j = il-1, k = i + 1; i < il; i++, j++, k++ ) {
if ( j == il ) j = 0;
if ( k == il ) k = 0;
if ( j === il ) j = 0;
if ( k === il ) k = 0;
// (j)---(i)---(k)
// console.log('i,j,k', i, j , k)
......@@ -372,8 +372,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
for ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++ ) {
if ( j == il ) j = 0;
if ( k == il ) k = 0;
if ( j === il ) j = 0;
if ( k === il ) k = 0;
// (j)---(i)---(k)
oneHoleMovements[ i ]= getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );
......
......@@ -54,7 +54,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
this.hasNormal = false;
this.positionArray = new Float32Array( this.maxCount * 3 );
this.normalArray = new Float32Array( this.maxCount * 3 );
this.normalArray = new Float32Array( this.maxCount * 3 );
};
......@@ -117,7 +117,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
var q3 = q * 3;
if ( this.normal_cache [ q3 ] == 0.0 ) {
if ( this.normal_cache [ q3 ] === 0.0 ) {
this.normal_cache[ q3 ] = this.field[ q - 1 ] - this.field[ q + 1 ];
this.normal_cache[ q3 + 1 ] = this.field[ q - this.yd ] - this.field[ q + this.yd ];
......@@ -163,16 +163,16 @@ THREE.MarchingCubes = function ( resolution, materials ) {
// if cube is entirely in/out of the surface - bail, nothing to draw
var bits = THREE.edgeTable[ cubeindex ];
if ( bits == 0 ) return 0;
if ( bits === 0 ) return 0;
var d = this.delta,
fx2 = fx + d,
fy2 = fy + d,
fx2 = fx + d,
fy2 = fy + d,
fz2 = fz + d;
// top of the cube
if ( bits & 1 ) {
if ( bits & 1 ) {
this.compNorm( q );
this.compNorm( q1 );
......@@ -180,23 +180,23 @@ THREE.MarchingCubes = function ( resolution, materials ) {
};
if ( bits & 2 ) {
if ( bits & 2 ) {
this.compNorm( q1 );
this.compNorm( q1y );
this.compNorm( q1 );
this.compNorm( q1y );
this.VIntY( q1 * 3, this.vlist, this.nlist, 3, isol, fx2, fy, fz, field1, field3 );
};
if ( bits & 4 ) {
if ( bits & 4 ) {
this.compNorm( qy );
this.compNorm( q1y );
this.VIntX( qy * 3, this.vlist, this.nlist, 6, isol, fx, fy2, fz, field2, field3 );
this.compNorm( qy );
this.compNorm( q1y );
this.VIntX( qy * 3, this.vlist, this.nlist, 6, isol, fx, fy2, fz, field2, field3 );
};
if ( bits & 8 ) {
if ( bits & 8 ) {
this.compNorm( q );
this.compNorm( qy );
......@@ -206,19 +206,19 @@ THREE.MarchingCubes = function ( resolution, materials ) {
// bottom of the cube
if ( bits & 16 ) {
if ( bits & 16 ) {
this.compNorm( qz );
this.compNorm( q1z );
this.VIntX( qz * 3, this.vlist, this.nlist, 12, isol, fx, fy, fz2, field4, field5 );
this.VIntX( qz * 3, this.vlist, this.nlist, 12, isol, fx, fy, fz2, field4, field5 );
};
if ( bits & 32 ) {
if ( bits & 32 ) {
this.compNorm( q1z );
this.compNorm( q1yz );
this.VIntY( q1z * 3, this.vlist, this.nlist, 15, isol, fx2, fy, fz2, field5, field7 );
this.compNorm( q1z );
this.compNorm( q1yz );
this.VIntY( q1z * 3, this.vlist, this.nlist, 15, isol, fx2, fy, fz2, field5, field7 );
};
......@@ -226,7 +226,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
this.compNorm( qyz );
this.compNorm( q1yz );
this.VIntX( qyz * 3, this.vlist, this.nlist, 18, isol, fx, fy2, fz2, field6, field7 );
this.VIntX( qyz * 3, this.vlist, this.nlist, 18, isol, fx, fy2, fz2, field6, field7 );
};
......@@ -234,7 +234,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
this.compNorm( qz );
this.compNorm( qyz );
this.VIntY( qz * 3, this.vlist, this.nlist, 21, isol, fx, fy, fz2, field4, field6 );
this.VIntY( qz * 3, this.vlist, this.nlist, 21, isol, fx, fy, fz2, field4, field6 );
};
......@@ -252,7 +252,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
this.compNorm( q1 );
this.compNorm( q1z );
this.VIntZ( q1 * 3, this.vlist, this.nlist, 27, isol, fx2, fy, fz, field1, field5 );
this.VIntZ( q1 * 3, this.vlist, this.nlist, 27, isol, fx2, fy, fz, field1, field5 );
};
......@@ -260,15 +260,15 @@ THREE.MarchingCubes = function ( resolution, materials ) {
this.compNorm( q1y );
this.compNorm( q1yz );
this.VIntZ( q1y * 3, this.vlist, this.nlist, 30, isol, fx2, fy2, fz, field3, field7 );
this.VIntZ( q1y * 3, this.vlist, this.nlist, 30, isol, fx2, fy2, fz, field3, field7 );
};
if ( bits & 2048 ) {
if ( bits & 2048 ) {
this.compNorm( qy );
this.compNorm( qyz );
this.VIntZ( qy * 3, this.vlist, this.nlist, 33, isol, fx, fy2, fz, field2, field6 );
this.VIntZ( qy * 3, this.vlist, this.nlist, 33, isol, fx, fy2, fz, field2, field6 );
};
......@@ -319,15 +319,15 @@ THREE.MarchingCubes = function ( resolution, materials ) {
this.positionArray[ c + 7 ] = pos[ o3 + 1 ];
this.positionArray[ c + 8 ] = pos[ o3 + 2 ];
this.normalArray[ c ] = norm[ o1 ];
this.normalArray[ c ] = norm[ o1 ];
this.normalArray[ c + 1 ] = norm[ o1 + 1 ];
this.normalArray[ c + 2 ] = norm[ o1 + 2 ];
this.normalArray[ c + 3 ] = norm[ o2 ];
this.normalArray[ c + 3 ] = norm[ o2 ];
this.normalArray[ c + 4 ] = norm[ o2 + 1 ];
this.normalArray[ c + 5 ] = norm[ o2 + 2 ];
this.normalArray[ c + 6 ] = norm[ o3 ];
this.normalArray[ c + 6 ] = norm[ o3 ];
this.normalArray[ c + 7 ] = norm[ o3 + 1 ];
this.normalArray[ c + 8 ] = norm[ o3 + 2 ];
......@@ -354,7 +354,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
this.end = function( render_callback ) {
if ( this.count == 0 )
if ( this.count === 0 )
return;
for ( var i = this.count * 3; i < this.positionArray.length; i++ )
......@@ -602,7 +602,7 @@ THREE.MarchingCubes = function ( resolution, materials ) {
var geo_callback = function( object ) {
var i, x, y, z, vertex, position, normal,
var i, x, y, z, vertex, position, normal,
face, a, b, c, na, nb, nc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册