StdPaint.ConsoleBuffer.DrawTriangle C# (CSharp) Method

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
        public void DrawTriangle(Point a, Point b, Point c, BufferBrush brush)
        {
            DrawLine(ref a, ref b, brush);
            DrawLine(ref b, ref c, brush);
            DrawLine(ref c, ref a, brush);
        }

Same methods

ConsoleBuffer::DrawTriangle ( Point a, Point b, Point c, BufferColor color ) : void
ConsoleBuffer::DrawTriangle ( Triangle triangle, BufferBrush brush ) : void
ConsoleBuffer::DrawTriangle ( Triangle triangle, BufferBrush border, BufferBrush fill ) : void
ConsoleBuffer::DrawTriangle ( Triangle triangle, BufferColor color ) : void

Usage Example

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);
             }
 }
All Usage Examples Of StdPaint.ConsoleBuffer::DrawTriangle