Skip to main content

UnityMesh

Struct UnityMesh 

Source
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: String

Mesh 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).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.