From 6697039076217d63a74440ef46e17933955401c8 Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 2 Jul 2024 03:49:17 +0400 Subject: [PATCH] Optimize? rotation matrix calculation --- src/math/mat4x4.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/math/mat4x4.rs b/src/math/mat4x4.rs index 68adb40..3acdb9f 100644 --- a/src/math/mat4x4.rs +++ b/src/math/mat4x4.rs @@ -398,6 +398,10 @@ impl Mat4x4 { #[must_use] ///Creates a rotation matrix for the given euler angles pub fn rotation_matrix_euler(rotation: &Vec3) -> Self { + if rotation.x == 0.0 && rotation.y == 0.0 && rotation.z == 0.0 { + return IDENTITY; + } + let sin_x = rotation.x.to_radians().sin(); let cos_x = rotation.x.to_radians().cos();