|
|
|
|
|
|
switch (light.type) |
|
|
|
{ |
|
|
|
case LightType.Directional: |
|
|
|
light.intensity = directionalIntensity; |
|
|
|
light.intensity = Mathf.Max(0, directionalIntensity); |
|
|
|
light.intensity = LightUtils.ConvertPointLightIntensity(punctualIntensity); |
|
|
|
light.intensity = LightUtils.ConvertPointLightIntensity(Mathf.Max(0, punctualIntensity)); |
|
|
|
// Spot should used conversion which take into account the angle, and thus the intensity vary with angle.
|
|
|
|
// This is not easy to manipulate for lighter, so we simply consider any spot light as just occluded point light. So reuse the same code.
|
|
|
|
light.intensity = LightUtils.ConvertPointLightIntensity(punctualIntensity); |
|
|
|
// TODO: What to do with box shape ?
|
|
|
|
// var spotLightShape = (SpotLightShape)m_AdditionalspotLightShape.enumValueIndex;
|
|
|
|
|
|
|
|
if (enableSpotReflector) |
|
|
|
{ |
|
|
|
if (spotLightShape == SpotLightShape.Cone) |
|
|
|
{ |
|
|
|
light.intensity = LightUtils.ConvertSpotLightIntensity(Mathf.Max(0, punctualIntensity), light.spotAngle * Mathf.Deg2Rad, true); |
|
|
|
} |
|
|
|
else if (spotLightShape == SpotLightShape.Pyramid) |
|
|
|
{ |
|
|
|
float angleA, angleB; |
|
|
|
LightUtils.CalculateAnglesForPyramid(aspectRatio, light.spotAngle, |
|
|
|
out angleA, out angleB); |
|
|
|
|
|
|
|
light.intensity = LightUtils.ConvertFrustrumLightIntensity(Mathf.Max(0, punctualIntensity), angleA, angleB); |
|
|
|
} |
|
|
|
else // Box shape, fallback to punctual light.
|
|
|
|
{ |
|
|
|
light.intensity = LightUtils.ConvertPointLightIntensity(Mathf.Max(0, punctualIntensity)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
// Spot should used conversion which take into account the angle, and thus the intensity vary with angle.
|
|
|
|
// This is not easy to manipulate for lighter, so we simply consider any spot light as just occluded point light. So reuse the same code.
|
|
|
|
light.intensity = LightUtils.ConvertPointLightIntensity(Mathf.Max(0, punctualIntensity)); |
|
|
|
// TODO: What to do with box shape ?
|
|
|
|
// var spotLightShape = (SpotLightShape)m_AdditionalspotLightShape.enumValueIndex;
|
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
light.intensity = LightUtils.ConvertRectLightIntensity(areaIntensity, shapeWidth, shapeHeight); |
|
|
|
light.intensity = LightUtils.ConvertRectLightIntensity(Mathf.Max(0, areaIntensity), shapeWidth, shapeHeight); |
|
|
|
light.intensity = LightUtils.CalculateLineLightIntensity(areaIntensity, shapeWidth); |
|
|
|
light.intensity = LightUtils.CalculateLineLightIntensity(Mathf.Max(0, areaIntensity), shapeWidth); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|