pub trait IsMatrix {
// Required method
fn to_scale_rotation_translation_or_id(&self) -> (Vec3, Quat, Vec3);
}
Expand description
Additional/replacement methods for glam matrix types.
These are required because naga
(wgpu
’s translation layer) doesn’t like
certain contstants like f32::INFINITY
or f32::NaN
, which cause errors in
naga’s WGSL output.
See this issue and crate::linkage::test
for more info.
Required Methods§
Sourcefn to_scale_rotation_translation_or_id(&self) -> (Vec3, Quat, Vec3)
fn to_scale_rotation_translation_or_id(&self) -> (Vec3, Quat, Vec3)
Extracts scale
, rotation
and translation
from self
. The input
matrix is expected to be a 3D affine transformation matrix otherwise
the output will be invalid.
Will return (Vec3::ONE, Quat::IDENTITY, Vec3::ZERO)
if the determinant
of self
is zero or if the resulting scale vector contains any zero
elements when glam_assert
is enabled.
This is required instead of using
glam::Mat4::to_scale_rotation_translation
, because that uses
f32::signum, which compares against f32::NAN
, which causes an error
in naga’s WGSL output.
See this issue and crate::linkage::test
for more info.