Table of Contents

Enum MeshMode

Namespace
Egami.Drawing
Assembly
Egami.Drawing.dll

How a Mesh reads its vertices (or its indices, when it has them) as triangles.

public enum MeshMode

Fields

Fan = 2

Each vertex after the second makes a triangle with the one before it and the first.

Strip = 1

Each vertex after the second makes a triangle with the two before it.

Triangles = 0

Every three vertices are one triangle; a remainder of one or two is ignored.

Examples

using (RasterCanvas<Rgba8> canvas = raster.CreateCanvas())
{
    // Gouraud shading: a color at each corner, blended across each triangle without cracks between them.
    Vector2[] quad = [new(10, 10), new(140, 20), new(130, 140), new(20, 120)];
    RgbaF32[] colors = [new(1, 0.2f, 0.2f, 1), new(1, 0.9f, 0.2f, 1), new(0.2f, 0.6f, 1, 1), new(0.6f, 0.2f, 0.9f, 1)];
    canvas.DrawMesh(new Mesh(MeshMode.Fan, quad, colors), Rgba8.White);

    // A textured mesh: each vertex says which point of the paint lands on it, here bending a photo into a trapezoid.
    Vector2[] trapezoid = [new(170, 20), new(280, 30), new(290, 140), new(160, 130)];
    Vector2[] corners = [new(0, 0), new(64, 0), new(64, 64), new(0, 64)];
    canvas.DrawMesh(new Mesh(MeshMode.Fan, trapezoid, texCoords: corners), new ImagePaint(photo));
}