示例#1
0
 protected override void OnRender()
 {
     foreach (var graphic in gameObject.GetComponents <Graphic>())
     {
         Command command = graphic.GenerateCommand();
         if (command == null)
         {
             continue;
         }
         RenderPipeline.Draw(command);
     }
 }
示例#2
0
        public override void Render(RenderPipeline pipeline)
        {
            pipeline.OutputMerger.RenderTarget.SetState(0, lightTarget.View);

            pipeline.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleList;
            pipeline.Rasterizer.Viewport = new Viewport(0, 0, lightTarget.Width, lightTarget.Height);

            pipeline.VertexShader.Shader = vsDirectional;
            pipeline.PixelShader.Shader  = psDirectional;
            pipeline.ParameterManager.ApplyCollection(parameterCollection);
            pipeline.ApplyOutputResources();
            pipeline.ApplyShaderResources();

            pipeline.Draw(3, 0);
        }
示例#3
0
        public override void Render(RenderPipeline pipeline)
        {
            pipeline.OutputMerger.RenderTarget.SetState(0, Destination.View);
            pipeline.OutputMerger.DepthStencilState = pipeline.OutputMerger.NoDepthStencilState;
            pipeline.VertexShader.Shader            = vsCombine;
            pipeline.PixelShader.Shader             = psCombine;
            pipeline.ParameterManager.ApplyCollection(parameterCollection);
            pipeline.ParameterManager.SetParameter("AlbedoTexture", albedo.SRV);
            pipeline.ParameterManager.SetParameter("LightTexture", light.SRV);
            pipeline.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleList;
            pipeline.Rasterizer.Viewport = new SharpDX.Viewport(0, 0, Destination.Width, Destination.Height);

            pipeline.ApplyOutputResources();
            pipeline.ApplyShaderResources();
            pipeline.Draw(3, 0);
        }
示例#4
0
        protected override void OnRender()
        {
            if (meshFilter == null || meshFilter.mesh == null || material == null)
            {
                return;
            }
            var command = new Command()
            {
                projection = RenderPipeline.projection,
                transform  = transform.localToWorldMatrix,
                mesh       = meshFilter.mesh,
                material   = material,
            };

            RenderPipeline.Draw(command);
        }
示例#5
0
        public override void Render(RenderPipeline pipeline)
        {
            pipeline.InputAssembler.ClearDesiredState();

            Geometry.Apply(pipeline);
            pipeline.ParameterManager.ApplyCollection(RenderParameter);
            pipeline.ApplyShaderResources();
            if (Geometry.NumIndices > 0)
            {
                pipeline.DrawIndexed(Geometry.NumIndices, 0, 0);
            }
            else
            {
                pipeline.Draw(Geometry.VertexCount, 0);
            }
        }
示例#6
0
        public override void Render(RenderPipeline pipeline)
        {
            pipeline.OutputMerger.RenderTarget.SetStates(0, renderTargets.GetRenderTargetViews());
            pipeline.OutputMerger.DepthStencil        = renderTargets.DepthStencilView;
            pipeline.OutputMerger.DepthStencilState   = pipeline.OutputMerger.NoDepthStencilState;
            pipeline.VertexShader.Shader              = vsClear;
            pipeline.PixelShader.Shader               = psClear;
            pipeline.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleList;
            pipeline.Rasterizer.Viewport              = renderTargets.Viewport;
            pipeline.ApplyOutputResources();
            pipeline.ApplyShaderResources();

            pipeline.ClearTargets(new SharpDX.Color4(0.2f, 0.2f, 0.2f, 1.0f), 1.0f, 0);

            pipeline.Draw(3, 0);
        }