mirror of
https://github.com/recp/cglm.git
synced 2025-12-26 02:25:02 +00:00
add new matrix mat3x4
Initial function being glm_mat3x4_make Signed-off-by: Vincent Davis Jr <vince@underview.tech>
This commit is contained in:
@@ -23,6 +23,7 @@ extern "C" {
|
||||
#include "call/mat2x4.h"
|
||||
#include "call/mat3.h"
|
||||
#include "call/mat3x2.h"
|
||||
#include "call/mat3x4.h"
|
||||
#include "call/mat4.h"
|
||||
#include "call/affine.h"
|
||||
#include "call/cam.h"
|
||||
|
||||
23
include/cglm/call/mat3x4.h
Normal file
23
include/cglm/call/mat3x4.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_mat3x4_h
|
||||
#define cglmc_mat3x4_h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../cglm.h"
|
||||
|
||||
CGLM_EXPORT
|
||||
void
|
||||
glmc_mat3x4_make(float * __restrict src, mat3x4 dest);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* cglmc_mat3x4_h */
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "mat4.h"
|
||||
#include "mat3.h"
|
||||
#include "mat3x2.h"
|
||||
#include "mat3x4.h"
|
||||
#include "mat2.h"
|
||||
#include "mat2x3.h"
|
||||
#include "mat2x4.h"
|
||||
|
||||
54
include/cglm/mat3x4.h
Normal file
54
include/cglm/mat3x4.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c), Recep Aslantas.
|
||||
*
|
||||
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||
* Full license can be found in the LICENSE file
|
||||
*/
|
||||
|
||||
/*
|
||||
Macros:
|
||||
GLM_MAT3X4_ZERO_INIT
|
||||
GLM_MAT3X4_ZERO
|
||||
|
||||
Functions:
|
||||
CGLM_INLINE void glm_mat3x4_make(float * restrict src, mat3x4 dest)
|
||||
*/
|
||||
|
||||
#ifndef cglm_mat3x4_h
|
||||
#define cglm_mat3x4_h
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define GLM_MAT3X4_ZERO_INIT {{0.0f, 0.0f, 0.0f, 0.0f}, \
|
||||
{0.0f, 0.0f, 0.0f, 0.0f}, \
|
||||
{0.0f, 0.0f, 0.0f, 0.0f}}
|
||||
|
||||
/* for C only */
|
||||
#define GLM_MAT3X4_ZERO GLM_MAT3X4_ZERO_INIT
|
||||
|
||||
/*!
|
||||
* @brief Create mat3x4 matrix from pointer
|
||||
*
|
||||
* @param[in] src pointer to an array of floats
|
||||
* @param[out] dest matrix
|
||||
*/
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_mat3x4_make(float * __restrict src, mat3x4 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];
|
||||
|
||||
dest[2][0] = src[8];
|
||||
dest[2][1] = src[9];
|
||||
dest[2][2] = src[10];
|
||||
dest[2][3] = src[11];
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -21,6 +21,7 @@ extern "C" {
|
||||
#include "struct/mat2x4.h"
|
||||
#include "struct/mat3.h"
|
||||
#include "struct/mat3x2.h"
|
||||
#include "struct/mat3x4.h"
|
||||
#include "struct/mat4.h"
|
||||
#include "struct/affine.h"
|
||||
#include "struct/frustum.h"
|
||||
|
||||
46
include/cglm/struct/mat3x4.h
Normal file
46
include/cglm/struct/mat3x4.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_MAT3X4_ZERO_INIT
|
||||
GLMS_MAT3X4_ZERO
|
||||
|
||||
Functions:
|
||||
CGLM_INLINE mat3x4s glms_mat3x4_make(float * __restrict src);
|
||||
*/
|
||||
|
||||
#ifndef cglms_mat3x4_h
|
||||
#define cglms_mat3x4_h
|
||||
|
||||
#include "../common.h"
|
||||
#include "../types-struct.h"
|
||||
#include "../mat3x4.h"
|
||||
|
||||
/* api definition */
|
||||
#define glms_mat3x4_(NAME) CGLM_STRUCTAPI(mat3x4, NAME)
|
||||
|
||||
#define GLMS_MAT3X4_ZERO_INIT {GLM_MAT3X4_ZERO_INIT}
|
||||
|
||||
/* for C only */
|
||||
#define GLMS_MAT3X4_ZERO ((mat3x4s)GLMS_MAT3X4_ZERO_INIT)
|
||||
|
||||
/*!
|
||||
* @brief Create mat3x4 matrix from pointer
|
||||
*
|
||||
* @param[in] src pointer to an array of floats
|
||||
* @return constructed matrix from raw pointer
|
||||
*/
|
||||
CGLM_INLINE
|
||||
mat3x4s
|
||||
glms_mat3x4_(make)(float * __restrict src) {
|
||||
mat3x4s r;
|
||||
glm_mat3x4_make(src, r.raw);
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* cglms_mat3x4_h */
|
||||
@@ -243,6 +243,18 @@ typedef union mat3x2s {
|
||||
#endif
|
||||
} mat3x2s;
|
||||
|
||||
typedef union mat3x4s {
|
||||
mat3x4 raw;
|
||||
vec4s col[3]; /* [col (3), row (4)] */
|
||||
#if CGLM_USE_ANONYMOUS_STRUCT
|
||||
struct {
|
||||
float m00, m01, m02, m03;
|
||||
float m10, m11, m12, m13;
|
||||
float m20, m21, m22, m23;
|
||||
};
|
||||
#endif
|
||||
} mat3x4s;
|
||||
|
||||
typedef union CGLM_ALIGN_MAT mat4s {
|
||||
mat4 raw;
|
||||
vec4s col[4];
|
||||
|
||||
@@ -56,6 +56,7 @@ typedef CGLM_ALIGN_IF(16) float vec4[4];
|
||||
typedef vec4 versor; /* |x, y, z, w| -> w is the last */
|
||||
typedef vec3 mat3[3];
|
||||
typedef vec2 mat3x2[3]; /* [row (3), col (2)] */
|
||||
typedef vec4 mat3x4[3]; /* [col (3), row (4)] */
|
||||
typedef CGLM_ALIGN_IF(16) vec2 mat2[2];
|
||||
typedef vec3 mat2x3[2]; /* [row (2), col (3)] */
|
||||
typedef vec4 mat2x4[2]; /* [row (2), col (4)] */
|
||||
|
||||
Reference in New Issue
Block a user