void SetLightIntensity(float intensity)
        {
            displayLightIntensity = intensity;

            if (lightUnit == LightUnit.Lumen)
            {
                switch (lightTypeExtent)
                {
                case LightTypeExtent.Punctual:
                    SetLightIntensityPunctual(intensity);
                    break;

                case LightTypeExtent.Line:
                    m_Light.intensity = LightUtils.CalculateLineLightLumenToLuminance(intensity, shapeWidth);
                    break;

                case LightTypeExtent.Rectangle:
                    m_Light.intensity = LightUtils.ConvertRectLightLumenToLuminance(intensity, shapeWidth, shapeHeight);
                    break;
                }
            }
            else
            {
                m_Light.intensity = intensity;
            }

        #if UNITY_EDITOR
            m_Light.SetLightDirty(); // Should be apply only to parameter that's affect GI, but make the code cleaner
        #endif
        }
Ejemplo n.º 2
0
        public static float ConvertAreaLightLumenToLuminance(LightTypeExtent areaLightType, float lumen, float width, float height = 0)
        {
            switch (areaLightType)
            {
            case LightTypeExtent.Line:
                return(LightUtils.CalculateLineLightLumenToLuminance(lumen, width));

            case LightTypeExtent.Rectangle:
                return(LightUtils.ConvertRectLightLumenToLuminance(lumen, width, height));
            }
            return(lumen);
        }