Skip to content

Commit cca4d42

Browse files
author
kevyuu
committed
Make rotation matrix 3x3
1 parent 14c379b commit cca4d42

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

include/nbl/builtin/hlsl/math/linalg/transform.hlsl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ namespace linalg
2626
///
2727
/// @tparam T A floating-point scalar type
2828
template <typename T>
29-
matrix<T, 4, 4> rotation_mat(T angle, vector<T, 3> const& axis)
29+
matrix<T, 3, 3> rotation_mat(T angle, vector<T, 3> const& axis)
3030
{
3131
T const a = angle;
3232
T const c = cos(a);
3333
T const s = sin(a);
3434

3535
vector<T, 3> temp((T(1) - c) * axis);
3636

37-
matrix<T, 4, 4> rotation;
37+
matrix<T, 3, 3> rotation;
3838
rotation[0][0] = c + temp[0] * axis[0];
3939
rotation[0][1] = temp[1] * axis[0] - s * axis[2];
4040
rotation[0][2] = temp[2] * axis[0] + s * axis[1];
@@ -47,8 +47,6 @@ matrix<T, 4, 4> rotation_mat(T angle, vector<T, 3> const& axis)
4747
rotation[2][1] = temp[1] * axis[2] + s * axis[0];
4848
rotation[2][2] = c + temp[2] * axis[2];
4949

50-
rotation[3][3] = 1;
51-
5250
return rotation;
5351
}
5452

0 commit comments

Comments
 (0)