Skip to main content

Gltf

Struct Gltf 

pub struct Gltf {
    pub document: Document,
    pub blob: Option<Vec<u8>>,
}
Expand description

glTF JSON wrapper plus binary payload.

Fields§

§document: Document

The glTF JSON wrapper.

§blob: Option<Vec<u8>>

The glTF binary payload in the case of binary glTF.

Implementations§

§

impl Gltf

pub fn open<P>(path: P) -> Result<Gltf, Error>
where P: AsRef<Path>,

Convenience function that loads glTF from the file system.

pub fn from_reader_without_validation<R>(reader: R) -> Result<Gltf, Error>
where R: Read + Seek,

Loads glTF from a reader without performing validation checks.

pub fn from_reader<R>(reader: R) -> Result<Gltf, Error>
where R: Read + Seek,

Loads glTF from a reader.

pub fn from_slice_without_validation(slice: &[u8]) -> Result<Gltf, Error>

Loads glTF from a slice of bytes without performing validation checks.

pub fn from_slice(slice: &[u8]) -> Result<Gltf, Error>

Loads glTF from a slice of bytes.

Methods from Deref<Target = Document>§

pub fn as_json(&self) -> &Root

Unwraps the glTF document, without consuming it.

pub fn accessors(&self) -> Accessors<'_>

Returns an Iterator that visits the accessors of the glTF asset.

pub fn animations(&self) -> Animations<'_>

Returns an Iterator that visits the animations of the glTF asset.

pub fn buffers(&self) -> Buffers<'_>

Returns an Iterator that visits the pre-loaded buffers of the glTF asset.

pub fn cameras(&self) -> Cameras<'_>

Returns an Iterator that visits the cameras of the glTF asset.

pub fn default_scene(&self) -> Option<Scene<'_>>

Returns the default scene, if provided.

pub fn extensions_used(&self) -> ExtensionsUsed<'_>

Returns the extensions referenced in this .document file.

pub fn extensions_required(&self) -> ExtensionsRequired<'_>

Returns the extensions required to load and render this asset.

pub fn images(&self) -> Images<'_>

Returns an Iterator that visits the pre-loaded images of the glTF asset.

pub fn materials(&self) -> Materials<'_>

Returns an Iterator that visits the materials of the glTF asset.

pub fn meshes(&self) -> Meshes<'_>

Returns an Iterator that visits the meshes of the glTF asset.

pub fn nodes(&self) -> Nodes<'_>

Returns an Iterator that visits the nodes of the glTF asset.

pub fn samplers(&self) -> Samplers<'_>

Returns an Iterator that visits the samplers of the glTF asset.

pub fn scenes(&self) -> Scenes<'_>

Returns an Iterator that visits the scenes of the glTF asset.

pub fn skins(&self) -> Skins<'_>

Returns an Iterator that visits the skins of the glTF asset.

pub fn textures(&self) -> Textures<'_>

Returns an Iterator that visits the textures of the glTF asset.

pub fn views(&self) -> Views<'_>

Returns an Iterator that visits the pre-loaded buffer views of the glTF asset.

Trait Implementations§

§

impl Clone for Gltf

§

fn clone(&self) -> Gltf

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Gltf

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Deref for Gltf

§

type Target = Document

The resulting type after dereferencing.
§

fn deref(&self) -> &<Gltf as Deref>::Target

Dereferences the value.
§

impl DerefMut for Gltf

§

fn deref_mut(&mut self) -> &mut <Gltf as Deref>::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl Freeze for Gltf

§

impl RefUnwindSafe for Gltf

§

impl Send for Gltf

§

impl Sync for Gltf

§

impl Unpin for Gltf

§

impl UnsafeUnpin for Gltf

§

impl UnwindSafe for Gltf

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.