예제 #1
0
        private void LoadAsTexture(uint textureId, uint?paletteOverride)
        {
            m_decorationType = DecorationType.Texture;
            EmbeddedFile file = TextureLoader.Instance.LoadTextureFile(textureId);

            m_texture = new ACTexture(file, paletteOverride);
            m_texture.ReadTexture();
        }
예제 #2
0
        public ACTexture LoadTexture(uint id)
        {
            EmbeddedFile file = LoadTextureFile(id);

            if (file == null)
            {
                return(null);
            }
            ACTexture texture = new ACTexture(file, null);

            texture.ReadTexture();
            return(texture);
        }
예제 #3
0
        private void lbTextureList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lbTextureList.SelectedIndex >= 0)
            {
                uint fileId = ((EmbeddedFileEntry)lbTextureList.SelectedItem).FileID;

                if ((fileId & 0xFF000000) == 0x04000000)
                {
                    ACPalette palette = PaletteLoader.Instance.LoadPalette(fileId);
                    SetPreviewBitmap(palette.GetPreviewBitmap());
                }
                else if ((fileId & 0xFF000000) == 0x05000000)
                {
                    ACTexture texture = TextureLoader.Instance.LoadTexture(fileId);
                    if (cbAlphaMap.Checked)
                    {
                        SetPreviewBitmap(ConvertToAlphaMap(texture.GetBitmap()));
                    }
                    else
                    {
                        SetPreviewBitmap(texture.GetBitmap());
                    }
                }
                else if ((fileId & 0xFF000000) == 0x08000000)
                {
                    MeshDecoration decoration = new MeshDecoration(fileId);
                    Bitmap         bmp        = new Bitmap(pbPreview.Width, pbPreview.Height, PixelFormat.Format24bppRgb);
                    using (Graphics g = Graphics.FromImage(bmp))
                    {
                        g.Clear(Color.White);
                        int  height = 10;
                        Font font   = new Font("Tahoma", height);
                        g.DrawString(String.Format("Decoration 0x{0:X8}", fileId), font, Brushes.Black, 5, 5 + (0 * height));
                        if (decoration.DecorationType == DecorationType.Texture)
                        {
                            g.DrawString(String.Format("Texture, texture id: 0x{0:X8}", decoration.Texture.ID), font, Brushes.Black, 5, 5 + (1 * height));
                        }
                        else if (decoration.DecorationType == DecorationType.SolidColor)
                        {
                            g.DrawString(String.Format("Solid, color: 0x{0:X8}", decoration.SolidColor.ToArgb()), font, Brushes.Black, 5, 5 + (1 * height));
                        }
                        else if (decoration.DecorationType == DecorationType.Unknown)
                        {
                            g.DrawString(String.Format("Unknown decoration type."), font, Brushes.Black, 5, 5 + (1 * height));
                        }
                        g.DrawString(String.Format("Type flag: {0:X}", decoration.TypeFlag), font, Brushes.Black, 5, 5 + (2 * height));
                    }
                    SetPreviewBitmap(bmp);
                }
            }
        }