瀏覽代碼

PlaneHelper: Clean up.

Mr.doob 8 年之前
父節點
當前提交
f720ff7bee
共有 1 個文件被更改,包括 6 次插入12 次删除
  1. 6 12
      src/helpers/PlaneHelper.js

+ 6 - 12
src/helpers/PlaneHelper.js

@@ -22,26 +22,20 @@ function PlaneHelper( plane, size, hex ) {
 	var positions = [ 1, - 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 ];
 	var positions = [ 1, - 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 ];
 
 
 	var geometry = new BufferGeometry();
 	var geometry = new BufferGeometry();
-
 	geometry.addAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
 	geometry.addAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
+	geometry.computeBoundingSphere();
 
 
 	Line.call( this, geometry, new LineBasicMaterial( { color: color } ) );
 	Line.call( this, geometry, new LineBasicMaterial( { color: color } ) );
 
 
-	this.geometry.computeBoundingSphere();
-
 	//
 	//
 
 
-	var positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, - 1, 1, 1, - 1, 1 ];
-
-	var geometry = new BufferGeometry();
-
-	geometry.addAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
-
-	var child = new THREE.Mesh( geometry, new LineBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false } ) );
+	var positions2 = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, - 1, 1, 1, - 1, 1 ];
 
 
-	child.geometry.computeBoundingSphere();
+	var geometry2 = new BufferGeometry();
+	geometry2.addAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );
+	geometry2.computeBoundingSphere();
 
 
-	this.add( child );
+	this.add( new THREE.Mesh( geometry2, new LineBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false } ) ) );
 
 
 	//
 	//