24 float t = time_of_day;
26 t += ((int)(-t) / 24000) * 24000.0f;
28 t -= ((int)(t) / 24000) * 24000.0f;
32 const float values[9][2] = {
33 {4250.0f + 125.0f, 175.0f},
34 {4500.0f + 125.0f, 175.0f},
35 {4750.0f + 125.0f, 250.0f},
36 {5000.0f + 125.0f, 350.0f},
37 {5250.0f + 125.0f, 500.0f},
38 {5500.0f + 125.0f, 675.0f},
39 {5750.0f + 125.0f, 875.0f},
40 {6000.0f + 125.0f, 1000.0f},
41 {6250.0f + 125.0f, 1000.0f},
45 float lastt = values[0][0];
46 for (u32 i = 1; i < 9; i++) {
47 float t0 = values[i][0];
48 float switch_t = (t0 + lastt) / 2.0f;
60 else if (t >= 6125.0f)
63 for (u32 i = 0; i < 9; i++) {
64 if (values[i][0] <= t)
67 float td0 = values[i][0] - values[i - 1][0];
68 float f = (t - values[i - 1][0]) / td0;
69 return f * values[i][1] + (1.0f - f) * values[i - 1][1];
u32 time_to_daynight_ratio(float time_of_day, bool smooth)
Definition: daynightratio.h:22