Пример #1
0
        public void ImportTexture()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Supported Formats|*.dds; *.png;*.tga;*.jpg;*.tiff|" +
                         "Microsoft DDS |*.dds|" +
                         "Portable Network Graphics |*.png|" +
                         "Joint Photographic Experts Group |*.jpg|" +
                         "Bitmap Image |*.bmp|" +
                         "Tagged Image File Format |*.tiff|" +
                         "All files(*.*)|*.*";

            ofd.Multiselect = true;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                BinaryTextureImporterList      importer = new BinaryTextureImporterList();
                List <TextureImporterSettings> settings = new List <TextureImporterSettings>();
                foreach (string name in ofd.FileNames)
                {
                    settings.Clear();
                    GC.Collect();
                    Cursor.Current = Cursors.Default;
                }
            }
        }
Пример #2
0
        public void Replace(string FileName)
        {
            string ext = Path.GetExtension(FileName);

            ext = ext.ToLower();

            TextureImporterSettings   setting  = new TextureImporterSettings();
            BinaryTextureImporterList importer = new BinaryTextureImporterList();

            switch (ext)
            {
            case ".bftex":
                Texture.Import(FileName);
                break;

            case ".dds":
                setting.LoadDDS(FileName, bntxFile, null, this);
                ApplyImportSettings(setting);
                break;

            default:
                setting.LoadBitMap(FileName, bntxFile);
                importer.LoadSetting(setting);

                if (importer.ShowDialog() == DialogResult.OK)
                {
                    ApplyImportSettings(setting);
                }
                break;
            }
        }
Пример #3
0
        public void Replace(string FileName)
        {
            string ext = System.IO.Path.GetExtension(FileName);

            ext = ext.ToLower();

            TextureImporterSettings   setting  = new TextureImporterSettings();
            BinaryTextureImporterList importer = new BinaryTextureImporterList();
        }
Пример #4
0
        public void ImportTexture()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            /*         ofd.Filter = "Supported Formats|*.bftex;*.dds; *.png;*.tga;*.jpg;*.tiff|" +
             *                    "Binary Texture |*.bftex|" +
             *                    "Microsoft DDS |*.dds|" +
             *                    "Portable Network Graphics |*.png|" +
             *                    "Joint Photographic Experts Group |*.jpg|" +
             *                    "Bitmap Image |*.bmp|" +
             *                    "Tagged Image File Format |*.tiff|" +
             *                    "All files(*.*)|*.*";*/
            ofd.Filter = "Supported Formats|*.bftex;*.dds|" +
                         "Binary Texture |*.bftex|" +
                         "Microsoft DDS |*.dds|" +
                         "All files(*.*)|*.*";

            ofd.DefaultExt  = "bftex";
            ofd.Multiselect = true;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                BinaryTextureImporterList importer = new BinaryTextureImporterList();

                List <TextureImporterSettings> settings = new List <TextureImporterSettings>();
                foreach (string name in ofd.FileNames)
                {
                    string ext = Path.GetExtension(name);
                    ext = ext.ToLower();

                    if (ext == ".dds" || ext == ".bftex")
                    {
                        AddTexture(name);
                    }
                    else
                    {
                        settings.Add(LoadSettings(name));
                    }
                }
                if (settings.Count == 0)
                {
                    importer.Dispose();
                    return;
                }

                importer.LoadSettings(settings, this);
                if (importer.ShowDialog() == DialogResult.OK)
                {
                    foreach (var setting in settings)
                    {
                        if (setting.DataBlockOutput != null)
                        {
                            Texture tex = setting.FromBitMap(setting.DataBlockOutput, setting);
                            if (setting.textureData != null)
                            {
                                setting.textureData.LoadTexture(tex, 1);
                            }
                            else
                            {
                                setting.textureData = new TextureData(tex, setting.bntx);
                            }

                            Nodes.Add(setting.textureData);
                            Textures.Add(setting.textureData.Text, setting.textureData);
                            setting.textureData.LoadOpenGLTexture();
                        }
                        else
                        {
                            MessageBox.Show("Something went wrong???");
                        }
                    }
                }
                settings.Clear();
                GC.Collect();
            }
        }