gltf-reader 0.1.0

A simple glTF 2.0 reader using `serde` and `serde_json`
Documentation
use alloc::borrow::Cow;
use alloc::vec::Vec;
use ownable::IntoOwned;
use serde::Deserialize;

use crate::camera::Camera;
use crate::mesh::Mesh;
use crate::skin::Skin;
use crate::{Extensions, Extras, Idx};

/// A node in the node hierarchy.
#[derive(Debug, Clone, Deserialize, IntoOwned)]
pub struct Node<'a> {
    /// The user-defined name of this object.
    #[serde(borrow)]
    pub name: Option<Cow<'a, str>>,

    /// The indices of this node's children.
    #[serde(default)]
    pub children: Vec<Idx<Node<'static>>>,

    /// The index of the camera referenced by this node.
    pub camera: Option<Idx<Camera<'static>>>,
    /// The index of the mesh in this node.
    pub mesh: Option<Idx<Mesh<'static>>>,
    /// The index of the skin referenced by this node.
    pub skin: Option<Idx<Skin<'static>>>,
    /// The weights of the instantiated morph target.
    pub weights: Option<Vec<f32>>,

    /// A 4x4 transformation matrix stored in column-major order.
    pub matrix: Option<[f32; 16]>,
    /// The node's unit quaternion rotation in the order (x, y, z, w), where w is the scalar.
    pub rotation: Option<[f32; 4]>,
    /// The node’s non-uniform scale, given as the scaling factors along the x, y, and z axes.
    pub scale: Option<[f32; 3]>,
    /// The node's translation along the x, y, and z axes.
    pub translation: Option<[f32; 3]>,

    #[serde(borrow)]
    pub extensions: Option<Extensions<'a>>,
    #[serde(borrow)]
    pub extras: Option<Extras<'a>>,
}