mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-09 16:10:31 -04:00
Removed NioTSO client and server
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
This commit is contained in:
parent
f12ba1502b
commit
22191ce648
591 changed files with 53264 additions and 3362 deletions
69
server/tso.common/Rendering/TimeOfDayConfig.cs
Executable file
69
server/tso.common/Rendering/TimeOfDayConfig.cs
Executable file
|
@ -0,0 +1,69 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace FSO.Common.Rendering
|
||||
{
|
||||
public static class TimeOfDayConfig
|
||||
{
|
||||
public static float DarknessMultiplier = 0.8f;
|
||||
private static Color[] m_TimeColors = new Color[]
|
||||
{
|
||||
new Color(50, 70, 122)*1.25f,
|
||||
new Color(50, 70, 122)*1.25f,
|
||||
new Color(55, 75, 111)*1.25f,
|
||||
new Color(70, 70, 70)*1.25f,
|
||||
new Color(217, 109, 50), //sunrise
|
||||
new Color(255, 255, 255),
|
||||
new Color(255, 255, 255), //peak
|
||||
new Color(255, 255, 255), //peak
|
||||
new Color(255, 255, 255),
|
||||
new Color(255, 255, 255),
|
||||
new Color(217, 109, 50), //sunset
|
||||
new Color(70, 70, 70)*1.25f,
|
||||
new Color(55, 75, 111)*1.25f,
|
||||
new Color(50, 70, 122)*1.25f,
|
||||
};
|
||||
|
||||
private static float[] m_SkyColors = new float[]
|
||||
{
|
||||
4/8f,
|
||||
4/8f,
|
||||
4/8f,
|
||||
5/8f,
|
||||
6/8f, //sunrise
|
||||
7/8f,
|
||||
8/8f, //peak
|
||||
0/8f, //peak
|
||||
0/8f,
|
||||
0/8f,
|
||||
1/8f, //sunset
|
||||
2/8f,
|
||||
3/8f,
|
||||
4/8f,
|
||||
};
|
||||
|
||||
private static Color PowColor(Color col, float pow)
|
||||
{
|
||||
var vec = col.ToVector4();
|
||||
vec.X = (float)Math.Pow(vec.X, pow);
|
||||
vec.Y = (float)Math.Pow(vec.Y, pow);
|
||||
vec.Z = (float)Math.Pow(vec.Z, pow);
|
||||
|
||||
return new Color(vec);
|
||||
}
|
||||
|
||||
public static Color ColorFromTime(double time)
|
||||
{
|
||||
Color col1 = m_TimeColors[(int)Math.Floor(time * (m_TimeColors.Length - 1))]; //first colour
|
||||
Color col2 = m_TimeColors[(int)Math.Floor(time * (m_TimeColors.Length - 1)) + 1]; //second colour
|
||||
if (DarknessMultiplier != 1.0)
|
||||
{
|
||||
col1 = Color.Lerp(Color.White, col1, DarknessMultiplier);
|
||||
col2 = Color.Lerp(Color.White, col2, DarknessMultiplier);
|
||||
}
|
||||
double Progress = (time * (m_TimeColors.Length - 1)) % 1; //interpolation progress (mod 1)
|
||||
|
||||
return PowColor(Color.Lerp(col1, col2, (float)Progress), 2.2f); //linearly interpolate between the two colours for this specific time.
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue