示例#1
0
        internal static unsafe void IsLightmapBakeTypeSupportedByRef(LightmapBakeType bakeType, IntPtr isSupportedPtr)
        {
            var isSupported = (bool *)isSupportedPtr;

            if (bakeType == LightmapBakeType.Mixed)
            {
                // we can't have Mixed without Bake
                bool isBakedSupported = IsLightmapBakeTypeSupported(LightmapBakeType.Baked);

                // we can't support Mixed mode and then not support any of the different modes
                if (!isBakedSupported || active.mixedLightingModes == LightmapMixedBakeModes.None)
                {
                    *isSupported = false;
                    return;
                }
            }

            *isSupported = ((active.lightmapBakeTypes & bakeType) == bakeType);

            // if we are using realtime GI on a new project and Enlighten has been deprecated, don't allow realtime GI
            if (bakeType == LightmapBakeType.Realtime && !active.enlighten && !GraphicsSettings.AllowEnlightenSupportForUpgradedProject())
            {
                *isSupported = false;
            }
        }
示例#2
0
 public void SetLightMode()
 {
     if (targetLight != null)
     {
         lightMode = targetLight.lightmapBakeType;
     }
 }
示例#3
0
        internal static unsafe bool IsLightmapBakeTypeSupported(LightmapBakeType bakeType)
        {
            bool isSupported;

            IsLightmapBakeTypeSupportedByRef(bakeType, new IntPtr(&isSupported));
            return(isSupported);
        }
示例#4
0
        protected override void ReadFromImpl(object obj)
        {
            base.ReadFromImpl(obj);
            Light uo = (Light)obj;

            shadows                  = uo.shadows;
            shadowStrength           = uo.shadowStrength;
            shadowResolution         = uo.shadowResolution;
            layerShadowCullDistances = uo.layerShadowCullDistances;
            cookieSize               = uo.cookieSize;
            cookie                 = ToID(uo.cookie);
            renderMode             = uo.renderMode;
            areaSize               = uo.areaSize;
            lightmapBakeType       = uo.lightmapBakeType;
            type                   = uo.type;
            spotAngle              = uo.spotAngle;
            color                  = uo.color;
            colorTemperature       = uo.colorTemperature;
            intensity              = uo.intensity;
            bounceIntensity        = uo.bounceIntensity;
            shadowCustomResolution = uo.shadowCustomResolution;
            shadowBias             = uo.shadowBias;
            shadowNormalBias       = uo.shadowNormalBias;
            shadowNearPlane        = uo.shadowNearPlane;
            range                  = uo.range;
            flare                  = ToID(uo.flare);
            bakingOutput           = uo.bakingOutput;
            cullingMask            = uo.cullingMask;
            lightShadowCasterMode  = uo.lightShadowCasterMode;
            shadowRadius           = uo.shadowRadius;
            shadowAngle            = uo.shadowAngle;
        }
示例#5
0
        internal static unsafe void IsLightmapBakeTypeSupportedByRef(LightmapBakeType bakeType, IntPtr isSupportedPtr)
        {
            var isSupported = (bool *)isSupportedPtr;

            if (bakeType == LightmapBakeType.Mixed)
            {
                // we can't have Mixed without Bake
                bool isBakedSupported = IsLightmapBakeTypeSupported(LightmapBakeType.Baked);

                // we can't support Mixed mode and then not support any of the different modes
                if (!isBakedSupported || active.mixedLightingModes == LightmapMixedBakeModes.None)
                {
                    *isSupported = false;
                    return;
                }
            }

            *isSupported = ((active.lightmapBakeTypes & bakeType) == bakeType);

            // If we are using real time lighting and Enlighten is disabled, don't allow realtime GI.
            if (bakeType == LightmapBakeType.Realtime && !active.enlighten)
            {
                *isSupported = false;
            }
        }
示例#6
0
        internal unsafe static bool IsLightmapBakeTypeSupported(LightmapBakeType bakeType)
        {
            bool result;

            SupportedRenderingFeatures.IsLightmapBakeTypeSupportedByRef(bakeType, new IntPtr((void *)(&result)));
            return(result);
        }
