get method
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.init(), "color": Color(0, 0, 0)};
break;
case 'SpotLight':
uniforms = {
"position": Vector3.init(),
"direction": Vector3.init(),
"color": Color(0, 0, 0),
"distance": 0,
"coneCos": 0,
"penumbraCos": 0,
"decay": 0
};
break;
case 'PointLight':
uniforms = {"position": Vector3.init(), "color": Color(1, 1, 1), "distance": 0, "decay": 0};
break;
case 'HemisphereLight':
uniforms = {"direction": Vector3.init(), "skyColor": Color(0, 0, 0), "groundColor": Color(0, 0, 0)};
break;
case 'RectAreaLight':
uniforms = {
"color": Color(0, 0, 0),
"position": Vector3.init(),
"halfWidth": Vector3.init(),
"halfHeight": Vector3.init()
};
break;
}
lights[light.id] = uniforms!;
return uniforms;
}