Made ambient lighting much darker and added a subtle glow around the player

This commit is contained in:
Joonas Rikkonen
2018-01-11 11:25:10 +02:00
parent 47f9900fdc
commit 3b9d51e695
4 changed files with 34 additions and 34 deletions
@@ -36,10 +36,8 @@ namespace Barotrauma
public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundCreatureManager = null)
{
float brightness = MathHelper.Clamp(50.0f + (cam.Position.Y - Size.Y) / 2000.0f, 10.0f, 40.0f);
float avgValue = (backgroundColor.R + backgroundColor.G + backgroundColor.G) / 3;
GameMain.LightManager.AmbientLight = new Color(backgroundColor * (brightness / avgValue), 1.0f);
float brightness = MathHelper.Clamp(1.1f + (cam.Position.Y - Size.Y) / 100000.0f, 0.1f, 1.0f);
GameMain.LightManager.AmbientLight = new Color(backgroundColor * brightness, 1.0f);
graphics.Clear(backgroundColor);
@@ -179,7 +179,7 @@ namespace Barotrauma.Lights
foreach (LightSource light in lights)
{
if (light.Color.A < 1 || light.Range < 1.0f || !light.CastShadows || !light.Enabled) continue;
if (light.Color.A < 1 || light.Range < 1.0f || !light.Enabled) continue;
if (!MathUtils.CircleIntersectsRectangle(light.WorldPosition, light.Range, viewRect)) continue;
light.Draw(spriteBatch, lightEffect, transform);
@@ -189,20 +189,6 @@ namespace Barotrauma.Lights
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.Additive);
if (Character.Controlled != null)
{
if (Character.Controlled.FocusedItem != null)
{
Character.Controlled.FocusedItem.IsHighlighted = true;
Character.Controlled.FocusedItem.Draw(spriteBatch, false, true);
Character.Controlled.FocusedItem.IsHighlighted = true;
}
else if (Character.Controlled.FocusedCharacter != null)
{
Character.Controlled.FocusedCharacter.Draw(spriteBatch);
}
}
foreach (Hull hull in smoothedHullAmbientLights.Keys)
{
if (smoothedHullAmbientLights[hull].A < 0.01f) continue;
@@ -215,14 +201,31 @@ namespace Barotrauma.Lights
GUI.DrawRectangle(spriteBatch,
new Vector2(drawRect.X, -drawRect.Y),
new Vector2(hull.Rect.Width, hull.Rect.Height),
smoothedHullAmbientLights[hull] * 0.5f, true);
smoothedHullAmbientLights[hull], true);
}
if (Character.Controlled != null)
{
if (Character.Controlled.FocusedItem != null)
{
Character.Controlled.FocusedItem.IsHighlighted = true;
Character.Controlled.FocusedItem.Draw(spriteBatch, false, true);
Character.Controlled.FocusedItem.IsHighlighted = true;
}
else if (Character.Controlled.FocusedCharacter != null)
{
Character.Controlled.FocusedCharacter.Draw(spriteBatch);
}
Vector2 drawPos = Character.Controlled.DrawPosition;
drawPos.Y = -drawPos.Y;
spriteBatch.Draw(
LightSource.LightTexture, drawPos, null, Color.White * 0.3f, 0.0f,
new Vector2(LightSource.LightTexture.Width / 2, LightSource.LightTexture.Height / 2), 1.0f, SpriteEffects.None, 0.0f);
}
spriteBatch.End();
//clear alpha, to avoid messing stuff up later
//ClearAlphaToOne(graphics, spriteBatch);
graphics.SetRenderTarget(null);
graphics.BlendState = BlendState.AlphaBlend;
}
@@ -308,7 +311,7 @@ namespace Barotrauma.Lights
var hull = Hull.FindHull(light.WorldPosition);
if (hull == null) return hullAmbientLight;
return AmbientLightHulls(hull, hullAmbientLight, light.Color * (light.Range/2000.0f));
return AmbientLightHulls(hull, hullAmbientLight, light.Color * (light.Range / 2000.0f));
}
/// <summary>
@@ -607,7 +607,6 @@ namespace Barotrauma.Lights
float scale = range / (currentTexture.Width / 2.0f);
spriteBatch.Draw(currentTexture, drawPos, null, color * (color.A / 255.0f), 0, center, scale, SpriteEffects.None, 1);
return;
}