Sign in

    Milky2018/mgstudio/mesh does not have a README file

    Mesh

    pub struct Mesh {
    geometry2d : Mesh2dGeometry
    }

    A minimal mesh asset type (shared by 2D/3D later).

    For now we only store 2D triangle geometry (Mesh2dGeometry) because the runtime backends are still bring-up / immediate-mode.

    Mesh::from_2d_geometry

    fn Mesh::from_2d_geometry(geometry2d : Mesh2dGeometry) -> Mesh

    Mesh2dGeometry

    pub struct Mesh2dGeometry {
    positions : Array[
    Vec2
    ]
    uvs : Array[
    Vec2
    ]
    indices : Array[Int]?
    }

    A minimal, Bevy-aligned 2D mesh geometry container.

    Notes:
    • Only triangle list is supported for now.
    • indices=None means the vertex arrays are already laid out as triangles.
    • UVs are required (matching Bevy mesh conventions) even if a pipeline does not use them yet.

    Mesh2dGeometry::encode_triangle_positions_csv

    fn Mesh2dGeometry::encode_triangle_positions_csv(self : Mesh2dGeometry) -> String?

    Encodes non-indexed triangle list positions as a comma-separated string: x0,y0,x1,y1,....

    Mesh2dGeometry::flatten_interleaved_xy_uv

    fn Mesh2dGeometry::flatten_interleaved_xy_uv(self : Mesh2dGeometry) -> Array[Double]?

    Mesh2dGeometry::flatten_positions_xy

    fn Mesh2dGeometry::flatten_positions_xy(self : Mesh2dGeometry) -> Array[Double]?

    Mesh2dGeometry::flatten_triangle_positions_xy

    fn Mesh2dGeometry::flatten_triangle_positions_xy(self : Mesh2dGeometry) -> Array[Double]?

    Returns a non-indexed triangle-list position buffer (xy per vertex). If the mesh is indexed, this expands indices on the CPU.

    Mesh2dGeometry::triangle_count

    fn Mesh2dGeometry::triangle_count(self : Mesh2dGeometry) -> Int?

    Mesh2dGeometry::validate

    Mesh2dGeometry::vertex_count

    fn Mesh2dGeometry::vertex_count(self : Mesh2dGeometry) -> Int

    Mesh2dValidationError

    pub(all) enum Mesh2dValidationError {
    EmptyVertices
    AttributeLengthMismatch(Int, Int)
    NonIndexedVertexCountNotMultipleOf3(Int)
    IndicesEmpty
    IndicesCountNotMultipleOf3(Int)
    IndexOutOfBounds(Int, Int)
    }

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io