DirectionalLightHelper constructor

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

light-- The light to be visualized.

size -- (optional) dimensions of the plane. Default is 1.

color -- (optional) if this is not the set the helper will take the color of the light.

Implementation

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

  matrix = light.matrixWorld;
  matrixAutoUpdate = false;
  BufferGeometry geometry = BufferGeometry();

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

  geometry.setAttributeFromString('position', Float32BufferAttribute.fromList(posData, 3, false));

  final material = LineBasicMaterial.fromMap({"fog": false, "toneMapped": false});

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

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

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

  update();
}