|
@@ -6,10 +6,13 @@ import { BufferGeometry } from '../core/BufferGeometry';
|
|
|
|
|
|
/**
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
|
+ * @author Mugen87 / http://github.com/Mugen87
|
|
|
*/
|
|
|
|
|
|
function BoxHelper( object, color ) {
|
|
|
|
|
|
+ this.object = object;
|
|
|
+
|
|
|
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 ] );
|
|
@@ -21,11 +24,9 @@ function BoxHelper( object, color ) {
|
|
|
|
|
|
LineSegments.call( this, geometry, new LineBasicMaterial( { color: color } ) );
|
|
|
|
|
|
- if ( object !== undefined ) {
|
|
|
-
|
|
|
- this.update( object );
|
|
|
+ this.matrixAutoUpdate = false;
|
|
|
|
|
|
- }
|
|
|
+ this.update();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -38,13 +39,15 @@ BoxHelper.prototype.update = ( function () {
|
|
|
|
|
|
return function update( object ) {
|
|
|
|
|
|
- if ( object && object.isBox3 ) {
|
|
|
+ if ( object !== undefined ) {
|
|
|
|
|
|
- box.copy( object );
|
|
|
+ console.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
+ if ( this.object !== undefined ) {
|
|
|
|
|
|
- box.setFromObject( object );
|
|
|
+ box.setFromObject( this.object );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -89,5 +92,14 @@ BoxHelper.prototype.update = ( function () {
|
|
|
|
|
|
} )();
|
|
|
|
|
|
+BoxHelper.prototype.setFromObject = function ( object ) {
|
|
|
+
|
|
|
+ this.object = object;
|
|
|
+ this.update();
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
|
|
|
export { BoxHelper };
|