add some missing non-square matrix funcs

This commit is contained in:
Recep Aslantas
2023-07-22 01:21:14 +03:00
parent cb4a1b2677
commit 1e077fd125
19 changed files with 304 additions and 3 deletions

View File

@@ -13,6 +13,14 @@ extern "C" {
#include "../cglm.h"
CGLM_EXPORT
void
glmc_mat2x3_copy(mat2x3 mat, mat2x3 dest);
CGLM_EXPORT
void
glmc_mat2x3_zero(mat2x3 mat);
CGLM_EXPORT
void
glmc_mat2x3_make(float * __restrict src, mat2x3 dest);

View File

@@ -13,6 +13,14 @@ extern "C" {
#include "../cglm.h"
CGLM_EXPORT
void
glmc_mat2x4_copy(mat2x4 mat, mat2x4 dest);
CGLM_EXPORT
void
glmc_mat2x4_zero(mat2x4 mat);
CGLM_EXPORT
void
glmc_mat2x4_make(float * __restrict src, mat2x4 dest);

View File

@@ -13,6 +13,14 @@ extern "C" {
#include "../cglm.h"
CGLM_EXPORT
void
glmc_mat3x2_copy(mat3x2 mat, mat3x2 dest);
CGLM_EXPORT
void
glmc_mat3x2_zero(mat3x2 mat);
CGLM_EXPORT
void
glmc_mat3x2_make(float * __restrict src, mat3x2 dest);

View File

@@ -13,6 +13,14 @@ extern "C" {
#include "../cglm.h"
CGLM_EXPORT
void
glmc_mat3x4_copy(mat3x4 mat, mat3x4 dest);
CGLM_EXPORT
void
glmc_mat3x4_zero(mat3x4 mat);
CGLM_EXPORT
void
glmc_mat3x4_make(float * __restrict src, mat3x4 dest);

View File

@@ -13,6 +13,14 @@ extern "C" {
#include "../cglm.h"
CGLM_EXPORT
void
glmc_mat4x2_copy(mat4x2 mat, mat4x2 dest);
CGLM_EXPORT
void
glmc_mat4x2_zero(mat4x2 mat);
CGLM_EXPORT
void
glmc_mat4x2_make(float * __restrict src, mat4x2 dest);

View File

@@ -13,6 +13,14 @@ extern "C" {
#include "../cglm.h"
CGLM_EXPORT
void
glmc_mat4x3_copy(mat4x3 mat, mat4x3 dest);
CGLM_EXPORT
void
glmc_mat4x3_zero(mat4x3 mat);
CGLM_EXPORT
void
glmc_mat4x3_make(float * __restrict src, mat4x3 dest);

View File

@@ -24,6 +24,36 @@
/* for C only */
#define GLM_MAT2X3_ZERO GLM_MAT2X3_ZERO_INIT
/*!
* @brief copy all members of [mat] to [dest]
*
* @param[in] mat source
* @param[out] dest destination
*/
CGLM_INLINE
void
glm_mat2x3_copy(mat2x3 mat, mat2x3 dest) {
dest[0][0] = mat[0][0];
dest[0][1] = mat[0][1];
dest[0][2] = mat[0][2];
dest[1][0] = mat[1][0];
dest[1][1] = mat[1][1];
dest[1][2] = mat[1][2];
}
/*!
* @brief make given matrix zero.
*
* @param[in, out] mat matrix
*/
CGLM_INLINE
void
glm_mat2x3_zero(mat2x3 mat) {
CGLM_ALIGN_MAT mat2x3 t = GLM_MAT2X3_ZERO_INIT;
glm_mat2x3_copy(t, mat);
}
/*!
* @brief Create mat2x3 matrix from pointer
*

View File

@@ -18,12 +18,38 @@
#define cglm_mat2x4_h
#include "common.h"
#include "vec4.h"
#define GLM_MAT2X4_ZERO_INIT {{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}}
/* for C only */
#define GLM_MAT2X4_ZERO GLM_MAT2X4_ZERO_INIT
/*!
* @brief copy all members of [mat] to [dest]
*
* @param[in] mat source
* @param[out] dest destination
*/
CGLM_INLINE
void
glm_mat2x4_copy(mat2x4 mat, mat2x4 dest) {
glm_vec4_ucopy(mat[0], dest[0]);
glm_vec4_ucopy(mat[1], dest[1]);
}
/*!
* @brief make given matrix zero.
*
* @param[in, out] mat matrix
*/
CGLM_INLINE
void
glm_mat2x4_zero(mat2x4 mat) {
CGLM_ALIGN_MAT mat2x4 t = GLM_MAT2X4_ZERO_INIT;
glm_mat2x4_copy(t, mat);
}
/*!
* @brief Create mat2x4 matrix from pointer
*

View File

@@ -24,6 +24,37 @@
/* for C only */
#define GLM_MAT3X2_ZERO GLM_MAT3X2_ZERO_INIT
/*!
* @brief copy all members of [mat] to [dest]
*
* @param[in] mat source
* @param[out] dest destination
*/
CGLM_INLINE
void
glm_mat3x2_copy(mat3x2 mat, mat3x2 dest) {
dest[0][0] = mat[0][0];
dest[0][1] = mat[0][1];
dest[1][0] = mat[1][0];
dest[1][1] = mat[1][1];
dest[2][0] = mat[2][0];
dest[2][1] = mat[2][1];
}
/*!
* @brief make given matrix zero.
*
* @param[in, out] mat matrix
*/
CGLM_INLINE
void
glm_mat3x2_zero(mat3x2 mat) {
CGLM_ALIGN_MAT mat3x2 t = GLM_MAT3X2_ZERO_INIT;
glm_mat3x2_copy(t, mat);
}
/*!
* @brief Create mat3x2 matrix from pointer
*

View File

@@ -26,6 +26,32 @@
/* for C only */
#define GLM_MAT3X4_ZERO GLM_MAT3X4_ZERO_INIT
/*!
* @brief copy all members of [mat] to [dest]
*
* @param[in] mat source
* @param[out] dest destination
*/
CGLM_INLINE
void
glm_mat3x4_copy(mat3x4 mat, mat3x4 dest) {
glm_vec4_ucopy(mat[0], dest[0]);
glm_vec4_ucopy(mat[1], dest[1]);
glm_vec4_ucopy(mat[2], dest[2]);
}
/*!
* @brief make given matrix zero.
*
* @param[in, out] mat matrix
*/
CGLM_INLINE
void
glm_mat3x4_zero(mat3x4 mat) {
CGLM_ALIGN_MAT mat3x4 t = GLM_MAT3X4_ZERO_INIT;
glm_mat3x4_copy(t, mat);
}
/*!
* @brief Create mat3x4 matrix from pointer
*

View File

@@ -24,6 +24,40 @@
/* for C only */
#define GLM_MAT4X2_ZERO GLM_MAT4X2_ZERO_INIT
/*!
* @brief copy all members of [mat] to [dest]
*
* @param[in] mat source
* @param[out] dest destination
*/
CGLM_INLINE
void
glm_mat4x2_copy(mat4x2 mat, mat4x2 dest) {
dest[0][0] = mat[0][0];
dest[0][1] = mat[0][1];
dest[1][0] = mat[1][0];
dest[1][1] = mat[1][1];
dest[2][0] = mat[2][0];
dest[2][1] = mat[2][1];
dest[3][0] = mat[3][0];
dest[3][1] = mat[3][1];
}
/*!
* @brief make given matrix zero.
*
* @param[in, out] mat matrix
*/
CGLM_INLINE
void
glm_mat4x2_zero(mat4x2 mat) {
CGLM_ALIGN_MAT mat4x2 t = GLM_MAT4X2_ZERO_INIT;
glm_mat4x2_copy(t, mat);
}
/*!
* @brief Create mat4x2 matrix from pointer
*

View File

@@ -25,6 +25,40 @@
/* for C only */
#define GLM_MAT4X3_ZERO GLM_MAT4X3_ZERO_INIT
/*!
* @brief copy all members of [mat] to [dest]
*
* @param[in] mat source
* @param[out] dest destination
*/
CGLM_INLINE
void
glm_mat4x3_copy(mat4x3 mat, mat4x3 dest) {
dest[0][0] = mat[0][0];
dest[0][1] = mat[0][1];
dest[1][0] = mat[1][0];
dest[1][1] = mat[1][1];
dest[2][0] = mat[2][0];
dest[2][1] = mat[2][1];
dest[3][0] = mat[3][0];
dest[3][1] = mat[3][1];
}
/*!
* @brief make given matrix zero.
*
* @param[in, out] mat matrix
*/
CGLM_INLINE
void
glm_mat4x3_zero(mat4x3 mat) {
CGLM_ALIGN_MAT mat4x3 t = GLM_MAT4X3_ZERO_INIT;
glm_mat4x3_copy(t, mat);
}
/*!
* @brief Create mat4x3 matrix from pointer
*

View File

@@ -8,6 +8,18 @@
#include "../include/cglm/cglm.h"
#include "../include/cglm/call.h"
CGLM_EXPORT
void
glmc_mat2x3_copy(mat2x3 mat, mat2x3 dest) {
glm_mat2x3_copy(mat, dest);
}
CGLM_EXPORT
void
glmc_mat2x3_zero(mat2x3 mat) {
glm_mat2x3_zero(mat);
}
CGLM_EXPORT
void
glmc_mat2x3_make(float * __restrict src, mat2x3 dest) {

View File

@@ -8,6 +8,18 @@
#include "../include/cglm/cglm.h"
#include "../include/cglm/call.h"
CGLM_EXPORT
void
glmc_mat2x4_copy(mat2x4 mat, mat2x4 dest) {
glm_mat2x4_copy(mat, dest);
}
CGLM_EXPORT
void
glmc_mat2x4_zero(mat2x4 mat) {
glm_mat2x4_zero(mat);
}
CGLM_EXPORT
void
glmc_mat2x4_make(float * __restrict src, mat2x4 dest) {

View File

@@ -8,6 +8,18 @@
#include "../include/cglm/cglm.h"
#include "../include/cglm/call.h"
CGLM_EXPORT
void
glmc_mat3x2_copy(mat3x2 mat, mat3x2 dest) {
glm_mat3x2_copy(mat, dest);
}
CGLM_EXPORT
void
glmc_mat3x2_zero(mat3x2 mat) {
glm_mat3x2_zero(mat);
}
CGLM_EXPORT
void
glmc_mat3x2_make(float * __restrict src, mat3x2 dest) {

View File

@@ -8,6 +8,18 @@
#include "../include/cglm/cglm.h"
#include "../include/cglm/call.h"
CGLM_EXPORT
void
glmc_mat3x4_copy(mat3x4 mat, mat3x4 dest) {
glm_mat3x4_copy(mat, dest);
}
CGLM_EXPORT
void
glmc_mat3x4_zero(mat3x4 mat) {
glm_mat3x4_zero(mat);
}
CGLM_EXPORT
void
glmc_mat3x4_make(float * __restrict src, mat3x4 dest) {

View File

@@ -8,6 +8,18 @@
#include "../include/cglm/cglm.h"
#include "../include/cglm/call.h"
CGLM_EXPORT
void
glmc_mat4x2_copy(mat4x2 mat, mat4x2 dest) {
glm_mat4x2_copy(mat, dest);
}
CGLM_EXPORT
void
glmc_mat4x2_zero(mat4x2 mat) {
glm_mat4x2_zero(mat);
}
CGLM_EXPORT
void
glmc_mat4x2_make(float * __restrict src, mat4x2 dest) {

View File

@@ -8,6 +8,18 @@
#include "../include/cglm/cglm.h"
#include "../include/cglm/call.h"
CGLM_EXPORT
void
glmc_mat4x3_copy(mat4x3 mat, mat4x3 dest) {
glm_mat4x3_copy(mat, dest);
}
CGLM_EXPORT
void
glmc_mat4x3_zero(mat4x3 mat) {
glm_mat4x3_zero(mat);
}
CGLM_EXPORT
void
glmc_mat4x3_make(float * __restrict src, mat4x3 dest) {