get method

dynamic get(
  1. dynamic light
)

Implementation

get(light) {
  if (lights[light.id] != null) {
    return lights[light.id];
  }

  Map<String, dynamic> uniforms = {};

  switch (light.type) {
    case 'DirectionalLight':
      uniforms = {
        "shadowBias": 0,
        "shadowNormalBias": 0,
        "shadowRadius": 1,
        "shadowMapSize": Vector2(null, null)
      };
      break;

    case 'SpotLight':
      uniforms = {
        "shadowBias": 0,
        "shadowNormalBias": 0,
        "shadowRadius": 1,
        "shadowMapSize": Vector2(null, null)
      };
      break;

    case 'PointLight':
      uniforms = {
        "shadowBias": 0,
        "shadowNormalBias": 0,
        "shadowRadius": 1,
        "shadowMapSize": Vector2(null, null),
        "shadowCameraNear": 1,
        "shadowCameraFar": 1000
      };
      break;

    // TODO (abelnation): set RectAreaLight shadow uniforms

  }

  lights[light.id] = uniforms;

  return uniforms;
}