Mr.doob 11 anni fa
parent
commit
caa2dc2b80
2 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 1 1
      build/three.js
  2. 2 2
      build/three.min.js

+ 1 - 1
build/three.js

@@ -33959,7 +33959,7 @@ THREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments )
 
 	offset = 0;
 
-	var indices = new Uint16Array( gridX * gridY * 6 );
+	var indices = new ( vertices.length > 65535 ? Uint32Array : Uint16Array )( gridX * gridY * 6 );
 
 	for ( var iy = 0; iy < gridY; iy ++ ) {
 

+ 2 - 2
build/three.min.js

@@ -642,8 +642,8 @@ n=a.vertices[g].y;g=a.vertices[g].z;r=a.vertices[h].x;var p=a.vertices[h].y;a=a.
 THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
 THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var k=e.shape,l=e.holes;if(!THREE.Shape.Utils.isClockWise(k))for(k=k.reverse(),e=0,f=l.length;e<f;e++)g=l[e],THREE.Shape.Utils.isClockWise(g)&&(l[e]=g.reverse());var n=THREE.Shape.Utils.triangulateShape(k,l);e=0;for(f=l.length;e<f;e++)g=l[e],
 k=k.concat(g);l=k.length;f=n.length;for(e=0;e<l;e++)g=k[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)l=n[e],k=l[0]+h,g=l[1]+h,l=l[2]+h,this.faces.push(new THREE.Face3(k,g,l,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,k,g,l))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);b=b||12;c=c||0;d=d||2*Math.PI;for(var e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var k=c+g*f*d,l=Math.cos(k),n=Math.sin(k),k=0,r=a.length;k<r;k++){var p=a[k],s=new THREE.Vector3;s.x=l*p.x-n*p.y;s.y=n*p.x+l*p.y;s.z=p.z;this.vertices.push(s)}c=a.length;g=0;for(h=b;g<h;g++)for(k=0,r=a.length-1;k<r;k++){b=n=k+c*g;d=n+c;var l=n+1+c,n=n+1,p=g*f,s=k*e,u=p+f,q=s+e;this.faces.push(new THREE.Face3(b,d,n));this.faceVertexUvs[0].push([new THREE.Vector2(p,
-s),new THREE.Vector2(u,s),new THREE.Vector2(p,q)]);this.faces.push(new THREE.Face3(d,l,n));this.faceVertexUvs[0].push([new THREE.Vector2(u,s),new THREE.Vector2(u,q),new THREE.Vector2(p,q)])}this.mergeVertices();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=c||1;d=d||1;var g=c+1,h=d+1,k=a/c,l=b/d;b=new Float32Array(g*h*3);a=new Float32Array(g*h*3);for(var n=new Float32Array(g*h*2),r=0,p=0,s=0;s<h;s++)for(var u=s*l-f,q=0;q<g;q++)b[r]=q*k-e,b[r+1]=-u,a[r+2]=1,n[p]=q/c,n[p+1]=1-s/d,r+=3,p+=2;r=0;e=new Uint16Array(c*d*6);for(s=0;s<d;s++)for(q=0;q<c;q++)f=q+g*(s+1),h=q+1+g*(s+1),k=q+1+g*s,e[r]=q+g*s,e[r+1]=f,e[r+2]=k,e[r+3]=f,e[r+4]=
-h,e[r+5]=k,r+=6;THREE.IndexedGeometry2.call(this,e,b,a,n)};THREE.PlaneGeometry.prototype=Object.create(THREE.IndexedGeometry2.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);a=a||0;b=b||50;e=void 0!==e?e:0;f=void 0!==f?f:2*Math.PI;c=void 0!==c?Math.max(3,c):8;d=void 0!==d?Math.max(3,d):8;var g,h=[],k=a,l=(b-a)/d;for(a=0;a<=d;a++){for(g=0;g<=c;g++){var n=new THREE.Vector3,r=e+g/c*f;n.x=k*Math.cos(r);n.y=k*Math.sin(r);this.vertices.push(n);h.push(new THREE.Vector2((n.x/b+1)/2,(n.y/b+1)/2))}k+=l}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*c,g=0;g<=c;g++)r=g+e,f=r+a,l=r+c+a,n=r+c+1+a,this.faces.push(new THREE.Face3(f,
+s),new THREE.Vector2(u,s),new THREE.Vector2(p,q)]);this.faces.push(new THREE.Face3(d,l,n));this.faceVertexUvs[0].push([new THREE.Vector2(u,s),new THREE.Vector2(u,q),new THREE.Vector2(p,q)])}this.mergeVertices();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=c||1;d=d||1;var g=c+1,h=d+1,k=a/c,l=b/d;b=new Float32Array(g*h*3);a=new Float32Array(g*h*3);for(var n=new Float32Array(g*h*2),r=0,p=0,s=0;s<h;s++)for(var u=s*l-f,q=0;q<g;q++)b[r]=q*k-e,b[r+1]=-u,a[r+2]=1,n[p]=q/c,n[p+1]=1-s/d,r+=3,p+=2;r=0;e=new (65535<b.length?Uint32Array:Uint16Array)(c*d*6);for(s=0;s<d;s++)for(q=0;q<c;q++)f=q+g*(s+1),h=q+1+g*(s+1),k=q+1+g*s,e[r]=q+g*s,e[r+
+1]=f,e[r+2]=k,e[r+3]=f,e[r+4]=h,e[r+5]=k,r+=6;THREE.IndexedGeometry2.call(this,e,b,a,n)};THREE.PlaneGeometry.prototype=Object.create(THREE.IndexedGeometry2.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);a=a||0;b=b||50;e=void 0!==e?e:0;f=void 0!==f?f:2*Math.PI;c=void 0!==c?Math.max(3,c):8;d=void 0!==d?Math.max(3,d):8;var g,h=[],k=a,l=(b-a)/d;for(a=0;a<=d;a++){for(g=0;g<=c;g++){var n=new THREE.Vector3,r=e+g/c*f;n.x=k*Math.cos(r);n.y=k*Math.sin(r);this.vertices.push(n);h.push(new THREE.Vector2((n.x/b+1)/2,(n.y/b+1)/2))}k+=l}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*c,g=0;g<=c;g++)r=g+e,f=r+a,l=r+c+a,n=r+c+1+a,this.faces.push(new THREE.Face3(f,
 l,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[l].clone(),h[n].clone()]),f=r+a,l=r+c+1+a,n=r+1+a,this.faces.push(new THREE.Face3(f,l,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[l].clone(),h[n].clone()]);this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,k)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};a=a||50;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)||6);d=void 0!==d?d:0;e=void 0!==e?e:2*Math.PI;f=void 0!==f?f:0;g=void 0!==g?g:Math.PI;var h,k,l=[],n=[];for(k=0;k<=c;k++){var r=[],p=[];for(h=0;h<=b;h++){var s=h/b,u=k/c,q=new THREE.Vector3;q.x=-a*Math.cos(d+s*e)*Math.sin(f+u*g);q.y=a*Math.cos(f+u*g);q.z=
 a*Math.sin(d+s*e)*Math.sin(f+u*g);this.vertices.push(q);r.push(this.vertices.length-1);p.push(new THREE.Vector2(s,1-u))}l.push(r);n.push(p)}for(k=0;k<c;k++)for(h=0;h<b;h++){d=l[k][h+1];e=l[k][h];f=l[k+1][h];g=l[k+1][h+1];var r=this.vertices[d].clone().normalize(),p=this.vertices[e].clone().normalize(),s=this.vertices[f].clone().normalize(),u=this.vertices[g].clone().normalize(),q=n[k][h+1].clone(),w=n[k][h].clone(),v=n[k+1][h].clone(),t=n[k+1][h+1].clone();Math.abs(this.vertices[d].y)===a?(q.x=(q.x+
 w.x)/2,this.faces.push(new THREE.Face3(d,f,g,[r,s,u])),this.faceVertexUvs[0].push([q,v,t])):Math.abs(this.vertices[f].y)===a?(v.x=(v.x+t.x)/2,this.faces.push(new THREE.Face3(d,e,f,[r,p,s])),this.faceVertexUvs[0].push([q,w,v])):(this.faces.push(new THREE.Face3(d,e,g,[r,p,u])),this.faceVertexUvs[0].push([q,w,t]),this.faces.push(new THREE.Face3(e,f,g,[p.clone(),s,u.clone()])),this.faceVertexUvs[0].push([w.clone(),v,t.clone()]))}this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,