|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
public enum SpotLightShape { Cone, Pyramid, Box }; |
|
|
|
|
|
|
|
public enum LightUnit |
|
|
|
{ |
|
|
|
Lumen, |
|
|
|
Candela, |
|
|
|
Lux, |
|
|
|
Luminance, |
|
|
|
} |
|
|
|
|
|
|
|
//@TODO: We should continuously move these values
|
|
|
|
// into the engine when we can see them being generally useful
|
|
|
|
|
|
|
|
|
|
|
public float intensity |
|
|
|
{ |
|
|
|
get { return m_Light.intensity; } |
|
|
|
set { GetLightIntensity(value); } |
|
|
|
get { return editorLightIntensity; } |
|
|
|
set { SetLightIntensity(value); } |
|
|
|
} |
|
|
|
|
|
|
|
// Only for Spotlight, should be hide for other light
|
|
|
|
|
|
|
public float volumetricDimmer = 1.0f; |
|
|
|
|
|
|
|
// Used internally to convert any light unit input into light intensity
|
|
|
|
public int lightUnit; |
|
|
|
public LightUnit lightUnit; |
|
|
|
|
|
|
|
// Not used for directional lights.
|
|
|
|
public float fadeDistance = 10000.0f; |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void GetLightIntensity(float value) |
|
|
|
void SetLightIntensity(float intensity) |
|
|
|
GetLightIntensityPunctual(value); |
|
|
|
SetLightIntensityPunctual(intensity); |
|
|
|
m_Light.intensity = LightUtils.CalculateLineLightIntensity(value, shapeWidth); |
|
|
|
if (lightUnit == LightUnit.Lumen) |
|
|
|
m_Light.intensity = LightUtils.CalculateLineLightIntensity(intensity, shapeWidth); |
|
|
|
else |
|
|
|
m_Light.intensity = intensity; |
|
|
|
m_Light.intensity = LightUtils.ConvertRectLightIntensity(value, shapeWidth, shapeHeight); |
|
|
|
break ; |
|
|
|
if (lightUnit == LightUnit.Lumen) |
|
|
|
m_Light.intensity = LightUtils.ConvertRectLightIntensity(intensity, shapeWidth, shapeHeight); |
|
|
|
else |
|
|
|
m_Light.intensity = intensity; |
|
|
|
break; |
|
|
|
void GetLightIntensityPunctual(float value) |
|
|
|
void SetLightIntensityPunctual(float intensity) |
|
|
|
m_Light.intensity = directionalIntensity; |
|
|
|
m_Light.intensity = intensity; // Alwas in lux
|
|
|
|
m_Light.intensity = LightUtils.ConvertPointLightIntensity(value); |
|
|
|
if (lightUnit == LightUnit.Candela) |
|
|
|
m_Light.intensity = intensity; |
|
|
|
else |
|
|
|
m_Light.intensity = LightUtils.ConvertPointLightIntensity(intensity); |
|
|
|
if (enableSpotReflector) |
|
|
|
|
|
|
|
if (lightUnit == LightUnit.Candela) |
|
|
|
m_Light.intensity = intensity; |
|
|
|
else if (enableSpotReflector) |
|
|
|
m_Light.intensity = LightUtils.ConvertSpotLightIntensity(value, m_Light.spotAngle * Mathf.Deg2Rad, true); |
|
|
|
m_Light.intensity = LightUtils.ConvertSpotLightIntensity(intensity, m_Light.spotAngle * Mathf.Deg2Rad, true); |
|
|
|
} |
|
|
|
else if (spotLightShape == SpotLightShape.Pyramid) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
m_Light.intensity = LightUtils.ConvertFrustrumLightIntensity(value, angleA, angleB); |
|
|
|
m_Light.intensity = LightUtils.ConvertFrustrumLightIntensity(intensity, angleA, angleB); |
|
|
|
m_Light.intensity = LightUtils.ConvertPointLightIntensity(value); |
|
|
|
m_Light.intensity = LightUtils.ConvertPointLightIntensity(intensity); |
|
|
|
m_Light.intensity = LightUtils.ConvertPointLightIntensity(value); |
|
|
|
m_Light.intensity = LightUtils.ConvertPointLightIntensity(intensity); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|