diff options
Diffstat (limited to 'source/blender/blenlib/intern/math_matrix.c')
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 7c1b44978e2..e9d196ccdbb 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -2164,7 +2164,7 @@ void rotate_m4(float mat[4][4], const char axis, const float angle) } /** Scale a matrix in-place. */ -void rescale_m4(float mat[4][4], float scale[3]) +void rescale_m4(float mat[4][4], const float scale[3]) { mul_v3_fl(mat[0], scale[0]); mul_v3_fl(mat[1], scale[1]); @@ -2359,6 +2359,20 @@ bool equals_m4m4(const float mat1[4][4], const float mat2[4][4]) /** * Make a 4x4 matrix out of 3 transform components. * Matrices are made in the order: `scale * rot * loc` + */ +void loc_rot_size_to_mat4(float mat[4][4], + const float loc[3], + const float rot[3][3], + const float size[3]) +{ + copy_m4_m3(mat, rot); + rescale_m4(mat, size); + copy_v3_v3(mat[3], loc); +} + +/** + * Make a 4x4 matrix out of 3 transform components. + * Matrices are made in the order: `scale * rot * loc` * * TODO: need to have a version that allows for rotation order... */ |