pub struct Loaded { /* private fields */ }Expand description
Contains the resources loaded using the Loader and/or manually inserted using the insert_bytes method. Use the remove_bytes or get_bytes function to extract the raw byte array for the loaded resource or one of the other methods to both extract and deserialize a loaded resource.
Implementations
sourceimpl Loaded
impl Loaded
sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new empty set of loaded files. Use this together with insert_bytes to load resources from an unsuported source and then parse them as usual using the functionality on Loaded.
sourcepub fn remove_bytes(&mut self, path: impl AsRef<Path>) -> ThreeDResult<Vec<u8>>
pub fn remove_bytes(&mut self, path: impl AsRef<Path>) -> ThreeDResult<Vec<u8>>
Remove and returns the loaded byte array for the resource at the given path. The byte array then has to be deserialized to whatever type this resource is (image, 3D model etc.).
sourceimpl Loaded
impl Loaded
sourcepub fn obj(
&mut self,
path: impl AsRef<Path>
) -> ThreeDResult<(Vec<CpuMesh>, Vec<CpuMaterial>)>
Available on crate feature obj-io only.
pub fn obj(
&mut self,
path: impl AsRef<Path>
) -> ThreeDResult<(Vec<CpuMesh>, Vec<CpuMaterial>)>
obj-io only.Deserialize a loaded .obj file resource and .mtl material file resource (if present) into a list of meshes and materials. It uses the wavefront-obj crate.
sourceimpl Loaded
impl Loaded
sourcepub fn gltf(
&mut self,
path: impl AsRef<Path>
) -> ThreeDResult<(Vec<CpuMesh>, Vec<CpuMaterial>)>
Available on crate feature gltf-io only.
pub fn gltf(
&mut self,
path: impl AsRef<Path>
) -> ThreeDResult<(Vec<CpuMesh>, Vec<CpuMaterial>)>
gltf-io only.Deserialize a loaded .gltf file and related .bin resource file and related texture resources or a loaded .glb file into a list of meshes and materials. It uses the gltf crate.
sourceimpl Loaded
impl Loaded
sourcepub fn image<P: AsRef<Path>>(&mut self, path: P) -> ThreeDResult<CpuTexture>
Available on crate feature image-io only.
pub fn image<P: AsRef<Path>>(&mut self, path: P) -> ThreeDResult<CpuTexture>
image-io only.Deserialize the loaded image resource at the given path into a CpuTexture using the image crate. The CpuTexture can then be used to create a Texture2D. Supported formats: PNG, JPEG, GIF, WebP, pnm (pbm, pgm, ppm and pam), TIFF, DDS, BMP, ICO, HDR, farbfeld. Note: If the image contains high dynamic range (hdr) information, use hdr_image instead.
sourcepub fn hdr_image(&mut self, path: impl AsRef<Path>) -> ThreeDResult<CpuTexture>
Available on crate feature image-io only.
pub fn hdr_image(&mut self, path: impl AsRef<Path>) -> ThreeDResult<CpuTexture>
image-io only.Deserialize the loaded image resource with hdr information at the given path into a CpuTexture using
the image crate.
The CpuTexture can then be used to create a Texture2D or a TextureCubeMap using the new_from_equirectangular method.
Supported formats: HDR.
sourcepub fn cube_image<P: AsRef<Path>>(
&mut self,
right_path: P,
left_path: P,
top_path: P,
bottom_path: P,
front_path: P,
back_path: P
) -> ThreeDResult<CpuTextureCube>
Available on crate feature image-io only.
pub fn cube_image<P: AsRef<Path>>(
&mut self,
right_path: P,
left_path: P,
top_path: P,
bottom_path: P,
front_path: P,
back_path: P
) -> ThreeDResult<CpuTextureCube>
image-io only.Deserialize the 6 loaded image resources at the given paths into a CpuTextureCube using the image crate. The CpuTextureCube can then be used to create a TextureCubeMap.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Loaded
impl Send for Loaded
impl Sync for Loaded
impl Unpin for Loaded
impl UnwindSafe for Loaded
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
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more