Skip to content

struct

Node

pub struct Node {
    pub name: String,
    pub parent: Option<usize>,
    pub translation: Vec3,
    pub rotation: [f32; 4],
    pub scale: Vec3,
    pub meshes: Vec<usize>,
    pub skin: Option<usize>,
}

A node of a model: its name, transform, parent and mesh.

Fields

name

pub name: String

Its name in the file ("" if none).

parent

pub parent: Option<usize>

Its parent node's index, unless it's a root.

translation

pub translation: Vec3

Position relative to its parent.

rotation

pub rotation: [f32; 4]

Unit quaternion (x, y, z, w).

scale

pub scale: Vec3

Scale relative to its parent.

meshes

pub meshes: Vec<usize>

Indices into [Model::meshes].

skin

pub skin: Option<usize>

The skin that deforms its meshes (their own transform then doesn't apply: the joints place them).

Methods

new

pub fn new(name: &str) -> Node

A node called name, at the origin, with no parent or mesh.

local_matrix

pub fn local_matrix(&self) -> Mat4

Its transform relative to its parent: translation, rotation, then scale.

Trait implementations