Mr.doob 11 anni fa
parent
commit
885eb52d01
2 ha cambiato i file con 18 aggiunte e 18 eliminazioni
  1. 12 12
      build/three.js
  2. 6 6
      build/three.min.js

+ 12 - 12
build/three.js

@@ -7128,7 +7128,7 @@ THREE.EventDispatcher.prototype = {
 						
 					}
 				
-				}else{
+				} else {
 				
 					var pointCount = positions.length / 3;
 
@@ -7326,26 +7326,26 @@ THREE.EventDispatcher.prototype = {
 
 					var positions = attributes.position.array;
 
-					for ( var i = 0, il = positions.length / 3; i < il; i += 3 ) {
+					for ( var i = 0, j = 0, il = positions.length; i < il; i += 3, j += 9 ) {
 
 						a = i;
 						b = i + 1;
 						c = i + 2;
 
 						vA.set(
-							positions[ a * 3 ],
-							positions[ a * 3 + 1 ],
-							positions[ a * 3 + 2 ]
+							positions[ j ],
+							positions[ j + 1 ],
+							positions[ j + 2 ]
 						);
 						vB.set(
-							positions[ b * 3 ],
-							positions[ b * 3 + 1 ],
-							positions[ b * 3 + 2 ]
+							positions[ j + 3 ],
+							positions[ j + 4 ],
+							positions[ j + 5 ]
 						);
 						vC.set(
-							positions[ c * 3 ],
-							positions[ c * 3 + 1 ],
-							positions[ c * 3 + 2 ]
+							positions[ j + 6 ],
+							positions[ j + 7 ],
+							positions[ j + 8 ]
 						);
 
 						
@@ -7371,7 +7371,7 @@ THREE.EventDispatcher.prototype = {
 
 							distance: distance,
 							point: intersectionPoint,
-							indices: [a, b, c],
+							indices: [ a, b, c ],
 							face: null,
 							faceIndex: null,
 							object: object

+ 6 - 6
build/three.min.js

@@ -147,12 +147,12 @@ e.getInverse(f.matrixWorld);c.copy(p.ray).applyMatrix4(e);if(null!==s.boundingBo
 n+2]);var C=c.distanceToPoint(w);if(C<v){var D=c.closestPointToPoint(w);D.applyMatrix4(f.matrixWorld);B=p.ray.origin.distanceTo(D);t.push({distance:B,distanceToRay:C,point:D.clone(),index:n,face:null,object:f})}}}else for(n=u.length/3,s=0;s<n;s++)w.set(u[3*s],u[3*s+1],u[3*s+2]),C=c.distanceToPoint(w),C<v&&(D=c.closestPointToPoint(w),D.applyMatrix4(f.matrixWorld),B=p.ray.origin.distanceTo(D),t.push({distance:B,distanceToRay:C,point:D,index:s,face:null,object:f}))}else for(u=f.geometry.vertices,s=0;s<
 u.length;s++)w=u[s],C=c.distanceToPoint(w),C<v&&(D=c.closestPointToPoint(w),D.applyMatrix4(f.matrixWorld),B=p.ray.origin.distanceTo(D),t.push({distance:B,distanceToRay:C,point:D.clone(),index:s,face:null,object:f}))}else if(f instanceof a.LOD)d.setFromMatrixPosition(f.matrixWorld),B=p.ray.origin.distanceTo(d),l(f.getObjectForDistance(B),p,t);else if(f instanceof a.Mesh){s=f.geometry;null===s.boundingSphere&&s.computeBoundingSphere();b.copy(s.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===p.ray.isIntersectionSphere(b))return t;
 e.getInverse(f.matrixWorld);c.copy(p.ray).applyMatrix4(e);if(null!==s.boundingBox&&!1===c.isIntersectionBox(s.boundingBox))return t;if(s instanceof a.BufferGeometry){v=f.material;if(void 0===v)return t;n=s.attributes;w=p.precision;if(void 0!==n.index)for(y=n.index.array,u=n.position.array,L=s.offsets,0===L.length&&(L=[{start:0,count:y.length,index:0}]),A=0,K=L.length;A<K;++A)for(n=L[A].start,B=L[A].count,E=L[A].index,s=n,G=n+B;s<G;s+=3){n=E+y[s];C=E+y[s+1];D=E+y[s+2];g.set(u[3*n],u[3*n+1],u[3*n+2]);
-h.set(u[3*C],u[3*C+1],u[3*C+2]);k.set(u[3*D],u[3*D+1],u[3*D+2]);var M=v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide);null!==M&&(M.applyMatrix4(f.matrixWorld),B=p.ray.origin.distanceTo(M),B<w||B<p.near||B>p.far||t.push({distance:B,point:M,indices:[n,C,D],face:null,faceIndex:null,object:f}))}else for(u=n.position.array,s=0,G=u.length/3;s<G;s+=3)n=s,C=s+1,D=s+2,g.set(u[3*n],u[3*n+1],u[3*n+2]),h.set(u[3*C],u[3*C+1],u[3*C+2]),k.set(u[3*D],u[3*D+1],u[3*
-D+2]),M=v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide),null!==M&&(M.applyMatrix4(f.matrixWorld),B=p.ray.origin.distanceTo(M),B<w||B<p.near||B>p.far||t.push({distance:B,point:M,indices:[n,C,D],face:null,faceIndex:null,object:f}))}else if(s instanceof a.Geometry)for(y=f.material instanceof a.MeshFaceMaterial,L=!0===y?f.material.materials:null,w=p.precision,u=s.vertices,A=0,K=s.faces.length;A<K;A++)if(E=s.faces[A],v=!0===y?L[E.materialIndex]:f.material,
-void 0!==v){n=u[E.a];C=u[E.b];D=u[E.c];if(!0===v.morphTargets){B=s.morphTargets;M=f.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);k.set(0,0,0);for(var G=0,N=B.length;G<N;G++){var I=M[G];if(0!==I){var z=B[G].vertices;g.x+=(z[E.a].x-n.x)*I;g.y+=(z[E.a].y-n.y)*I;g.z+=(z[E.a].z-n.z)*I;h.x+=(z[E.b].x-C.x)*I;h.y+=(z[E.b].y-C.y)*I;h.z+=(z[E.b].z-C.z)*I;k.x+=(z[E.c].x-D.x)*I;k.y+=(z[E.c].y-D.y)*I;k.z+=(z[E.c].z-D.z)*I}}g.add(n);h.add(C);k.add(D);n=g;C=h;D=k}M=v.side===a.BackSide?c.intersectTriangle(D,C,
-n,!0):c.intersectTriangle(n,C,D,v.side!==a.DoubleSide);null!==M&&(M.applyMatrix4(f.matrixWorld),B=p.ray.origin.distanceTo(M),B<w||B<p.near||B>p.far||t.push({distance:B,point:M,face:E,faceIndex:A,object:f}))}}else if(f instanceof a.Line){w=p.linePrecision;n=w*w;s=f.geometry;null===s.boundingSphere&&s.computeBoundingSphere();b.copy(s.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===p.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(p.ray).applyMatrix4(e);if(s instanceof a.Geometry)for(u=
-s.vertices,v=u.length,w=new a.Vector3,C=new a.Vector3,D=f.type===a.LineStrip?1:2,s=0;s<v-1;s+=D)c.distanceSqToSegment(u[s],u[s+1],C,w)>n||(B=c.origin.distanceTo(C),B<p.near||B>p.far||t.push({distance:B,point:w.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},p=function(a,b,c){a=a.getDescendants();for(var d=0,e=a.length;d<e;d++)l(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&&p(a,this,c);l(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++)l(a[d],this,c),!0===b&&p(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=THREE.Object3D.DefaultUp.clone();var a=new THREE.Vector3,b=new THREE.Euler,c=new THREE.Quaternion,d=new THREE.Vector3(1,1,1);b.onChange(function(){c.setFromEuler(b,!1)});c.onChange(function(){b.setFromQuaternion(c,void 0,!1)});Object.defineProperties(this,{position:{enumerable:!0,get:function(){return a},set:function(b){console.error("THREE.Object3D: .position = new THREE.Vector3() pattern no longer works. Use .position.copy() instead.");
+h.set(u[3*C],u[3*C+1],u[3*C+2]);k.set(u[3*D],u[3*D+1],u[3*D+2]);var M=v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide);null!==M&&(M.applyMatrix4(f.matrixWorld),B=p.ray.origin.distanceTo(M),B<w||B<p.near||B>p.far||t.push({distance:B,point:M,indices:[n,C,D],face:null,faceIndex:null,object:f}))}else for(u=n.position.array,y=s=0,G=u.length;s<G;s+=3,y+=9)n=s,C=s+1,D=s+2,g.set(u[y],u[y+1],u[y+2]),h.set(u[y+3],u[y+4],u[y+5]),k.set(u[y+6],u[y+7],u[y+8]),M=
+v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide),null!==M&&(M.applyMatrix4(f.matrixWorld),B=p.ray.origin.distanceTo(M),B<w||B<p.near||B>p.far||t.push({distance:B,point:M,indices:[n,C,D],face:null,faceIndex:null,object:f}))}else if(s instanceof a.Geometry)for(y=f.material instanceof a.MeshFaceMaterial,L=!0===y?f.material.materials:null,w=p.precision,u=s.vertices,A=0,K=s.faces.length;A<K;A++)if(E=s.faces[A],v=!0===y?L[E.materialIndex]:f.material,void 0!==
+v){n=u[E.a];C=u[E.b];D=u[E.c];if(!0===v.morphTargets){B=s.morphTargets;M=f.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);k.set(0,0,0);for(var G=0,N=B.length;G<N;G++){var I=M[G];if(0!==I){var z=B[G].vertices;g.x+=(z[E.a].x-n.x)*I;g.y+=(z[E.a].y-n.y)*I;g.z+=(z[E.a].z-n.z)*I;h.x+=(z[E.b].x-C.x)*I;h.y+=(z[E.b].y-C.y)*I;h.z+=(z[E.b].z-C.z)*I;k.x+=(z[E.c].x-D.x)*I;k.y+=(z[E.c].y-D.y)*I;k.z+=(z[E.c].z-D.z)*I}}g.add(n);h.add(C);k.add(D);n=g;C=h;D=k}M=v.side===a.BackSide?c.intersectTriangle(D,C,n,!0):c.intersectTriangle(n,
+C,D,v.side!==a.DoubleSide);null!==M&&(M.applyMatrix4(f.matrixWorld),B=p.ray.origin.distanceTo(M),B<w||B<p.near||B>p.far||t.push({distance:B,point:M,face:E,faceIndex:A,object:f}))}}else if(f instanceof a.Line){w=p.linePrecision;n=w*w;s=f.geometry;null===s.boundingSphere&&s.computeBoundingSphere();b.copy(s.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===p.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(p.ray).applyMatrix4(e);if(s instanceof a.Geometry)for(u=s.vertices,
+v=u.length,w=new a.Vector3,C=new a.Vector3,D=f.type===a.LineStrip?1:2,s=0;s<v-1;s+=D)c.distanceSqToSegment(u[s],u[s+1],C,w)>n||(B=c.origin.distanceTo(C),B<p.near||B>p.far||t.push({distance:B,point:w.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},p=function(a,b,c){a=a.getDescendants();for(var d=0,e=a.length;d<e;d++)l(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&&p(a,this,c);l(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++)l(a[d],this,c),!0===b&&p(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=THREE.Object3D.DefaultUp.clone();var a=new THREE.Vector3,b=new THREE.Euler,c=new THREE.Quaternion,d=new THREE.Vector3(1,1,1);b.onChange(function(){c.setFromEuler(b,!1)});c.onChange(function(){b.setFromQuaternion(c,void 0,!1)});Object.defineProperties(this,{position:{enumerable:!0,get:function(){return a},set:function(b){console.error("THREE.Object3D: .position = new THREE.Vector3() pattern no longer works. Use .position.copy() instead.");
 a.copy(b)}},rotation:{enumerable:!0,get:function(){return b},set:function(a){console.error("THREE.Object3D: .rotation = new THREE.Euler() pattern no longer works. Use .rotation.copy() instead.");b.copy(a)}},quaternion:{enumerable:!0,get:function(){return c},set:function(a){console.error("THREE.Object3D: .quaternion = new THREE.Quaternion() pattern no longer works. Use .quaternion.copy() instead.");c.copy(a)}},scale:{enumerable:!0,get:function(){return d},set:function(a){console.error("THREE.Object3D: .scale = new THREE.Vector3() pattern no longer works. Use .scale.copy() instead.");
 d.copy(a)}}});this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};THREE.Object3D.DefaultUp=new THREE.Vector3(0,1,0);
 THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");return this.rotation.order},set eulerOrder(a){console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");this.rotation.order=a},get useQuaternion(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(a){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},