public void OnRender() { //return; vao.Bind(); _shader.Bind(); _shader.SetMatrix4("View", Camera.GetViewMatrix(Vector3.Zero)); _shader.SetMatrix4("Projection", Camera.ProjectionMatrix); txt.Bind(0); _shader.SetInt("Skybox", 0); GraphicsDevice.Default.DepthMask = false; //GL.DepthFunc(DepthFunction.Equal); GraphicsDevice.Default.DepthFunc = DepthFunction.Lequal; vao.Draw(); GraphicsDevice.Default.DepthFunc = DepthFunction.Less; GraphicsDevice.Default.DepthMask = true; }
private void RenderPass2(RenderContext context, Camera camera) { Pass = DeferredPass.Pass2; ObjectManager.PushDebugGroup("OnRender LightShader", this); _DefLightShader.Bind(); GPosition.Bind(TextureUnit.Texture0); GNormal.Bind(TextureUnit.Texture1); GAlbedoSpec.Bind(TextureUnit.Texture2); GMaterial.Bind(TextureUnit.Texture3); if (Renderer.Current.UseShadows) { context.GetPipeline <DirectionalShadowRenderPipeline>().FrameBuffer.GetDestinationTexture().Bind(TextureUnit.Texture4); _DefLightShader.SetInt("DirectionalShadowMap", 4); context.GetPipeline <PointShadowRenderPipeline>().FrameBuffer.GetDestinationTexture().Bind(TextureUnit.Texture5); _DefLightShader.SetInt("PointShadowMap", 5); } _DefLightShader.SetVector3("ViewPos", camera.Position); _DefLightShader.SetFloat("FarPlane", camera.FarPlane); // TODO: Move to Pass1 //_DefLightShader.SetMaterial("material", Material.Default); _DefLightShader.BindBlock("LightsArray", context.LightBinding); _DefLightShader.SetInt("LightCount", context.LightObjects.Count); context.GetPipeline <ForwardRenderPipeline>().FrameBuffer.Bind(); vao.Bind(); GL.Disable(EnableCap.DepthTest); vao.Draw(); GL.Enable(EnableCap.DepthTest); ObjectManager.PopDebugGroup(); }