updateMatrixWorld method

  1. @override
void updateMatrixWorld([
  1. bool force = false
])
override

Implementation

@override
void updateMatrixWorld([bool force = false]) {
  scale.set(0.5 * light.width!, 0.5 * light.height!, 1);

  if (color != null) {
    material.color.set(color);
    children[0].material.color.set(color);
  } else {
    material.color.copy(light.color).multiplyScalar(light.intensity);

    // prevent hue shift
    var c = material.color;
    var max = Math.max3(c.r, c.g, c.b);
    if (max > 1) c.multiplyScalar(1 / max);

    children[0].material.color.copy(material.color);
  }

  // ignore world scale on light
  matrixWorld.extractRotation(light.matrixWorld).scale(scale).copyPosition(light.matrixWorld);

  children[0].matrixWorld.copy(matrixWorld);
}