BoxHelper constructor

BoxHelper(
  1. dynamic object, {
  2. dynamic color = 0xffff00,
})

Implementation

factory BoxHelper(object, {color = 0xffff00}) {
  var indices = Uint16Array.from([
    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 = Float32Array(8 * 3);

  var geometry = BufferGeometry();
  geometry.setIndex(Uint16BufferAttribute(indices, 1, false));
  geometry.setAttribute(
      'position', Float32BufferAttribute(positions, 3, false));

  var _boxHelper = BoxHelper.create(
      geometry, LineBasicMaterial({"color": color, "toneMapped": false}));

  _boxHelper.object = object;
  _boxHelper.type = 'BoxHelper';

  _boxHelper.matrixAutoUpdate = false;

  _boxHelper.update();

  return _boxHelper;
}