pub struct Root {Show 19 fields
pub accessors: Vec<Accessor>,
pub animations: Vec<Animation>,
pub asset: Asset,
pub buffers: Vec<Buffer>,
pub buffer_views: Vec<View>,
pub scene: Option<Index<Scene>>,
pub extensions: Option<Root>,
pub extras: Void,
pub extensions_used: Vec<String>,
pub extensions_required: Vec<String>,
pub cameras: Vec<Camera>,
pub images: Vec<Image>,
pub materials: Vec<Material>,
pub meshes: Vec<Mesh>,
pub nodes: Vec<Node>,
pub samplers: Vec<Sampler>,
pub scenes: Vec<Scene>,
pub skins: Vec<Skin>,
pub textures: Vec<Texture>,
}Expand description
The root object of a glTF 2.0 asset.
Fields§
§accessors: Vec<Accessor>An array of accessors.
animations: Vec<Animation>An array of keyframe animations.
asset: AssetMetadata about the glTF asset.
buffers: Vec<Buffer>An array of buffers.
buffer_views: Vec<View>An array of buffer views.
scene: Option<Index<Scene>>The default scene.
extensions: Option<Root>Extension specific data.
extras: VoidOptional application specific data.
extensions_used: Vec<String>Names of glTF extensions used somewhere in this asset.
extensions_required: Vec<String>Names of glTF extensions required to properly load this asset.
cameras: Vec<Camera>An array of cameras.
images: Vec<Image>An array of images.
materials: Vec<Material>An array of materials.
meshes: Vec<Mesh>An array of meshes.
nodes: Vec<Node>An array of nodes.
samplers: Vec<Sampler>An array of samplers.
scenes: Vec<Scene>An array of scenes.
skins: Vec<Skin>An array of skins.
textures: Vec<Texture>An array of textures.
Implementations§
source§impl Root
impl Root
sourcepub fn get<T>(&self, index: Index<T>) -> Option<&T>
pub fn get<T>(&self, index: Index<T>) -> Option<&T>
Returns a single item from the root object.
sourcepub fn push<T>(&mut self, value: T) -> Index<T>
pub fn push<T>(&mut self, value: T) -> Index<T>
Insert the given value into this (as via Vec::push()), then return the Index to it.
This allows you to easily obtain Index values with the correct index and type when
creating a glTF asset.
If you have a mutable borrow conflict when using this method, consider using the more
explicit Index::push() method, passing it only the necessary vector.
§Panics
Panics if there are already u32::MAX or more elements of this type,
in which case an Index cannot be created.
sourcepub fn from_reader<R>(reader: R) -> Result<Root, Error>where
R: Read,
pub fn from_reader<R>(reader: R) -> Result<Root, Error>where
R: Read,
Deserialize from a stream of JSON.
sourcepub fn to_string_pretty(&self) -> Result<String, Error>
pub fn to_string_pretty(&self) -> Result<String, Error>
Serialize as a pretty-printed String of JSON.
sourcepub fn to_vec_pretty(&self) -> Result<Vec<u8>, Error>
pub fn to_vec_pretty(&self) -> Result<Vec<u8>, Error>
Serialize as a pretty-printed JSON byte vector.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Root
impl<'de> Deserialize<'de> for Root
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Root, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Root, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl Serialize for Root
impl Serialize for Root
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Root
impl RefUnwindSafe for Root
impl Send for Root
impl Sync for Root
impl Unpin for Root
impl UnwindSafe for Root
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.