/// <summary> /// Renders this camera. /// </summary> public void Render() { ValidateDispose(); // mark this as the currently rendering camera current = this; // set up the camera data buffer fo the render if (m_dataBuffer == null) { m_dataBuffer = new UniformBuffer <CameraData>(); } m_dataBuffer.Value = new CameraData(ViewMatrix, ProjectionMatrix); m_dataBuffer.BufferData(); // setup the lighting data buffer for the render if (m_lightBuffer == null) { m_lightBuffer = new UniformBuffer <LightData>(); } m_lightBuffer.Value = Entity.Scene.GetLightData(); m_lightBuffer.BufferData(); // clear the render target GL.ClearColor(m_clearColor); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); // do culling on all renderable components List <Renderer> toRender = new List <Renderer>(); foreach (Renderer renderer in Entity.Scene.GetRenderables()) { if (!renderer.IsCulled()) { toRender.Add(renderer); } } // sort the rendered components to minimize state changes toRender.Sort(); // rendering all active components foreach (Renderer renderer in toRender) { renderer.Render(); } current = null; }