public void RenderAll(IReadOnlyList <Camera> cameras, IReadOnlyList <LightSource> lights, RendererCollection renderables) { Assert.True(cameras.Count > 0); _glContext.Viewport(0u, 0u, (uint)_screenSize.Width, (uint)_screenSize.Height); _graphics.DrawCalls = 0; for (int camNo = 0; camNo < cameras.Count; camNo++) { var camera = cameras[camNo]; if (camera.IsEnabled == false) { continue; } _graphics.SetupCameraAndLights(camera, lights); FirstPass(renderables, camera); SecondPass(camNo == 0, camera); _glContext.DepthMask(false); _glContext.Enable(EnableCap.Blend); var opaqueCount = renderables.Opaque.Count; var transparent = renderables.Transparent; for (int i = 0; i < transparent.Count; i++) { _graphics.UpdateAndRender(camera, transparent[i], (uint)(i + 1 + opaqueCount)); } _glContext.DepthMask(true); } DrawGBuffer(); }
private void RenderCamera(Camera camera, RendererCollection renderables) { renderables.OpenGLSort(camera); _glContext.DepthMask(true); _glContext.Disable(EnableCap.Blend); var opaque = renderables.Opaque; for (int i = 0; i < opaque.Count; i++) { _graphics.UpdateAndRender(camera, opaque[i], (uint)(i + 1)); } _glContext.DepthMask(false); _glContext.Enable(EnableCap.Blend); var transparent = renderables.Transparent; for (int i = 0; i < transparent.Count; i++) { _graphics.UpdateAndRender(camera, transparent[i], (uint)(i + 1 + opaque.Count)); } _glContext.DepthMask(true); }