fix test build, supress warnings, update header guards for struct api

This commit is contained in:
Recep Aslantas
2019-06-03 12:54:27 +03:00
parent 817da18f3a
commit 3797c55154
16 changed files with 56 additions and 76 deletions

View File

@@ -29,8 +29,8 @@
CGLM_INLINE void glms_decompose(mat4s m, vec4s t, mat4s * r, vec3s * s); CGLM_INLINE void glms_decompose(mat4s m, vec4s t, mat4s * r, vec3s * s);
*/ */
#ifndef cglm_affines_h #ifndef cglms_affines_h
#define cglm_affines_h #define cglms_affines_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -117,8 +117,8 @@ glms_translate_make(vec3s v) {
/*! /*!
* @brief creates NEW scale matrix by v vector * @brief creates NEW scale matrix by v vector
* *
* @param[out] m affine transfrom
* @param[in] v scale vector [x, y, z] * @param[in] v scale vector [x, y, z]
* @returns affine transfrom
*/ */
CGLM_INLINE CGLM_INLINE
mat4s mat4s
@@ -334,4 +334,4 @@ glms_decompose(mat4s m, vec4s * __restrict t, mat4s * __restrict r, vec3s * __re
glm_decompose(m.raw, t->raw, r->raw, s->raw); glm_decompose(m.raw, t->raw, r->raw, s->raw);
} }
#endif /* cglm_affines_h */ #endif /* cglms_affines_h */

View File

@@ -5,8 +5,8 @@
* Full license can be found in the LICENSE file * Full license can be found in the LICENSE file
*/ */
#ifndef cglm_boxs_h #ifndef cglms_boxs_h
#define cglm_boxs_h #define cglms_boxs_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -178,7 +178,7 @@ glms_aabb_radius(vec3s box[2]) {
* @brief computes center point of AABB * @brief computes center point of AABB
* *
* @param[in] box bounding box * @param[in] box bounding box
* @param[out] dest center of bounding box * @returns center of bounding box
*/ */
CGLM_INLINE CGLM_INLINE
vec3s vec3s
@@ -253,4 +253,4 @@ glms_aabb_contains(vec3s box[2], vec3s other[2]) {
return glm_aabb_contains(rawBox, rawOther); return glm_aabb_contains(rawBox, rawOther);
} }
#endif /* cglm_boxs_h */ #endif /* cglms_boxs_h */

View File

@@ -5,8 +5,8 @@
* Full license can be found in the LICENSE file * Full license can be found in the LICENSE file
*/ */
#ifndef cglm_colors_h #ifndef cglms_colors_h
#define cglm_colors_h #define cglms_colors_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -24,4 +24,4 @@ glms_luminance(vec3s rgb) {
return glm_luminance(rgb.raw); return glm_luminance(rgb.raw);
} }
#endif /* cglm_colors_h */ #endif /* cglms_colors_h */

View File

@@ -5,8 +5,8 @@
* Full license can be found in the LICENSE file * Full license can be found in the LICENSE file
*/ */
#ifndef cglm_curves_h #ifndef cglms_curves_h
#define cglm_curves_h #define cglms_curves_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -37,4 +37,4 @@ glms_smc(float s, mat4s m, vec4s c) {
return glm_smc(s, m.raw, c.raw); return glm_smc(s, m.raw, c.raw);
} }
#endif /* cglm_curves_h */ #endif /* cglms_curves_h */

View File

@@ -5,8 +5,8 @@
* Full license can be found in the LICENSE file * Full license can be found in the LICENSE file
*/ */
#ifndef cglm_frustums_h #ifndef cglms_frustums_h
#define cglm_frustums_h #define cglms_frustums_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -152,4 +152,4 @@ glms_frustum_corners_at(vec4s corners[8],
glms_vec4_pack(planeCorners, rawPlaneCorners, 8); glms_vec4_pack(planeCorners, rawPlaneCorners, 8);
} }
#endif /* cglm_frustums_h */ #endif /* cglms_frustums_h */

View File

@@ -15,8 +15,8 @@
CGLM_INLINE void glm_versor_print(versor vec, FILE *ostream); CGLM_INLINE void glm_versor_print(versor vec, FILE *ostream);
*/ */
#ifndef cglm_ios_h #ifndef cglms_ios_h
#define cglm_ios_h #define cglms_ios_h
#include "../common.h" #include "../common.h"
#include "../io.h" #include "../io.h"
@@ -79,4 +79,4 @@ glms_aabb_print(vec3s bbox[2],
glm_aabb_print(rawBbox, tag, ostream); glm_aabb_print(rawBbox, tag, ostream);
} }
#endif /* cglm_ios_h */ #endif /* cglms_ios_h */

View File

