浏览代码

Updated builds.

alteredq 12 年之前
父节点
当前提交
450e2e3dc0
共有 2 个文件被更改,包括 24 次插入36 次删除
  1. 17 28
      build/three.js
  2. 7 8
      build/three.min.js

+ 17 - 28
build/three.js

@@ -4302,17 +4302,8 @@ THREE.Rectangle = function () {
 
 THREE.Sphere = function ( center, radius ) {
 
-	if ( center === undefined && radius === undefined ) {
-
-		this.center = new THREE.Vector3();
-		this.radius = 0;
-
-	} else {
-
-		this.center = center.clone();
-		this.radius = radius || 0;
-
-	}
+	this.center = center === undefined ? new THREE.Vector3() : center.clone();
+	this.radius = radius === undefined ? 0 : radius;
 
 };
 
@@ -7110,30 +7101,26 @@ THREE.Geometry.prototype = {
 
 	computeBoundingBox: function () {
 
-		if ( ! this.boundingBox ) {
-
-			this.boundingBox = new THREE.Box3().setFromPoints( this.vertices );
-
-		} else {
+		if ( this.boundingBox === null ) {
 
-			this.boundingBox.setFromPoints( this.vertices );
+			this.boundingBox = new THREE.Box3();
 
 		}
 
+		this.boundingBox.setFromPoints( this.vertices );
+
 	},
 
 	computeBoundingSphere: function () {
 
-		if ( ! this.boundingSphere ) {
-
-			this.boundingSphere = new THREE.Sphere().setFromCenterAndPoints( new THREE.Vector3(), this.vertices );
-
-		} else {
+		if ( this.boundingSphere === null ) {
 
-			this.boundingSphere.setFromCenterAndPoints( this.boundingSphere.center, this.vertices );
+			this.boundingSphere = new THREE.Sphere();
 
 		}
 
+		this.boundingSphere.setFromCenterAndPoints( this.boundingSphere.center, this.vertices );
+
 	},
 
 	/*
@@ -7354,7 +7341,7 @@ THREE.BufferGeometry.prototype = {
 
 	computeBoundingBox: function () {
 
-		if ( ! this.boundingBox ) {
+		if ( this.boundingBox === null ) {
 
 			this.boundingBox = new THREE.Box3();
 
@@ -7426,8 +7413,10 @@ THREE.BufferGeometry.prototype = {
 
 	computeBoundingSphere: function () {
 
-		if ( ! this.boundingSphere ) {
+		if ( this.boundingSphere === null ) {
+
 			this.boundingSphere = new THREE.Sphere();
+
 		}
 
 		var positions = this.attributes[ "position" ].array;
@@ -7536,15 +7525,15 @@ THREE.BufferGeometry.prototype = {
 						ab.sub( pA, pB );
 						cb.crossSelf( ab );
 
-						normals[ vA * 3 ] 	  += cb.x;
+						normals[ vA * 3 ]     += cb.x;
 						normals[ vA * 3 + 1 ] += cb.y;
 						normals[ vA * 3 + 2 ] += cb.z;
 
-						normals[ vB * 3 ] 	  += cb.x;
+						normals[ vB * 3 ]     += cb.x;
 						normals[ vB * 3 + 1 ] += cb.y;
 						normals[ vB * 3 + 2 ] += cb.z;
 
-						normals[ vC * 3 ] 	  += cb.x;
+						normals[ vC * 3 ]     += cb.x;
 						normals[ vC * 3 + 1 ] += cb.y;
 						normals[ vC * 3 + 2 ] += cb.z;
 

+ 7 - 8
build/three.min.js

@@ -87,7 +87,7 @@ THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.cop
 a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a){return this.orthoPoint(a).subSelf(a).negate()},orthoPoint:function(a){a=this.distanceToPoint(a);return(new THREE.Vector3).copy(this.normal).multiplyScalar(a)},intersectsLine:function(a,b){var c=this.distanceToPoint(a),
 d=this.distanceToPoint(b);return 0>c&&0<d||0>d&&0<c},coplanarPoint:function(){return(new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},translate:function(a){this.constant=-a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}};THREE.Plane.__v1=new THREE.Vector3;THREE.Plane.__v2=new THREE.Vector3;THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b=0,c=0,d=0,e=0,f=0,g=0,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,m,p){h=!1;b=f;c=g;d=m;e=p;a()};this.addPoint=function(f,g){!0===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,m,p,n,r){!0===h?(h=!1,b=f<m?f<n?f:n:m<n?m:n,c=g<p?g<r?g:r:p<r?p:r,d=f>m?f>n?f:n:m>n?m:n,e=g>p?g>r?g:r:p>r?p:r):(b=f<m?f<n?f<b?f:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b,c=g<p?g<r?g<c?g:c:r<c?r:c:p<r?p<c?p:c:r<c?r:c,d=f>m?f>n?f>d?f:d:n>d?n:d:m>n?m>d?m:d:n>d?n:d,e=g>p?g>r?g>e?g:e:r>e?r:e:p>r?p>e?p:e:r>e?r:e);a()};this.addRectangle=function(f){!0===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}};THREE.Sphere=function(a,b){void 0===a&&void 0===b?(this.center=new THREE.Vector3,this.radius=0):(this.center=a.clone(),this.radius=b||0)};
+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}};THREE.Sphere=function(a,b){this.center=void 0===a?new THREE.Vector3:a.clone();this.radius=void 0===b?0:b};
 THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromCenterAndPoints:function(a,b){for(var c=0,d=0,e=b.length;d<e;d++)var f=a.distanceToSquared(b[d]),c=Math.max(c,f);this.center=a;this.radius=Math.sqrt(c);return this},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-
 this.radius},clampPoint:function(a){var b=this.center.distanceToSquared(a),a=(new THREE.Vector3).copy(a);b>this.radius*this.radius&&(a.subSelf(this.center).normalize(),a.multiplyScalar(this.radius).addSelf(this.center));return a},bounds:function(){var a=new THREE.Box3(this.center,this.center);a.expandByScalar(this.radius);return a},translate:function(){this.center.addSelf(this.offset);return this},scale:function(a){this.radius*=a;return this},equals:function(a){return a.center.equals(this.center)&&
 a.radius===this.radius},clone:function(){return(new THREE.Sphere3).copy(this)}};THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0},degreesToRadians:function(a){return a*THREE.Math.__d2r},
@@ -143,13 +143,12 @@ b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].fa
 this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],j=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,
 e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,v){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];m=g[e];p=g[f];n=g[v];r=i.x-h.x;s=j.x-h.x;l=i.y-h.y;t=j.y-h.y;u=i.z-h.z;E=j.z-h.z;y=p.x-m.x;q=n.x-m.x;G=p.y-m.y;A=n.y-m.y;z=1/(y*A-q*G);F.set((A*r-G*s)*z,(A*l-G*t)*z,(A*u-G*E)*z);M.set((y*s-q*r)*z,(y*t-q*l)*z,(y*E-q*u)*z);I[b].addSelf(F);I[c].addSelf(F);I[d].addSelf(F);D[b].addSelf(M);D[c].addSelf(M);D[d].addSelf(M)}var b,c,d,e,f,g,h,i,j,m,p,n,r,s,l,t,u,E,
 y,q,G,A,z,v,I=[],D=[],F=new THREE.Vector3,M=new THREE.Vector3,B=new THREE.Vector3,J=new THREE.Vector3,C=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)I[b]=new THREE.Vector3,D[b]=new THREE.Vector3;b=0;for(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.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var L=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<
-f.vertexNormals.length;d++)C.copy(f.vertexNormals[d]),e=f[L[d]],v=I[e],B.copy(v),B.subSelf(C.multiplyScalar(C.dot(v))).normalize(),J.cross(f.vertexNormals[d],v),e=J.dot(D[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){this.boundingBox?this.boundingBox.setFromPoints(this.vertices):this.boundingBox=
-(new THREE.Box3).setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere?this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices):this.boundingSphere=(new THREE.Sphere).setFromCenterAndPoints(new THREE.Vector3,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],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]];f=0;for(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];d=[a.a,a.b,a.c,a.d];for(e=3;0<e;e--)if(d.indexOf(a["abcd"[e]])!==e){d.splice(e,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);d=0;for(h=this.faceVertexUvs.length;d<h;d++)(i=this.faceVertexUvs[d][f])&&i.splice(e,1);this.faces[f].vertexColors=a.vertexColors;
-break}}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],g=0,h=e.length;g<h;g++)f.push(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},deallocate:function(){delete THREE.GeometryLibrary[this.id]}};
-THREE.GeometryIdCount=0;THREE.GeometryLibrary={};THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.attributes={};this.dynamic=!1;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[];THREE.GeometryLibrary[this.id]=this};
-THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&(b=new THREE.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){this.boundingBox||(this.boundingBox=new THREE.Box3);
-var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,g=a.length;f<g;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){this.boundingSphere||(this.boundingSphere=
+f.vertexNormals.length;d++)C.copy(f.vertexNormals[d]),e=f[L[d]],v=I[e],B.copy(v),B.subSelf(C.multiplyScalar(C.dot(v))).normalize(),J.cross(f.vertexNormals[d],v),e=J.dot(D[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},
+computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],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]];f=0;for(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];d=[a.a,a.b,a.c,a.d];for(e=3;0<e;e--)if(d.indexOf(a["abcd"[e]])!==e){d.splice(e,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);d=0;for(h=this.faceVertexUvs.length;d<h;d++)(i=this.faceVertexUvs[d][f])&&i.splice(e,1);this.faces[f].vertexColors=a.vertexColors;break}}c=this.vertices.length-b.length;this.vertices=b;return c},
+clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],g=0,h=e.length;g<h;g++)f.push(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},deallocate:function(){delete THREE.GeometryLibrary[this.id]}};THREE.GeometryIdCount=0;THREE.GeometryLibrary={};THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.attributes={};this.dynamic=!1;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[];THREE.GeometryLibrary[this.id]=this};
+THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&(b=new THREE.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);
+var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,g=a.length;f<g;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=
 new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
 0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,i,j,m,p,n=new THREE.Vector3,r=new THREE.Vector3,s=new THREE.Vector3,l=new THREE.Vector3,t=new THREE.Vector3;if(this.attributes.index){var u=this.attributes.index.array,E=this.offsets;c=0;for(d=E.length;c<d;++c){b=E[c].start;g=E[c].count;var y=E[c].index;a=b;for(b+=g;a<b;a+=3)g=y+u[a],h=y+u[a+1],i=y+u[a+2],j=e[3*g],m=e[3*g+1],p=e[3*g+2],n.set(j,m,p),j=e[3*h],m=e[3*h+1],p=e[3*h+2],r.set(j,m,p),j=e[3*i],m=e[3*i+1],p=e[3*i+2],s.set(j,
 m,p),l.sub(s,r),t.sub(n,r),l.crossSelf(t),f[3*g]+=l.x,f[3*g+1]+=l.y,f[3*g+2]+=l.z,f[3*h]+=l.x,f[3*h+1]+=l.y,f[3*h+2]+=l.z,f[3*i]+=l.x,f[3*i+1]+=l.y,f[3*i+2]+=l.z}}else{a=0;for(b=e.length;a<b;a+=9)j=e[a],m=e[a+1],p=e[a+2],n.set(j,m,p),j=e[a+3],m=e[a+4],p=e[a+5],r.set(j,m,p),j=e[a+6],m=e[a+7],p=e[a+8],s.set(j,m,p),l.sub(s,r),t.sub(n,r),l.crossSelf(t),f[a]=l.x,f[a+1]=l.y,f[a+2]=l.z,f[a+3]=l.x,f[a+4]=l.y,f[a+5]=l.z,f[a+6]=l.x,f[a+7]=l.y,f[a+8]=l.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=