gltf_json/
skin.rs

1use crate::{accessor, extensions, scene, Extras, Index};
2use gltf_derive::Validate;
3use serde_derive::{Deserialize, Serialize};
4
5/// Joints and matrices defining a skin.
6#[derive(Clone, Debug, Deserialize, Serialize, Validate)]
7pub struct Skin {
8    /// Extension specific data.
9    #[serde(default, skip_serializing_if = "Option::is_none")]
10    pub extensions: Option<extensions::skin::Skin>,
11
12    /// Optional application specific data.
13    #[serde(default)]
14    #[cfg_attr(feature = "extras", serde(skip_serializing_if = "Option::is_none"))]
15    #[cfg_attr(not(feature = "extras"), serde(skip_serializing))]
16    pub extras: Extras,
17
18    /// The index of the accessor containing the 4x4 inverse-bind matrices.
19    ///
20    /// When `None`,each matrix is assumed to be the 4x4 identity matrix
21    /// which implies that the inverse-bind matrices were pre-applied.
22    #[serde(rename = "inverseBindMatrices")]
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub inverse_bind_matrices: Option<Index<accessor::Accessor>>,
25
26    /// Indices of skeleton nodes used as joints in this skin.
27    ///
28    /// The array length must be the same as the `count` property of the
29    /// `inverse_bind_matrices` `Accessor` (when defined).
30    #[serde(skip_serializing_if = "Vec::is_empty")]
31    pub joints: Vec<Index<scene::Node>>,
32
33    /// Optional user-defined name for this object.
34    #[cfg(feature = "names")]
35    #[cfg_attr(feature = "names", serde(skip_serializing_if = "Option::is_none"))]
36    pub name: Option<String>,
37
38    /// The index of the node used as a skeleton root.
39    ///
40    /// When `None`, joints transforms resolve to scene root.
41    #[serde(skip_serializing_if = "Option::is_none")]
42    pub skeleton: Option<Index<scene::Node>>,
43}