@@ -30,8 +30,8 @@
CGLM_INLINE float glms_mat3_rmc(vec3s r, mat3s m, vec3s c); CGLM_INLINE float glms_mat3_rmc(vec3s r, mat3s m, vec3s c);
*/ */
#ifndef cglm_mat3s_h #ifndef cglms_mat3s_h
#define cglm_mat3s_h #define cglms_mat3s_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -286,4 +286,4 @@ glms_mat3_rmc(vec3s r, mat3s m, vec3s c) {
return glm_mat3_rmc(r.raw, m.raw, c.raw); return glm_mat3_rmc(r.raw, m.raw, c.raw);
} }
#endif /* cglm_mat3s_h */ #endif /* cglms_mat3s_h */

View File

@@ -44,8 +44,8 @@
CGLM_INLINE float glms_mat4_rmc(vec4s r, mat4s m, vec4s c); CGLM_INLINE float glms_mat4_rmc(vec4s r, mat4s m, vec4s c);
*/ */
#ifndef cglm_mat4s_h #ifndef cglms_mat4s_h
#define cglm_mat4s_h #define cglms_mat4s_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -463,5 +463,4 @@ glms_mat4_rmc(vec4s r, mat4s m, vec4s c) {
return glm_mat4_rmc(r.raw, m.raw, c.raw); return glm_mat4_rmc(r.raw, m.raw, c.raw);
} }
#endif /* cglm_mat4s_h */ #endif /* cglms_mat4s_h */

View File

@@ -5,8 +5,8 @@
* Full license can be found in the LICENSE file * Full license can be found in the LICENSE file
*/ */
#ifndef cglm_planes_h #ifndef cglms_planes_h
#define cglm_planes_h #define cglms_planes_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -37,4 +37,4 @@ glms_plane_normalize(vec4s plane) {
return plane; return plane;
} }
#endif /* cglm_planes_h */ #endif /* cglms_planes_h */

View File

@@ -5,8 +5,8 @@
* Full license can be found in the LICENSE file * Full license can be found in the LICENSE file
*/ */
#ifndef cglm_projects_h #ifndef cglms_projects_h
#define cglm_projects_h #define cglms_projects_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -91,7 +91,7 @@ glms_unproject(vec3s pos, mat4s m, vec4s vp) {
* @param[in] pos object coordinates * @param[in] pos object coordinates
* @param[in] m MVP matrix * @param[in] m MVP matrix
* @param[in] vp viewport as [x, y, width, height] * @param[in] vp viewport as [x, y, width, height]
* @param[out] dest projected coordinates * @returns projected coordinates
*/ */
CGLM_INLINE CGLM_INLINE
vec3s vec3s
@@ -101,4 +101,4 @@ glms_project(vec3s pos, mat4s m, vec4s vp) {
return r; return r;
} }
#endif /* cglm_projects_h */ #endif /* cglms_projects_h */

View File

@@ -5,8 +5,8 @@
* Full license can be found in the LICENSE file * Full license can be found in the LICENSE file
*/ */
#ifndef cglm_spheres_h #ifndef cglms_spheres_h
#define cglm_spheres_h #define cglms_spheres_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -90,4 +90,4 @@ glms_sphere_point(vec4s s, vec3s point) {
return glm_sphere_point(s.raw, point.raw); return glm_sphere_point(s.raw, point.raw);
} }
#endif /* cglm_spheres_h */ #endif /* cglms_spheres_h */

View File

@@ -26,8 +26,8 @@
CGLM_INLINE vec3s glms_vec3_sqrt(vec3s v); CGLM_INLINE vec3s glms_vec3_sqrt(vec3s v);
*/ */
#ifndef cglm_vec3s_ext_h #ifndef cglms_vec3s_ext_h
#define cglm_vec3s_ext_h #define cglms_vec3s_ext_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -195,4 +195,4 @@ glms_vec3_sqrt(vec3s v) {
return r; return r;
} }
#endif /* cglm_vec3s_ext_h */ #endif /* cglms_vec3s_ext_h */

View File

