Ejemplo n.º 1
0
        protected void UpdateShaders(GraphicsDevice graphics, D3DRenderComponent render,
                                     D3DShaderTechniquePass pass, VertexLayoutConstructor layconst)
        {
            var device = graphics.D3DDevice;

            var vertexShaderByteCode = pass.VertexShader.ReadCompiledBytes();

            var inputSignature = ShaderSignature.GetInputSignature(vertexShaderByteCode);

            render.Layout.Set(new InputLayout(device, inputSignature, layconst.ConstuctElements()));

            render.VertexShader.Set(new VertexShader(device, vertexShaderByteCode));

            if (pass.GeometryShader != null)
            {
                render.GeometryShader.Set(new GeometryShader(device, pass.GeometryShader.ReadCompiledBytes()));
            }
            if (pass.PixelShader != null)
            {
                render.PixelShader.Set(new PixelShader(device, pass.PixelShader.ReadCompiledBytes()));
            }

            render.RasterizerState = new D3DRasterizerState(rasterizerStateDescription);
            render.SetStates(
                new BlendState(graphics.D3DDevice, blendStateDescription),
                new DepthStencilState(graphics.D3DDevice, depthStencilStateDescription));
        }
Ejemplo n.º 2
0
        static SpherePointRenderStrategy()
        {
            layconst = new VertexLayoutConstructor()
                       .AddPositionElementAsVector3()
                       .AddColorElementAsVector4();

            var d = new CombinedShadersLoader(typeof(SpherePointRenderStrategy));

            pass = new D3DShaderTechniquePass(d.Load(path, "SPH_"));
        }
Ejemplo n.º 3
0
        static LineVertexRenderTechnique()
        {
            layconst = new VertexLayoutConstructor()
                       .AddPositionElementAsVector3()
                       .AddColorElementAsVector4();

            var d = new CombinedShadersLoader(typeof(LineVertexRenderTechnique));

            pass = new D3DShaderTechniquePass(d.Load(path, "LV_"));
        }