Ejemplo n.º 1
0
 public override void Render(Matrix4 viewMatrix, Matrix4 projectionMatrix, List <Light> lights, bool PhongLightningModel, bool PhongShading)
 {
     if (RawModel != null)
     {
         int offset = 0;
         renderer.Use();
         renderer.SetModelMatrix(ModelMatrix);
         renderer.SetProjectionMatrix(projectionMatrix);
         renderer.SetViewMatrix(viewMatrix);
         renderer.SetHasTexture(Texture != null);
         renderer.SetPhongLightning(PhongLightningModel);
         renderer.SetDiscard(true);
         GL.ActiveTexture(TextureUnit.Texture0);
         GL.BindTexture(TextureTarget.Texture2D, Texture.TextureId);
         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();
     }
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 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();
 }