#[repr(C)]pub struct TransformInstance {
pub col0: [f32; 4],
pub col1: [f32; 4],
pub col2: [f32; 4],
pub col3: [f32; 4],
}Fields§
§col0: [f32; 4]§col1: [f32; 4]§col2: [f32; 4]§col3: [f32; 4]Implementations§
Source§impl InstanceTransform
impl InstanceTransform
pub fn identity() -> Self
Sourcepub fn translation(tx: f32, ty: f32) -> Self
pub fn translation(tx: f32, ty: f32) -> Self
Create a 2D translation transform (tx, ty) in pixels.
Each field (col0..col3) stores one column of the GPU mat4x4.
Translation lives in col3.
Sourcepub fn translation3d(tx: f32, ty: f32, tz: f32) -> Self
pub fn translation3d(tx: f32, ty: f32, tz: f32) -> Self
Create a 3D translation transform (tx, ty, tz).
Translation is stored in col3.
Sourcepub fn scale3d(sx: f32, sy: f32, sz: f32) -> Self
pub fn scale3d(sx: f32, sy: f32, sz: f32) -> Self
Create a 3D scale transform with factors (sx, sy, sz).
Sourcepub fn rotation_z(radians: f32) -> Self
pub fn rotation_z(radians: f32) -> Self
Create a rotation around the Z axis by radians.
Positive angles rotate counter-clockwise in screen space.
Sourcepub fn rotation_z_deg(degrees: f32) -> Self
pub fn rotation_z_deg(degrees: f32) -> Self
Create a rotation around the Z axis by degrees.
Sourcepub fn affine_2d(a: f32, b: f32, c: f32, d: f32, tx: f32, ty: f32) -> Self
pub fn affine_2d(a: f32, b: f32, c: f32, d: f32, tx: f32, ty: f32) -> Self
Create a 2D affine transform from matrix components: [ a c tx ] [ b d ty ] [ 0 0 1 ]
Stored so that col0..col3 map to GPU columns 0..3:
col0=[a,b,0,0] col1=[c,d,0,0] col2=[0,0,1,0] col3=[tx,ty,0,1]
Sourcepub fn multiply(&self, rhs: &Self) -> Self
pub fn multiply(&self, rhs: &Self) -> Self
Compose two transforms so that self is applied first, then rhs.
This uses left-to-right application order (like CSS/SVG/euclid’s .then()):
a.multiply(&b) means “apply a first, then b”.
Note: mathematically this computes rhs × self (not self × rhs),
which is what gives us the intuitive left-to-right ordering.
pub fn desc<'a>() -> VertexBufferLayout<'a>
Trait Implementations§
Source§impl Clone for InstanceTransform
impl Clone for InstanceTransform
Source§fn clone(&self) -> InstanceTransform
fn clone(&self) -> InstanceTransform
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InstanceTransform
impl Debug for InstanceTransform
impl Copy for InstanceTransform
impl Pod for InstanceTransform
Auto Trait Implementations§
impl Freeze for InstanceTransform
impl RefUnwindSafe for InstanceTransform
impl Send for InstanceTransform
impl Sync for InstanceTransform
impl Unpin for InstanceTransform
impl UnsafeUnpin for InstanceTransform
impl UnwindSafe for InstanceTransform
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.