Don't store pre-calculated texture coords in Sprite.

By storing only the four corners, we can save the object overhead of an array and 4 float elements per sprite. This results in savings of around 5 MiB to store these coordinates.
This commit is contained in:
RoosterDragon
2014-10-03 21:04:21 +01:00
parent 59b3cd154d
commit bbb3990a0f
3 changed files with 30 additions and 22 deletions

View File

@@ -90,10 +90,10 @@ namespace OpenRA.Graphics
var channels = new float2(channelSelect[(int)s.channel], channelSelect[(int)s.channel + 1]);
return new Vertex[4]
{
new Vertex(coord(0, 0), s.FastMapTextureCoords(0), channels),
new Vertex(coord(su, 0), s.FastMapTextureCoords(1), channels),
new Vertex(coord(su, sv), s.FastMapTextureCoords(3), channels),
new Vertex(coord(0, sv), s.FastMapTextureCoords(2), channels)
new Vertex(coord(0, 0), s.TopLeftTextureCoords, channels),
new Vertex(coord(su, 0), s.TopRightTextureCoords, channels),
new Vertex(coord(su, sv), s.BottomRightTextureCoords, channels),
new Vertex(coord(0, sv), s.BottomLeftTextureCoords, channels)
};
}