public void Lerp(LightingProfile current, LightingProfile source, float blend, bool switchSkybox, bool useEnvLighting, bool useEnvReflection, bool useMixedLighting, bool useFog, bool useHalo)
 {
     if (switchSkybox)
     {
         SetSkybox(current, source);
     }
     if (useEnvLighting)
     {
         SetEnvironmentLighting(current, source, blend);
     }
     if (useEnvReflection)
     {
         SetEnvironmentReflections(current, source, blend);
     }
     if (useFog)
     {
         SetFog(current, source, blend);
     }
     if (useHalo)
     {
         SetHalo(current, source, blend);
     }
     if (useMixedLighting)
     {
         SetMixedLighting(current, source, blend);
     }
 }
 LightingVolumeManager()
 {
     volumes = new List <LightingVolume>();
     //colliders = new List<Collider>(5);
     colliders           = new List <Collider>();
     tempLightingProfile = ScriptableObject.CreateInstance <LightingProfile>();
 }
 private void SetFog(LightingProfile current, LightingProfile source, float blend)
 {
     fog              = source.fog;
     fogMode          = source.fogMode;
     fogColor         = Color.Lerp(current.fogColor, source.fogColor, blend);
     fogDensity       = Mathf.Lerp(current.fogDensity, source.fogDensity, blend);
     fogEndDistance   = Mathf.Lerp(current.fogEndDistance, source.fogEndDistance, blend);
     fogStartDistance = Mathf.Lerp(current.fogStartDistance, source.fogStartDistance, blend);
 }
 private void SetSkybox(LightingProfile current, LightingProfile source)
 {
     //Debug.Log("<color=#FF8F00>Changing skybox...</color>");
     if (skybox != source.skybox)
     {
         skybox = source.skybox;
         Debug.Log("<color=green>SKYBOX</color> changed!");
     }
 }
Esempio n. 5
0
 private void OnEnable()
 {
     lp                    = (LightingProfile)target;
     skybox                = serializedObject.FindProperty("skybox");
     sourceLighting        = serializedObject.FindProperty("sourceLighting");
     defaultReflectionMode = serializedObject.FindProperty("defaultReflectionMode");
     customReflection      = serializedObject.FindProperty("customReflection");
     reflectionResolution  = serializedObject.FindProperty("reflectionResolution");
     fogMode               = serializedObject.FindProperty("fogMode");
 }
        internal void SetProfiles()
        {
            Debug.Log("Copying init profile settings");
            initialProfile = ScriptableObject.CreateInstance <LightingProfile>();
            initialProfile.CopyFromCurrentScene();

            currentProfile  = ScriptableObject.CreateInstance <LightingProfile>();
            temporalProfile = ScriptableObject.CreateInstance <LightingProfile>();
            currentProfile.CopyFromCurrentScene();
            temporalProfile.CopyFromCurrentScene();
        }
        private void CreateAsset(LightingProfile asset, string file)
        {
            string path = Path.Combine("Assets", string.Format("{0}.asset", file));

            AssetDatabase.CreateAsset(asset, path);
            AssetDatabase.SaveAssets();

            EditorUtility.FocusProjectWindow();
            lv.profile             = asset;
            Selection.activeObject = asset;
        }
 private void ResetTemporalProfile()
 {
     counter = blend = 0;
     if (volA != null)
     {
         volA.blend = 0;
     }
     hasToFade = false;
     currentProfile.CopyFromCurrentScene();
     currentProfileName = desireProfile.name;
     desireProfile      = null;
     desiredProfileName = "---";
 }
