浏览代码

Tweaked EdgesHelper code. See #5490.

Mr.doob 10 年之前
父节点
当前提交
eeb4d43585
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/extras/helpers/EdgesHelper.js

+ 3 - 3
src/extras/helpers/EdgesHelper.js

@@ -48,9 +48,7 @@ THREE.EdgesHelper = function ( object, hex ) {
 
 	}
 
-	geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( numEdges * 2 * 3 ), 3 ) );
-
-	var coords = geometry.attributes.position.array;
+	var coords = new Float32Array( numEdges * 2 * 3 );
 
 	var index = 0;
 
@@ -74,6 +72,8 @@ THREE.EdgesHelper = function ( object, hex ) {
 
 	}
 
+	geometry.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) );
+
 	THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color } ), THREE.LinePieces );
 
 	this.matrix = object.matrixWorld;