pub struct Model {
pub meshes: Vec<Mesh>,
pub materials: Vec<Material>,
pub transform: Mat4,
pub highlight: Color,
pub bounding_center: Vec3,
pub bounding_radius: f32,
/* private fields */
}Fields§
§meshes: Vec<Mesh>§materials: Vec<Material>§transform: Mat4Model matrix applied to every vertex in world space. Defaults to
glam::Mat4::IDENTITY. Prefer building it up through the Transformable methods.
highlight: ColorRGBA overlay blended over the model’s shaded color
(mix(shaded, highlight.rgb, highlight.a) in the fragment shader). Alpha 0 (the default)
means no highlight at all. Intended for editor-style hover/selection feedback rather than
gameplay use.
bounding_center: Vec3Center of the model’s bounding sphere, in local (pre-transform) space.
bounding_radius: f32Radius of the model’s bounding sphere, in local (pre-transform) space. Computed once at load time since the raw vertex positions aren’t retained after upload to the GPU.
Implementations§
Trait Implementations§
Source§impl Transformable for Model
impl Transformable for Model
Source§fn transform_mut(&mut self) -> &mut Mat4
fn transform_mut(&mut self) -> &mut Mat4
Mutable access to the model matrix.
Source§fn pivot(&self) -> Vec3
fn pivot(&self) -> Vec3
Local-space point that rotations and scales turn around. Defaults to the local origin.
Source§fn set_transform(&mut self, transform: Mat4) -> &mut Selfwhere
Self: Sized,
fn set_transform(&mut self, transform: Mat4) -> &mut Selfwhere
Self: Sized,
Replaces the model matrix outright, discarding any accumulated transforms.
Source§fn reset_transform(&mut self) -> &mut Selfwhere
Self: Sized,
fn reset_transform(&mut self) -> &mut Selfwhere
Self: Sized,
Clears the model matrix back to the identity.
Source§fn apply(&mut self, transform: Mat4) -> &mut Selfwhere
Self: Sized,
fn apply(&mut self, transform: Mat4) -> &mut Selfwhere
Self: Sized,
Composes
transform onto the current matrix, about the local origin.Source§fn apply_about_pivot(&mut self, transform: Mat4) -> &mut Selfwhere
Self: Sized,
fn apply_about_pivot(&mut self, transform: Mat4) -> &mut Selfwhere
Self: Sized,
Composes
transform onto the current matrix, about Transformable::pivot.Source§fn translate(&mut self, x: f32, y: f32) -> &mut Selfwhere
Self: Sized,
fn translate(&mut self, x: f32, y: f32) -> &mut Selfwhere
Self: Sized,
Moves along the local X and Y axes.
Source§fn translate3(&mut self, offset: Vec3) -> &mut Selfwhere
Self: Sized,
fn translate3(&mut self, offset: Vec3) -> &mut Selfwhere
Self: Sized,
Moves by
offset in local space.Source§fn rotate(&mut self, radians: f32) -> &mut Selfwhere
Self: Sized,
fn rotate(&mut self, radians: f32) -> &mut Selfwhere
Self: Sized,
Rotates around the Z axis — the in-plane spin for 2D content.
Source§fn rotate_degrees(&mut self, degrees: f32) -> &mut Selfwhere
Self: Sized,
fn rotate_degrees(&mut self, degrees: f32) -> &mut Selfwhere
Self: Sized,
Transformable::rotate, taking degrees.Source§fn rotate_x(&mut self, radians: f32) -> &mut Selfwhere
Self: Sized,
fn rotate_x(&mut self, radians: f32) -> &mut Selfwhere
Self: Sized,
Rotates around the X axis.
Source§fn rotate_y(&mut self, radians: f32) -> &mut Selfwhere
Self: Sized,
fn rotate_y(&mut self, radians: f32) -> &mut Selfwhere
Self: Sized,
Rotates around the Y axis.
Source§fn rotate_z(&mut self, radians: f32) -> &mut Selfwhere
Self: Sized,
fn rotate_z(&mut self, radians: f32) -> &mut Selfwhere
Self: Sized,
Rotates around the Z axis.
Source§fn rotate_quat(&mut self, rotation: Quat) -> &mut Selfwhere
Self: Sized,
fn rotate_quat(&mut self, rotation: Quat) -> &mut Selfwhere
Self: Sized,
Applies an arbitrary rotation.
Source§fn scale(&mut self, x: f32, y: f32) -> &mut Selfwhere
Self: Sized,
fn scale(&mut self, x: f32, y: f32) -> &mut Selfwhere
Self: Sized,
Scales the X and Y axes independently.
Source§fn scale_uniform(&mut self, factor: f32) -> &mut Selfwhere
Self: Sized,
fn scale_uniform(&mut self, factor: f32) -> &mut Selfwhere
Self: Sized,
Scales every axis by the same factor.
Auto Trait Implementations§
impl !RefUnwindSafe for Model
impl !UnwindSafe for Model
impl Freeze for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more
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> 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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Variant for T
impl<T> Variant for T
§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert this [
Variant] trait object to &mut dyn Any.§fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Convert this [
Variant] trait object to Box<dyn Any>.§fn clone_object(&self) -> Box<dyn Variant>
fn clone_object(&self) -> Box<dyn Variant>
Clone this [
Variant] trait object.