mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 09:08:53 +00:00
add some missing non-square matrix funcs
This commit is contained in:
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
*
|
||||
|
@@ -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
|
||||
*
|
||||
|
@@ -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
|
||||
*
|
||||
|
@@ -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
|
||||
*
|
||||
|
@@ -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
|
||||
*
|
||||
|
@@ -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
|
||||
*
|
||||
|
@@ -46,9 +46,9 @@
|
||||
#define CGLM_CASTPTR_ASSUME_ALIGNED(expr, type) \
|
||||
((type*)CGLM_ASSUME_ALIGNED((expr), __alignof__(type)))
|
||||
|
||||
typedef int ivec2[2];
|
||||
typedef int ivec3[3];
|
||||
typedef int ivec4[4];
|
||||
typedef int ivec2[2];
|
||||
typedef int ivec3[3];
|
||||
typedef int ivec4[4];
|
||||
|
||||
typedef float vec2[2];
|
||||
typedef float vec3[3];
|
||||
|
12
src/mat2x3.c
12
src/mat2x3.c
@@ -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) {
|
||||
|
12
src/mat2x4.c
12
src/mat2x4.c
@@ -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) {
|
||||
|
12
src/mat3x2.c
12
src/mat3x2.c
@@ -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) {
|
||||
|
12
src/mat3x4.c
12
src/mat3x4.c
@@ -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) {
|
||||
|
12
src/mat4x2.c
12
src/mat4x2.c
@@ -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) {
|
||||
|
12
src/mat4x3.c
12
src/mat4x3.c
@@ -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) {
|
||||
|
Reference in New Issue
Block a user