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 _size = size.toDouble();

  List<double> _posData = [
    -_size,
    _size,
    0.0,
    _size,
    _size,
    0.0,
    _size,
    -_size,
    0.0,
    -_size,
    -_size,
    0.0,
    -_size,
    _size,
    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();
}