diff --git a/OpenRA.Game/Graphics/Sprite.cs b/OpenRA.Game/Graphics/Sprite.cs index c71be5ccdb..d90d1cbba9 100644 --- a/OpenRA.Game/Graphics/Sprite.cs +++ b/OpenRA.Game/Graphics/Sprite.cs @@ -20,6 +20,7 @@ namespace OpenRA.Graphics public readonly TextureChannel channel; public readonly float2 size; public readonly float2 offset; + public readonly float2 fractionalOffset; readonly float2[] textureCoords; public Sprite(Sheet sheet, Rectangle bounds, TextureChannel channel) @@ -37,6 +38,8 @@ namespace OpenRA.Graphics this.size = new float2(bounds.Size); this.blendMode = blendMode; + this.fractionalOffset = offset / this.size; + var left = (float)(bounds.Left) / sheet.Size.Width; var top = (float)(bounds.Top) / sheet.Size.Height; var right = (float)(bounds.Right) / sheet.Size.Width; diff --git a/OpenRA.Game/Graphics/SpriteRenderer.cs b/OpenRA.Game/Graphics/SpriteRenderer.cs index e9ccf19969..8c076e7bc5 100644 --- a/OpenRA.Game/Graphics/SpriteRenderer.cs +++ b/OpenRA.Game/Graphics/SpriteRenderer.cs @@ -73,7 +73,7 @@ namespace OpenRA.Graphics currentBlend = s.blendMode; currentSheet = s.sheet; - Util.FastCreateQuad(vertices, location + s.offset, s, paletteIndex, nv, size); + Util.FastCreateQuad(vertices, location + s.fractionalOffset * size, s, paletteIndex, nv, size); nv += 4; }