pub struct UnityMesh {
pub name: String,
pub vertices: Vec<[f32; 3]>,
pub normals: Vec<[f32; 3]>,
pub tangents: Vec<[f32; 4]>,
pub uvs: Vec<Vec<[f32; 2]>>,
pub sub_meshes: Vec<UnitySubMesh>,
}Expand description
A Unity-shaped glTF mesh: one shared vertex array with N sub-meshes (one per glTF primitive).
Maps directly to a UnityEngine.Mesh with subMeshCount sub-meshes.
Fields§
§name: StringMesh name. Falls back to the glTF mesh index if the source mesh is unnamed.
vertices: Vec<[f32; 3]>All vertex positions across all primitives, concatenated.
Left-handed coordinate system (X negated relative to glTF).
Tightly packed [x, y, z] floats — maps to mesh.vertices.
normals: Vec<[f32; 3]>Vertex normals, same length as vertices. Empty if the source mesh has no normals.
Left-handed coordinate system (X negated relative to glTF).
Tightly packed [x, y, z] floats — maps to mesh.normals.
tangents: Vec<[f32; 4]>Vertex tangents, same length as vertices. Empty if the source mesh has no tangents.
Left-handed coordinate system (X and W negated relative to glTF).
Tightly packed [x, y, z, w] floats — maps to mesh.tangents.
uvs: Vec<Vec<[f32; 2]>>UV channels, densely packed from channel 0.
uvs[k] holds all vertices for TEXCOORD_k (V-flipped for Unity’s bottom-left origin).
Only channels present on every primitive are included; the vec stops at the first absent channel.
Maps to mesh.SetUVs(k, uvs[k]).
sub_meshes: Vec<UnitySubMesh>One sub-mesh per glTF primitive — maps to mesh.SetTriangles(tris, submeshIndex).