protected override void render() { if (material == null) { return; } material.Bind(); if (EngineBase.Renderer.ShadowFrameBuffer.TextureHandle > 0) { GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, EngineBase.Renderer.ShadowFrameBuffer.TextureHandle); material.SetUniform("shadowMap", 0); material.SetUniform("shadowViewProjection", Matrix4.Mult(shadowViewProjection, EngineBase.Renderer.ShadowMapBias)); } Matrix4 mv = Matrix4.Mult(transformation, EngineBase.Renderer.View); Matrix4 nm = Matrix4.Invert(mv); nm.Transpose(); material.SetUniform("normalMatrix", nm); material.SetUniform("model", transformation); material.SetUniform("modelView", mv); material.SetUniform("modelViewProjection", Matrix4.Mult(mv, EngineBase.Renderer.Projection)); if (light == null) { light = (DirectionalLight)EngineBase.Scene.GetLight(0); } material.SetUniform("lightDirection", light.Direction); material.SetUniform("color", ref color); material.SetUniform("time", Time); GL.BindVertexArray(vaoHandle); GL.DrawElements(PrimitiveType.Triangles, indicesVboData.Length, DrawElementsType.UnsignedInt, IntPtr.Zero); GL.BindVertexArray(0); material.Unbind(); }