#[repr(C)]pub struct Matrix4x4 {}Expand description
A 4x4 matrix (a three-dimensional transform).
The layout is the one of the reference runtime and is relied on when the
value is passed to a graphics API by address: sixteen consecutive singles
in row order (m11 to m14, then the second, third and fourth row).
Fields§
§m11: f32The first element of the first row.
m12: f32The second element of the first row.
m13: f32The third element of the first row.
m14: f32The fourth element of the first row.
m21: f32The first element of the second row.
m22: f32The second element of the second row.
m23: f32The third element of the second row.
m24: f32The fourth element of the second row.
m31: f32The first element of the third row.
m32: f32The second element of the third row.
m33: f32The third element of the third row.
m34: f32The fourth element of the third row.
m41: f32The first element of the fourth row.
m42: f32The second element of the fourth row.
m43: f32The third element of the fourth row.
m44: f32The fourth element of the fourth row.
Implementations§
Source§impl Matrix4x4
impl Matrix4x4
Sourcepub const fn new(
m11: f32,
m12: f32,
m13: f32,
m14: f32,
m21: f32,
m22: f32,
m23: f32,
m24: f32,
m31: f32,
m32: f32,
m33: f32,
m34: f32,
m41: f32,
m42: f32,
m43: f32,
m44: f32,
) -> Self
pub const fn new( m11: f32, m12: f32, m13: f32, m14: f32, m21: f32, m22: f32, m23: f32, m24: f32, m31: f32, m32: f32, m33: f32, m34: f32, m41: f32, m42: f32, m43: f32, m44: f32, ) -> Self
Creates a 4x4 matrix from the specified components, given in row order.
Sourcepub const fn from_matrix3x2(value: Matrix3x2) -> Self
pub const fn from_matrix3x2(value: Matrix3x2) -> Self
Creates a 4x4 matrix from the specified 3x2 matrix.
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Indicates whether the current matrix is the identity matrix.
Sourcepub fn translation(&self) -> Vector3
pub fn translation(&self) -> Vector3
Gets the translation component of this matrix.
Sourcepub fn set_translation(&mut self, value: Vector3)
pub fn set_translation(&mut self, value: Vector3)
Sets the translation component of this matrix.
Sourcepub fn create_from_axis_angle(axis: Vector3, angle: f32) -> Matrix4x4
pub fn create_from_axis_angle(axis: Vector3, angle: f32) -> Matrix4x4
Creates a matrix that rotates around an arbitrary (unit) vector.
As in the reference runtime, the matrix is built from the quaternion of the rotation.
Sourcepub fn create_from_quaternion(quaternion: Quaternion) -> Matrix4x4
pub fn create_from_quaternion(quaternion: Quaternion) -> Matrix4x4
Creates a rotation matrix from the specified quaternion rotation value.
Sourcepub fn create_from_yaw_pitch_roll(yaw: f32, pitch: f32, roll: f32) -> Matrix4x4
pub fn create_from_yaw_pitch_roll(yaw: f32, pitch: f32, roll: f32) -> Matrix4x4
Creates a rotation matrix from the specified yaw, pitch, and roll.
Sourcepub fn create_look_at(
camera_position: Vector3,
camera_target: Vector3,
camera_up_vector: Vector3,
) -> Matrix4x4
pub fn create_look_at( camera_position: Vector3, camera_target: Vector3, camera_up_vector: Vector3, ) -> Matrix4x4
Creates a view matrix: a camera at camera_position that looks at
camera_target, with camera_up_vector as the direction that is up
from the camera’s point of view (right-handed).
As in the reference runtime, nothing is validated: a target at the position of the camera, or an up vector parallel to the direction of view, gives NaN components.
Sourcepub fn create_perspective_field_of_view(
field_of_view: f32,
aspect_ratio: f32,
near_plane_distance: f32,
far_plane_distance: f32,
) -> Matrix4x4
pub fn create_perspective_field_of_view( field_of_view: f32, aspect_ratio: f32, near_plane_distance: f32, far_plane_distance: f32, ) -> Matrix4x4
Creates a perspective projection matrix based on a field of view, aspect ratio, and near and far view plane distances (right-handed, with a depth range of zero to one).
field_of_view is the field of view in the y direction, in radians.
A far plane at positive infinity is accepted and gives the limit of
the matrix (m33 is -1 and m43 is -near_plane_distance).
§Panics
Panics where the reference runtime throws an
ArgumentOutOfRangeException: when field_of_view is less than or
equal to zero or greater than or equal to pi, when
near_plane_distance or far_plane_distance is less than or equal to
zero, and when near_plane_distance is greater than or equal to
far_plane_distance.
Sourcepub fn create_rotation_x(radians: f32) -> Matrix4x4
pub fn create_rotation_x(radians: f32) -> Matrix4x4
Creates a matrix for rotating points around the X axis.
Sourcepub fn create_rotation_x_at(radians: f32, center_point: Vector3) -> Matrix4x4
pub fn create_rotation_x_at(radians: f32, center_point: Vector3) -> Matrix4x4
Creates a matrix for rotating points around the X axis from a center point.
Sourcepub fn create_rotation_y(radians: f32) -> Matrix4x4
pub fn create_rotation_y(radians: f32) -> Matrix4x4
Creates a matrix for rotating points around the Y axis.
Sourcepub fn create_rotation_y_at(radians: f32, center_point: Vector3) -> Matrix4x4
pub fn create_rotation_y_at(radians: f32, center_point: Vector3) -> Matrix4x4
Creates a matrix for rotating points around the Y axis from a center point.
Sourcepub fn create_rotation_z(radians: f32) -> Matrix4x4
pub fn create_rotation_z(radians: f32) -> Matrix4x4
Creates a matrix for rotating points around the Z axis.
Sourcepub fn create_rotation_z_at(radians: f32, center_point: Vector3) -> Matrix4x4
pub fn create_rotation_z_at(radians: f32, center_point: Vector3) -> Matrix4x4
Creates a matrix for rotating points around the Z axis from a center point.
Sourcepub fn create_scale(scales: Vector3) -> Matrix4x4
pub fn create_scale(scales: Vector3) -> Matrix4x4
Creates a scaling matrix from the specified vector scale.
Sourcepub fn create_scale_xyz(x_scale: f32, y_scale: f32, z_scale: f32) -> Matrix4x4
pub fn create_scale_xyz(x_scale: f32, y_scale: f32, z_scale: f32) -> Matrix4x4
Creates a scaling matrix from the specified X, Y, and Z components.
Sourcepub fn create_scale_uniform(scale: f32) -> Matrix4x4
pub fn create_scale_uniform(scale: f32) -> Matrix4x4
Creates a uniform scaling matrix that scales equally on each axis.
Sourcepub fn create_scale_at(scales: Vector3, center_point: Vector3) -> Matrix4x4
pub fn create_scale_at(scales: Vector3, center_point: Vector3) -> Matrix4x4
Creates a scaling matrix with a center point.
Sourcepub fn create_translation(position: Vector3) -> Matrix4x4
pub fn create_translation(position: Vector3) -> Matrix4x4
Creates a translation matrix from the specified 3-dimensional vector.
Sourcepub fn create_translation_xyz(
x_position: f32,
y_position: f32,
z_position: f32,
) -> Matrix4x4
pub fn create_translation_xyz( x_position: f32, y_position: f32, z_position: f32, ) -> Matrix4x4
Creates a translation matrix from the specified X, Y, and Z components.
Sourcepub fn get_determinant(&self) -> f32
pub fn get_determinant(&self) -> f32
Calculates the determinant of the current 4x4 matrix.
Sourcepub fn invert(matrix: Matrix4x4) -> Option<Matrix4x4>
pub fn invert(matrix: Matrix4x4) -> Option<Matrix4x4>
Tries to invert the specified matrix. Returns None when the matrix is
singular; see Matrix4x4::invert_or_nan for the value the reference
runtime stores in that case.
Sourcepub fn invert_or_nan(matrix: Matrix4x4) -> Matrix4x4
pub fn invert_or_nan(matrix: Matrix4x4) -> Matrix4x4
Inverts the specified matrix; a singular matrix gives a matrix whose
components are all NaN (the out value of the reference runtime).
Trait Implementations§
Source§impl BatchValue for Matrix4x4
impl BatchValue for Matrix4x4
impl Copy for Matrix4x4
Source§impl ExpressionVariantValue for Matrix4x4
impl ExpressionVariantValue for Matrix4x4
Source§const FFI_VARIANT_TYPE: Option<VariantType>
const FFI_VARIANT_TYPE: Option<VariantType>
None when the type cannot be a foreign function parameter.Source§fn try_from_variant(v: &ExpressionVariant) -> Option<Self>
fn try_from_variant(v: &ExpressionVariant) -> Option<Self>
Source§fn into_variant(self) -> ExpressionVariant
fn into_variant(self) -> ExpressionVariant
Source§impl From<Matrix4x4> for ExpressionVariant
impl From<Matrix4x4> for ExpressionVariant
Source§fn from(value: Matrix4x4) -> ExpressionVariant
fn from(value: Matrix4x4) -> ExpressionVariant
impl StructuralPartialEq for Matrix4x4
Auto Trait Implementations§
impl Freeze for Matrix4x4
impl RefUnwindSafe for Matrix4x4
impl Send for Matrix4x4
impl Sync for Matrix4x4
impl Unpin for Matrix4x4
impl UnsafeUnpin for Matrix4x4
impl UnwindSafe for Matrix4x4
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more