提交 1878279f 编写于 作者: M Mr.doob

Updated builds.

上级 e4b76322
......@@ -32926,6 +32926,64 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
THREE.PolyhedronGeometry.prototype = Object.create( THREE.Geometry.prototype );
// File:src/extras/geometries/DodecahedronGeometry.js
/**
* @author Abe Pazos / https://hamoid.com
*/
THREE.DodecahedronGeometry = function ( radius, detail ) {
this.parameters = {
radius: radius,
detail: detail
};
var t = ( 1 + Math.sqrt( 5 ) ) / 2;
var r = 1 / t;
var vertices = [
// (±1, ±1, ±1)
-1, -1, -1, -1, -1, 1,
-1, 1, -1, -1, 1, 1,
1, -1, -1, 1, -1, 1,
1, 1, -1, 1, 1, 1,
// (0, ±1/φ, ±φ)
0, -r, -t, 0, -r, t,
0, r, -t, 0, r, t,
// (±1/φ, ±φ, 0)
-r, -t, 0, -r, t, 0,
r, -t, 0, r, t, 0,
// (±φ, 0, ±1/φ)
-t, 0, -r, t, 0, -r,
-t, 0, r, t, 0, r
];
var indices = [
3, 11, 7, 3, 7, 15, 3, 15, 13,
7, 19, 17, 7, 17, 6, 7, 6, 15,
17, 4, 8, 17, 8, 10, 17, 10, 6,
8, 0, 16, 8, 16, 2, 8, 2, 10,
0, 12, 1, 0, 1, 18, 0, 18, 16,
6, 10, 2, 6, 2, 13, 6, 13, 15,
2, 16, 18, 2, 18, 3, 2, 3, 13,
18, 1, 9, 18, 9, 11, 18, 11, 3,
4, 14, 12, 4, 12, 0, 4, 0, 8,
11, 9, 5, 11, 5, 19, 11, 19, 7,
19, 5, 14, 19, 14, 4, 19, 4, 17,
1, 12, 14, 1, 14, 5, 1, 5, 9
];
THREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );
};
THREE.DodecahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );
// File:src/extras/geometries/IcosahedronGeometry.js
/**
......
......@@ -754,6 +754,8 @@ THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clo
Math.pow(2,b);Math.pow(4,b);for(var d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),m=[],n=0;n<=c;n++){m[n]=[];for(var p=e(d.clone().lerp(h,n/c)),r=e(g.clone().lerp(h,n/c)),q=c-n,s=0;s<=q;s++)m[n][s]=0==s&&n==c?p:e(p.clone().lerp(r,s/q))}for(n=0;n<c;n++)for(s=0;s<2*(c-n)-1;s++)d=Math.floor(s/2),0==s%2?f(m[n][d+1],m[n+1][d],m[n][d]):f(m[n][d+1],m[n+1][d+1],m[n+1][d])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,
a.y));return a.clone()}THREE.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var k=this,m=0,n=a.length;m<n;m+=3)e(new THREE.Vector3(a[m],a[m+1],a[m+2]));a=this.vertices;for(var q=[],s=m=0,n=b.length;m<n;m+=3,s++){var t=a[b[m]],r=a[b[m+1]],p=a[b[m+2]];q[s]=new THREE.Face3(t.index,r.index,p.index,[t.clone(),r.clone(),p.clone()])}for(var v=new THREE.Vector3,m=0,n=q.length;m<n;m++)g(q[m],d);m=0;for(n=this.faceVertexUvs[0].length;m<
n;m++)b=this.faceVertexUvs[0][m],d=b[0].x,a=b[1].x,q=b[2].x,s=Math.max(d,Math.max(a,q)),t=Math.min(d,Math.min(a,q)),0.9<s&&0.1>t&&(0.2>d&&(b[0].x+=1),0.2>a&&(b[1].x+=1),0.2>q&&(b[2].x+=1));m=0;for(n=this.vertices.length;m<n;m++)this.vertices[m].multiplyScalar(c);this.mergeVertices();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
THREE.DodecahedronGeometry=function(a,b){this.parameters={radius:a,detail:b};var c=(1+Math.sqrt(5))/2,d=1/c;THREE.PolyhedronGeometry.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,
11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b)};THREE.DodecahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b}};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
THREE.OctahedronGeometry=function(a,b){this.parameters={radius:a,detail:b};THREE.PolyhedronGeometry.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b}};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b}};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
......
......@@ -41,6 +41,7 @@
"src/extras/geometries/TorusKnotGeometry.js",
"src/extras/geometries/TubeGeometry.js",
"src/extras/geometries/PolyhedronGeometry.js",
"src/extras/geometries/DodecahedronGeometry.js",
"src/extras/geometries/IcosahedronGeometry.js",
"src/extras/geometries/OctahedronGeometry.js",
"src/extras/geometries/TetrahedronGeometry.js",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册