فهرست منبع

Updated builds.

Mr.doob 12 سال پیش
والد
کامیت
6abc178974
2فایلهای تغییر یافته به همراه54 افزوده شده و 31 حذف شده
  1. 49 26
      build/three.js
  2. 5 5
      build/three.min.js

+ 49 - 26
build/three.js

@@ -5381,7 +5381,7 @@ THREE.Ray.prototype = {
 
 
 		return function ( a, b, c, backfaceCulling, optionalTarget ) {
 		return function ( a, b, c, backfaceCulling, optionalTarget ) {
 
 
-			//from http://www.geometrictools.com/LibMathematics/Intersection/Wm5IntrRay3Triangle3.cpp
+			// from http://www.geometrictools.com/LibMathematics/Intersection/Wm5IntrRay3Triangle3.cpp
 
 
 			edge1.subVectors( b, a );
 			edge1.subVectors( b, a );
 			edge2.subVectors( c, a );
 			edge2.subVectors( c, a );
@@ -5392,41 +5392,60 @@ THREE.Ray.prototype = {
 			//   |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
 			//   |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
 			//   |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
 			//   |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
 			//   |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
 			//   |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
-			var DdN = this.direction.dot(normal);
+			var DdN = this.direction.dot( normal );
 			var sign;
 			var sign;
+
 			if ( DdN > 0 ) {
 			if ( DdN > 0 ) {
 
 
-					if ( backfaceCulling ) return null;
-					sign = 1;
+				if ( backfaceCulling ) return null;
+				sign = 1;
 
 
 			} else if ( DdN < 0 ) {
 			} else if ( DdN < 0 ) {
 
 
-					sign = - 1;
-					DdN = - DdN;
+				sign = - 1;
+				DdN = - DdN;
+
+			} else {
 
 
-			} else return null;
+				return null;
+
+			}
 
 
 			diff.subVectors( this.origin, a );
 			diff.subVectors( this.origin, a );
 			var DdQxE2 = sign * this.direction.dot( edge2.crossVectors( diff, edge2 ) );
 			var DdQxE2 = sign * this.direction.dot( edge2.crossVectors( diff, edge2 ) );
 
 
 			// b1 < 0, no intersection
 			// b1 < 0, no intersection
-			if ( DdQxE2 < 0 )
+			if ( DdQxE2 < 0 ) {
+
 				return null;
 				return null;
 
 
+			}
+
 			var DdE1xQ = sign * this.direction.dot( edge1.cross( diff ) );
 			var DdE1xQ = sign * this.direction.dot( edge1.cross( diff ) );
+
 			// b2 < 0, no intersection
 			// b2 < 0, no intersection
-			if ( DdE1xQ < 0 )
+			if ( DdE1xQ < 0 ) {
+
 				return null;
 				return null;
 
 
+			}
+
 			// b1+b2 > 1, no intersection
 			// b1+b2 > 1, no intersection
-			if ( DdQxE2 + DdE1xQ > DdN )
-				return null
+			if ( DdQxE2 + DdE1xQ > DdN ) {
+
+				return null;
+
+			}
 
 
 			// Line intersects triangle, check if ray does.
 			// Line intersects triangle, check if ray does.
 			var QdN = - sign * diff.dot( normal );
 			var QdN = - sign * diff.dot( normal );
+
 			// t < 0, no intersection
 			// t < 0, no intersection
-			if ( QdN < 0 )
-				return null
+			if ( QdN < 0 ) {
+
+				return null;
+
+			}
 
 
 			// Ray intersects triangle.
 			// Ray intersects triangle.
 			return this.at( QdN / DdN, optionalTarget );
 			return this.at( QdN / DdN, optionalTarget );
@@ -6812,14 +6831,14 @@ THREE.EventDispatcher.prototype = {
 
 
 			}
 			}
 
 
-			//Check boundingBox before continuing
+			// Check boundingBox before continuing
 			
 			
 			inverseMatrix.getInverse( object.matrixWorld );  
 			inverseMatrix.getInverse( object.matrixWorld );  
 			localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
 			localRay.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
 
 
-			if ( geometry.boundingBox !== null) {
+			if ( geometry.boundingBox !== null ) {
 
 
-				if ( localRay.isIntersectionBox(geometry.boundingBox) === false )  {
+				if ( localRay.isIntersectionBox( geometry.boundingBox ) === false )  {
 
 
 					return intersects;
 					return intersects;
 
 
@@ -6896,12 +6915,16 @@ THREE.EventDispatcher.prototype = {
 							positions[ c * 3 + 2 ]
 							positions[ c * 3 + 2 ]
 						);
 						);
 
 
-						var interPoint = localRay.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide );
+						var intersectionPoint = localRay.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide );
+
+						if ( intersectionPoint === null ) {
 
 
-						if ( !interPoint ) continue;
+							continue;
+
+						}
 
 
-						interPoint.applyMatrix4( object.matrixWorld );
-						var distance = raycaster.ray.origin.distanceTo( interPoint );
+						intersectionPoint.applyMatrix4( object.matrixWorld );
+						var distance = raycaster.ray.origin.distanceTo( intersectionPoint );
 
 
 						// bail if the ray is too close to the plane
 						// bail if the ray is too close to the plane
 						if ( distance < precision ) continue;
 						if ( distance < precision ) continue;
@@ -6911,7 +6934,7 @@ THREE.EventDispatcher.prototype = {
 						intersects.push( {
 						intersects.push( {
 
 
 							distance: distance,
 							distance: distance,
-							point: interPoint,
+							point: intersectionPoint,
 							face: null,
 							face: null,
 							faceIndex: null,
 							faceIndex: null,
 							object: object
 							object: object
@@ -6941,16 +6964,16 @@ THREE.EventDispatcher.prototype = {
 					b = vertices[ face.b ];
 					b = vertices[ face.b ];
 					c = vertices[ face.c ];
 					c = vertices[ face.c ];
 					
 					
-					var interPoint = localRay.intersectTriangle( a, b, c, material.side !== THREE.DoubleSide );
+					var intersectionPoint = localRay.intersectTriangle( a, b, c, material.side !== THREE.DoubleSide );
 
 
-					if ( !interPoint ) {
+					if ( intersectionPoint === null ) {
 
 
 						continue;
 						continue;
 
 
 					}
 					}
 
 
-					interPoint.applyMatrix4( object.matrixWorld );
-					var distance = raycaster.ray.origin.distanceTo( interPoint );
+					intersectionPoint.applyMatrix4( object.matrixWorld );
+					var distance = raycaster.ray.origin.distanceTo( intersectionPoint );
 
 
 					// bail if the ray is too close to the plane
 					// bail if the ray is too close to the plane
 					if ( distance < precision ) continue;
 					if ( distance < precision ) continue;
@@ -6960,7 +6983,7 @@ THREE.EventDispatcher.prototype = {
 					intersects.push( {
 					intersects.push( {
 
 
 						distance: distance,
 						distance: distance,
-						point: interPoint,
+						point: intersectionPoint,
 						face: face,
 						face: face,
 						faceIndex: f,
 						faceIndex: f,
 						object: object
 						object: object

+ 5 - 5
build/three.min.js

@@ -140,11 +140,11 @@ a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.Ev
 THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&
 THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&
 c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;c<d;c++)b[c].call(this,a)}}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},h=new a.Vector3,g=new a.Vector3,i=new a.Vector3,k=function(f,m,s){if(f instanceof a.Particle){d.getPositionFromMatrix(f.matrixWorld);var q=m.ray.distanceToPoint(d);if(q>f.scale.x)return s;s.push({distance:q,point:f.position,face:null,object:f})}else if(f instanceof
 c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;c<d;c++)b[c].call(this,a)}}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},h=new a.Vector3,g=new a.Vector3,i=new a.Vector3,k=function(f,m,s){if(f instanceof a.Particle){d.getPositionFromMatrix(f.matrixWorld);var q=m.ray.distanceToPoint(d);if(q>f.scale.x)return s;s.push({distance:q,point:f.position,face:null,object:f})}else if(f instanceof
 a.LOD)d.getPositionFromMatrix(f.matrixWorld),q=m.ray.origin.distanceTo(d),k(f.getObjectForDistance(q),m,s);else if(f instanceof a.Mesh){var p=f.geometry;d.getPositionFromMatrix(f.matrixWorld);null===p.boundingSphere&&p.computeBoundingSphere();b.set(d,p.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(null!==p.boundingBox&&!1===c.isIntersectionBox(p.boundingBox))return s;var r=p.vertices;
 a.LOD)d.getPositionFromMatrix(f.matrixWorld),q=m.ray.origin.distanceTo(d),k(f.getObjectForDistance(q),m,s);else if(f instanceof a.Mesh){var p=f.geometry;d.getPositionFromMatrix(f.matrixWorld);null===p.boundingSphere&&p.computeBoundingSphere();b.set(d,p.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(null!==p.boundingBox&&!1===c.isIntersectionBox(p.boundingBox))return s;var r=p.vertices;
-if(p instanceof a.BufferGeometry){var t=f.material;if(void 0===t||!1===p.dynamic)return s;var u,w,F=m.precision,B,r=!1;p.attributes.index&&(r=!0);B=p.offsets;for(var z=p.attributes.index.array,G=p.attributes.position.array,E=p.offsets.length,v=0;v<E;++v)for(var q=B[v].start,O=B[v].index,p=q,A=q+B[v].count;p<A;p+=3)if(r?(q=O+z[p],u=O+z[p+1],w=O+z[p+2]):(q=O,u=O+1,w=O+2),h.set(G[3*q],G[3*q+1],G[3*q+2]),g.set(G[3*u],G[3*u+1],G[3*u+2]),i.set(G[3*w],G[3*w+1],G[3*w+2]),u=c.intersectTriangle(h,g,i,t.side!==
-a.DoubleSide))u.applyMatrix4(f.matrixWorld),q=m.ray.origin.distanceTo(u),q<F||q<m.near||q>m.far||s.push({distance:q,point:u,face:null,faceIndex:null,object:f})}else if(p instanceof a.Geometry){z=f.material instanceof a.MeshFaceMaterial;G=!0===z?f.material.materials:null;F=m.precision;E=0;for(B=p.faces.length;E<B;E++)if(v=p.faces[E],t=!0===z?G[v.materialIndex]:f.material,void 0!==t&&(q=r[v.a],u=r[v.b],w=r[v.c],u=c.intersectTriangle(q,u,w,t.side!==a.DoubleSide)))u.applyMatrix4(f.matrixWorld),q=m.ray.origin.distanceTo(u),
-q<F||q<m.near||q>m.far||s.push({distance:q,point:u,face:v,faceIndex:E,object:f})}}else if(f instanceof a.Line){F=m.linePrecision;t=F*F;p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();d.getPositionFromMatrix(f.matrixWorld);b.set(d,p.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);r=p.vertices;F=r.length;u=new a.Vector3;w=new a.Vector3;B=f.type===a.LineStrip?1:2;for(p=0;p<
-F-1;p+=B)c.distanceSqToSegment(r[p],r[p+1],w,u)<=t&&(q=c.origin.distanceTo(w),m.near<=q&&q<=m.far&&s.push({distance:q,point:u.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},m=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)k(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&m(a,this,c);k(a,
-this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)k(a[d],this,c),!0===b&&m(a[d],this,c);c.sort(f);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Euler;this.quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this.rotation._quaternion=this.quaternion;this.quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
+if(p instanceof a.BufferGeometry){var t=f.material;if(void 0===t||!1===p.dynamic)return s;var u,w,F=m.precision,B,r=!1;p.attributes.index&&(r=!0);B=p.offsets;for(var z=p.attributes.index.array,G=p.attributes.position.array,E=p.offsets.length,v=0;v<E;++v)for(var q=B[v].start,O=B[v].index,p=q,A=q+B[v].count;p<A;p+=3)r?(q=O+z[p],u=O+z[p+1],w=O+z[p+2]):(q=O,u=O+1,w=O+2),h.set(G[3*q],G[3*q+1],G[3*q+2]),g.set(G[3*u],G[3*u+1],G[3*u+2]),i.set(G[3*w],G[3*w+1],G[3*w+2]),u=c.intersectTriangle(h,g,i,t.side!==
+a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),q=m.ray.origin.distanceTo(u),q<F||q<m.near||q>m.far||s.push({distance:q,point:u,face:null,faceIndex:null,object:f}))}else if(p instanceof a.Geometry){z=f.material instanceof a.MeshFaceMaterial;G=!0===z?f.material.materials:null;F=m.precision;E=0;for(B=p.faces.length;E<B;E++)v=p.faces[E],t=!0===z?G[v.materialIndex]:f.material,void 0!==t&&(q=r[v.a],u=r[v.b],w=r[v.c],u=c.intersectTriangle(q,u,w,t.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
+q=m.ray.origin.distanceTo(u),q<F||q<m.near||q>m.far||s.push({distance:q,point:u,face:v,faceIndex:E,object:f})))}}else if(f instanceof a.Line){F=m.linePrecision;t=F*F;p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();d.getPositionFromMatrix(f.matrixWorld);b.set(d,p.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);r=p.vertices;F=r.length;u=new a.Vector3;w=new a.Vector3;B=f.type===
+a.LineStrip?1:2;for(p=0;p<F-1;p+=B)c.distanceSqToSegment(r[p],r[p+1],w,u)<=t&&(q=c.origin.distanceTo(w),m.near<=q&&q<=m.far&&s.push({distance:q,point:u.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},m=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)k(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=
+[];!0===b&&m(a,this,c);k(a,this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)k(a[d],this,c),!0===b&&m(a[d],this,c);c.sort(f);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Euler;this.quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this.rotation._quaternion=this.quaternion;this.quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
 this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
 this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
 THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");return this.rotation.order},set eulerOrder(a){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");this.rotation.order=a},get useQuaternion(){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(a){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},
 THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");return this.rotation.order},set eulerOrder(a){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");this.rotation.order=a},get useQuaternion(){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(a){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},
 applyMatrix:function(){var a=new THREE.Matrix4;return function(b){this.matrix.multiplyMatrices(b,this.matrix);this.position.getPositionFromMatrix(this.matrix);this.scale.getScaleFromMatrix(this.matrix);a.extractRotation(this.matrix);this.quaternion.setFromRotationMatrix(a)}}(),setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},
 applyMatrix:function(){var a=new THREE.Matrix4;return function(b){this.matrix.multiplyMatrices(b,this.matrix);this.position.getPositionFromMatrix(this.matrix);this.scale.getScaleFromMatrix(this.matrix);a.extractRotation(this.matrix);this.quaternion.setFromRotationMatrix(a)}}(),setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},