pub struct Transform { /* private fields */ }Expand description
Implementations§
source§impl Transform
impl Transform
sourcepub const fn new(
translation: Vector3,
rotation: Quaternion,
scale: Vector3,
) -> Self
pub const fn new( translation: Vector3, rotation: Quaternion, scale: Vector3, ) -> Self
Creates a new transform with the given position, rotation, and scale
§Parameters
translation- The translation of the transformrotation- The rotation of the transformscale- The scale of the transform
sourcepub const fn from_translation(translation: Vector3) -> Self
pub const fn from_translation(translation: Vector3) -> Self
Creates a new transform representing just the translation
§Parameters
translation- The translation of the transform
sourcepub const fn from_x_translation(x: f32) -> Self
pub const fn from_x_translation(x: f32) -> Self
Creates a new transform representing a translation only in the x direction.
§Parameters
x- The translation along the x-axis
sourcepub const fn from_y_translation(y: f32) -> Self
pub const fn from_y_translation(y: f32) -> Self
Creates a new transform representing a translation only in the y direction.
§Parameters
y- The translation along the y-axis
sourcepub const fn from_z_translation(z: f32) -> Self
pub const fn from_z_translation(z: f32) -> Self
Creates a new transform representing a translation only in the z direction.
§Parameters
z- The translation along the z-axis
sourcepub const fn from_translation_vec3(translation: &Vec3) -> Self
pub const fn from_translation_vec3(translation: &Vec3) -> Self
Creates a new transform representing just the translation
§Parameters
translation- The translation of the transform
sourcepub const fn from_rotation(rotation: Quaternion) -> Self
pub const fn from_rotation(rotation: Quaternion) -> Self
Creates a new transform representing just the rotation
§Parameters
rotation- The rotation of the transform
sourcepub const fn from_rotation_vec4(rotation: &Vec4) -> Self
pub const fn from_rotation_vec4(rotation: &Vec4) -> Self
Creates a new transform representing just the rotation identified in a
Vec4 encoded as a Quaternion.
§Parameters
rotation- The rotation of the transform
sourcepub fn from_yaw_rotation<A: Angle>(angle: A) -> Self
pub fn from_yaw_rotation<A: Angle>(angle: A) -> Self
Creates a new transform representing just a yaw rotation
§Parameters
angle- The yaw angle of the transform
sourcepub fn from_pitch_rotation<A: Angle>(angle: A) -> Self
pub fn from_pitch_rotation<A: Angle>(angle: A) -> Self
Creates a new transform representing just a pitch rotation
§Parameters
angle- The pitch angle of the transform
sourcepub fn from_roll_rotation<A: Angle>(angle: A) -> Self
pub fn from_roll_rotation<A: Angle>(angle: A) -> Self
Creates a new transform representing just a roll rotation
§Parameters
angle- The roll angle of the transform
sourcepub const fn from_scale(scale: Vector3) -> Self
pub const fn from_scale(scale: Vector3) -> Self
sourcepub const fn from_scale_vec3(scale: &Vec3) -> Self
pub const fn from_scale_vec3(scale: &Vec3) -> Self
sourcepub const fn from_uniform_scale(scale: f32) -> Self
pub const fn from_uniform_scale(scale: f32) -> Self
sourcepub const fn from_nonuniform_scale(x: f32, y: f32, z: f32) -> Self
pub const fn from_nonuniform_scale(x: f32, y: f32, z: f32) -> Self
Creates a new transform representing a non-uniform scale
§Parameters
x- The scale factor along the x-axisy- The scale factor along the y-axisz- The scale factor along the z-axis
sourcepub const fn from_x_scale(x: f32) -> Self
pub const fn from_x_scale(x: f32) -> Self
Creates a new transform representing an x-scaled transform
§Parameters
x- The scale factor along the x-axis
sourcepub const fn from_y_scale(y: f32) -> Self
pub const fn from_y_scale(y: f32) -> Self
Creates a new transform representing a y-scaled transform
§Parameters
y- The scale factor along the y-axis
sourcepub const fn from_z_scale(z: f32) -> Self
pub const fn from_z_scale(z: f32) -> Self
Creates a new transform representing a z-scaled transform
§Parameters
z- The scale factor along the z-axis
source§impl Transform
impl Transform
sourcepub fn translation(&self) -> &Vec3
pub fn translation(&self) -> &Vec3
Returns the position of the transform
sourcepub fn rotation(&self) -> &Quaternion
pub fn rotation(&self) -> &Quaternion
Returns the rotation of the transform
sourcepub fn scale_direction(&self) -> &Vec3
pub fn scale_direction(&self) -> &Vec3
Returns the scale direction of the transform
source§impl Transform
impl Transform
sourcepub fn set_translation(&mut self, translation: Vector3)
pub fn set_translation(&mut self, translation: Vector3)
sourcepub fn set_translation_vec3(&mut self, translation: &Vec3)
pub fn set_translation_vec3(&mut self, translation: &Vec3)
sourcepub fn translate_x(&mut self, x: f32)
pub fn translate_x(&mut self, x: f32)
Sets the translation of the transform in the x direction
§Parameters
x- The translation along the x-axis
sourcepub fn translate_y(&mut self, y: f32)
pub fn translate_y(&mut self, y: f32)
Sets the translation of the transform in the y direction
§Parameters
y- The translation along the y-axis
sourcepub fn translate_z(&mut self, z: f32)
pub fn translate_z(&mut self, z: f32)
Sets the translation of the transform in the z direction
§Parameters
z- The translation along the z-axis
source§impl Transform
impl Transform
sourcepub fn set_rotation(&mut self, rotation: Quaternion)
pub fn set_rotation(&mut self, rotation: Quaternion)
Sets the rotation of the transform
sourcepub fn rotate_yaw<A: Angle>(&mut self, angle: A)
pub fn rotate_yaw<A: Angle>(&mut self, angle: A)
Rotates the transform in the yaw direction by the given angle.
§Parameters
angle- The angle to rotate the transform by.
sourcepub fn rotate_pitch<A: Angle>(&mut self, angle: A)
pub fn rotate_pitch<A: Angle>(&mut self, angle: A)
Rotates the transform in the pitch direction by the given angle.
§Parameters
angle- The angle to rotate the transform by.
sourcepub fn rotate_roll<A: Angle>(&mut self, angle: A)
pub fn rotate_roll<A: Angle>(&mut self, angle: A)
Rotates the transform in the roll direction by the given angle.
§Parameters
angle- The angle to rotate the transform by.
sourcepub fn rotate_euler_angles<A: Angle>(&mut self, yaw: A, pitch: A, roll: A)
pub fn rotate_euler_angles<A: Angle>(&mut self, yaw: A, pitch: A, roll: A)
Rotates the transform by the given euler angles.
§Parameters
yaw- The yaw angle to rotate the transform by.pitch- The pitch angle to rotate the transform by.roll- The roll angle to rotate the transform by.
sourcepub fn rotate(&mut self, rotation: &Quaternion)
pub fn rotate(&mut self, rotation: &Quaternion)
source§impl Transform
impl Transform
sourcepub fn scale(&mut self, scale: &Vec3)
pub fn scale(&mut self, scale: &Vec3)
Scales the transformation by the vector scale
§Parameters
scale- The scale to apply to the transform
sourcepub fn scale_width(&mut self, width: f32)
pub fn scale_width(&mut self, width: f32)
sourcepub fn scale_height(&mut self, height: f32)
pub fn scale_height(&mut self, height: f32)
sourcepub fn scale_depth(&mut self, depth: f32)
pub fn scale_depth(&mut self, depth: f32)
sourcepub fn scale_uniform(&mut self, scale: f32)
pub fn scale_uniform(&mut self, scale: f32)
Scales the transform uniformly by the given scale factor
§Parameters
scale- The scale factor to apply to the transform
Trait Implementations§
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)