Merge branch 'master' into vec2_mat2

This commit is contained in:
Recep Aslantas
2020-02-23 13:10:36 +03:00
75 changed files with 8194 additions and 1305 deletions

View File

@@ -16,7 +16,7 @@
CGLM_INLINE mat4s glms_scale_make(vec3s v);
CGLM_INLINE mat4s glms_scale(mat4s m, vec3s v);
CGLM_INLINE mat4s glms_scale_uni(mat4s m, float s);
CGLM_INLINE mat4s glmx_rotate_x(mat4s m, float angle);
CGLM_INLINE mat4s glms_rotate_x(mat4s m, float angle);
CGLM_INLINE mat4s glms_rotate_y(mat4s m, float angle);
CGLM_INLINE mat4s glms_rotate_z(mat4s m, float angle);
CGLM_INLINE mat4s glms_rotate_make(float angle, vec3s axis);
@@ -169,7 +169,7 @@ glms_scale_uni(mat4s m, float s) {
*/
CGLM_INLINE
mat4s
glmx_rotate_x(mat4s m, float angle) {
glms_rotate_x(mat4s m, float angle) {
mat4s r;
glm_rotate_x(m.raw, angle, r.raw);
return r;

View File

@@ -14,9 +14,9 @@
Functions:
CGLM_INLINE mat3s glms_mat3_copy(mat3s mat);
CGLM_INLINE mat3s glms_mat3_identity();
CGLM_INLINE mat3s glms_mat3_identity(void);
CGLM_INLINE void glms_mat3_identity_array(mat3s * __restrict mat, size_t count);
CGLM_INLINE mat3s glms_mat3_zero();
CGLM_INLINE mat3s glms_mat3_zero(void);
CGLM_INLINE mat3s glms_mat3_mul(mat3s m1, mat3s m2);
CGLM_INLINE ma3s glms_mat3_transpose(mat3s m);
CGLM_INLINE vec3s glms_mat3_mulv(mat3s m, vec3s v);
@@ -38,12 +38,8 @@
#include "../mat3.h"
#include "vec3.h"
#define GLMS_MAT3_IDENTITY_INIT {1.0f, 0.0f, 0.0f, \
0.0f, 1.0f, 0.0f, \
0.0f, 0.0f, 1.0f}
#define GLMS_MAT3_ZERO_INIT {0.0f, 0.0f, 0.0f, \
0.0f, 0.0f, 0.0f, \
0.0f, 0.0f, 0.0f}
#define GLMS_MAT3_IDENTITY_INIT {GLM_MAT3_IDENTITY_INIT}
#define GLMS_MAT3_ZERO_INIT {GLM_MAT3_ZERO_INIT}
/* for C only */
#define GLMS_MAT3_IDENTITY ((mat3s)GLMS_MAT3_IDENTITY_INIT)
@@ -79,7 +75,7 @@ glms_mat3_copy(mat3s mat) {
*/
CGLM_INLINE
mat3s
glms_mat3_identity() {
glms_mat3_identity(void) {
mat3s r;
glm_mat3_identity(r.raw);
return r;
@@ -111,7 +107,7 @@ glms_mat3_identity_array(mat3s * __restrict mat, size_t count) {
*/
CGLM_INLINE
mat3s
glms_mat3_zero() {
glms_mat3_zero(void) {
mat3s r;
glm_mat3_zero(r.raw);
return r;

View File

@@ -20,9 +20,9 @@
Functions:
CGLM_INLINE mat4s glms_mat4_ucopy(mat4s mat);
CGLM_INLINE mat4s glms_mat4_copy(mat4s mat);
CGLM_INLINE mat4s glms_mat4_identity();
CGLM_INLINE mat4s glms_mat4_identity(void);
CGLM_INLINE void glms_mat4_identity_array(mat4s * __restrict mat, size_t count);
CGLM_INLINE mat4s glms_mat4_zero();
CGLM_INLINE mat4s glms_mat4_zero(void);
CGLM_INLINE mat3s glms_mat4_pick3(mat4s mat);
CGLM_INLINE mat3s glms_mat4_pick3t(mat4s mat);
CGLM_INLINE mat4s glms_mat4_ins3(mat3s mat);
@@ -53,15 +53,8 @@
#include "vec4.h"
#include "vec3.h"
#define GLMS_MAT4_IDENTITY_INIT {1.0f, 0.0f, 0.0f, 0.0f, \
0.0f, 1.0f, 0.0f, 0.0f, \
0.0f, 0.0f, 1.0f, 0.0f, \
0.0f, 0.0f, 0.0f, 1.0f}
#define GLMS_MAT4_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, \
0.0f, 0.0f, 0.0f, 0.0f}
#define GLMS_MAT4_IDENTITY_INIT {GLM_MAT4_IDENTITY_INIT}
#define GLMS_MAT4_ZERO_INIT {GLM_MAT4_ZERO_INIT}
/* for C only */
#define GLMS_MAT4_IDENTITY ((mat4s)GLMS_MAT4_IDENTITY_INIT)
@@ -114,7 +107,7 @@ glms_mat4_copy(mat4s mat) {
*/
CGLM_INLINE
mat4s
glms_mat4_identity() {
glms_mat4_identity(void) {
mat4s r;
glm_mat4_identity(r.raw);
return r;
@@ -146,7 +139,7 @@ glms_mat4_identity_array(mat4s * __restrict mat, size_t count) {
*/
CGLM_INLINE
mat4s
glms_mat4_zero() {
glms_mat4_zero(void) {
mat4s r;
glm_mat4_zero(r.raw);
return r;

View File

@@ -11,7 +11,7 @@
GLMS_QUAT_IDENTITY
Functions:
CGLM_INLINE versors glms_quat_identity()
CGLM_INLINE versors glms_quat_identity(void)
CGLM_INLINE void glms_quat_identity_array(versor *q, size_t count)
CGLM_INLINE versors glms_quat_init(float x, float y, float z, float w)
CGLM_INLINE versors glms_quatv(float angle, vec3s axis)
@@ -62,7 +62,7 @@
* ----------------------------------------------------------------------------
*/
#define GLMS_QUAT_IDENTITY_INIT GLM_QUAT_IDENTITY_INIT
#define GLMS_QUAT_IDENTITY_INIT {GLM_QUAT_IDENTITY_INIT}
#define GLMS_QUAT_IDENTITY ((versors)GLMS_QUAT_IDENTITY_INIT)
/*!
@@ -72,7 +72,7 @@
*/
CGLM_INLINE
versors
glms_quat_identity() {
glms_quat_identity(void) {
versors dest;
glm_quat_identity(dest.raw);
return dest;
@@ -251,7 +251,7 @@ CGLM_INLINE
vec3s
glms_quat_imagn(versors q) {
vec3s dest;
glm_normalize_to(q.imag.raw, dest.raw);
glm_normalize_to(q.raw, dest.raw);
return dest;
}
@@ -437,15 +437,14 @@ glms_quat_look(vec3s eye, versors ori) {
* @brief creates look rotation quaternion
*
* @param[in] dir direction to look
* @param[in] fwd forward vector
* @param[in] up up vector
* @returns destination quaternion
*/
CGLM_INLINE
versors
glms_quat_for(vec3s dir, vec3s fwd, vec3s up) {
glms_quat_for(vec3s dir, vec3s up) {
versors dest;
glm_quat_for(dir.raw, fwd.raw, up.raw, dest.raw);
glm_quat_for(dir.raw, up.raw, dest.raw);
return dest;
}
@@ -455,15 +454,14 @@ glms_quat_for(vec3s dir, vec3s fwd, vec3s up) {
*
* @param[in] from source point
* @param[in] to destination point
* @param[in] fwd forward vector
* @param[in] up up vector
* @returns destination quaternion
*/
CGLM_INLINE
versors
glms_quat_forp(vec3s from, vec3s to, vec3s fwd, vec3s up) {
glms_quat_forp(vec3s from, vec3s to, vec3s up) {
versors dest;
glm_quat_forp(from.raw, to.raw, fwd.raw, up.raw, dest.raw);
glm_quat_forp(from.raw, to.raw, up.raw, dest.raw);
return dest;
}

View File

@@ -19,8 +19,8 @@
CGLM_INLINE vec3s glms_vec3(vec4s v4);
CGLM_INLINE void glms_vec3_pack(vec3s dst[], vec3 src[], size_t len);
CGLM_INLINE void glms_vec3_unpack(vec3 dst[], vec3s src[], size_t len);
CGLM_INLINE vec3s glms_vec3_zero();
CGLM_INLINE vec3s glms_vec3_one();
CGLM_INLINE vec3s glms_vec3_zero(void);
CGLM_INLINE vec3s glms_vec3_one(void);
CGLM_INLINE float glms_vec3_dot(vec3s a, vec3s b);
CGLM_INLINE float glms_vec3_norm2(vec3s v);
CGLM_INLINE float glms_vec3_norm(vec3s v);
@@ -86,15 +86,15 @@
#include "../vec3.h"
#include "vec3-ext.h"
#define GLMS_VEC3_ONE_INIT {1.0f, 1.0f, 1.0f}
#define GLMS_VEC3_ZERO_INIT {0.0f, 0.0f, 0.0f}
#define GLMS_VEC3_ONE_INIT {GLM_VEC3_ONE_INIT}
#define GLMS_VEC3_ZERO_INIT {GLM_VEC3_ZERO_INIT}
#define GLMS_VEC3_ONE ((vec3s)GLMS_VEC3_ONE_INIT)
#define GLMS_VEC3_ZERO ((vec3s)GLMS_VEC3_ZERO_INIT)
#define GLMS_YUP ((vec3s){0.0f, 1.0f, 0.0f})
#define GLMS_ZUP ((vec3s){0.0f, 0.0f, 1.0f})
#define GLMS_XUP ((vec3s){1.0f, 0.0f, 0.0f})
#define GLMS_YUP ((vec3s){{0.0f, 1.0f, 0.0f}})
#define GLMS_ZUP ((vec3s){{0.0f, 0.0f, 1.0f}})
#define GLMS_XUP ((vec3s){{1.0f, 0.0f, 0.0f}})
/*!
* @brief init vec3 using vec4
@@ -151,7 +151,7 @@ glms_vec3_unpack(vec3 dst[], vec3s src[], size_t len) {
*/
CGLM_INLINE
vec3s
glms_vec3_zero() {
glms_vec3_zero(void) {
vec3s r;
glm_vec3_zero(r.raw);
return r;
@@ -164,7 +164,7 @@ glms_vec3_zero() {
*/
CGLM_INLINE
vec3s
glms_vec3_one() {
glms_vec3_one(void) {
vec3s r;
glm_vec3_one(r.raw);
return r;

View File

@@ -7,12 +7,12 @@
/*
Macros:
GLM_VEC4_ONE_INIT
GLM_VEC4_BLACK_INIT
GLM_VEC4_ZERO_INIT
GLM_VEC4_ONE
GLM_VEC4_BLACK
GLM_VEC4_ZERO
GLMS_VEC4_ONE_INIT
GLMS_VEC4_BLACK_INIT
GLMS_VEC4_ZERO_INIT
GLMS_VEC4_ONE
GLMS_VEC4_BLACK
GLMS_VEC4_ZERO
Functions:
CGLM_INLINE vec4s glms_vec4(vec3s v3, float last);
@@ -72,9 +72,9 @@
#include "../vec4.h"
#include "vec4-ext.h"
#define GLMS_VEC4_ONE_INIT {1.0f, 1.0f, 1.0f, 1.0f}
#define GLMS_VEC4_BLACK_INIT {0.0f, 0.0f, 0.0f, 1.0f}
#define GLMS_VEC4_ZERO_INIT {0.0f, 0.0f, 0.0f, 0.0f}
#define GLMS_VEC4_ONE_INIT {GLM_VEC4_ONE_INIT}
#define GLMS_VEC4_BLACK_INIT {GLM_VEC4_BLACK_INIT}
#define GLMS_VEC4_ZERO_INIT {GLM_VEC4_ZERO_INIT}
#define GLMS_VEC4_ONE ((vec4s)GLM_VEC4_ONE_INIT)
#define GLMS_VEC4_BLACK ((vec4s)GLM_VEC4_BLACK_INIT)
@@ -180,7 +180,7 @@ glms_vec4_unpack(vec4 dst[], vec4s src[], size_t len) {
*/
CGLM_INLINE
vec4s
glms_vec4_zero() {
glms_vec4_zero(void) {
vec4s r;
glm_vec4_zero(r.raw);
return r;
@@ -193,7 +193,7 @@ glms_vec4_zero() {
*/
CGLM_INLINE
vec4s
glms_vec4_one() {
glms_vec4_one(void) {
vec4s r;
glm_vec4_one(r.raw);
return r;