提交 851b868a 编写于 作者: M Mr.doob

BoxHelper: Clean up.

上级 2e1581fa
......@@ -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>
......
......@@ -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 ) );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册