@@ -17,7 +17,6 @@
Functions: Functions:
CGLM_INLINE vec3s glms_vec3(vec4s v4); CGLM_INLINE vec3s glms_vec3(vec4s v4);
CGLM_INLINE vec3s glms_vec3_copy(vec3s v);
CGLM_INLINE void glms_vec3_pack(vec3s dst[], vec3 src[], size_t len); 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 void glms_vec3_unpack(vec3 dst[], vec3s src[], size_t len);
CGLM_INLINE vec3s glms_vec3_zero(); CGLM_INLINE vec3s glms_vec3_zero();
@@ -66,8 +65,8 @@
CGLM_INLINE vec3s glms_normalize(vec3s v); CGLM_INLINE vec3s glms_normalize(vec3s v);
*/ */
#ifndef cglm_vec3s_h #ifndef cglms_vec3s_h
#define cglm_vec3s_h #define cglms_vec3s_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -99,20 +98,6 @@ glms_vec3(vec4s v4) {
return r; return r;
} }
/*!
* @brief copy all members of [a] to [dest]
*
* @param[in] a source
* @returns destination
*/
CGLM_INLINE
vec3s
glms_vec3_copy(vec3s v) {
vec3s r;
glm_vec3_copy(v.raw, r.raw);
return r;
}
/*! /*!
* @brief pack an array of vec3 into an array of vec3s * @brief pack an array of vec3 into an array of vec3s
* *
@@ -150,7 +135,6 @@ glms_vec3_unpack(vec3 dst[], vec3s src[], size_t len) {
/*! /*!
* @brief make vector zero * @brief make vector zero
* *
* @param[in] v vector
* @returns zero vector * @returns zero vector
*/ */
CGLM_INLINE CGLM_INLINE
@@ -164,7 +148,6 @@ glms_vec3_zero() {
/*! /*!
* @brief make vector one * @brief make vector one
* *
* @param[in] v vector
* @returns one vector * @returns one vector
*/ */
CGLM_INLINE CGLM_INLINE
@@ -237,7 +220,7 @@ glms_vec3_add(vec3s a, vec3s b) {
/*! /*!
* @brief add scalar to v vector store result in dest (d = v + s) * @brief add scalar to v vector store result in dest (d = v + s)
* *
* @param[in] v vector * @param[in] a vector
* @param[in] s scalar * @param[in] s scalar
* @returns destination vector * @returns destination vector
*/ */
@@ -267,7 +250,7 @@ glms_vec3_sub(vec3s a, vec3s b) {
/*! /*!
* @brief subtract scalar from v vector store result in dest (d = v - s) * @brief subtract scalar from v vector store result in dest (d = v - s)
* *
* @param[in] v vector * @param[in] a vector
* @param[in] s scalar * @param[in] s scalar
* @returns destination vector * @returns destination vector
*/ */
@@ -342,7 +325,7 @@ glms_vec3_div(vec3s a, vec3s b) {
/*! /*!
* @brief div vector with scalar: d = v / s * @brief div vector with scalar: d = v / s
* *
* @param[in] v vector * @param[in] a vector
* @param[in] s scalar * @param[in] s scalar
* @returns result = (a[0]/s, a[1]/s, a[2]/s) * @returns result = (a[0]/s, a[1]/s, a[2]/s)
*/ */
@@ -764,4 +747,4 @@ glms_normalize(vec3s v) {
return v; return v;
} }
#endif /* cglm_vec3s_h */ #endif /* cglms_vec3s_h */

View File

@@ -26,8 +26,8 @@
CGLM_INLINE vec4s glms_vec4_sqrt(vec4s v); CGLM_INLINE vec4s glms_vec4_sqrt(vec4s v);
*/ */
#ifndef cglm_vec4s_ext_h #ifndef cglms_vec4s_ext_h
#define cglm_vec4s_ext_h #define cglms_vec4s_ext_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -195,4 +195,4 @@ glms_vec4_sqrt(vec4s v) {
return r; return r;
} }
#endif /* cglm_vec4s_ext_h */ #endif /* cglms_vec4s_ext_h */

View File

@@ -50,8 +50,8 @@
CGLM_INLINE vec4s glms_vec4_cubic(float s); CGLM_INLINE vec4s glms_vec4_cubic(float s);
*/ */
#ifndef cglm_vec4s_h #ifndef cglms_vec4s_h
#define cglm_vec4s_h #define cglms_vec4s_h
#include "../common.h" #include "../common.h"
#include "../types-struct.h" #include "../types-struct.h"
@@ -85,8 +85,8 @@ glms_vec4(vec3s v3, float last) {
/*! /*!
* @brief copy first 3 members of [a] to [dest] * @brief copy first 3 members of [a] to [dest]
* *
* @param[in] a source * @param[in] v source
* @returns destination * @returns vec3
*/ */
CGLM_INLINE CGLM_INLINE
vec3s vec3s
@@ -163,7 +163,6 @@ glms_vec4_unpack(vec4 dst[], vec4s src[], size_t len) {
/*! /*!
* @brief make vector zero * @brief make vector zero
* *
* @param[in] v vector
* @returns zero vector * @returns zero vector
*/ */
CGLM_INLINE CGLM_INLINE
@@ -177,7 +176,6 @@ glms_vec4_zero() {
/*! /*!
* @brief make vector one * @brief make vector one
* *
* @param[in] v vector
* @returns one vector * @returns one vector
*/ */
CGLM_INLINE CGLM_INLINE
@@ -579,4 +577,4 @@ glms_vec4_cubic(float s) {
return r; return r;
} }
#endif /* cglm_vec4s_h */ #endif /* cglms_vec4s_h */

View File

@@ -20,7 +20,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <cglm/cglm.h> #include <cglm/cglm.h>
#include <cglm/cglms.h> #include <cglm/struct.h>
#include <cglm/call.h> #include <cglm/call.h>
void void
@@ -63,13 +63,13 @@ void
test_rand_vec3(vec3 dest); test_rand_vec3(vec3 dest);
vec3s vec3s
test_rand_vec3s(); test_rand_vec3s(void);
void void
test_rand_vec4(vec4 dest); test_rand_vec4(vec4 dest);
vec4s vec4s
test_rand_vec4s(); test_rand_vec4s(void);
float float
test_rand(void); test_rand(void);