예제 #1
0
 private static void AppendTexAttributes(XmlDocument doc, DatTexture tex, XmlNode texNode)
 {
     AppendXmlAttribute(doc, texNode, "Flags", tex.UnkFlags.ToString("X"));
     AppendXmlAttribute(doc, texNode, "WrapS", tex.WrapS.ToString());
     AppendXmlAttribute(doc, texNode, "WrapT", tex.WrapT.ToString());
     AppendXmlAttribute(doc, texNode, "MagFilter", tex.MagFilter.ToString());
 }
예제 #2
0
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         Selected = (DatTexture)listView1.SelectedItems[0].Tag;
     }
     else
     {
         Selected = null;
     }
 }
예제 #3
0
        public MeleeRenderTexture(DatTexture datTexture)
        {
            WScale = datTexture.WScale;
            HScale = datTexture.HScale;

            if (datTexture.ImageData != null)
            {
                using (Bitmap b = datTexture.GetBitmap())
                {
                    texture.LoadImageData(b);
                }
            }

            texture.TextureWrapS = GetGLWrapModeFromGX(datTexture.WrapS);
            texture.TextureWrapT = GetGLWrapModeFromGX(datTexture.WrapT);
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (CBFormat.SelectedItem == null)
            {
                CBFormat.SelectedItem = TPL_TextureFormat.CMP;
            }
            if (SelectedTexture != null)
            {
                using (OpenFileDialog ofd = new OpenFileDialog())
                {
                    if ((TPL_TextureFormat)CBFormat.SelectedItem == TPL_TextureFormat.CMP)
                    {
                        ofd.Filter = "DDS|*.dds";
                    }
                    else
                    {
                        ofd.Filter = "PNG|*.png";
                    }

                    if (ofd.ShowDialog() == DialogResult.OK)
                    {
                        Selected = SelectedTexture.Texture;
                        if ((TPL_TextureFormat)CBFormat.SelectedItem == TPL_TextureFormat.CMP)
                        {
                            DDS d = new DDS(new FileData(ofd.FileName));
                            if (d.header.ddspf.fourCC != 0x31545844)
                            {
                                MessageBox.Show("Error Importing Texture:\nOnly DXT1 Files are supported currently");
                                return;
                            }
                            Selected.SetFromDXT1(new FileData(d.bdata).getSection(0, (int)(d.header.width * d.header.height / 2)), (int)d.header.width, (int)d.header.height);
                        }
                        else
                        {
                            Bitmap b = new Bitmap(ofd.FileName);
                            Selected.SetFromBitmap(b, (MeleeLib.TPL_TextureFormat)CBFormat.SelectedItem, (MeleeLib.TPL_PaletteFormat)CBPalette.SelectedItem);
                            b.Dispose();
                        }
                        DialogResult = DialogResult.OK;
                        CloseForm();
                        Close();
                    }
                }
            }
        }
예제 #5
0
 public void refreshTextureList()
 {
     listBox1.Items.Clear();
     foreach (int image in dat.tobjLinker.Keys)
     {
         object[]   texture = dat.tobjLinker[image]; //testOffset, image, imageOffset, imageDataOffset
         DatTexture temp    = new DatTexture();
         temp.tobjOffset         = (int)texture[0];
         temp.image              = (Bitmap)texture[1];
         temp.textureOffset      = (int)texture[2];
         temp.textureDataOffsest = (int)texture[3];
         foreach (TreeNode t in dat.tree)
         {
             if (((int)t.Tag) == temp.textureDataOffsest)
             {
                 temp.name = t.Text;
             }
         }
         listBox1.Items.Add(temp);
     }
 }
예제 #6
0
 public TextureNode(DatTexture Texture)
 {
     this.Texture = Texture;
     Text         = Texture.UnkFlags.ToString("X") + (Texture.ImageData == null ? "" : "_" + Texture.ImageData.Format.ToString());
 }