mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-09 04:56:01 +10:00
fixed Geometry.js so computeEdgeFaces() writes face indices to edges
This commit is contained in:
+35
-19
@@ -498,8 +498,8 @@ THREE.Geometry.prototype = {
|
||||
// should shared edge be included?
|
||||
// comment out if not
|
||||
|
||||
hash = edge_hash( face.b, face.d );
|
||||
addToMap( vfMap, hash, i );
|
||||
// hash = edge_hash( face.b, face.d );
|
||||
// addToMap( vfMap, hash, i );
|
||||
|
||||
hash = edge_hash( face.a, face.b );
|
||||
addToMap( vfMap, hash, i );
|
||||
@@ -518,24 +518,40 @@ THREE.Geometry.prototype = {
|
||||
}
|
||||
|
||||
// extract faces
|
||||
|
||||
for( i = 0, il = this.edges.length; i < il; i ++ ) {
|
||||
|
||||
edge = this.edges[ i ];
|
||||
|
||||
v1 = edge.vertexIndices[ 0 ];
|
||||
v2 = edge.vertexIndices[ 1 ];
|
||||
|
||||
edge.faceIndices = vfMap[ edge_hash( v1, v2 ) ].array;
|
||||
|
||||
for( j = 0; j < edge.faceIndices.length; j ++ ) {
|
||||
|
||||
faceIndex = edge.faceIndices[ j ];
|
||||
edge.faces.push( this.faces[ faceIndex ] );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.vfMap = vfMap;
|
||||
|
||||
var numOfEdges = 0;
|
||||
for (i in vfMap) {
|
||||
numOfEdges++;
|
||||
|
||||
edge = vfMap[i];
|
||||
this.edges.push(edge.array);
|
||||
|
||||
}
|
||||
|
||||
//console.log('vfMap', vfMap, 'this.edges',this.edges, 'numOfEdges', numOfEdges);
|
||||
|
||||
// Not sure what the below does.
|
||||
|
||||
// for( i = 0, il = this.edges.length; i < il; i ++ ) {
|
||||
//
|
||||
// edge = this.edges[ i ];
|
||||
//
|
||||
// v1 = edge.vertexIndices[ 0 ];
|
||||
// v2 = edge.vertexIndices[ 1 ];
|
||||
//
|
||||
// edge.faceIndices = vfMap[ edge_hash( v1, v2 ) ].array;
|
||||
//
|
||||
// for( j = 0; j < edge.faceIndices.length; j ++ ) {
|
||||
//
|
||||
// faceIndex = edge.faceIndices[ j ];
|
||||
// edge.faces.push( this.faces[ faceIndex ] );
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user