DrawTriangle() public method

Draws a triangle to the buffer.
public DrawTriangle ( Point a, Point b, Point c, BufferBrush brush ) : void
a Point The first point of the triangle.
b Point The second point of the triangle.
c Point The third point of the triangle.
brush BufferBrush The brush of the line.
return void
Esempio n. 1
0
 /// <summary>
 /// Render the current scene to the active buffer.
 /// </summary>
 /// <param name="buffer"></param>
 public void Render(ConsoleBuffer buffer)
 {
     foreach (Renderable obj in Objects)
         foreach (Face face in obj.Faces)
             foreach (Triangle3f tri in face.Triangles)
             {
                 Vector2 point1 = ActiveCamera.ProjectVector(buffer.Width, buffer.Height, tri.A, obj.ModelMatrix);
                 Vector2 point2 = ActiveCamera.ProjectVector(buffer.Width, buffer.Height, tri.B, obj.ModelMatrix);
                 Vector2 point3 = ActiveCamera.ProjectVector(buffer.Width, buffer.Height, tri.C, obj.ModelMatrix);
                 buffer.DrawTriangle(point1.ToPoint(), point2.ToPoint(), point3.ToPoint(), face.Color);
             }
 }
Esempio n. 2
0
 /// <summary>
 /// Render the current scene to the active buffer.
 /// </summary>
 /// <param name="buffer"></param>
 public void Render(ConsoleBuffer buffer)
 {
     foreach (Renderable obj in Objects)
     {
         foreach (Face face in obj.Faces)
         {
             foreach (Triangle3f tri in face.Triangles)
             {
                 Vector2 point1 = ActiveCamera.ProjectVector(buffer.Width, buffer.Height, tri.A, obj.ModelMatrix);
                 Vector2 point2 = ActiveCamera.ProjectVector(buffer.Width, buffer.Height, tri.B, obj.ModelMatrix);
                 Vector2 point3 = ActiveCamera.ProjectVector(buffer.Width, buffer.Height, tri.C, obj.ModelMatrix);
                 buffer.DrawTriangle(point1.ToPoint(), point2.ToPoint(), point3.ToPoint(), face.Color);
             }
         }
     }
 }