did palette animation the sane way (switching palettes) rather than cycling 0x60-0x66 in the shader

This commit is contained in:
Chris Forbes
2009-10-13 23:02:46 +13:00
parent d8d1def249
commit bebe9bee85
4 changed files with 17 additions and 24 deletions

View File

@@ -9,9 +9,15 @@ namespace OpenRa.Game.Graphics
class Renderer
{
readonly GraphicsDevice device;
Texture[] palettes;
public Shader SpriteShader { get; private set; } /* note: shared shader params */
public Shader LineShader { get; private set; }
public void BuildPalette(Map map)
{
palettes = Util.MakeArray(7, i => new HardwarePalette(this, map, i).Texture);
}
public void SetPalette(HardwarePalette hp)
{
SpriteShader.SetValue("Palette", hp.Texture);
@@ -37,7 +43,7 @@ namespace OpenRa.Game.Graphics
{
device.Begin();
SpriteShader.SetValue("palDist", waterFrame);
SpriteShader.SetValue("Palette", palettes[ (int)(waterFrame * palettes.Length) % palettes.Length ]);
SpriteShader.SetValue("Scroll", scroll);
SpriteShader.SetValue("r1", r1);
SpriteShader.SetValue("r2", r2);