Ejemplo n.º 1
0
            public void CreateNew(object sender, EventArgs args)
            {
                BFLIM bflim = CreateNewFromImage();

                if (bflim == null)
                {
                    return;
                }

                var form = new GenericEditorForm(false, bflim.OpenForm());

                LibraryGUI.CreateMdiWindow(form);
                bflim.UpdateForm();
            }
Ejemplo n.º 2
0
        public static BFLIM CreateNewFromImage()
        {
            BFLIM bflim = new BFLIM();

            bflim.CanSave   = true;
            bflim.IFileInfo = new IFileInfo();
            bflim.header    = new Header();

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect = false;
            ofd.Filter      = FileFilters.GTX;
            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }

            FTEX ftex = new FTEX();

            ftex.ReplaceTexture(ofd.FileName, TEX_FORMAT.BC3_UNORM_SRGB, 1, 0, bflim.SupportedFormats, true, false, true, false);
            if (ftex.texture != null)
            {
                bflim.Text              = $"{Path.GetFileNameWithoutExtension(ofd.FileName)}.bflim";
                bflim.image             = new Image();
                bflim.image.Swizzle     = (byte)ftex.texture.Swizzle;
                bflim.image.BflimFormat = FormatsWiiU.FirstOrDefault(x => x.Value == ftex.Format).Key;
                if (ftex.UseBc4Alpha)
                {
                    bflim.image.BflimFormat = 16;
                }

                bflim.image.Height = (ushort)ftex.texture.Height;
                bflim.image.Width  = (ushort)ftex.texture.Width;

                bflim.Format    = FormatsWiiU[bflim.image.BflimFormat];
                bflim.Width     = bflim.image.Width;
                bflim.Height    = bflim.image.Height;
                bflim.ImageData = ftex.texture.Data;

                bflim.LoadComponents(bflim.Format, ftex.UseBc4Alpha);
            }

            return(bflim);
        }
Ejemplo n.º 3
0
            public void CreateNew(object sender, EventArgs args)
            {
                BFLIM bflim = new BFLIM();

                bflim.CanSave   = true;
                bflim.IFileInfo = new IFileInfo();
                bflim.header    = new Header();

                OpenFileDialog ofd = new OpenFileDialog();

                ofd.Multiselect = false;
                ofd.Filter      = FileFilters.GTX;
                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                FTEX ftex = new FTEX();

                ftex.ReplaceTexture(ofd.FileName, TEX_FORMAT.BC3_UNORM_SRGB, 1, 0, bflim.SupportedFormats, false, true, false);
                if (ftex.texture != null)
                {
                    bflim.Text              = ftex.texture.Name;
                    bflim.image             = new Image();
                    bflim.image.Swizzle     = (byte)ftex.texture.Swizzle;
                    bflim.image.BflimFormat = FormatsWiiU.FirstOrDefault(x => x.Value == ftex.Format).Key;
                    bflim.image.Height      = (ushort)ftex.texture.Height;
                    bflim.image.Width       = (ushort)ftex.texture.Width;

                    bflim.Format = FormatsWiiU[bflim.image.BflimFormat];
                    bflim.Width  = bflim.image.Width;
                    bflim.Height = bflim.image.Height;

                    bflim.ImageData = ftex.texture.Data;
                    var form = new GenericEditorForm(false, bflim.OpenForm());
                    LibraryGUI.CreateMdiWindow(form);

                    bflim.UpdateForm();
                }
            }