private void ComboBoxCompression_SelectedIndexChanged(object sender, EventArgs e) { G1Texture tex = new G1Texture(); if (FormatIndex == NodeIndexBin && treeView1.Nodes.ContainsKey("BIN")) { if (treeView1.SelectedNode.Level == 2) { tex = BinFileList[treeView1.SelectedNode.Parent.Index][treeView1.SelectedNode.Index].Textures[treeView1.SelectedNode.FirstNode.Index]; } if (treeView1.SelectedNode.Level == 3) { tex = BinFileList[treeView1.SelectedNode.Parent.Parent.Index][treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index]; } } if (FormatIndex == NodeIndexG1T && treeView1.Nodes.ContainsKey("G1T")) { if (treeView1.SelectedNode.Level == 1) { tex = G1TFileList[treeView1.SelectedNode.Index].Textures[treeView1.SelectedNode.FirstNode.Index]; } if (treeView1.SelectedNode.Level == 2) { tex = G1TFileList[treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index]; } } tex.pixelInternalFormat = G1Texture.GetPixelInternalFormatForTextures((byte)((ComboBoxItem)comboBoxCompression.SelectedItem).Value); }
private void CheckBoxNormalMap_CheckedChanged(object sender, EventArgs e) { G1Texture tex = new G1Texture(); if (FormatIndex == NodeIndexBin && treeView1.Nodes.ContainsKey("BIN")) { if (treeView1.SelectedNode.Level == 2) { tex = BinFileList[treeView1.SelectedNode.Parent.Index][treeView1.SelectedNode.Index].Textures[treeView1.SelectedNode.FirstNode.Index]; } if (treeView1.SelectedNode.Level == 3) { tex = BinFileList[treeView1.SelectedNode.Parent.Parent.Index][treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index]; } } if (FormatIndex == NodeIndexG1T && treeView1.Nodes.ContainsKey("G1T")) { if (treeView1.SelectedNode.Level == 1) { tex = G1TFileList[treeView1.SelectedNode.Index].Textures[treeView1.SelectedNode.FirstNode.Index]; } if (treeView1.SelectedNode.Level == 2) { tex = G1TFileList[treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index]; } } if (checkBoxNormalMap.Checked) { tex.NormalMapFlags = 3; } else { tex.NormalMapFlags = 0; } }
private void NumericUpDownMipMap_ValueChanged(object sender, EventArgs e) { G1Texture tex = new G1Texture(); if (FormatIndex == NodeIndexBin && treeView1.Nodes.ContainsKey("BIN")) { if (treeView1.SelectedNode.Level == 2) { tex = BinFileList[treeView1.SelectedNode.Parent.Index][treeView1.SelectedNode.Index].Textures[treeView1.SelectedNode.FirstNode.Index]; } if (treeView1.SelectedNode.Level == 3) { tex = BinFileList[treeView1.SelectedNode.Parent.Parent.Index][treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index]; } } if (FormatIndex == NodeIndexG1T && treeView1.Nodes.ContainsKey("G1T")) { if (treeView1.SelectedNode.Level == 1) { tex = G1TFileList[treeView1.SelectedNode.Index].Textures[treeView1.SelectedNode.FirstNode.Index]; } if (treeView1.SelectedNode.Level == 2) { tex = G1TFileList[treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index]; } } tex.MipMapCount = (byte)numericUpDownMipMap.Value; }
private void ReplaceDDS_Click(object sender, EventArgs e) { using (var opendialog = new OpenFileDialog()) { opendialog.Filter = "DirectDraw Surface|*.dds"; if (opendialog.ShowDialog() == DialogResult.OK) { G1Texture texture = new G1Texture(); DDS newDDS = new DDS(); newDDS.Read(opendialog.FileName); if (newDDS.MipMapCount >= 10) { MessageBox.Show("The amount of mipmaps for this texture is too big. Reducing it to 9."); newDDS.MipMapCount = 9; } if (FormatIndex == NodeIndexBin && treeView1.Nodes.ContainsKey("BIN")) { texture = BinFileList[treeView1.SelectedNode.Parent.Parent.Index][treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index]; texture.Replace(newDDS); } if (FormatIndex == NodeIndexG1T && treeView1.Nodes.ContainsKey("G1T")) { texture = G1TFileList[treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index]; texture.Replace(newDDS); } pictureBox1.Image = texture.Mipmap.GetBitmap(); } } }
private void CheckBoxNormalMap_CheckedChanged(object sender, EventArgs e) { G1Texture tex = (G1Texture)textureListBox.SelectedItem; if (checkBoxNormalMap.Checked) { tex.NormalMapFlags = 3; } else { tex.NormalMapFlags = 0; } }
private void TextureListBox_SelectedIndexChanged(object sender, EventArgs e) { if (textureListBox.SelectedIndex >= 0) { G1Texture tex = (G1Texture)textureListBox.SelectedItem; tex.Mipmap.Bind(); widthLabel.Text = $"Width: {tex.Mipmap.Width}"; heightLabel.Text = $"Height: {tex.Mipmap.Height}"; numericUpDownMipMap.Value = tex.MipMapCount; if (tex.NormalMapFlags != 0) { checkBoxNormalMap.Checked = true; } else { checkBoxNormalMap.Checked = false; } checkBoxExHeader.Checked = tex.UsesExtraHeader; checkBoxNormalMap.Text = $"Normal map ({tex.NormalMapFlags:X})"; pictureBox1.Image = tex.Mipmap.GetBitmap(); comboBoxCompression.SelectedItem = GetComboBoxItemByValue(tex.compression_format); numericUpDownMipMap.Enabled = true; checkBoxNormalMap.Enabled = true; } else { numericUpDownMipMap.Enabled = false; checkBoxNormalMap.Enabled = false; } }
private void ComboBoxCompression_SelectedIndexChanged(object sender, EventArgs e) { G1Texture tex = (G1Texture)textureListBox.SelectedItem; tex.pixelInternalFormat = G1Texture.GetPixelInternalFormatForTextures((byte)((ComboBoxItem)comboBoxCompression.SelectedItem).Value); }
private void NumericUpDownMipMap_ValueChanged(object sender, EventArgs e) { G1Texture tex = (G1Texture)textureListBox.SelectedItem; tex.MipMapCount = (byte)numericUpDownMipMap.Value; }