Inheritance: System.Windows.Forms.Form
Exemplo n.º 1
0
        private void showPixelShaderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SlimDX.Direct3D9.ShaderBytecode shader = null;
            try
            {
                shader = SlimDX.Direct3D9.ShaderBytecode.Compile(this.GetType().Assembly.GetResourceAsString("ModelViewer.pshader.psh"), "ps_main", "ps_3_0", SlimDX.Direct3D9.ShaderFlags.Debug);

                var data = shader.Disassemble(true);

                // Save data to temporary file
                var tempFileName = Path.GetTempFileName();
                using (FileStream fs = File.OpenWrite(tempFileName))
                {
                    data.CopyTo(fs);
                }

                var viewer = new ShaderViewer("pshader.psh", tempFileName);
                viewer.Show();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
                return;
            }
            finally
            {
                if (shader != null)
                {
                    shader.Dispose();
                }
            }
        }
Exemplo n.º 2
0
        private void btnDecompileShader_Click(object sender, EventArgs e)
        {
            var shaderFile = fileNavigator.SelectedNode.Tag as DatDigger.Sections.Shader.FileChunk;

            if (shaderFile == null)
            {
                return;
            }

            using (var shader = new SlimDX.Direct3D9.ShaderBytecode(shaderFile.CompiledShader))
            {
                var data = shader.Disassemble(true);

                // Save data to temporary file
                var tempFileName = Path.GetTempFileName();
                using (FileStream fs = File.OpenWrite(tempFileName))
                {
                    data.CopyTo(fs);
                }

                var viewer = new ShaderViewer(shaderFile.Name, tempFileName);
                viewer.Show();
            }
        }
Exemplo n.º 3
0
        private void showVertexShaderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SlimDX.Direct3D9.ShaderBytecode shader = null;
            try
            {
                shader = SlimDX.Direct3D9.ShaderBytecode.Compile(this.GetType().Assembly.GetResourceAsString("ModelViewer.vshader.vsh"), "vs_main", "vs_3_0", SlimDX.Direct3D9.ShaderFlags.OptimizationLevel3);

                var data = shader.Disassemble(true);

                // Save data to temporary file
                var tempFileName = Path.GetTempFileName();
                using (FileStream fs = File.OpenWrite(tempFileName))
                {
                    data.CopyTo(fs);
                }

                var viewer = new ShaderViewer("vshader.vsh", tempFileName);
                viewer.Show();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
                return;
            }
            finally
            {
                if (shader != null) { shader.Dispose(); }
            }
        }
Exemplo n.º 4
0
        private void btnDecompileShader_Click(object sender, EventArgs e)
        {
            var shaderFile = fileNavigator.SelectedNode.Tag as DatDigger.Sections.Shader.FileChunk;
            if (shaderFile == null)
            {
                return;
            }

            using (var shader = new SlimDX.Direct3D9.ShaderBytecode(shaderFile.CompiledShader))
            {

                var data = shader.Disassemble(true);

                // Save data to temporary file
                var tempFileName = Path.GetTempFileName();
                using (FileStream fs = File.OpenWrite(tempFileName))
                {
                    data.CopyTo(fs);
                }

                var viewer = new ShaderViewer(shaderFile.Name, tempFileName);
                viewer.Show();
            }
        }