浏览代码

BoxHelper: Clean up.

Mr.doob 9 年之前
父节点
当前提交
851b868ab0
共有 2 个文件被更改,包括 6 次插入5 次删除
  1. 3 3
      docs/api/extras/helpers/BoxHelper.html
  2. 3 2
      src/extras/helpers/BoxHelper.js

+ 3 - 3
docs/api/extras/helpers/BoxHelper.html

@@ -18,7 +18,7 @@
 		<h2>Example</h2>
 
 		<code>var sphere = new THREE.SphereGeometry();
-		var object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial(0xff0000) );
+		var object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
 		var box = new THREE.BoxHelper( object );
 		scene.add( box );
 		</code>
@@ -26,10 +26,10 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]( [page:Object3D object], [page:Number hex] )</h3>
+		<h3>[name]( [page:Object3D object], [page:Color color] )</h3>
 		<div>
 		object -- Object3D -- the object3D to show the world-axis-aligned boundingbox.<br />
-		hex -- hexadecimal value to define color ex:0xffff00
+		color -- The color of the helper. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0xffff00
 		</div>
 		<div>Creates a new wireframe box matching the size of the passed box.</div>
 

+ 3 - 2
src/extras/helpers/BoxHelper.js

@@ -2,11 +2,12 @@
  * @author mrdoob / http://mrdoob.com/
  */
 
-THREE.BoxHelper = function ( object, hex ) {
+THREE.BoxHelper = function ( object, color ) {
+	
+	if ( color === undefined ) color = 0xffff00;
 
 	var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
 	var positions = new Float32Array( 8 * 3 );
-	var color = ( hex !== undefined ) ? hex : 0xffff00;
 
 	var geometry = new THREE.BufferGeometry();
 	geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );