提交 4becf192 编写于 作者: Z zz85

fixed a very rare case situation when a duplicated vertex in a face4

allows a reduction to a face3 in Geometry's .mergeVertices(). so finally the
LatheGeometry example in subdivision surfaces is finally working as
intended!
上级 df83164e
......@@ -224,13 +224,12 @@
smooth = THREE.GeometryUtils.clone( geometry );
// mergeVertices(); is run in case of duplicated vertices
if (! (geometry instanceof THREE.LatheGeometry) ) {
smooth.mergeVertices();
}
smooth.mergeVertices();
smooth.computeCentroids();
smooth.computeFaceNormals();
smooth.computeVertexNormals();
// smooth.computeCentroids();
// smooth.computeFaceNormals();
// smooth.computeVertexNormals();
modifier.modify( smooth );
updateInfo();
......
......@@ -574,6 +574,7 @@ THREE.Geometry.prototype = {
var precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001
var precision = Math.pow( 10, precisionPoints );
var i,il, face;
var abcd = 'abcd', o, k;
for ( i = 0, il = this.vertices.length; i < il; i ++ ) {
......@@ -615,6 +616,19 @@ THREE.Geometry.prototype = {
face.c = changes[ face.c ];
face.d = changes[ face.d ];
// check dups in (a, b, c, d) and convert to -> face3
o = [face.a, face.b, face.c, face.d];
for (k=3;k>0;k--) {
if ( o.indexOf(face[abcd[k]]) != k ) {
// console.log('faces', face.a, face.b, face.c, face.d, 'dup at', k);
o.splice(k, 1);
this.faces[ i ] = new THREE.Face3(o[0], o[1], o[2]);
this.faceVertexUvs[0][i].splice(k, 1);
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册