DirectionalLightHelper constructor

DirectionalLightHelper(
  1. DirectionalLight light, [
  2. int? size = 1,
  3. Color? color
])

Implementation

DirectionalLightHelper(this.light, [int? size = 1, this.color]) : super() {
  light.updateMatrixWorld(false);

  matrix = light.matrixWorld;
  matrixAutoUpdate = false;

  size ??= 1;
  var geometry = BufferGeometry();

  double s = size.toDouble();

  List<double> posData = [-s, s, 0.0, s, s, 0.0, s, -s, 0.0, -s, -s, 0.0, -s, s, 0.0];

  geometry.setAttribute('position', Float32BufferAttribute(Float32Array.from(posData), 3, false));

  var material = LineBasicMaterial({"fog": false, "toneMapped": false});

  lightPlane = Line(geometry, material);
  add(lightPlane);

  geometry = BufferGeometry();
  List<double> d2 = [0, 0, 0, 0, 0, 1];
  geometry.setAttribute('position', Float32BufferAttribute(Float32Array.from(d2), 3, false));

  targetLine = Line(geometry, material);
  add(targetLine);

  update();
}