mirror of
https://github.com/recp/cglm.git
synced 2025-12-24 20:34:58 +00:00
add new matrix mat2x4
Initial function being glm_mat2x4_make Signed-off-by: Vincent Davis Jr <vince@underview.tech>
This commit is contained in:
@@ -20,6 +20,7 @@ extern "C" {
|
||||
#include "call/ivec4.h"
|
||||
#include "call/mat2.h"
|
||||
#include "call/mat2x3.h"
|
||||
#include "call/mat2x4.h"
|
||||
#include "call/mat3.h"
|
||||
#include "call/mat4.h"
|
||||
#include "call/affine.h"
|
||||
|
||||
23
include/cglm/call/mat2x4.h
Normal file
23
include/cglm/call/mat2x4.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c), Recep Aslantas.
|
||||
*
|
||||
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||
* Full license can be found in the LICENSE file
|
||||
*/
|
||||
|
||||
#ifndef cglmc_mat2x4_h
|
||||
#define cglmc_mat2x4_h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../cglm.h"
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_mat2x4_make(float * __restrict src, mat2x4 dest);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* cglmc_mat2x4_h */
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "mat3.h"
|
||||
#include "mat2.h"
|
||||
#include "mat2x3.h"
|
||||
#include "mat2x4.h"
|
||||
#include "affine.h"
|
||||
#include "cam.h"
|
||||
#include "frustum.h"
|
||||
|
||||
47
include/cglm/mat2x4.h
Normal file
47
include/cglm/mat2x4.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c), Recep Aslantas.
|
||||
*
|
||||
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||
* Full license can be found in the LICENSE file
|
||||
*/
|
||||
|
||||
/*
|
||||
Macros:
|
||||
GLM_MAT2X4_ZERO_INIT
|
||||
GLM_MAT2X4_ZERO
|
||||
|
||||
Functions:
|
||||
CGLM_INLINE void glm_mat2x4_make(float * restrict src, mat2x4 dest)
|
||||
*/
|
||||
|
||||
#ifndef cglm_mat2x4_h
|
||||
#define cglm_mat2x4_h
|
||||
|
||||
#include "common.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 Create mat2x4 matrix from pointer
|
||||
*
|
||||
* @param[in] src pointer to an array of floats
|
||||
* @param[out] dest matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_mat2x4_make(float * __restrict src, mat2x4 dest) {
|
||||
dest[0][0] = src[0];
|
||||
dest[0][1] = src[1];
|
||||
dest[0][2] = src[2];
|
||||
dest[0][3] = src[3];
|
||||
|
||||
dest[1][0] = src[4];
|
||||
dest[1][1] = src[5];
|
||||
dest[1][2] = src[6];
|
||||
dest[1][3] = src[7];
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -18,6 +18,7 @@ extern "C" {
|
||||
#include "struct/vec4.h"
|
||||
#include "struct/mat2.h"
|
||||
#include "struct/mat2x3.h"
|
||||
#include "struct/mat2x4.h"
|
||||
#include "struct/mat3.h"
|
||||
#include "struct/mat4.h"
|
||||
#include "struct/affine.h"
|
||||
|
||||
46
include/cglm/struct/mat2x4.h
Normal file
46
include/cglm/struct/mat2x4.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c), Recep Aslantas.
|
||||
*
|
||||
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||
* Full license can be found in the LICENSE file
|
||||
*/
|
||||
|
||||
/*
|
||||
Macros:
|
||||
GLMS_MAT2X4_ZERO_INIT
|
||||
GLMS_MAT2X4_ZERO
|
||||
|
||||
Functions:
|
||||
CGLM_INLINE float glms_mat2x4_make(float * __restrict src);
|
||||
*/
|
||||
|
||||
#ifndef cglms_mat2x4_h
|
||||
#define cglms_mat2x4_h
|
||||
|
||||
#include "../common.h"
|
||||
#include "../types-struct.h"
|
||||
#include "../mat2x4.h"
|
||||
|
||||
/* api definition */
|
||||
#define glms_mat2x4_(NAME) CGLM_STRUCTAPI(mat2x4, NAME)
|
||||
|
||||
#define GLMS_MAT2X4_ZERO_INIT {GLM_MAT2X4_ZERO_INIT}
|
||||
|
||||
/* for C only */
|
||||
#define GLMS_MAT2X4_ZERO ((mat2x4s)GLMS_MAT2X4_ZERO_INIT)
|
||||
|
||||
/*!
|
||||
* @brief Create mat2x4 matrix from pointer
|
||||
*
|
||||
* @param[in] src pointer to an array of floats
|
||||
* @return constructed matrix from raw pointer
|
||||
*/
|
||||
CGLM_INLINE
|
||||
mat2x4s
|
||||
glms_mat2x4_(make)(float * __restrict src) {
|
||||
mat2x4s r;
|
||||
glm_mat2x4_make(src, r.raw);
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* cglms_mat2x4_h */
|
||||
@@ -208,6 +208,17 @@ typedef union mat2x3s {
|
||||
#endif
|
||||
} mat2x3s;
|
||||
|
||||
typedef union mat2x4s {
|
||||
mat2x4 raw;
|
||||
vec4s col[2]; /* col -> row | [row (2), col (4)] */
|
||||
#if CGLM_USE_ANONYMOUS_STRUCT
|
||||
struct {
|
||||
float m00, m01, m02, m03;
|
||||
float m10, m11, m12, m13;
|
||||
};
|
||||
#endif
|
||||
} mat2x4s;
|
||||
|
||||
typedef union mat3s {
|
||||
mat3 raw;
|
||||
vec3s col[3];
|
||||
|
||||
@@ -57,6 +57,7 @@ typedef vec4 versor; /* |x, y, z, w| -> w is the last */
|
||||
typedef vec3 mat3[3];
|
||||
typedef CGLM_ALIGN_IF(16) vec2 mat2[2];
|
||||
typedef vec3 mat2x3[2]; /* [row (2), col (3)] */
|
||||
typedef vec4 mat2x4[2]; /* [row (2), col (4)] */
|
||||
typedef CGLM_ALIGN_MAT vec4 mat4[4];
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user