Merge RGBA sprite rendering into SpriteRenderer.

Renderer.RgbaSpriteRenderer is kept as a thin
wrapper to maintain compatibility with consumer
code.
This commit is contained in:
Paul Chote
2018-05-31 22:07:40 +00:00
committed by reaperrr
parent ba38878933
commit 131496ebf8
10 changed files with 95 additions and 92 deletions

View File

@@ -59,6 +59,13 @@ namespace OpenRA.Graphics
currentSheet = s.Sheet;
}
internal void DrawSprite(Sprite s, float3 location, float paletteTextureIndex, float3 size)
{
SetRenderStateForSprite(s);
Util.FastCreateQuad(vertices, location + s.FractionalOffset * size, s, paletteTextureIndex, nv, size);
nv += 6;
}
public void DrawSprite(Sprite s, float3 location, PaletteReference pal)
{
DrawSprite(s, location, pal.TextureIndex, s.Size);
@@ -69,24 +76,6 @@ namespace OpenRA.Graphics
DrawSprite(s, location, pal.TextureIndex, size);
}
void DrawSprite(Sprite s, float3 location, float paletteTextureIndex, float3 size)
{
SetRenderStateForSprite(s);
Util.FastCreateQuad(vertices, location + s.FractionalOffset * size, s, paletteTextureIndex, nv, size);
nv += 6;
}
// For RGBASpriteRenderer, which doesn't use palettes
public void DrawSprite(Sprite s, float3 location)
{
DrawSprite(s, location, 0, s.Size);
}
public void DrawSprite(Sprite s, float3 location, float3 size)
{
DrawSprite(s, location, 0, size);
}
public void DrawSprite(Sprite s, float3 a, float3 b, float3 c, float3 d)
{
SetRenderStateForSprite(s);
@@ -94,13 +83,6 @@ namespace OpenRA.Graphics
nv += 6;
}
public void DrawSprite(Sprite s, Vertex[] sourceVertices, int offset)
{
SetRenderStateForSprite(s);
Array.Copy(sourceVertices, offset, vertices, nv, 6);
nv += 6;
}
public void DrawVertexBuffer(IVertexBuffer<Vertex> buffer, int start, int length, PrimitiveType type, Sheet sheet, BlendMode blendMode)
{
shader.SetTexture("DiffuseTexture", sheet.GetTexture());