Beispiel #1
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 #2
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();
        }