Skip to content

Commit a1ff504

Browse files
Merge pull request #382 from Gothic-Unity-Project/bugfix/day-sky-texture
fix: properly set the sky textures, only during the day
2 parents c378927 + f0afb47 commit a1ff504

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

Assets/Gothic-Core/Scripts/Services/World/SkyService.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,26 @@ private void UpdateStateTexAndFog()
144144
Logger.LogError(e.ToString(), LogCat.Mesh);
145145
return;
146146
}
147+
148+
var fogColor = new Vector3(colorValues[0], colorValues[1], colorValues[2]);
147149

148150
foreach (var state in _stateList)
149151
{
150-
// all states that contain day sky layer dawn, evening and day 0 to 3
151-
if (state.Time < 0.35 || state.Time > 0.65)
152+
if (!(state.Time < 0.35) || !(state.Time > 0.65)) // set new textures only for day states
153+
{
154+
continue;
155+
}
156+
157+
state.Layer[0].TEXName = "SKYDAY_LAYER0_A" + day % 2 + ".TGA";
158+
159+
if (!(state.Time < 0.3) || !(state.Time > 0.7))
152160
{
153-
state.Layer[0].TEXName = "SKYDAY_LAYER0_A" + day % 2 + ".TGA";
154-
// day states that contain sky cloud layer day 0 to 3
155-
if (state.Time < 0.3 || state.Time > 0.7)
156-
{
157-
state.Layer[1].TEXName = "SKYDAY_LAYER1_A" + day % 2 + ".TGA";
158-
state.FogColor = new Vector3(colorValues[0], colorValues[1], colorValues[2]);
159-
state.DomeColor0 = new Vector3(colorValues[0], colorValues[1], colorValues[2]);
160-
}
161+
continue;
161162
}
163+
164+
state.Layer[1].TEXName = "SKYDAY_LAYER1_A" + day % 2 + ".TGA";
165+
state.FogColor = fogColor;
166+
state.DomeColor0 = fogColor;
162167
}
163168
}
164169

0 commit comments

Comments
 (0)