52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
namespace Kav
|
|
{
|
|
public class PaletteCrushEffect : Effect
|
|
{
|
|
EffectParameter textureParam;
|
|
EffectParameter paletteParam;
|
|
EffectParameter paletteWidthParam;
|
|
|
|
Texture2D texture;
|
|
Texture2D palette;
|
|
|
|
int paletteWidth;
|
|
|
|
public Texture2D Texture
|
|
{
|
|
get { return texture; }
|
|
set
|
|
{
|
|
texture = value;
|
|
textureParam.SetValue(texture);
|
|
}
|
|
}
|
|
|
|
public Texture2D Palette
|
|
{
|
|
get { return palette; }
|
|
set
|
|
{
|
|
palette = value;
|
|
paletteWidth = palette.Width;
|
|
paletteParam.SetValue(palette);
|
|
paletteWidthParam.SetValue(paletteWidth);
|
|
}
|
|
}
|
|
|
|
public PaletteCrushEffect(GraphicsDevice graphicsDevice) : base(graphicsDevice, Resources.PaletteCrushEffect)
|
|
{
|
|
CacheEffectParameters();
|
|
}
|
|
|
|
void CacheEffectParameters()
|
|
{
|
|
textureParam = Parameters["Texture"];
|
|
paletteParam = Parameters["Palette"];
|
|
|
|
paletteWidthParam = Parameters["PaletteWidth"];
|
|
}
|
|
}
|
|
}
|