コード例 #1
0
        public static float ConvertPunctualLightCandelaToLumen(LightType lightType, SpotLightShape spotLigthShape, float candela, bool enableSpotReflector, float spotAngle, float aspectRatio)
        {
            if (lightType == LightType.Spot && enableSpotReflector)
            {
                // We just need to multiply candela by solid angle in this case
                if (spotLigthShape == SpotLightShape.Cone)
                {
                    return(LightUtils.ConvertSpotLightCandelaToLumen(candela, spotAngle * Mathf.Deg2Rad, true));
                }
                else if (spotLigthShape == SpotLightShape.Pyramid)
                {
                    float angleA, angleB;
                    LightUtils.CalculateAnglesForPyramid(aspectRatio, spotAngle * Mathf.Deg2Rad, out angleA, out angleB);

                    return(LightUtils.ConvertFrustrumLightCandelaToLumen(candela, angleA, angleB));
                }
                else // Box
                {
                    return(LightUtils.ConvertPointLightCandelaToLumen(candela));
                }
            }

            return(LightUtils.ConvertPointLightCandelaToLumen(candela));
        }