A CLUT (Color Look Up Table) The first palette seems to always be the original from the artists and the subsequent palettes appear to have been generated procedurally at build time. This is evidenced in the artifacts in some palettes > 0.
Пример #1
0
        private static void ConstructWeaponPalettes(EndianBinaryReader reader, List<TextureMap> outTextures, int numOfPalettes, int width, int height, byte colorsPerPalette)
        {
            // construct the handle palette the first 1/3 of the colors.
            Palette handlePalette = new Palette();
            for (int i = 0; i < colorsPerPalette / 3; i++)
            {
                handlePalette.colors.Add(VSTools.BitColorConverter(reader.ReadUInt16()));
            }

            // construct the next 7 palettes out of the data stream that follows.
            for (int p = 0; p < numOfPalettes; p++)
            {
                TextureMap tex = new TextureMap(width, height);
                Palette palette = new Palette();

                // pack first 1/3 with handle colors.
                for (int h = 0; h < handlePalette.GetColorCount(); h++)
                {
                    palette.colors.Add(handlePalette.colors[h]);
                }

                int count = (int)(colorsPerPalette / 3);
                count += count;

                // read blade from stream
                for (int c = 0; c < count; c++)
                {
                    palette.colors.Add(VSTools.BitColorConverter(reader.ReadUInt16()));
                }
                tex.ColorPalette = palette;

                tex.Index = p;
                outTextures.Add(tex);
            }
        }
Пример #2
0
        private static void ConstructCharacterPalettes(EndianBinaryReader reader, List<TextureMap> outTextures, int numOfPalettes, int width, int height, byte colorsPerPalette)
        {
            for (int p = 0; p < numOfPalettes; p++)
            {
                TextureMap tex = new TextureMap(width, height);
                Palette palette = new Palette();

                for (int c = 0; c < colorsPerPalette; c++)
                {
                    palette.colors.Add(VSTools.BitColorConverter(reader.ReadUInt16()));
                }
                tex.ColorPalette = palette;

                tex.Index = p;
                outTextures.Add(tex);
            }
        }