提交 8cb7093b 编写于 作者: M Mr.doob

Face3ized more geometries.

上级 20f33dbe
......@@ -195,7 +195,7 @@
var clothMaterial = new THREE.MeshPhongMaterial( { alphaTest: 0.5, ambient: 0xffffff, color: 0xffffff, specular: 0x030303, emissive: 0x111111, shiness: 10, map: clothTexture, side: THREE.DoubleSide } );
// cloth geometry
clothGeometry = new THREE.ParametricGeometry( clothFunction, cloth.w, cloth.h, true );
clothGeometry = new THREE.ParametricGeometry( clothFunction, cloth.w, cloth.h );
clothGeometry.dynamic = true;
clothGeometry.computeFaceNormals();
......
......@@ -3,11 +3,11 @@
* Parametric Surfaces Geometry
* based on the brilliant article by @prideout http://prideout.net/blog/?p=44
*
* new THREE.ParametricGeometry( parametricFunction, uSegments, ySegements, useTris );
* new THREE.ParametricGeometry( parametricFunction, uSegments, ySegements );
*
*/
THREE.ParametricGeometry = function ( func, slices, stacks, useTris ) {
THREE.ParametricGeometry = function ( func, slices, stacks ) {
THREE.Geometry.call( this );
......@@ -15,8 +15,6 @@ THREE.ParametricGeometry = function ( func, slices, stacks, useTris ) {
var faces = this.faces;
var uvs = this.faceVertexUvs[ 0 ];
useTris = (useTris === undefined) ? false : useTris;
var i, il, j, p;
var u, v;
......@@ -54,20 +52,11 @@ THREE.ParametricGeometry = function ( func, slices, stacks, useTris ) {
uvc = new THREE.Vector2( j / slices, ( i + 1 ) / stacks );
uvd = new THREE.Vector2( ( j + 1 ) / slices, ( i + 1 ) / stacks );
if ( useTris ) {
faces.push( new THREE.Face3( a, b, c ) );
faces.push( new THREE.Face3( b, d, c ) );
uvs.push( [ uva, uvb, uvc ] );
uvs.push( [ uvb, uvd, uvc ] );
} else {
faces.push( new THREE.Face4( a, b, d, c ) );
uvs.push( [ uva, uvb, uvd, uvc ] );
faces.push( new THREE.Face3( a, b, c ) );
uvs.push( [ uva, uvb, uvc ] );
}
faces.push( new THREE.Face3( a, c, d ) );
uvs.push( [ uva, uvc, uvd ] );
}
......
......@@ -110,8 +110,11 @@ THREE.TubeGeometry = function( path, segments, radius, radialSegments, closed )
uvc = new THREE.Vector2( ( i + 1 ) / this.segments, ( j + 1 ) / this.radialSegments );
uvd = new THREE.Vector2( i / this.segments, ( j + 1 ) / this.radialSegments );
this.faces.push( new THREE.Face4( a, b, c, d ) );
this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvc, uvd ] );
this.faces.push( new THREE.Face3( a, b, c ) );
this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvc ] );
this.faces.push( new THREE.Face3( a, c, d ) );
this.faceVertexUvs[ 0 ].push( [ uva, uvc, uvd ] );
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册