get method

Map<String, dynamic> get(
  1. dynamic light
)

Implementation

Map<String, dynamic> get(light) {
  if (lights[light.id] != null) {
    return lights[light.id]!;
  }

  Map<String, dynamic>? uniforms;

  switch (light.type) {
    case 'DirectionalLight':
      uniforms = {"direction": Vector3(), "color": Color(0, 0, 0)};
      break;

    case 'SpotLight':
      uniforms = {
        "position": Vector3(),
        "direction": Vector3(),
        "color": Color(0, 0, 0),
        "distance": 0,
        "coneCos": 0,
        "penumbraCos": 0,
        "decay": 0
      };
      break;

    case 'PointLight':
      uniforms = {
        "position": Vector3(),
        "color": Color(1, 1, 1),
        "distance": 0,
        "decay": 0
      };
      break;

    case 'HemisphereLight':
      uniforms = {
        "direction": Vector3(),
        "skyColor": Color(0, 0, 0),
        "groundColor": Color(0, 0, 0)
      };
      break;

    case 'RectAreaLight':
      uniforms = {
        "color": Color(0, 0, 0),
        "position": Vector3(),
        "halfWidth": Vector3(),
        "halfHeight": Vector3()
      };
      break;
  }

  lights[light.id] = uniforms!;

  return uniforms;
}