From 52458ed72e5023e2be7b4b0f9d8303ab48f51909 Mon Sep 17 00:00:00 2001 From: zz85 Date: Fri, 20 Apr 2012 10:28:54 +0800 Subject: [PATCH] defaults to quads instead of triangles in ParametricGeometry. Also not using mergeVertices by defaults. --- src/extras/geometries/ParametricGeometry.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/extras/geometries/ParametricGeometry.js b/src/extras/geometries/ParametricGeometry.js index 98be599913..7e9a882f2e 100644 --- a/src/extras/geometries/ParametricGeometry.js +++ b/src/extras/geometries/ParametricGeometry.js @@ -2,9 +2,12 @@ * @author zz85 / https://github.com/zz85 * Parametric Surfaces Geometry * based on the brilliant article by @prideout http://prideout.net/blog/?p=44 + * + * new THREE.ParametricGeometry( parametricFunction, uSements, ySegements, useTris ); + * */ -THREE.ParametricGeometry = function ( func, slices, stacks, face4 ) { +THREE.ParametricGeometry = function ( func, slices, stacks, useTris ) { THREE.Geometry.call( this ); @@ -12,7 +15,7 @@ THREE.ParametricGeometry = function ( func, slices, stacks, face4 ) { var faces = this.faces; var uvs = this.faceVertexUvs[ 0 ]; - var useFace3 = (face4 === undefined) ? true : !face4; + useTris = (useTris === undefined) ? false : useTris; var i, il, j, p; var u, v; @@ -50,7 +53,7 @@ THREE.ParametricGeometry = function ( func, slices, stacks, face4 ) { uvc = new THREE.UV( ( i + 1 ) / slices, j / stacks ); uvd = new THREE.UV( ( i + 1 ) / slices, ( j + 1 ) / stacks ); - if ( useFace3 ) { + if ( useTris ) { faces.push( new THREE.Face3( a, b, c ) ); faces.push( new THREE.Face3( b, d, c ) ); @@ -72,8 +75,8 @@ THREE.ParametricGeometry = function ( func, slices, stacks, face4 ) { // console.log(this); // magic bullet - var diff = this.mergeVertices(); - console.log('removed ', diff, ' vertices by merging'); + // var diff = this.mergeVertices(); + // console.log('removed ', diff, ' vertices by merging'); this.computeCentroids(); this.computeFaceNormals(); -- GitLab