Esempio n. 9
0
        internal LightingProfile GetGlobalLighting()
        {
            tempLightingProfile = GetDefaultGlobalProfileLighting();

            if (tempLightingProfile == null)
            {
                Debug.Log("No Global profile found. TEMP profile is now the initial profile");
                tempLightingProfile = initProfile;
            }

            Debug.Log("Applying TEMP profile");
            tempLightingProfile.ApplyRenderSettings();
            return(tempLightingProfile);
        }
        private void SetEnvironmentLighting(LightingProfile current, LightingProfile source, float blend)
        {
            //Debug.Log("<color=#FF8F00>Changing Source Environment Lighting...</color>");

            if (sourceLighting != source.sourceLighting)
            {
                sourceLighting = source.sourceLighting;
                Debug.Log("<color=green>ENVIRONMENT LIGHTING</color> changed!");
            }

            ambientEquatorColor = Color.Lerp(current.ambientEquatorColor, source.ambientEquatorColor, blend);
            ambientGroundColor  = Color.Lerp(current.ambientGroundColor, source.ambientGroundColor, blend);
            ambientIntensity    = Mathf.Lerp(current.ambientIntensity, source.ambientIntensity, blend);
            ambientSkyColor     = Color.Lerp(current.ambientSkyColor, source.ambientSkyColor, blend);
        }
        private void SetEnvironmentReflections(LightingProfile current, LightingProfile source, float blend)
        {
            if (customReflection != source.customReflection)
            {
                customReflection = source.customReflection;
            }
            if (defaultReflectionMode != source.defaultReflectionMode)
            {
                defaultReflectionMode = source.defaultReflectionMode;
            }
            if (defaultReflectionResolution != source.defaultReflectionResolution)
            {
                defaultReflectionResolution = source.defaultReflectionResolution;
            }
            if (reflectionBounces != source.reflectionBounces)
            {
                reflectionBounces = source.reflectionBounces;
            }

            reflectionIntensity = Mathf.Lerp(current.reflectionIntensity, source.reflectionIntensity, blend);
        }
        private void GetCurrentVolumes()
        {
            if (ListOfVolumesIsEmpty())
            {
                return;
            }

            if (LayerIsInsideBlendArea())
            {
                isInBlend = true;
                if (LayerIsInsideVolume())
                {
                    string blend  = currentBlendVolume.name;
                    string inside = currentVolume.name;
                    //Debug.Log(string.Format("Layer is in a <color=yellow>BLEND AREA</color> between <color=#FF9000>{0}</color> and <color=#FF9000>{1}</color>.", blend, inside));

                    if (currentBlendVolume.priority > currentVolume.priority)
                    {
                        SetLightingProfiles(currentBlendVolume, currentVolume);
                        currentProfile = volA.profile;
                        desireProfile  = volB.profile;
                        volB.blend     = GetBlendValue() * 100;
                        if (volA != null)
                        {
                            volA.blend = 100 - volB.blend;
                        }

                        //Debug.Log("Blend position: " + GetBlendValue());
                    }
                    //else
                    //{
                    //    Debug.Log(string.Format("but nothing changes because <color=#FF9000>{0}</color> has more priority than <color=#FF9000>{1}</color>", inside, blend));
                    //}
                }
                else
                {
                    SetLightingProfiles(GetHighestCurrentBlendVolume(), GetHighestCurrentGlobalVolume());
                    currentProfile = volA.profile;
                    desireProfile  = volB.profile;
                    volB.blend     = GetBlendValue() * 100;
                    if (volA != null)
                    {
                        volA.blend = 100 - volB.blend;
                    }
                    //Debug.Log(string.Format("Layer is in a <color=yellow>BLEND AREA</color> between <color=#FF9000>{0}</color> and <color=#FF9000>{1}</color>.", volA.name, volB.name));
                    //Debug.Log("Blend position: " + GetBlendValue());
                }
            }
            //else if (LayerIsInsideVolume())
            //{
            //    isInBlend = true;
            //    Debug.Log(string.Format("Layer is <color=cyan>INSIDE</color> of the <color=#FF9000>{0}</color> blend volume.", GetHighestCurrentBlendVolume().name));
            //}
            else
            {
                isInBlend = false;

                if (volB != GetHighestCurrentGlobalVolume())
                {
                    if (volB == null)
                    {
                        SetLightingProfiles(null, GetHighestCurrentGlobalVolume());
                    }
                    else
                    {
                        SetLightingProfiles(volB, GetHighestCurrentGlobalVolume());
                    }

                    desireProfile      = volB.profile;
                    desiredProfileName = volB.profile.name;
                    blendTime          = volB.timeToBlend;
                    curve     = volB.timeCurve;
                    hasToFade = true;
                }

                //Debug.Log(string.Format("Layer is <color=green>OUTSIDE</color> of any blend volume. Using <color=#FF9000>{0}</color> as a profile.", GetHighestCurrentGlobalVolume().name));
            }
        }
 private void SetHalo(LightingProfile current, LightingProfile source, float blend)
 {
     flareFadeSpeed = Mathf.Lerp(current.flareFadeSpeed, source.flareFadeSpeed, blend);
     flareStrength  = Mathf.Lerp(current.flareStrength, source.flareStrength, blend);
     haloStrength   = Mathf.Lerp(current.haloStrength, source.haloStrength, blend);
 }
 private void SetMixedLighting(LightingProfile current, LightingProfile source, float blend)
 {
     subtractiveShadowColor = Color.Lerp(current.subtractiveShadowColor, source.subtractiveShadowColor, blend);
 }
Esempio n. 15
0
 LightingBlendingManager()
 {
     volumes             = new List <LightingVolume>();
     tempLightingProfile = ScriptableObject.CreateInstance <LightingProfile>();
 }