예제 #1
0
        /// <summary>
        /// Used to update the cached lighting / render settings.
        /// Since extracting them is complex and requires scene loading, I thought it best to avoid having the profile do it.
        /// </summary>
        /// <param name="sceneInfo">The scene these settings belong to.</param>
        public void SetLightingCache(SceneInfo sceneInfo, RuntimeLightingSettings lightingSettings, RuntimeRenderSettings renderSettings, RuntimeSunlightSettings sunlightSettings)
        {
            CachedLightingSettings settings = new CachedLightingSettings();

            settings.SceneName        = sceneInfo.Name;
            settings.LightingSettings = lightingSettings;
            settings.RenderSettings   = renderSettings;
            settings.SunlightSettings = sunlightSettings;
            settings.TimeStamp        = DateTime.Now;

            cachedLightingSettings.Add(settings);

            editorLightingCacheOutOfDate = false;
        }
예제 #2
0
#pragma warning restore 414

        #endregion

        public bool GetLightingSceneSettings(
            string lightingSceneName,
            out SceneInfo lightingScene,
            out RuntimeLightingSettings lightingSettings,
            out RuntimeRenderSettings renderSettings,
            out RuntimeSunlightSettings sunlightSettings)
        {
            lightingSettings = default(RuntimeLightingSettings);
            renderSettings   = default(RuntimeRenderSettings);
            sunlightSettings = default(RuntimeSunlightSettings);
            lightingScene    = SceneInfo.Empty;

            for (int i = 0; i < lightingScenes.Count; i++)
            {
                if (lightingScenes[i].Name == lightingSceneName)
                {
                    lightingScene = lightingScenes[i];
                    break;
                }
            }

            if (lightingScene.IsEmpty)
            {   // If we didn't find a lighting scene, don't bother looking for a cache
                return(false);
            }

            bool foundCache = false;

            for (int i = 0; i < cachedLightingSettings.Count; i++)
            {
                CachedLightingSettings cache = cachedLightingSettings[i];
                if (cache.SceneName == lightingSceneName)
                {
                    lightingSettings = cache.LightingSettings;
                    renderSettings   = cache.RenderSettings;
                    sunlightSettings = cache.SunlightSettings;
                    foundCache       = true;
                    break;
                }
            }

            return(foundCache);
        }