Example #1
0
        private void RegenerateMipMaps_Click(object sender, EventArgs e)
        {
            if (OpenTkSharedResources.SetupStatus != OpenTkSharedResources.SharedResourceStatus.Initialized)
            {
                return;
            }

            if (textureListBox.SelectedItem != null)
            {
                NutTexture tex = ((NutTexture)textureListBox.SelectedItem);
                NUT.RegenerateMipmapsFromTexture2D(tex);

                // Render the selected texture again.
                currentNut.RefreshGlTexturesByHashId();
                if (currentNut.glTexByHashId.ContainsKey(tex.HashId))
                {
                    textureToRender = currentNut.glTexByHashId[tex.HashId];
                }

                glControl1.Invalidate();
            }
        }
Example #2
0
 private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
 {
     tbl = new DataTable();
     tbl.Columns.Add(new DataColumn("Name")
     {
         ReadOnly = true
     });
     tbl.Columns.Add("Value");
     dataGridView1.DataSource = tbl;
     tbl.Rows.Clear();
     try
     {
         if (e.Node.Parent.Text == "Symbols")
         {
             tbl.Rows.Add("String", lumen.Strings[e.Node.Index]);
         }
         else if (e.Node.Parent.Text == "Colors")
         {
             tbl.Rows.Add("Red", lumen.Colors[e.Node.Index].X * 255);
             tbl.Rows.Add("Green", lumen.Colors[e.Node.Index].Y * 255);
             tbl.Rows.Add("Blue", lumen.Colors[e.Node.Index].Z * 255);
             tbl.Rows.Add("Alpha", lumen.Colors[e.Node.Index].W * 255);
         }
         else if (e.Node.Parent.Text == "Transforms")
         {
             tbl.Rows.Add("X-Scale", lumen.Transforms[e.Node.Index].Row0[0]);
             tbl.Rows.Add("X-Skew", lumen.Transforms[e.Node.Index].Row1[0]);
             tbl.Rows.Add("X-Transform", lumen.Transforms[e.Node.Index].Row3[0]);
             tbl.Rows.Add("Y-Scale", lumen.Transforms[e.Node.Index].Row1[1]);
             tbl.Rows.Add("Y-Skew", lumen.Transforms[e.Node.Index].Row0[1]);
             tbl.Rows.Add("Y-Transform", lumen.Transforms[e.Node.Index].Row3[1]);
         }
         else if (e.Node.Parent.Text == "Positions")
         {
             tbl.Rows.Add("X", lumen.Positions[e.Node.Index][0]);
             tbl.Rows.Add("Y", lumen.Positions[e.Node.Index][1]);
         }
         else if (e.Node.Parent.Text == "Bounds")
         {
             tbl.Rows.Add("Top", lumen.Bounds[e.Node.Index].TopLeft.X);
             tbl.Rows.Add("Left", lumen.Bounds[e.Node.Index].TopLeft.Y);
             tbl.Rows.Add("Bottom", lumen.Bounds[e.Node.Index].BottomRight.X);
             tbl.Rows.Add("Right", lumen.Bounds[e.Node.Index].BottomRight.Y);
         }
         else if (e.Node.Parent.Text == "Atlases")
         {
             tbl.Rows.Add("Texture ID", lumen.Atlases[e.Node.Index].id);
             tbl.Rows.Add("Name ID", lumen.Atlases[e.Node.Index].nameId);
             tbl.Rows.Add("Width", lumen.Atlases[e.Node.Index].width);
             tbl.Rows.Add("Height", lumen.Atlases[e.Node.Index].height);
         }
         else if (e.Node.Text.StartsWith("Graphic 0x"))
         {
             string filename = (Path.GetDirectoryName(lumen.Filename) + "\\img-" + (e.Node.Index.ToString("00000")) + ".nut");
             nut = new NUT(filename);
             nut.RefreshGlTexturesByHashId();
             LmuvViewer uvViewer = new LmuvViewer(lumen, nut, e.Node.Parent.Index, e.Node.Index);
             uvViewer.Show();
         }
         else if (e.Node.Parent.Text == "Texts")
         {
             tbl.Rows.Add("Character ID", lumen.Texts[e.Node.Index].CharacterId);
             tbl.Rows.Add("unk 1", lumen.Texts[e.Node.Index].unk1);
             tbl.Rows.Add("Placeholder Text ID", lumen.Texts[e.Node.Index].placeholderTextId);
             tbl.Rows.Add("unk 2", lumen.Texts[e.Node.Index].unk2);
             tbl.Rows.Add("Stroke Color ID", lumen.Texts[e.Node.Index].strokeColorId);
             tbl.Rows.Add("unk 3", lumen.Texts[e.Node.Index].unk3);
             tbl.Rows.Add("unk 4", lumen.Texts[e.Node.Index].unk3);
             tbl.Rows.Add("unk 5", lumen.Texts[e.Node.Index].unk3);
             tbl.Rows.Add("Text Alignment", lumen.Texts[e.Node.Index].alignment);
             tbl.Rows.Add("unk 6", lumen.Texts[e.Node.Index].unk3);
             tbl.Rows.Add("unk 7", lumen.Texts[e.Node.Index].unk3);
             tbl.Rows.Add("unk 8", lumen.Texts[e.Node.Index].unk3);
             tbl.Rows.Add("Size", lumen.Texts[e.Node.Index].size);
             tbl.Rows.Add("unk 9", lumen.Texts[e.Node.Index].unk3);
             tbl.Rows.Add("unk 10", lumen.Texts[e.Node.Index].unk10);
             tbl.Rows.Add("unk 11", lumen.Texts[e.Node.Index].unk11);
             tbl.Rows.Add("unk 12", lumen.Texts[e.Node.Index].unk12);
         }
         else if (e.Node.Parent.Text == "Unk")
         {
         }
     }
     catch { }
 }