示例#1
0
        private void exportTextureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (NUT == null || textureListBox.SelectedItem == null)
            {
                return;
            }
            using (var sfd = new SaveFileDialog())
            {
                NutTexture tex = (NutTexture)(textureListBox.SelectedItem);

                sfd.FileName = tex.ToString() + ".dds";
                sfd.Filter   = "Supported Formats|*.dds;*.png|" +
                               "DirectDraw Surface (.dds)|*.dds|" +
                               "Portable Network Graphics (.png)|*.png|" +
                               "All files(*.*)|*.*";

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    string extension = Path.GetExtension(sfd.FileName).ToLowerInvariant();

                    if (extension == ".dds")
                    {
                        ExportDDS(sfd.FileName, tex);
                    }
                    else if (extension == ".png")
                    {
                        ExportPNG(sfd.FileName, tex);
                    }
                }
            }
        }
示例#2
0
 private void SetGeneralAndDimensionsText(NutTexture tex)
 {
     textureIdTB.Text = tex.ToString();
     formatLabel.Text = "Format: " + (tex.pixelInternalFormat == PixelInternalFormat.Rgba ? "" + tex.pixelFormat : "" + tex.pixelInternalFormat);
     widthLabel.Text  = "Width: " + tex.Width;
     heightLabel.Text = "Height:" + tex.Height;
 }
示例#3
0
        private void textureListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (textureListBox.SelectedIndex >= 0)
            {
                NutTexture tex = ((NutTexture)textureListBox.SelectedItem);
                textureIdTB.Text = tex.ToString();
                formatLabel.Text = "Format: " + (tex.type == PixelInternalFormat.Rgba ? "" + tex.utype : "" + tex.type);
                widthLabel.Text  = "Width: " + tex.Width;
                heightLabel.Text = "Height:" + tex.Height;

                // Get number of mip maps for current texture.
                mipLevelTrackBar.Maximum = (tex.surfaces[0].mipmaps.Count) - 1;
                maxMipLevelLabel.Text    = "Total:" + tex.surfaces[0].mipmaps.Count + "";
            }
            else
            {
                textureIdTB.Text = "";
                formatLabel.Text = "Format:";
                widthLabel.Text  = "Width:";
                heightLabel.Text = "Height:";
            }

            glControl1.Invalidate();
            glControl1.Update();
            RenderTexture();
        }
示例#4
0
        private void exportTextureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currentNut == null || textureListBox.SelectedItem == null)
            {
                return;
            }

            using (var sfd = new SaveFileDialog())
            {
                NutTexture tex = (NutTexture)(textureListBox.SelectedItem);

                sfd.FileName = tex.ToString() + ".dds";

                // OpenGL is used for simplifying conversion to PNG.
                if (OpenTKSharedResources.SetupStatus == OpenTKSharedResources.SharedResourceStatus.Initialized)
                {
                    sfd.Filter = "Supported Formats|*.dds;*.png|" +
                                 "DirectDraw Surface (.dds)|*.dds|" +
                                 "Portable Network Graphics (.png)|*.png|" +
                                 "All files(*.*)|*.*";
                }
                else
                {
                    sfd.Filter = "DirectDraw Surface (.dds)|*.dds|" +
                                 "All files(*.*)|*.*";
                }

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    string extension = Path.GetExtension(sfd.FileName).ToLowerInvariant();

                    if (extension == ".dds")
                    {
                        ExportDDS(sfd.FileName, tex);
                    }
                    else if (extension == ".png")
                    {
                        ExportPNG(sfd.FileName, tex);
                    }
                }
            }
        }