pub struct AvatarMeta { /* private fields */ }Expand description
The metadata of an avatar: name, authors, licenses and usage permissions.
Implementations§
Source§impl AvatarMeta
impl AvatarMeta
Sourcepub fn new(
name: impl Into<String>,
authors: impl IntoIterator<Item = impl Into<String>>,
license_url: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, authors: impl IntoIterator<Item = impl Into<String>>, license_url: impl Into<String>, ) -> Self
Creates the required metadata fields for a programmatic avatar.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Returns the avatar title.
Examples found in repository?
examples/basic.rs (line 13)
9fn main() {
10 let path = std::env::args().nth(1).expect("usage: basic <avatar.vrm>");
11 let avatar = AvatarAsset::load(&path).expect("failed to load avatar");
12
13 println!("avatar: {}", avatar.meta().name());
14 println!("primitives: {}", avatar.primitives().len());
15
16 let mut runtime = AvatarRuntime::new(avatar);
17
18 // One frame with spring bones and constraints enabled by default.
19 let frame = runtime.update(1.0 / 60.0).expect("valid delta time");
20
21 // Bake fully transformed, renderer-ready CPU meshes on demand.
22 let meshes = frame.bake_cpu();
23 for mesh in &meshes {
24 println!(
25 "mesh(node {}): vertices={} indices={} topology={:?} material={:?}",
26 mesh.node_id,
27 mesh.positions.len(),
28 mesh.indices.len(),
29 mesh.topology,
30 mesh.material_id,
31 );
32 }
33}Returns author names in declaration order.
Sourcepub fn copyright_information(&self) -> Option<&str>
pub fn copyright_information(&self) -> Option<&str>
Returns free-form copyright information.
Sourcepub fn contact_information(&self) -> Option<&str>
pub fn contact_information(&self) -> Option<&str>
Returns author contact information.
Sourcepub fn references(&self) -> Option<&[String]>
pub fn references(&self) -> Option<&[String]>
Returns source or reference URLs supplied by the author.
Sourcepub fn third_party_licenses(&self) -> Option<&str>
pub fn third_party_licenses(&self) -> Option<&str>
Returns third-party license notices bundled with the avatar.
Sourcepub fn thumbnail_image(&self) -> Option<u32>
pub fn thumbnail_image(&self) -> Option<u32>
Returns the glTF image index of the square thumbnail, if present.
Sourcepub fn license_url(&self) -> Option<&str>
pub fn license_url(&self) -> Option<&str>
Returns the required license URL.
Sourcepub fn other_license_url(&self) -> Option<&str>
pub fn other_license_url(&self) -> Option<&str>
Returns an additional license URL, if supplied.
Sourcepub fn permissions(&self) -> &AvatarPermissions
pub fn permissions(&self) -> &AvatarPermissions
Returns the structured usage permissions declared by the author.
Trait Implementations§
Source§impl Clone for AvatarMeta
impl Clone for AvatarMeta
Source§impl Debug for AvatarMeta
impl Debug for AvatarMeta
Auto Trait Implementations§
impl Freeze for AvatarMeta
impl RefUnwindSafe for AvatarMeta
impl Send for AvatarMeta
impl Sync for AvatarMeta
impl Unpin for AvatarMeta
impl UnsafeUnpin for AvatarMeta
impl UnwindSafe for AvatarMeta
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
Mutably borrows from an owned value. Read more