pub enum Transform {
Values {
dest: Point2<f32>,
rotation: f32,
scale: Vector2<f32>,
offset: Point2<f32>,
},
Matrix(ColumnMatrix4<f32>),
}Expand description
A struct that represents where to put a Drawable.
This can either be a set of individual components, or
a single Matrix4 transform.
Variants§
Values
Transform made of individual values
Fields
offset: Point2<f32>An offset from the center for transform operations like scale/rotation,
with 0,0 meaning the origin and 1,1 meaning the opposite corner from the origin.
By default these operations are done from the top-left corner, so to rotate something
from the center specify Point2::new(0.5, 0.5) here.
Matrix(ColumnMatrix4<f32>)
Transform made of an arbitrary matrix.
It should represent the final model matrix of the given drawable. This is useful for situations where, for example, you build your own hierarchy system, where you calculate matrices of each hierarchy item and store a calculated world-space model matrix of an item. This lets you implement transform stacks, skeletal animations, etc.
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn to_matrix(self) -> Self
pub fn to_matrix(self) -> Self
Crunches the transform down to a single matrix, if it’s not one already.
Sourcepub fn to_bare_matrix(self) -> ColumnMatrix4<f32>
pub fn to_bare_matrix(self) -> ColumnMatrix4<f32>
Same as to_matrix() but just returns a bare mint matrix.
Trait Implementations§
impl Copy for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations§
impl Freeze for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnwindSafe for Transform
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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