提交 669eb6dd 编写于 作者: D dubejf

Simplify tracking of EdgesGeometry coordinates

上级 319a4a9c
......@@ -33,7 +33,6 @@ THREE.EdgesGeometry = function ( geometry, thresholdAngle ) {
var vertices = geometry2.vertices;
var faces = geometry2.faces;
var numEdges = 0;
for ( var i = 0, l = faces.length; i < l; i ++ ) {
......@@ -50,7 +49,6 @@ THREE.EdgesGeometry = function ( geometry, thresholdAngle ) {
if ( hash[ key ] === undefined ) {
hash[ key ] = { vert1: edge[ 0 ], vert2: edge[ 1 ], face1: i, face2: undefined };
numEdges ++;
} else {
......@@ -62,9 +60,7 @@ THREE.EdgesGeometry = function ( geometry, thresholdAngle ) {
}
var coords = new Float32Array( numEdges * 2 * 3 );
var index = 0;
var coords = [];
for ( var key in hash ) {
......@@ -73,22 +69,20 @@ THREE.EdgesGeometry = function ( geometry, thresholdAngle ) {
if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) {
var vertex = vertices[ h.vert1 ];
coords[ index ++ ] = vertex.x;
coords[ index ++ ] = vertex.y;
coords[ index ++ ] = vertex.z;
coords.push( vertex.x );
coords.push( vertex.y );
coords.push( vertex.z );
vertex = vertices[ h.vert2 ];
coords[ index ++ ] = vertex.x;
coords[ index ++ ] = vertex.y;
coords[ index ++ ] = vertex.z;
coords.push( vertex.x );
coords.push( vertex.y );
coords.push( vertex.z );
}
}
coords = coords.subarray( 0, index );
this.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) );
this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( coords ), 3 ) );
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册