public static void SetFallShaderGlobals(Map map) { if (PlantFallColors.FallIntensityOverride) { Shader.SetGlobalFloat(ShaderPropertyIDs.FallIntensity, PlantFallColors.FallIntensity); } else { Vector2 vector = Find.WorldGrid.LongLatOf(map.Tile); Shader.SetGlobalFloat(ShaderPropertyIDs.FallIntensity, PlantFallColors.GetFallColorFactor(vector.y, GenLocalDate.DayOfYear(map))); } Shader.SetGlobalInt("_FallGlobalControls", (!PlantFallColors.FallGlobalControls) ? 0 : 1); if (PlantFallColors.FallGlobalControls) { Shader.SetGlobalVector("_FallSrc", new Vector3(PlantFallColors.FallSrcR, PlantFallColors.FallSrcG, PlantFallColors.FallSrcB)); Shader.SetGlobalVector("_FallDst", new Vector3(PlantFallColors.FallDstR, PlantFallColors.FallDstG, PlantFallColors.FallDstB)); Shader.SetGlobalVector("_FallRange", new Vector3(PlantFallColors.FallRangeBegin, PlantFallColors.FallRangeEnd)); } }
public static void LogFallColorForYear() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Fall color amounts for each latitude and each day of the year"); stringBuilder.AppendLine("---------------------------------------"); stringBuilder.Append("Lat".PadRight(6)); for (int i = -90; i <= 90; i += 10) { stringBuilder.Append((i.ToString() + "d").PadRight(6)); } stringBuilder.AppendLine(); for (int j = 0; j < 60; j += 5) { stringBuilder.Append(j.ToString().PadRight(6)); for (int k = -90; k <= 90; k += 10) { stringBuilder.Append(PlantFallColors.GetFallColorFactor((float)k, j).ToString("F3").PadRight(6)); } stringBuilder.AppendLine(); } Log.Message(stringBuilder.ToString()); }