not being quite so stupid :)

git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1932 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
chrisf
2008-03-13 07:32:57 +00:00
parent 9dc6383a6c
commit 6d2b2aec87

View File

@@ -10,22 +10,11 @@ namespace OpenRa.Game
{
static class Util
{
static float[] channelSelect = { 0.75f, 0.25f, -0.25f, -0.75f };
static float2 EncodeVertexAttributes(TextureChannel channel, int paletteLine)
{
Converter<TextureChannel, float> channelEncoder = delegate(TextureChannel c)
{
switch (c)
{
case TextureChannel.Red: return 0.75f;
case TextureChannel.Green: return 0.25f;
case TextureChannel.Blue: return -0.25f;
case TextureChannel.Alpha: return -0.75f;
default:
throw new ArgumentException();
}
};
return new float2(paletteLine / 16.0f, channelEncoder(channel));
return new float2(paletteLine / 16.0f, channelSelect[(int)channel]);
}
public static Vertex MakeVertex(float2 o, float2 uv, Sprite r, int palette)