Timing.Alpha isn't updated if accumulator < step, using interpolated positions to draw lightsources & ragdoll/ai debug info (-> no twitching when the sub is moving)
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Barotrauma.Lights
|
||||
|
||||
private Sprite overrideLightTexture;
|
||||
|
||||
public Entity ParentSub;
|
||||
public Submarine ParentSub;
|
||||
|
||||
public bool CastShadows;
|
||||
|
||||
@@ -299,6 +299,11 @@ namespace Barotrauma.Lights
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Vector2 drawPos = position;
|
||||
if (ParentSub != null) drawPos += ParentSub.DrawPosition;
|
||||
|
||||
drawPos.Y = -drawPos.Y;
|
||||
|
||||
if (range > 1.0f)
|
||||
{
|
||||
if (overrideLightTexture == null)
|
||||
@@ -306,12 +311,12 @@ namespace Barotrauma.Lights
|
||||
Vector2 center = new Vector2(LightTexture.Width / 2, LightTexture.Height / 2);
|
||||
float scale = range / (lightTexture.Width / 2.0f);
|
||||
|
||||
spriteBatch.Draw(lightTexture, new Vector2(WorldPosition.X, -WorldPosition.Y), null, color * (color.A / 255.0f), 0, center, scale, SpriteEffects.None, 1);
|
||||
spriteBatch.Draw(lightTexture, drawPos, null, color * (color.A / 255.0f), 0, center, scale, SpriteEffects.None, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
overrideLightTexture.Draw(spriteBatch,
|
||||
new Vector2(WorldPosition.X, -WorldPosition.Y), color * (color.A / 255.0f),
|
||||
drawPos, color * (color.A / 255.0f),
|
||||
overrideLightTexture.Origin, -Rotation,
|
||||
new Vector2(overrideLightTexture.size.X / overrideLightTexture.SourceRect.Width, overrideLightTexture.size.Y / overrideLightTexture.SourceRect.Height));
|
||||
}
|
||||
@@ -319,7 +324,7 @@ namespace Barotrauma.Lights
|
||||
|
||||
if (LightSprite != null)
|
||||
{
|
||||
LightSprite.Draw(spriteBatch, new Vector2(WorldPosition.X, -WorldPosition.Y), Color, LightSprite.Origin);
|
||||
LightSprite.Draw(spriteBatch, drawPos, Color, LightSprite.Origin);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user