Beispiel #1
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.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.pixelInternalFormat = PixelInternalFormat.CompressedRgbaS3tcDxt5Ext;
            tex.HashId = id;
            n.Nodes.Add(tex);
            n.glTexByHashId.Add(tex.HashId, NUT.CreateTexture2D(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);
                }
            }
        }
Beispiel #2
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);
                }
            }
        }