update method

void update()

Implementation

void update() {
  final mesh = children[0];

  if (color != null) {
    material?.color.setFrom(color!);
  } else {
    final colors = mesh.geometry!.getAttributeFromString('color');

    _color1.setFrom(light.color!);
    _color2.setFrom(light.groundColor!);

    for (int i = 0, l = colors.count; i < l; i++) {
      final color = (i < (l / 2)) ? _color1 : _color2;

      colors.setXYZ(i, color.red, color.green, color.blue);
    }

    colors.needsUpdate = true;
  }

  mesh.lookAt(_vectorHemisphereLightHelper
      .setFromMatrixPosition(light.matrixWorld)
      .negate());
}