Skip to main content

AvatarMeta

Struct AvatarMeta 

Source
pub struct AvatarMeta { /* private fields */ }
Expand description

The metadata of an avatar: name, authors, licenses and usage permissions.

Implementations§

Source§

impl AvatarMeta

Source

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.

Source

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}
Source

pub fn version(&self) -> Option<&str>

Returns the author-provided avatar version.

Source

pub fn authors(&self) -> &[String]

Returns author names in declaration order.

Source

pub fn copyright_information(&self) -> Option<&str>

Returns free-form copyright information.

Source

pub fn contact_information(&self) -> Option<&str>

Returns author contact information.

Source

pub fn references(&self) -> Option<&[String]>

Returns source or reference URLs supplied by the author.

Source

pub fn third_party_licenses(&self) -> Option<&str>

Returns third-party license notices bundled with the avatar.

Source

pub fn thumbnail_image(&self) -> Option<u32>

Returns the glTF image index of the square thumbnail, if present.

Source

pub fn license_url(&self) -> Option<&str>

Returns the required license URL.

Source

pub fn other_license_url(&self) -> Option<&str>

Returns an additional license URL, if supplied.

Source

pub fn permissions(&self) -> &AvatarPermissions

Returns the structured usage permissions declared by the author.

Trait Implementations§

Source§

impl Clone for AvatarMeta

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AvatarMeta

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for AvatarMeta

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.