Backported LOS effect changes from the dev branch (the brightness of the obstructer area is the same as ambient light)

This commit is contained in:
Joonas Rikkonen
2018-08-17 12:58:23 +03:00
parent d0e0143308
commit 9783ed3750

View File

@@ -244,13 +244,12 @@ namespace Barotrauma
GameMain.LightManager.LosEffect.Parameters["xTexture"].SetValue(renderTargetBackground);
GameMain.LightManager.LosEffect.Parameters["xLosTexture"].SetValue(GameMain.LightManager.losTexture);
#endif
//convert the los color to HLS and make sure the luminance of the color is always the same regardless
//of the ambient light color and the luminance of the damage overlight color
//convert the los color to HLS and make sure the luminance of the color is always the same
//as the luminance of the ambient light color
float r = Math.Min(CharacterHUD.damageOverlayTimer * 0.5f, 0.5f);
Vector3 ambientLightHls = GameMain.LightManager.AmbientLight.RgbToHLS();
Vector3 losColorHls = Color.Lerp(GameMain.LightManager.AmbientLight, Color.Red, r).RgbToHLS();
losColorHls.Y = 0.1f;
losColorHls.Y = ambientLightHls.Y;
Color losColor = ToolBox.HLSToRGB(losColorHls);
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null, GameMain.LightManager.LosEffect, null);