From 6d2b2aec877682820dea875f8e22e0fd989c4025 Mon Sep 17 00:00:00 2001 From: chrisf Date: Thu, 13 Mar 2008 07:32:57 +0000 Subject: [PATCH] not being quite so stupid :) git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1932 993157c7-ee19-0410-b2c4-bb4e9862e678 --- OpenRa.Game/Util.cs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/OpenRa.Game/Util.cs b/OpenRa.Game/Util.cs index c94d240df1..b26023ffc2 100644 --- a/OpenRa.Game/Util.cs +++ b/OpenRa.Game/Util.cs @@ -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 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)