HemisphereLightHelper constructor

HemisphereLightHelper(
  1. Light light,
  2. double size, [
  3. Color? color
])

light - The light being visualized.

size - The size of the mesh used to visualize the light.

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

Implementation

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

  matrix = light.matrixWorld;
  matrixAutoUpdate = false;

  final geometry = OctahedronGeometry(size);
  geometry.rotateY(math.pi * 0.5);

  material = MeshBasicMaterial.fromMap({"wireframe": true, "fog": false, "toneMapped": false});
  if (color == null) material?.vertexColors = true;

  final position = geometry.getAttributeFromString('position');
  final colors = Float32List(position.count * 3);

  geometry.setAttributeFromString('color', Float32BufferAttribute.fromList(colors, 3, false));
  add(Mesh(geometry, material));
  update();
}