public override void Render(Matrix4 viewMatrix, Matrix4 projectionMatrix, List <Light> lights, bool PhongLightningModel, bool PhongShading) { if (_rawModel != null) { int offset = 0; renderer.Use(); renderer.SetLights(lights); renderer.SetProjectionMatrix(projectionMatrix); renderer.SetViewMatrix(viewMatrix); renderer.SetModelMatrix(ModelMatrix); renderer.SetHasTexture(Texture != null); renderer.SetPhongLightning(PhongLightningModel); renderer.SetDiscard(false); renderer.EnableVertexAttribArrays(); foreach (Mesh mesh in _rawModel.Meshes) { renderer.SetAmbientColor(mesh.MeshMaterial.Ka); renderer.SetDiffuseColor(mesh.MeshMaterial.Kd); renderer.SetSpecularColor(mesh.MeshMaterial.Ks); renderer.SetSpecularExponent(mesh.MeshMaterial.Ns); GL.DrawElements(BeginMode.Triangles, mesh.Indices.Count, DrawElementsType.UnsignedInt, offset * sizeof(uint)); offset += mesh.Indices.Count; } renderer.DisableVertexAttribArrays(); } }
public override void Render(Matrix4 viewMatrix, Matrix4 projectionMatrix, List <Light> lights, bool PhongLightningModel, bool PhongShading) { renderer.SetModelMatrix(ModelMatrix); renderer.SetProjectionMatrix(projectionMatrix); renderer.SetViewMatrix(viewMatrix); renderer.SetLights(lights); renderer.SetHasTexture(Texture != null); renderer.SetAmbientColor(Color); renderer.SetDiffuseColor(Color); renderer.SetSpecularColor(Color); renderer.SetSpecularExponent(SpecularExponent); renderer.EnableVertexAttribArrays(); renderer.SetPhongLightning(PhongLightningModel); GL.DrawArrays(PrimitiveType.Triangles, 0, vertexCount); renderer.DisableVertexAttribArrays(); }
public override void Render(Matrix4 viewMatrix, Matrix4 projectionMatrix, List <Light> lights, bool PhongLightningModel, bool PhongShading) { renderer.SetModelMatrix(ModelMatrix); renderer.SetProjectionMatrix(projectionMatrix); renderer.SetViewMatrix(viewMatrix); renderer.SetLights(lights); renderer.SetHasTexture(Texture != null); renderer.SetAmbientColor(Color); renderer.SetDiffuseColor(Color); renderer.SetSpecularColor(Color); renderer.SetSpecularExponent(SpecularExponent); renderer.SetPhongLightning(PhongLightningModel); renderer.EnableVertexAttribArrays(); GL.DrawElements(BeginMode.TriangleStrip, _indicesCount, DrawElementsType.UnsignedInt, 0); renderer.DisableVertexAttribArrays(); }