Пример #1
0
        public override void Draw(ApplicationTime time)
        {
            Device.WaitIdle();
            CommandBuffer commandBuffer = Context.CommandBuffer;

            commandBuffer.Begin();


            commandBuffer.BeginFramebuffer(Framebuffer);
            commandBuffer.SetScissor(Window.FramebufferSize.Width, Window.FramebufferSize.Height, 0, 0);
            commandBuffer.SetViewport(Window.FramebufferSize.Width, Window.FramebufferSize.Height, 0, 0);

            commandBuffer.SetGraphicPipeline(PipelineState);
            commandBuffer.BindDescriptorSets(DescriptorSet);

            commandBuffer.SetVertexBuffers(new[] { GLTFModel.VertexBuffer });
            commandBuffer.SetIndexBuffer(GLTFModel.IndexBuffer, 0, GLTFModel.IndexType);


            foreach (Scene sc in GLTFModel.Scenes)
            {
                foreach (Node node in sc.Root.Children)
                {
                    RenderNode(commandBuffer, node, sc.Root.LocalMatrix);
                }
            }


            commandBuffer.Close();
            Device.Submit(commandBuffer);
            SwapChain.Present();
        }
Пример #2
0
        public override void Draw(ApplicationTime time)
        {
            Device.WaitIdle();
            CommandBuffer cmd = Context.CommandBuffer;

            cmd.Begin();
            cmd.BeginFramebuffer(Framebuffer);
            cmd.SetScissor(Window.FramebufferSize.Width, Window.FramebufferSize.Height, 0, 0);
            cmd.SetViewport(Window.FramebufferSize.Width, Window.FramebufferSize.Height, 0, 0);


            cmd.BindDescriptorSets(DescriptorSet_0);
            cmd.SetGraphicPipeline(PipelineState_0);
            GLTFModel.Draw(cmd, PipelineState_0);


            cmd.BindDescriptorSets(DescriptorSet_1);
            cmd.SetGraphicPipeline(PipelineState_1);
            GLTFModel.Draw(cmd, PipelineState_1);


            cmd.BindDescriptorSets(DescriptorSet_2);
            cmd.SetGraphicPipeline(PipelineState_2);
            GLTFModel.Draw(cmd, PipelineState_2);


            cmd.Close();
            Device.Submit(cmd);
            SwapChain.Present();
        }
Пример #3
0
        public override void Draw(ApplicationTime time)
        {
            Device.WaitIdle();

            cmd_compute.Begin();
            cmd_compute.SetComputePipeline(PipelineState_1);
            cmd_compute.BindDescriptorSets(DescriptorSet_1);

            cmd_compute.Dispatch2D(Window.FramebufferSize.Width, Window.FramebufferSize.Height, 8, 8);

            cmd_compute.Close();
            Device.Submit(cmd_compute);
            Device.ComputeQueueWaitIdle();


            CommandBuffer cmd = Context.CommandBuffer;

            cmd.Begin();
            cmd.BeginFramebuffer(Framebuffer);
            cmd.SetScissor(Window.FramebufferSize.Width, Window.FramebufferSize.Height, 0, 0);
            cmd.SetViewport(Window.FramebufferSize.Width, Window.FramebufferSize.Height, 0, 0);


            cmd.BindDescriptorSets(DescriptorSet_0);
            cmd.SetGraphicPipeline(PipelineState_0);
            cmd.Draw(3, 1, 0, 0);


            cmd.Close();
            Device.Submit(cmd);
            SwapChain.Present();
        }
Пример #4
0
        public override void Draw(ApplicationTime time)
        {
            Device.WaitIdle();

            CommandBuffer.Begin();
            CommandBuffer.BeginFramebuffer(Framebuffer, r, g, b, 1);

            CommandBuffer.Close();
            Device.Submit(CommandBuffer);

            SwapChain.Present();
        }