提交 429b3de2 编写于 作者: M Mr.doob

Updated builds.

上级 36c1aeff
......@@ -34580,7 +34580,8 @@ THREE.TubeGeometry = function ( path, segments, radius, radialSegments, closed,
segments: segments,
radius: radius,
radialSegments: radialSegments,
closed: closed
closed: closed,
taper: taper
};
segments = segments || 64;
......@@ -34695,6 +34696,14 @@ THREE.TubeGeometry = function ( path, segments, radius, radialSegments, closed,
THREE.TubeGeometry.prototype = Object.create( THREE.Geometry.prototype );
THREE.TubeGeometry.prototype.constructor = THREE.TubeGeometry;
THREE.TubeGeometry.prototype.clone = function() {
return new this.constructor( this.parameters.path,
this.parameters.segments, this.parameters.radius, this.parameters.radialSegments,
this.parameters.closed, this.parameters.taper
);
};
THREE.TubeGeometry.NoTaper = function ( u ) {
......
......@@ -823,9 +823,10 @@ THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e){var f=Math
Array(d);var q=m/c*2*e*Math.PI,s=h(q,g,e,a,f),q=h(q+.01,g,e,a,f);k.subVectors(q,s);n.addVectors(q,s);p.crossVectors(k,n);n.crossVectors(p,k);p.normalize();n.normalize();for(q=0;q<d;++q){var t=q/d*2*Math.PI,v=-b*Math.cos(t),t=b*Math.sin(t),x=new THREE.Vector3;x.x=s.x+v*n.x+t*p.x;x.y=s.y+v*n.y+t*p.y;x.z=s.z+v*n.z+t*p.z;l[m][q]=this.vertices.push(x)-1}}for(m=0;m<c;++m)for(q=0;q<d;++q)e=(m+1)%c,g=(q+1)%d,a=l[m][q],b=l[e][q],e=l[e][g],g=l[m][g],f=new THREE.Vector2(m/c,q/d),k=new THREE.Vector2((m+1)/c,
q/d),n=new THREE.Vector2((m+1)/c,(q+1)/d),p=new THREE.Vector2(m/c,(q+1)/d),this.faces.push(new THREE.Face3(a,b,g)),this.faceVertexUvs[0].push([f,k,p]),this.faces.push(new THREE.Face3(b,e,g)),this.faceVertexUvs[0].push([k.clone(),n,p.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
THREE.TorusKnotGeometry.prototype.clone=function(){return new THREE.TorusKnotGeometry(this.parameters.radius,this.parameters.tube,this.parameters.radialSegments,this.parameters.tubularSegments,this.parameters.p,this.parameters.q,this.parameters.heightScale)};
THREE.TubeGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);this.type="TubeGeometry";this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;g=g||THREE.TubeGeometry.NoTaper;var f=[],h,l,k=b+1,n,p,m,q,s,t=new THREE.Vector3,v,x,u;v=new THREE.TubeGeometry.FrenetFrames(a,b,e);x=v.normals;u=v.binormals;this.tangents=v.tangents;this.normals=x;this.binormals=u;for(v=0;v<k;v++)for(f[v]=[],n=v/(k-1),s=a.getPointAt(n),h=x[v],l=u[v],m=c*g(n),n=0;n<d;n++)p=
n/d*2*Math.PI,q=-m*Math.cos(p),p=m*Math.sin(p),t.copy(s),t.x+=q*h.x+p*l.x,t.y+=q*h.y+p*l.y,t.z+=q*h.z+p*l.z,f[v][n]=this.vertices.push(new THREE.Vector3(t.x,t.y,t.z))-1;for(v=0;v<b;v++)for(n=0;n<d;n++)g=e?(v+1)%b:v+1,k=(n+1)%d,a=f[v][n],c=f[g][n],g=f[g][k],k=f[v][k],t=new THREE.Vector2(v/b,n/d),x=new THREE.Vector2((v+1)/b,n/d),u=new THREE.Vector2((v+1)/b,(n+1)/d),h=new THREE.Vector2(v/b,(n+1)/d),this.faces.push(new THREE.Face3(a,c,k)),this.faceVertexUvs[0].push([t,x,h]),this.faces.push(new THREE.Face3(c,
g,k)),this.faceVertexUvs[0].push([x.clone(),u,h.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;THREE.TubeGeometry.NoTaper=function(a){return 1};THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)};
THREE.TubeGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);this.type="TubeGeometry";this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e,taper:g};b=b||64;c=c||1;d=d||8;e=e||!1;g=g||THREE.TubeGeometry.NoTaper;var f=[],h,l,k=b+1,n,p,m,q,s,t=new THREE.Vector3,v,x,u;v=new THREE.TubeGeometry.FrenetFrames(a,b,e);x=v.normals;u=v.binormals;this.tangents=v.tangents;this.normals=x;this.binormals=u;for(v=0;v<k;v++)for(f[v]=[],n=v/(k-1),s=a.getPointAt(n),h=x[v],l=u[v],m=c*g(n),n=0;n<
d;n++)p=n/d*2*Math.PI,q=-m*Math.cos(p),p=m*Math.sin(p),t.copy(s),t.x+=q*h.x+p*l.x,t.y+=q*h.y+p*l.y,t.z+=q*h.z+p*l.z,f[v][n]=this.vertices.push(new THREE.Vector3(t.x,t.y,t.z))-1;for(v=0;v<b;v++)for(n=0;n<d;n++)g=e?(v+1)%b:v+1,k=(n+1)%d,a=f[v][n],c=f[g][n],g=f[g][k],k=f[v][k],t=new THREE.Vector2(v/b,n/d),x=new THREE.Vector2((v+1)/b,n/d),u=new THREE.Vector2((v+1)/b,(n+1)/d),h=new THREE.Vector2(v/b,(n+1)/d),this.faces.push(new THREE.Face3(a,c,k)),this.faceVertexUvs[0].push([t,x,h]),this.faces.push(new THREE.Face3(c,
g,k)),this.faceVertexUvs[0].push([x.clone(),u,h.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;THREE.TubeGeometry.prototype.clone=function(){return new this.constructor(this.parameters.path,this.parameters.segments,this.parameters.radius,this.parameters.radialSegments,this.parameters.closed,this.parameters.taper)};THREE.TubeGeometry.NoTaper=function(a){return 1};
THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)};
THREE.TubeGeometry.FrenetFrames=function(a,b,c){var d=new THREE.Vector3,e=[],g=[],f=[],h=new THREE.Vector3,l=new THREE.Matrix4;b+=1;var k,n,p;this.tangents=e;this.normals=g;this.binormals=f;for(k=0;k<b;k++)n=k/(b-1),e[k]=a.getTangentAt(n),e[k].normalize();g[0]=new THREE.Vector3;f[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);n=Math.abs(e[0].y);p=Math.abs(e[0].z);k<=a&&(a=k,d.set(1,0,0));n<=a&&(a=n,d.set(0,1,0));p<=a&&d.set(0,0,1);h.crossVectors(e[0],d).normalize();g[0].crossVectors(e[0],
h);f[0].crossVectors(e[0],g[0]);for(k=1;k<b;k++)g[k]=g[k-1].clone(),f[k]=f[k-1].clone(),h.crossVectors(e[k-1],e[k]),1E-4<h.length()&&(h.normalize(),d=Math.acos(THREE.Math.clamp(e[k-1].dot(e[k]),-1,1)),g[k].applyMatrix4(l.makeRotationAxis(h,d))),f[k].crossVectors(e[k],g[k]);if(c)for(d=Math.acos(THREE.Math.clamp(g[0].dot(g[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(g[0],g[b-1]))&&(d=-d),k=1;k<b;k++)g[k].applyMatrix4(l.makeRotationAxis(e[k],d*k)),f[k].crossVectors(e[k],g[k])};
THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=l.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+.5;a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5;b.uv=new THREE.Vector2(c,1-a);return b}function g(a,b,c,d){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()],void 0,d);l.faces.push(d);v.copy(a).add(b).add(c).divideScalar(3);d=Math.atan2(v.z,-v.x);l.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}function f(a,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册