Beispiel #1
0
        protected override void Draw()
        {
            _commandList.Begin("Clear", _simplePipeline);
            _commandList.SetRenderTarget(BackBufferView, BackBufferDepthStencilView);
            _commandList.ClearRenderTarget(BackBufferView, new Vector4(0.0863f, 0.0353f, 0.0706f, 1.0f));
            _commandList.ClearDepthStencil(BackBufferDepthStencilView, 1.0f, 1);

            _commandList.SetVertexBuffer(_cubeVertexBuffer);
            _commandList.SetConstantBuffer(_leftConstantBuffer, BufferScope.VertexShader);
            _commandList.Draw(36);
            _commandList.End();

            _commandList.Begin("SimpleTextured", _texturedPipeline);
            _commandList.SetVertexBuffer(_texturedVertexBuffer);
            _commandList.SetConstantBuffer(_rightConstantBuffer, BufferScope.VertexShader);
            _commandList.SetSampler(_simpleSampler);
            _commandList.SetTexture(_simpleTexture.View);
            _commandList.Draw(3);
            _commandList.End();

            _commandList.Submit();
        }
Beispiel #2
0
        public override void RenderEntity(Renderer renderer, ICommandList commandList, Node node, object renderableResource, int subEntity)
        {
            //Bind the render pipeline
            commandList.BindPipeline(pipeline);
            //Push the height/upper color/lower color to the fragment shader
            pushConstant
            .Write(1000.0f)
            .Write(0.22f, 0.2f, 0.13f, 1.0f)
            .Write(0.2f, 0.3f, 0.3f, 1.0f)
            .Commit(ShaderStage.FragmentShader, commandList);


            //draw a triangle(without vertex buffer)
            commandList.Draw(0, 3);
        }
Beispiel #3
0
        public override void RenderEntity(Renderer renderer, ICommandList cl, Node node, object renderableResource, int subEntity)
        {
            var vb = (IVertexBuffer)renderableResource;

            //Bind the graphics pipeline
            cl.BindPipeline(pipeline);
            cl.BindVertexBuffer(vb);



            //Prepare the world view projection matrix
            var wvp = renderer.Variables.MatrixWorldViewProjection;

            ms.SetLength(0);
            w.Write(wvp);
            cl.PushConstants(ShaderStage.VertexShader, ms.GetBuffer(), (int)ms.Length);

            //Draw the object
            cl.Draw();
        }