Scripting API

Scripting API

MeshData

Struct in Abyss.Core, from Abyss.Core.

The vertex data of a mesh, as spans over the caller's own memory.

public readonly ref struct MeshData

Remarks

Only the handle is special about an asset. The geometry is numbers, and it crosses the boundary the way every other bulk payload in this engine does: as spans, in one call, with no per-vertex marshalling.

MeshData.Normals, MeshData.Uvs and the colors may be empty. MeshData.Positions may not, and every non-empty attribute must be the same length as it — the engine checks, because the alternative is a panic from inside wgpu several frames later with nothing in it naming you.

Properties

Positions

public required ReadOnlySpan<float> Positions { get; init; }

One position per vertex, as x, y, z triples.

Normals

public ReadOnlySpan<float> Normals { get; init; }

One normal per vertex, as x, y, z triples, or empty.

Uvs

public ReadOnlySpan<float> Uvs { get; init; }

One texture coordinate per vertex, as u, v pairs, or empty.

Colors

public ReadOnlySpan<float> Colors { get; init; }

One color per vertex, as r, g, b, a quadruples from 0 to 1, linear, or empty: what a block world's corner shading and light levels are. Every material multiplies its color by them, as one does an imported model's. Given here or as MeshData.Colors32, not both.

Colors32

public ReadOnlySpan<uint> Colors32 { get; init; }

One color per vertex in four bytes, red first in memory — 0xAABBGGRR as a number — each from 0 to 255, linear, or empty: a quarter of MeshData.Colors' size for a game that keeps them so. The engine makes them floats, which is what the GPU is given. Given here or as MeshData.Colors, not both.

Indices

public required ReadOnlySpan<uint> Indices { get; init; }

Triangle indices, three per triangle.