示例#7
0
 /// <summary>
 /// Print all lights of one LightmapBakeType
 /// </summary>
 public static void FindLightsOfType(LightmapBakeType type)
 {
     object[] objs = Object.FindObjectsOfType(typeof(Light));
     foreach (Light light in objs)
     {
         if (light.lightmapBakeType == type)
         {
             Debug.Log(type.ToString() + " Light on " + light.gameObject, light);
         }
     }
 }
示例#8
0
    public LightComponent(Component comp)
        : base(comp)
    {
        Light light = comp as Light;

        if (light != null)
        {
            lightType  = light.type;
            color      = light.color;
            lightMode  = light.lightmapBakeType;
            intensity  = light.intensity;
            shadowType = light.shadows;
        }
    }
示例#9
0
        internal static unsafe void IsLightmapBakeTypeSupportedByRef(LightmapBakeType bakeType, IntPtr isSupportedPtr)
        {
            var isSupported = (bool *)isSupportedPtr;

            if (bakeType == LightmapBakeType.Mixed)
            {
                // we can't have Mixed without Bake
                bool isBakedSupported = IsLightmapBakeTypeSupported(LightmapBakeType.Baked);
                // we can't support Mixed mode and then not support any of the different modes
                if (!isBakedSupported || SupportedRenderingFeatures.active.supportedMixedLightingModes == LightmapMixedBakeMode.None)
                {
                    *isSupported = false;
                    return;
                }
            }

            *isSupported = ((SupportedRenderingFeatures.active.supportedLightmapBakeTypes & bakeType) == bakeType);
        }
示例#10
0
        public static void Draw()
        {
            // --

            GUILayout.Label("Lights", EditorStyles.boldLabel);

            lightShadows = ( LightShadows )EditorGUILayout.EnumPopup("Shadows", lightShadows);

            lightCasting = ( LightmapBakeType )EditorGUILayout.EnumPopup("Casting", lightCasting);

            // --

            GUILayout.Space(5);

            GUILayout.Label("Renderers", EditorStyles.boldLabel);

            shadowCastingMode = ( ShadowCastingMode )EditorGUILayout.EnumPopup("Cast Shadows", shadowCastingMode);

            receiveShadows = EditorGUILayout.Toggle("Receive Shadow", receiveShadows);
        }
示例#11
0
        internal unsafe static void IsLightmapBakeTypeSupportedByRef(LightmapBakeType bakeType, IntPtr isSupportedPtr)
        {
            bool *ptr  = (bool *)((void *)isSupportedPtr);
            bool  flag = bakeType == LightmapBakeType.Mixed;

            if (flag)
            {
                bool flag2 = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked);
                bool flag3 = !flag2 || SupportedRenderingFeatures.active.mixedLightingModes == SupportedRenderingFeatures.LightmapMixedBakeModes.None;
                if (flag3)
                {
                    *ptr = false;
                    return;
                }
            }
            *    ptr   = ((SupportedRenderingFeatures.active.lightmapBakeTypes & bakeType) == bakeType);
            bool flag4 = bakeType == LightmapBakeType.Realtime && !SupportedRenderingFeatures.active.enlighten;

            if (flag4)
            {
                *ptr = false;
            }
        }
示例#12
0
 internal static bool IsLightmapBakeTypeSupported(LightmapBakeType bakeType)
 {
     return((SupportedRenderingFeatures.active.supportedLightmapBakeTypes & bakeType) == bakeType);
 }
示例#13
0
 public static LightMode Extract(LightmapBakeType baketype)
 {
     return((baketype != LightmapBakeType.Realtime) ? ((baketype != LightmapBakeType.Mixed) ? LightMode.Baked : LightMode.Mixed) : LightMode.Realtime);
 }
示例#14
0
 public static LightMode Extract(LightmapBakeType baketype)
 {
     return(baketype == LightmapBakeType.Realtime ? LightMode.Realtime : (baketype == LightmapBakeType.Mixed ? LightMode.Mixed : LightMode.Baked));
 }
 /// <summary>
 /// Set Lightmap Bake Type.
 /// </summary>
 /// <param name="hdLight"></param>
 /// <param name="lightmapBakeType"></param>
 /// <returns></returns>
 public static LightmapBakeType SetLightmapBakeType(this HDAdditionalLightData hdLight, LightmapBakeType lightmapBakeType) => hdLight.legacyLight.lightmapBakeType = lightmapBakeType;