internal void Draw(ref DeviceContext context, ref Camera camera, bool isShadowPass) { if (!isShadowPass) { context.OutputMerger.SetBlendState(BlendStates.Disabled); context.OutputMerger.SetDepthStencilState(DepthStencilStates.Standard); context.Rasterizer.State = RasterizerStates.BackFaceCull; DrawSky(ref camera); MainPass.Use(ref context); Context.VertexShader.SetConstantBuffers(0, camera.Constants, Lighting.LightingConstantBuffer); Context.PixelShader.SetConstantBuffers(0, camera.Constants, Lighting.LightingConstantBuffer, Shadows.ReceiverConstants); Context.PixelShader.SetShaderResources(0, Shadows.ShadowMap); } _cubeRenderer.Draw(ref context, ref camera); _cylinderRenderer.Draw(ref context, ref camera); _sphereRenderer.Draw(ref context, ref camera); _wedgeRenderer.Draw(ref context, ref camera); lock (_locker) { for (var i = 0; i < _renderObjects2.Count; i++) { _renderObjects2[i].Draw(ref context, ref camera); } _partDistanceComparer.CameraPosition = camera.CFrame.p; } }
private void Blit(CommandBuffer cb, RenderTargetIdentifier srcID, RenderTargetIdentifier destID, MainPass mainPass = MainPass.Copy) { cb.SetGlobalTexture(mainTexID, srcID); cb.SetRenderTarget(destID, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store); cb.DrawMesh(fullScreenTriangle, Matrix4x4.identity, mainMat, 0, (int)mainPass); }