Esempio n. 1
0
 private NUT ReplaceTexture(NUT.NUD_Texture tex, int width, int height, NUT nut)
 {
     if (tex.width == width && tex.height == height)
     {
         tex.id = 0x280052B7;
         if (nut != null && nut.textures.Count > 0)
         {
             tex.id = nut.textures[0].id;
             nut.Destroy();
         }
         if (nut == null)
         {
             nut = new NUT();
         }
         nut.textures.Clear();
         nut.draw.Clear();
         nut.textures.Add(tex);
         nut.draw.Add(tex.id, NUT.loadImage(tex));
     }
     else
     {
         MessageBox.Show("Dimensions must be " + width + "x" + height);
     }
     return(nut);
 }
Esempio n. 2
0
 private NUT ReplaceTexture(NutTexture tex, int width, int height, NUT nut)
 {
     if (tex.Width == width && tex.Height == height)
     {
         tex.HASHID = 0x280052B7;
         if (nut != null && nut.Nodes.Count > 0)
         {
             tex.HASHID = ((NutTexture)nut.Nodes[0]).HASHID;
             nut.Destroy();
         }
         if (nut == null)
         {
             nut = new NUT();
         }
         nut.Nodes.Clear();
         nut.glTexByHashId.Clear();
         nut.Nodes.Add(tex);
         nut.glTexByHashId.Add(tex.HASHID, NUT.CreateGlTexture(tex));
     }
     else
     {
         MessageBox.Show("Dimensions must be " + width + "x" + height);
     }
     return(nut);
 }
Esempio n. 3
0
 /*
  * This method is for clearing all the GL stuff
  * Don't want wasted buffers :>
  * */
 public void Destroy()
 {
     if (NUD != null)
     {
         NUD.Destroy();
     }
     if (NUT != null)
     {
         NUT.Destroy();
     }
 }
Esempio n. 4
0
        private void LetsDance(object sender, EventArgs e)
        {
            VBNViewport view = MainForm.Instance.viewports[0];

            view.CurrentMode = VBNViewport.Mode.Normal;

            NUT n = null;

            if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer)
            {
                n = stock_90;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer)
            {
                n = chr_00;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer)
            {
                n = chr_11;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer)
            {
                n = chr_13;
            }
            if (n == null)
            {
                return;
            }

            byte[] data = RenderTools.DXT5ScreenShot(view.glControl1, view.shootX, view.shootY, view.shootWidth, view.shootHeight);
            int    id   = n.textures.Count > 0 ? n.textures[0].id : 0x280052B7;

            n.Destroy();
            n.textures.Clear();
            n.draw.Clear();

            NUT.NUD_Texture tex = new NUT.NUD_Texture();
            tex.width  = view.shootWidth;
            tex.height = view.shootHeight;
            tex.mipmaps.Add(FlipDXT5(data, tex.width, tex.height));
            tex.type = PixelInternalFormat.CompressedRgbaS3tcDxt5Ext;
            tex.id   = id;
            n.textures.Add(tex);
            n.draw.Add(tex.id, NUT.loadImage(tex));
            ((MenuItem)sender).GetContextMenu().SourceControl.Invalidate();

            if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer)
            {
                if (stock_90_loc != null)
                {
                    stock_90.Save(stock_90_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer)
            {
                if (chr_00_loc != null)
                {
                    chr_00.Save(chr_00_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer)
            {
                if (chr_11_loc != null)
                {
                    chr_11.Save(chr_13_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer)
            {
                if (chr_13_loc != null)
                {
                    chr_13.Save(chr_13_loc);
                }
            }
        }
Esempio n. 5
0
        private void LetsDance(object sender, EventArgs e)
        {
            Control c = MainForm.Instance.GetActiveModelViewport();

            if (!(c is ModelViewport))
            {
                return;
            }
            ModelViewport view = (ModelViewport)c;

            view.currentMode = ModelViewport.Mode.Normal;

            NUT n = null;

            if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer)
            {
                n = stock_90;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer)
            {
                n = chr_00;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer)
            {
                n = chr_11;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer)
            {
                n = chr_13;
            }
            if (n == null)
            {
                return;
            }

            byte[] data = RenderTools.DXT5ScreenShot(view.glViewport, view.shootX, view.shootY, view.shootWidth, view.shootHeight);
            int    id   = n.Nodes.Count > 0 ? ((NutTexture)n.Nodes[0]).HASHID : 0x280052B7;

            n.Destroy();
            n.Nodes.Clear();
            n.glTexByHashId.Clear();

            NutTexture tex = new NutTexture();

            tex.Width  = view.shootWidth;
            tex.Height = view.shootHeight;
            tex.surfaces.Add(new TextureSurface());
            tex.surfaces[0].mipmaps.Add(FlipDXT5(data, tex.Width, tex.Height));
            tex.type   = PixelInternalFormat.CompressedRgbaS3tcDxt5Ext;
            tex.HASHID = id;
            n.Nodes.Add(tex);
            n.glTexByHashId.Add(tex.HASHID, NUT.CreateGlTexture(tex));
            ((MenuItem)sender).GetContextMenu().SourceControl.Invalidate();

            if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer)
            {
                if (stock_90_loc != null)
                {
                    stock_90.Save(stock_90_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer)
            {
                if (chr_00_loc != null)
                {
                    chr_00.Save(chr_00_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer)
            {
                if (chr_11_loc != null)
                {
                    chr_11.Save(chr_13_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer)
            {
                if (chr_13_loc != null)
                {
                    chr_13.Save(chr_13_loc);
                }
            }
        }