public static void Postfix(TODStateConfig __instance, int nightStates) { if (nightStates > 0) { __instance.m_SkyBloomIntensity *= 0.3f; } }
internal static void Postfix(TODStateConfig __instance, TODStateConfig a, TODStateConfig b, float blend, float blendBiased, int nightStates) { //undo Wulf's night sky bloom intensity change because its breaks the dawn transition. if (Solstice_RV.better_night_sky_installed && (nightStates > 0)) { __instance.m_SkyBloomIntensity /= 0.3f; } }
private static void DisableChromaticAberration(TODStateConfig config) { if (config == null) { return; } config.m_VignettingChromaticAberration = 0; }
internal static bool Prefix(ActiveEnvironment __instance, WeatherStateConfig wsA, WeatherStateConfig wsB, float weatherBlendFrac, TODBlendState todBlendState, float todBlendFrac, float todBlendBiased, bool isIndoors) { // if ((Time.frameCount % 50) == 0) { ColorGradingSettings settings1A = null; ColorGradingSettings settings1B = null; ColorGradingSettings settings2A = null; ColorGradingSettings settings2B = null; Traverse traverseA = Traverse.Create(__instance).Field("m_WorkA"); TODStateConfig m_WorkA = traverseA.GetValue <TODStateConfig>(); Traverse traverseB = Traverse.Create(__instance).Field("m_WorkB"); TODStateConfig m_WorkB = traverseB.GetValue <TODStateConfig>(); TODStateConfig[] wsA_TodStates = { wsA.m_NightColors, wsA.m_DawnColors, wsA.m_MorningColors, wsA.m_MiddayColors, wsA.m_AfternoonColors, wsA.m_DuskColors, wsA.m_NightColors, wsA.m_NightColors }; TODStateConfig[] wsB_TodStates = { wsB.m_NightColors, wsB.m_DawnColors, wsB.m_MorningColors, wsB.m_MiddayColors, wsB.m_AfternoonColors, wsB.m_DuskColors, wsB.m_NightColors, wsA.m_NightColors }; bool flagtoAdd = false; int[] nightstates = { 1, 0, 0, 0, 0, 2, 3 }; float[] keyangles = { Solstice_RV.dawndusk_angle, Solstice_RV.riseset_angle, Solstice_RV.mornaft_angle, Solstice_RV.getSunAngleAtUnitime(Mathf.Floor(Solstice_RV.unitime()) + 0.5f), Solstice_RV.mornaft_angle, Solstice_RV.riseset_angle, Solstice_RV.dawndusk_angle, Solstice_RV.getSunAngleAtUnitime(Mathf.Floor(Solstice_RV.unitime())) }; if (GameManager.GetUniStorm().m_NormalizedTime > 1f) { GameManager.GetUniStorm().SetNormalizedTime(GameManager.GetUniStorm().m_NormalizedTime - 1f); flagtoAdd = true; } todBlendState = GameManager.GetUniStorm().GetTODBlendState(); // Debug.Log(todBlendState); int itod = (int)todBlendState; string debugtext; float zenith = Solstice_RV.getSunAngleAtUnitime(Mathf.Floor(Solstice_RV.unitime()) + 0.5f); float nadir = Solstice_RV.getSunAngleAtUnitime(Mathf.Floor(Solstice_RV.unitime()) + 0.0f); float throughpcntzen; float throughpcntnad; TODStateConfig wsAStartblend; TODStateConfig wsAEndblend; TODStateConfig wsBStartblend; TODStateConfig wsBEndblend; TODStateConfig wsAZenblend; TODStateConfig wsANadblend; TODStateConfig wsBZenblend; TODStateConfig wsBNadblend; wsAStartblend = wsA_TodStates[itod]; wsAEndblend = wsA_TodStates[itod + 1]; wsBStartblend = wsB_TodStates[itod]; wsBEndblend = wsB_TodStates[itod + 1]; String namestartblend = Enum.GetNames(typeof(TODBlendState))[(int)todBlendState]; String nameendblend = Enum.GetNames(typeof(TODBlendState))[((int)todBlendState + 1) % 6]; float st_ang = keyangles[itod]; float en_ang = keyangles[itod + 1]; throughpcntzen = (zenith - st_ang) / (en_ang - st_ang); debugtext = Solstice_RV.gggtime(Solstice_RV.unitime()) + " " + Enum.GetNames(typeof(TODBlendState))[(int)todBlendState]; // do we need a new zen state if (throughpcntzen >= 0 && throughpcntzen <= 1) { if (itod == (int)TODBlendState.MorningToMidday)// need to correct against game zenith of 45 { throughpcntzen = Mathf.Clamp((zenith - st_ang) / (45f - st_ang), 0, 1); } if (itod == (int)TODBlendState.MiddayToAfternoon)// need to correct against game zenith of 45 { throughpcntzen = Mathf.Clamp((zenith - 45f) / (en_ang - 45f), 0, 1); } //debugtext += " mc:" + throughpcntzen; wsAZenblend = Solstice_RV.createNewMidPoint(wsA_TodStates[itod], wsA_TodStates[itod + 1], wsA_TodStates[6 - itod], wsA_TodStates[((5 - itod) % 8 + 8) % 8], throughpcntzen); wsBZenblend = Solstice_RV.createNewMidPoint(wsB_TodStates[itod], wsB_TodStates[itod + 1], wsB_TodStates[6 - itod], wsB_TodStates[((5 - itod) % 8 + 8) % 8], throughpcntzen); if (itod < 3) { en_ang = zenith; nameendblend = "Zen"; wsAEndblend = wsAZenblend; wsBEndblend = wsBZenblend; } else { st_ang = zenith; namestartblend = "Zen"; wsAStartblend = wsAZenblend; wsBStartblend = wsBZenblend; } } throughpcntnad = (nadir - st_ang) / (en_ang - st_ang); if (throughpcntnad >= 0 && throughpcntnad <= 1) { debugtext += " mc:" + throughpcntnad + "[" + itod + "][" + (itod + 1) + "][" + (6 - itod) + "][" + ((5 - itod) % 8 + 8) % 8 + "]"; wsANadblend = Solstice_RV.createNewMidPoint(wsA_TodStates[itod], wsA_TodStates[itod + 1], wsA_TodStates[6 - itod], wsA_TodStates[((5 - itod) % 8 + 8) % 8], throughpcntnad); wsBNadblend = Solstice_RV.createNewMidPoint(wsB_TodStates[itod], wsB_TodStates[itod + 1], wsB_TodStates[6 - itod], wsB_TodStates[((5 - itod) % 8 + 8) % 8], throughpcntnad); if (itod > 3) { en_ang = nadir; nameendblend = "Nad"; wsAEndblend = wsANadblend; wsBEndblend = wsBNadblend; } else { st_ang = nadir; namestartblend = "Nad"; wsAStartblend = wsANadblend; wsBStartblend = wsBNadblend; } } float newtodBlendFrac = (Solstice_RV.getSunAngleAtUnitime(Solstice_RV.unitime()) - st_ang) / (en_ang - st_ang); debugtext += "(" + namestartblend + ":" + nameendblend + ")"; debugtext += " s:" + st_ang + " e:" + en_ang + " c:" + string.Format("{0:0.00}", Solstice_RV.getSunAngleAtUnitime(Solstice_RV.unitime())) + " =:" + string.Format("{0:0.00}", newtodBlendFrac); m_WorkA.SetBlended(wsAStartblend, wsAEndblend, newtodBlendFrac, newtodBlendFrac, nightstates[itod]); m_WorkB.SetBlended(wsBStartblend, wsBEndblend, newtodBlendFrac, newtodBlendFrac, nightstates[itod]); settings1A = wsA_TodStates[(int)todBlendState].m_ColorGradingSettings; settings1B = wsA_TodStates[((int)todBlendState + 1) % 7].m_ColorGradingSettings; settings2A = wsB_TodStates[(int)todBlendState].m_ColorGradingSettings; settings2B = wsB_TodStates[((int)todBlendState + 1) % 7].m_ColorGradingSettings; __instance.m_TodState.SetBlended(m_WorkA, m_WorkB, weatherBlendFrac, weatherBlendFrac, 0); //if ((Time.frameCount % 1600) == 0) Debug.Log(debugtext); if (isIndoors) { __instance.m_TodState.SetIndoors(); } else { UnityEngine.Rendering.PostProcessing.ColorGrading colorGrading = GameManager.GetCameraEffects().ColorGrading(); if (colorGrading != null) { //if ((Time.frameCount % 50) == 0) Debug.Log("[A"+ (int)todBlendState + "][A"+ ((int)todBlendState + 1) % 7 + "[B" + (int)todBlendState + "][B" + ((int)todBlendState + 1) % 7 + "],"+ newtodBlendFrac + ","+ weatherBlendFrac); colorGrading.UpdateLutForTimeOfDay(settings1A, settings1B, settings2A, settings2B, newtodBlendFrac, newtodBlendFrac, weatherBlendFrac); //colorGrading.UpdateLutForTimeOfDay(wsA.m_DawnColors.m_ColorGradingSettings, wsA.m_MorningColors.m_ColorGradingSettings, wsB.m_DawnColors.m_ColorGradingSettings, wsB.m_MorningColors.m_ColorGradingSettings, 0.5f,0.5f, 0.5f); } } __instance.m_GrassTintScalar = Mathf.Lerp(wsA.m_GrassTintScalar, wsB.m_GrassTintScalar, weatherBlendFrac); if (flagtoAdd) { GameManager.GetUniStorm().SetNormalizedTime(GameManager.GetUniStorm().m_NormalizedTime + 1f); } return(false); } }
internal LightSet GetCurrentLightSet() { if (data == null) { return(null); } TimeWeather.GetCurrentPeriodAndWeather(); LightSet ls = new LightSet(); UniStormWeatherSystem uniStorm = GameManager.GetUniStorm(); TODStateConfig state = uniStorm.GetActiveTODState(); AmbPeriod prd = GetPeriodSet(); //Base Colors Color baseSun = state.m_SunLight; Color origSun = state.m_SunLight; Color baseFog = state.m_FogColor; Color origFog = state.m_FogColor; baseSun.a = 1; baseFog.a = 1; float auroraFade = GameManager.GetAuroraManager().GetNormalizedAlphaSquare(); if (Mathf.Abs(auroraFade) > 0.0001f) { Color auroraColour = GameManager.GetAuroraManager().GetAuroraColour(); ColorHSV auroraModColor = auroraColour; if (!GameManager.GetAuroraManager().IsUsingCinematicColours()) { auroraModColor.s *= Settings.options.auroraSaturation; auroraModColor.v *= Settings.options.auroraIntensity; } float auroraLevel = Mathf.Clamp01(GameManager.GetAuroraManager().m_NormalizedActive / GameManager.GetAuroraManager().m_FullyActiveValue); baseSun = Color.Lerp(origSun, auroraModColor, auroraLevel); baseFog = Color.Lerp(origFog, auroraModColor, auroraLevel); } float baseInt = 1f; float baseRng = 10f; //Setup Global values ls.intMod = ApplyWeatherIntensityMod() + (GetFlickeringMod() * 1f); ls.rngMod = ApplyWeatherRangeMod(); ls.shadowStr = GetShadowStrength(); ls.lightshaftStr = GetLightshaftStrength(); ls.sunStr = (GetLightshaftStrength() + (GetFlickeringMod() * 0.4f)) * GetSunStrength(); //Lightshaft ColorHSV sColor = baseSun; sColor.v = 0.8f; ls.lightshaftColor = ApplyWeatherMod(sColor); //Ambience Color bColor = ApplyWeatherMod(baseSun); ColorHSV dColor = bColor; dColor.s *= 0.5f; //Flicker doesn't affect ambience //dColor.v = 0.4f + (GetFlickeringMod() * 0.1f); dColor.v = 0.4f; ColorHSV nColor = dColor; nColor.v = 0.01f; ls.ambientDayColor = dColor; ls.ambientNightColor = nColor; //Windows ColorHSV wColor = bColor; wColor.s *= Mathf.Min(ApplyWeatherSaturationMod() - 0.2f, 0.4f); wColor.v *= (ls.intMod + 0.5f) + GetFlickeringMod(); ls.windowColor = wColor; ls.windowStrMod = ls.intMod; //Setup Orientations foreach (string dir in cardinal) { Color lColor = baseFog; if (prd != null) { float sunMix = Mathf.Lerp(prd.orientations[dir].sun[0], prd.orientations[dir].sun[1], TimeWeather.currentPeriodPct); lColor = Color.Lerp(baseFog, baseSun, sunMix); //Apply hue mod if (prd.orientations[dir].hue != null) { float hueMix = Mathf.Lerp(prd.orientations[dir].hue[0], prd.orientations[dir].hue[1], TimeWeather.currentPeriodPct); ColorHSV lColorHSV = new ColorHSV(lColor); lColorHSV.h += hueMix; lColor = lColorHSV; } //Apply weather mods lColor = ApplyWeatherMod(lColor); //Apply Intensity & Range baseInt = Mathf.Lerp(prd.intensity[0], prd.intensity[1], TimeWeather.currentPeriodPct); baseRng = Mathf.Lerp(prd.range[0], prd.range[1], TimeWeather.currentPeriodPct); } LightOrientation lo = new LightOrientation { color = (Color)lColor, intensity = baseInt, range = baseRng }; ls.orientations.Add(dir, lo); } LightOrientation defaultOrientation = new LightOrientation { color = baseFog, intensity = baseInt, range = baseRng }; ls.orientations.Add("default", defaultOrientation); return(ls); }