Skip to content

Commit

Permalink
reduce glms_mat[4|3|2]_make()'s dest parameter
Browse files Browse the repository at this point in the history
the return value is the dest.
  • Loading branch information
recp committed May 16, 2023
1 parent 56d9e41 commit 530ec2d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
10 changes: 6 additions & 4 deletions include/cglm/struct/mat2.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
CGLM_INLINE void glms_mat2_swap_col(mat2 mat, int col1, int col2)
CGLM_INLINE void glms_mat2_swap_row(mat2 mat, int row1, int row2)
CGLM_INLINE float glms_mat2_rmc(vec2 r, mat2 m, vec2 c)
CGLM_INLINE float glms_mat42_make(float * __restrict src);
*/

#ifndef cglms_mat2_h
Expand Down Expand Up @@ -262,13 +263,14 @@ glms_mat2_(rmc)(vec2s r, mat2s m, vec2s c) {
* @brief Create mat2 matrix from pointer
*
* @param[in] src pointer to an array of floats
* @param[out] dest matrix
* @return constructed matrix from raw pointer
*/
CGLM_INLINE
mat2s
glms_mat2_(make)(float * __restrict src, mat2s dest) {
glm_mat2_make(src, dest.raw);
return dest;
glms_mat2_(make)(float * __restrict src) {
mat2s r;
glm_mat2_make(src, r.raw);
return r;
}

#endif /* cglms_mat2_h */
10 changes: 6 additions & 4 deletions include/cglm/struct/mat3.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
CGLM_INLINE mat3s glms_mat3_swap_col(mat3s mat, int col1, int col2);
CGLM_INLINE mat3s glms_mat3_swap_row(mat3s mat, int row1, int row2);
CGLM_INLINE float glms_mat3_rmc(vec3s r, mat3s m, vec3s c);
CGLM_INLINE float glms_mat3_make(float * __restrict src);
*/

#ifndef cglms_mat3s_h
Expand Down Expand Up @@ -289,13 +290,14 @@ glms_mat3_(rmc)(vec3s r, mat3s m, vec3s c) {
* @brief Create mat3 matrix from pointer
*
* @param[in] src pointer to an array of floats
* @param[out] dest matrix
* @return constructed matrix from raw pointer
*/
CGLM_INLINE
mat3s
glms_mat3_(make)(float * __restrict src, mat3s dest) {
glm_mat3_make(src, dest.raw);
return dest;
glms_mat3_(make)(float * __restrict src) {
mat3s r;
glm_mat3_make(src, r.raw);
return r;
}

#endif /* cglms_mat3s_h */
10 changes: 6 additions & 4 deletions include/cglm/struct/mat4.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
CGLM_INLINE mat4s glms_mat4_swap_col(mat4s mat, int col1, int col2);
CGLM_INLINE mat4s glms_mat4_swap_row(mat4s mat, int row1, int row2);
CGLM_INLINE float glms_mat4_rmc(vec4s r, mat4s m, vec4s c);
CGLM_INLINE float glms_mat4_make(float * __restrict src);
*/

#ifndef cglms_mat4s_h
Expand Down Expand Up @@ -463,13 +464,14 @@ glms_mat4_(rmc)(vec4s r, mat4s m, vec4s c) {
* @brief Create mat4 matrix from pointer
*
* @param[in] src pointer to an array of floats
* @param[out] dest matrix
* @return constructed matrix from raw pointer
*/
CGLM_INLINE
mat4s
glms_mat4_(make)(float * __restrict src, mat4s dest) {
glm_mat4_make(src, dest.raw);
return dest;
glms_mat4_(make)(float * __restrict src) {
mat4s r;
glm_mat4_make(src, r.raw);
return r;
}

#endif /* cglms_mat4s_h */

0 comments on commit 530ec2d

Please sign in to comment.