Skip to content

Commit ef8a553

Browse files
authored
Merge pull request #604 from pzgulyas/headlight
Fix headlight flickering when switching down from bright to dim
2 parents fd1cf1f + 65acdfe commit ef8a553

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Source/RunActivity/Viewer3D/Shaders.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public void SetLightVector_ZFar(Vector3 sunDirection, int zFar)
205205
public void SetHeadlight(ref Vector3 position, ref Vector3 direction, float distance, float minDotProduct, float fadeTime, float fadeDuration, float clampValue, ref Vector4 color)
206206
{
207207
var lighting = fadeTime / fadeDuration * clampValue;
208-
if (lighting < 0) lighting = 1 + lighting;
208+
if (fadeDuration < 0) lighting = 1 + lighting;
209209
headlightPosition.SetValue(new Vector4(position, MathHelper.Clamp(lighting, 0, clampValue)));
210210
headlightDirection.SetValue(new Vector4(direction, 0.5f * (1 - minDotProduct))); // We want 50% brightness at the given dot product.
211211
headlightRcpDistance.SetValue(1f / distance); // Needed to be separated (direction * distance) because no pre-shaders are supported in XNA 4

0 commit comments

Comments
 (0)