calculateLights method

void calculateLights(
  1. List<Light> lights
)

Implementation

void calculateLights(List<Light> lights){
  _ambientLight.setValues( 0, 0, 0 );
  _directionalLights.setValues( 0, 0, 0 );
  _pointLights.setValues( 0, 0, 0 );

  for(int l = 0; l < lights.length; l ++ ) {
    Light light = lights[l];
    Color lightColor = light.color ?? Color();

    if (light is AmbientLight) {
      _ambientLight.red += lightColor.red;
      _ambientLight.green += lightColor.green;
      _ambientLight.blue += lightColor.blue;
    } else if (light is DirectionalLight) {
      _directionalLights.red += lightColor.red;
      _directionalLights.green += lightColor.green;
      _directionalLights.blue += lightColor.blue;
    } else if (light is PointLight) {
      _pointLights.red += lightColor.red;
      _pointLights.green += lightColor.green;
      _pointLights.blue += lightColor.blue;
    }
  }
}