gltf_json/extensions/
accessor.rs

1use gltf_derive::Validate;
2use serde_derive::{Deserialize, Serialize};
3#[cfg(feature = "extensions")]
4use serde_json::{Map, Value};
5
6/// Contains data structures for sparse storage.
7pub mod sparse {
8    use super::*;
9
10    /// Indices of those attributes that deviate from their initialization value.
11    #[derive(Clone, Debug, Default, Deserialize, Serialize, Validate)]
12    pub struct Indices {}
13
14    /// Sparse storage of attributes that deviate from their initialization value.
15    #[derive(Clone, Debug, Default, Deserialize, Serialize, Validate)]
16    pub struct Sparse {}
17
18    /// Array of size `count * number_of_components` storing the displaced
19    /// accessor attributes pointed by `accessor::sparse::Indices`.
20    #[derive(Clone, Debug, Default, Deserialize, Serialize, Validate)]
21    pub struct Values {}
22}
23
24/// A typed view into a buffer view.
25#[derive(Clone, Debug, Default, Deserialize, Serialize, Validate)]
26pub struct Accessor {
27    #[cfg(feature = "extensions")]
28    #[serde(default, flatten)]
29    pub others: Map<String, Value>,
30}