#[repr(C)]pub struct GltfAsset<'a, ImageData = (Vec<u8>, Extent2D)> {
pub gltf: Gltf,
pub bin: Cow<'a, [u8]>,
pub buffers: Vec<Vec<u8>>,
pub images: Vec<ImageData>,
}
Expand description
A parsed glTF 2.0 asset and resources. See: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html
Fields
gltf: Gltf
glTF model
bin: Cow<'a, [u8]>
Binary chunk for GLB
buffers: Vec<Vec<u8>>
Buffer data
images: Vec<ImageData>
Image data
Implementations
sourceimpl<'a, ImageData> GltfAsset<'a, ImageData>
impl<'a, ImageData> GltfAsset<'a, ImageData>
sourcepub fn into_owned(self) -> GltfAsset<'static, ImageData>
pub fn into_owned(self) -> GltfAsset<'static, ImageData>
Converts to owned data. Clones the binary data if it is not already owned.
sourcepub fn parse_gltf(data: &str) -> Result<Self, ParseGltfError>
pub fn parse_gltf(data: &str) -> Result<Self, ParseGltfError>
Parses a glTF JSON string.
sourcepub async fn load<L: GltfResourceLoader<ImageData = ImageData>>(
loader: &L,
uri: &str,
load_resources: bool
) -> Result<GltfAsset<'a, ImageData>, LoadGltfResourceError>
pub async fn load<L: GltfResourceLoader<ImageData = ImageData>>(
loader: &L,
uri: &str,
load_resources: bool
) -> Result<GltfAsset<'a, ImageData>, LoadGltfResourceError>
Loads a glTF or GLB asset, optionally with its referenced resources.
sourcepub async fn load_resources<L: GltfResourceLoader<ImageData = ImageData>>(
self,
loader: &L
) -> Result<GltfAsset<'static, ImageData>, LoadGltfResourceError>
pub async fn load_resources<L: GltfResourceLoader<ImageData = ImageData>>(
self,
loader: &L
) -> Result<GltfAsset<'static, ImageData>, LoadGltfResourceError>
Loads all resources of this glTF asset. The bin chunk, if exists, will be consumed and left empty.
Trait Implementations
Auto Trait Implementations
impl<'a, ImageData> RefUnwindSafe for GltfAsset<'a, ImageData> where
ImageData: RefUnwindSafe,
impl<'a, ImageData> Send for GltfAsset<'a, ImageData> where
ImageData: Send,
impl<'a, ImageData> Sync for GltfAsset<'a, ImageData> where
ImageData: Sync,
impl<'a, ImageData> Unpin for GltfAsset<'a, ImageData> where
ImageData: Unpin,
impl<'a, ImageData> UnwindSafe for GltfAsset<'a, ImageData> where
ImageData: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more