Exemple #1
0
        public void SetSharpShader()
        {
            basicShader = new SharpShader(device, Application.StartupPath + "/Resources/SharpDX/Shader_Basic.hlsl",
                                          new SharpShaderDescription()
            {
                VertexShaderFunction = "VS", PixelShaderFunction = "PS"
            },
                                          new InputElement[] {
                new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0)
            });

            basicBuffer = basicShader.CreateBuffer <DefaultRenderData>();

            defaultShader = new SharpShader(device, Application.StartupPath + "/Resources/SharpDX/Shader_Default.hlsl",
                                            new SharpShaderDescription()
            {
                VertexShaderFunction = "VS", PixelShaderFunction = "PS"
            },
                                            new InputElement[] {
                new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0),
                new InputElement("COLOR", 0, Format.R8G8B8A8_UNorm, 12, 0),
                new InputElement("TEXCOORD", 0, Format.R32G32_Float, 16, 0)
            });

            defaultBuffer = defaultShader.CreateBuffer <Matrix>();

            tintedShader = new SharpShader(device, Application.StartupPath + "/Resources/SharpDX/Shader_Tinted.hlsl",
                                           new SharpShaderDescription()
            {
                VertexShaderFunction = "VS", PixelShaderFunction = "PS"
            },
                                           new InputElement[] {
                new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
                new InputElement("COLOR", 0, Format.R8G8B8A8_UNorm, 16, 0),
                new InputElement("TEXCOORD", 0, Format.R32G32_Float, 20, 0)
            });

            tintedBuffer = tintedShader.CreateBuffer <UvAnimRenderData>();
        }