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

View File

@@ -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);

View File

@@ -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>

View File

@@ -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;
}

View File

@@ -30,7 +30,7 @@
VoronoiSiteInterval="2000,2000"
VoronoiSiteVariance="800,800"
MainPathNodeIntervalRange="10000,30000"
BackgroundColor="29,36,50"
BackgroundColor="14,18,25"
SmallTunnelCount="5"
SmallTunnelLengthRange="10000,20000"
RuinCount="1"
@@ -50,7 +50,7 @@
VoronoiSiteInterval="2000,2000"
VoronoiSiteVariance="800,800"
MainPathNodeIntervalRange="5000,10000"
BackgroundColor="55,61,72"
BackgroundColor="27,30,36"
SmallTunnelCount="3"
SmallTunnelLengthRange="10000,20000"
RuinCount="1"
@@ -65,7 +65,7 @@
VoronoiSiteInterval="1000,8000"
VoronoiSiteVariance="100,1400"
MainPathNodeIntervalRange="5000,10000"
BackgroundColor="55,72,58"
BackgroundColor="27,36,29"
SmallTunnelCount="10"
SmallTunnelLengthRange="10000,20000"
RuinCount="1"
@@ -86,7 +86,7 @@
VoronoiSiteInterval="8000,1000"
VoronoiSiteVariance="1400,100"
MainPathNodeIntervalRange="5000,10000"
BackgroundColor="55,72,58"
BackgroundColor="27,36,29"
SmallTunnelCount="10"
SmallTunnelLengthRange="10000,20000"
RuinCount="1"
@@ -102,7 +102,7 @@
VoronoiSiteInterval="1500,1500"
VoronoiSiteVariance="700,700"
MainPathNodeIntervalRange="20000,50000"
BackgroundColor="25,23,10"
BackgroundColor="12,11,5"
SmallTunnelCount="10"
SmallTunnelLengthRange="5000,50000"
RuinCount="3"
@@ -124,7 +124,7 @@
VoronoiSiteVariance="700,700"
MainPathNodeIntervalRange="6000,10000"
WallColor="160,150,150"
BackgroundColor="20,15,13"
BackgroundColor="10,7,8"
SmallTunnelCount="1"
SmallTunnelLengthRange="5000,50000"
RuinCount="1"
@@ -146,7 +146,7 @@
VoronoiSiteVariance="700,700"
MainPathNodeIntervalRange="6000,10000"
WallColor="200,150,150"
BackgroundColor="25,15,10"
BackgroundColor="12,7,5"
SmallTunnelCount="10"
SmallTunnelLengthRange="5000,50000"
RuinCount="3"
@@ -167,7 +167,7 @@
VoronoiSiteInterval="2000,2000"
VoronoiSiteVariance="800,800"
MainPathNodeIntervalRange="10000,20000"
BackgroundColor="29,36,50"
BackgroundColor="14,13,25"
RuinCount="1"
BottomHoleProbability="0.9"
BackgroundSpriteAmount="1000"