pub struct Model { /* private fields */ }Expand description
A glTF / GLB model, loaded with the vendored GLTFLoader.
use autumn_plugin_three::Model;
let duck = Model::gltf("/static/models/duck.glb").fit(2.0).play_all();The URL must be http(s) or relative. The app CSP must allow the URL in
connect-src. The default CSP allows same-origin URLs. Images inside a
GLB work under the default CSP. Images at external URLs need img-src
and connect-src to allow them.
Implementations§
Source§impl Model
impl Model
Sourcepub const fn fit(self, size: f32) -> Self
pub const fn fit(self, size: f32) -> Self
Scales the model so that its largest side is size. It also puts the
model center at the model position. The method ignores a size that
is not a finite positive number.
Sourcepub fn play(self, name: impl Into<String>) -> Self
pub fn play(self, name: impl Into<String>) -> Self
Plays the clip with this name in a loop. The runtime trims the name,
so this method trims it too. An empty name is ignored. The name *
plays all clips.
Sourcepub fn rotation(self, degrees: impl Into<Vec3>) -> Self
pub fn rotation(self, degrees: impl Into<Vec3>) -> Self
Sets the rotation in degrees (X, Y, Z order).
Sourcepub fn scale(self, scale: impl Into<Vec3>) -> Self
pub fn scale(self, scale: impl Into<Vec3>) -> Self
Sets the scale. Use Vec3::splat for a uniform scale.
Sourcepub fn spin(self, degrees_per_second: impl Into<Vec3>) -> Self
pub fn spin(self, degrees_per_second: impl Into<Vec3>) -> Self
Spins the object, in degrees per second on each axis.
Spin stops when the user prefers reduced motion, unless the scene
calls Scene::animate_reduced_motion.
Trait Implementations§
Source§impl From<Model> for SceneObject
impl From<Model> for SceneObject
impl StructuralPartialEq for Model
Auto Trait Implementations§
impl Forget for Model
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnsafeUnpin for Model
impl UnwindSafe for Model
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.