提交 52458ed7 编写于 作者: Z zz85

defaults to quads instead of triangles in ParametricGeometry. Also not using...

defaults to quads instead of triangles in ParametricGeometry. Also not using mergeVertices by defaults.
上级 99ac6131
...@@ -2,9 +2,12 @@ ...@@ -2,9 +2,12 @@
* @author zz85 / https://github.com/zz85 * @author zz85 / https://github.com/zz85
* Parametric Surfaces Geometry * Parametric Surfaces Geometry
* based on the brilliant article by @prideout http://prideout.net/blog/?p=44 * 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 ); THREE.Geometry.call( this );
...@@ -12,7 +15,7 @@ THREE.ParametricGeometry = function ( func, slices, stacks, face4 ) { ...@@ -12,7 +15,7 @@ THREE.ParametricGeometry = function ( func, slices, stacks, face4 ) {
var faces = this.faces; var faces = this.faces;
var uvs = this.faceVertexUvs[ 0 ]; var uvs = this.faceVertexUvs[ 0 ];
var useFace3 = (face4 === undefined) ? true : !face4; useTris = (useTris === undefined) ? false : useTris;
var i, il, j, p; var i, il, j, p;
var u, v; var u, v;
...@@ -50,7 +53,7 @@ THREE.ParametricGeometry = function ( func, slices, stacks, face4 ) { ...@@ -50,7 +53,7 @@ THREE.ParametricGeometry = function ( func, slices, stacks, face4 ) {
uvc = new THREE.UV( ( i + 1 ) / slices, j / stacks ); uvc = new THREE.UV( ( i + 1 ) / slices, j / stacks );
uvd = new THREE.UV( ( i + 1 ) / slices, ( j + 1 ) / 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( a, b, c ) );
faces.push( new THREE.Face3( b, d, c ) ); faces.push( new THREE.Face3( b, d, c ) );
...@@ -72,8 +75,8 @@ THREE.ParametricGeometry = function ( func, slices, stacks, face4 ) { ...@@ -72,8 +75,8 @@ THREE.ParametricGeometry = function ( func, slices, stacks, face4 ) {
// console.log(this); // console.log(this);
// magic bullet // magic bullet
var diff = this.mergeVertices(); // var diff = this.mergeVertices();
console.log('removed ', diff, ' vertices by merging'); // console.log('removed ', diff, ' vertices by merging');
this.computeCentroids(); this.computeCentroids();
this.computeFaceNormals(); this.computeFaceNormals();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册