pub struct GltfAsset {
pub models: Vec<(Handle<Mesh>, Handle<PbrMaterial>)>,
pub conditions: Vec<Option<ModelCondition>>,
pub geometry: Vec<Arc<MeshGeometry>>,
pub bbox: MeshBbox,
pub properties: HashMap<String, (Vec3, Vec3)>,
pub bones: Vec<GltfBone>,
pub model_bones: Vec<Option<usize>>,
pub animations: HashMap<String, Handle<AnimationClip>>,
pub lights: Vec<GltfLight>,
/* private fields */
}Expand description
Representation of a 3D GLTF model asset. This will spawn the model and return the parent entity ID. See the crate documentation for usage examples.
Fields§
§models: Vec<(Handle<Mesh>, Handle<PbrMaterial>)>The list of parsed glTF models. Each model is represented by a mesh and its associated material.
conditions: Vec<Option<ModelCondition>>Connection condition of each entry of Self::models (None = always shown).
geometry: Vec<Arc<MeshGeometry>>Triangles of each entry of Self::models, kept on the CPU (e.g. for navigation): the
meshes themselves leave the main world once uploaded to the GPU.
bbox: MeshBboxThe englobing bounding box of the entire model, computed from the bounding boxes of all meshes.
properties: HashMap<String, (Vec3, Vec3)>Named properties (e.g. spawn points) extracted from meshes whose name starts with %P%.
These meshes are not added to Self::models; only their name, position and scale are kept here.
bones: Vec<GltfBone>Bones of a rigged model (nodes named %B%<bone>), parents first.
model_bones: Vec<Option<usize>>Bone each entry of Self::models moves with (its vertices are then relative to the bone).
animations: HashMap<String, Handle<AnimationClip>>Animation clips of the bones, by name.
lights: Vec<GltfLight>Lights of the model, spawned with it (see Self::spawn_lights).
Implementations§
Source§impl GltfAsset
impl GltfAsset
pub fn animation(&self, name: &str) -> Option<&Handle<AnimationClip>>
Sourcepub fn spawn_lights(&self, commands: &mut Commands<'_, '_>, parent: Entity)
pub fn spawn_lights(&self, commands: &mut Commands<'_, '_>, parent: Entity)
Spawns the lights of the model under parent, following its transform.
Sourcepub fn models_where(
&self,
connected: impl Fn(&str) -> bool,
) -> impl Iterator<Item = &(Handle<Mesh>, Handle<PbrMaterial>)>
pub fn models_where( &self, connected: impl Fn(&str) -> bool, ) -> impl Iterator<Item = &(Handle<Mesh>, Handle<PbrMaterial>)>
Models whose connection condition holds, connected telling whether an anchor is connected.
Trait Implementations§
impl Asset for GltfAsset
Source§impl TypePath for GltfAsset
impl TypePath for GltfAsset
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Auto Trait Implementations§
impl !RefUnwindSafe for GltfAsset
impl !UnwindSafe for GltfAsset
impl Freeze for GltfAsset
impl Send for GltfAsset
impl Sync for GltfAsset
impl Unpin for GltfAsset
impl UnsafeUnpin for GltfAsset
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path].§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
TypePath::short_type_path].§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident].§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name].§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
TypePath::module_path].§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more