mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 09:08:53 +00:00
move types to individual header
* include cglm-common to all headers
This commit is contained in:
@@ -9,7 +9,9 @@
|
|||||||
#define cglm_affine_mat_avx_h
|
#define cglm_affine_mat_avx_h
|
||||||
#ifdef __AVX__
|
#ifdef __AVX__
|
||||||
|
|
||||||
|
#include "cglm-common.h"
|
||||||
#include "cglm-intrin.h"
|
#include "cglm-intrin.h"
|
||||||
|
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
#define cglm_affine_mat_sse2_h
|
#define cglm_affine_mat_sse2_h
|
||||||
#if defined( __SSE__ ) || defined( __SSE2__ )
|
#if defined( __SSE__ ) || defined( __SSE2__ )
|
||||||
|
|
||||||
|
#include "cglm-common.h"
|
||||||
#include "cglm-intrin.h"
|
#include "cglm-intrin.h"
|
||||||
#include "cglm.h"
|
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
|
@@ -8,11 +8,12 @@
|
|||||||
#ifndef cglm_affine_mat_h
|
#ifndef cglm_affine_mat_h
|
||||||
#define cglm_affine_mat_h
|
#define cglm_affine_mat_h
|
||||||
|
|
||||||
#include "cglm.h"
|
#include "cglm-common.h"
|
||||||
#include "cglm-mat.h"
|
#include "cglm-mat.h"
|
||||||
#include "cglm-mat3.h"
|
#include "cglm-mat3.h"
|
||||||
#include "cglm-affine-mat-sse2.h"
|
#include "cglm-affine-mat-sse2.h"
|
||||||
#include "cglm-affine-mat-avx.h"
|
#include "cglm-affine-mat-avx.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
@@ -8,10 +8,9 @@
|
|||||||
#ifndef cglm_affine_h
|
#ifndef cglm_affine_h
|
||||||
#define cglm_affine_h
|
#define cglm_affine_h
|
||||||
|
|
||||||
#include "cglm.h"
|
#include "cglm-common.h"
|
||||||
#include "cglm-vec.h"
|
#include "cglm-vec.h"
|
||||||
#include "cglm-affine-mat.h"
|
#include "cglm-affine-mat.h"
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
|
@@ -5,18 +5,11 @@
|
|||||||
* Full license can be found in the LICENSE file
|
* Full license can be found in the LICENSE file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
#ifndef cglm_vcam_h
|
||||||
TODO: GLdouble vs float ?
|
#define cglm_vcam_h
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef glm_vcam_h
|
#include "cglm-common.h"
|
||||||
#define glm_vcam_h
|
|
||||||
|
|
||||||
#define _USE_MATH_DEFINES
|
|
||||||
|
|
||||||
#include "cglm.h"
|
|
||||||
#include "cglm-platform.h"
|
#include "cglm-platform.h"
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -186,4 +179,4 @@ glm_lookat(vec3 eye,
|
|||||||
dest[3][3] = 1;
|
dest[3][3] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* glm_vcam_h */
|
#endif /* cglm_vcam_h */
|
||||||
|
@@ -5,17 +5,18 @@
|
|||||||
* Full license can be found in the LICENSE file
|
* Full license can be found in the LICENSE file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glm_common_h
|
#ifndef cglm_common_h
|
||||||
#define glm_common_h
|
#define cglm_common_h
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES /* for windows */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# define CGLM_INLINE __forceinline
|
# define CGLM_INLINE __forceinline
|
||||||
# define CGLM_ALIGN(X) /* __declspec(align(X)) */
|
|
||||||
#else
|
#else
|
||||||
# define CGLM_INLINE static inline __attribute((always_inline))
|
# define CGLM_INLINE static inline __attribute((always_inline))
|
||||||
# define CGLM_ALIGN(X) __attribute((aligned(X)))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define glm__memcpy(type, dest, src, size) \
|
#define glm__memcpy(type, dest, src, size) \
|
||||||
@@ -46,4 +47,6 @@
|
|||||||
|
|
||||||
#define glm__memzero(type, dest, size) glm__memset(type, dest, size, 0)
|
#define glm__memzero(type, dest, size) glm__memset(type, dest, size, 0)
|
||||||
|
|
||||||
#endif /* glm_common_h */
|
#include "cglm-types.h"
|
||||||
|
|
||||||
|
#endif /* cglm_common_h */
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#ifndef cglm_euler_h
|
#ifndef cglm_euler_h
|
||||||
#define cglm_euler_h
|
#define cglm_euler_h
|
||||||
|
|
||||||
#include "cglm.h"
|
#include "cglm-common.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief build rotation matrix from euler angles/yaw-pitch-roll (xyz)
|
* @brief build rotation matrix from euler angles/yaw-pitch-roll (xyz)
|
||||||
|
@@ -9,7 +9,9 @@
|
|||||||
#define cglm_mat_simd_avx_h
|
#define cglm_mat_simd_avx_h
|
||||||
#ifdef __AVX__
|
#ifdef __AVX__
|
||||||
|
|
||||||
|
#include "cglm-common.h"
|
||||||
#include "cglm-intrin.h"
|
#include "cglm-intrin.h"
|
||||||
|
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#define cglm_mat_sse_h
|
#define cglm_mat_sse_h
|
||||||
#if defined( __SSE__ ) || defined( __SSE2__ )
|
#if defined( __SSE__ ) || defined( __SSE2__ )
|
||||||
|
|
||||||
|
#include "cglm-common.h"
|
||||||
#include "cglm-intrin.h"
|
#include "cglm-intrin.h"
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
@@ -13,9 +13,10 @@
|
|||||||
#ifndef cglm_mat_h
|
#ifndef cglm_mat_h
|
||||||
#define cglm_mat_h
|
#define cglm_mat_h
|
||||||
|
|
||||||
#include "cglm.h"
|
#include "cglm-common.h"
|
||||||
#include "cglm-mat-simd-sse2.h"
|
#include "cglm-mat-simd-sse2.h"
|
||||||
#include "cglm-mat-simd-avx.h"
|
#include "cglm-mat-simd-avx.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#define GLM_MAT4_IDENTITY_INIT {{1.0f, 0.0f, 0.0f, 0.0f}, \
|
#define GLM_MAT4_IDENTITY_INIT {{1.0f, 0.0f, 0.0f, 0.0f}, \
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#define cglm_mat3_sse_h
|
#define cglm_mat3_sse_h
|
||||||
#if defined( __SSE__ ) || defined( __SSE2__ )
|
#if defined( __SSE__ ) || defined( __SSE2__ )
|
||||||
|
|
||||||
|
#include "cglm-common.h"
|
||||||
#include "cglm-intrin.h"
|
#include "cglm-intrin.h"
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#ifndef cglm_mat3_h
|
#ifndef cglm_mat3_h
|
||||||
#define cglm_mat3_h
|
#define cglm_mat3_h
|
||||||
|
|
||||||
#include "cglm.h"
|
#include "cglm-common.h"
|
||||||
#include "cglm-mat3-simd-sse2.h"
|
#include "cglm-mat3-simd-sse2.h"
|
||||||
|
|
||||||
#define GLM_MAT3_IDENTITY_INIT {{1.0f, 0.0f, 0.0f}, \
|
#define GLM_MAT3_IDENTITY_INIT {{1.0f, 0.0f, 0.0f}, \
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
#ifndef cglm_mat_opengl_h
|
#ifndef cglm_mat_opengl_h
|
||||||
#define cglm_mat_opengl_h
|
#define cglm_mat_opengl_h
|
||||||
|
|
||||||
|
#include "cglm-common.h"
|
||||||
#include "cglm-platform.h"
|
#include "cglm-platform.h"
|
||||||
#include "cglm.h"
|
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#ifndef cglm_quat_simd_h
|
#ifndef cglm_quat_simd_h
|
||||||
#define cglm_quat_simd_h
|
#define cglm_quat_simd_h
|
||||||
|
|
||||||
|
#include "cglm-common.h"
|
||||||
#include "cglm-intrin.h"
|
#include "cglm-intrin.h"
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
@@ -8,11 +8,10 @@
|
|||||||
#ifndef cglm_quat_h
|
#ifndef cglm_quat_h
|
||||||
#define cglm_quat_h
|
#define cglm_quat_h
|
||||||
|
|
||||||
#include "cglm.h"
|
#include "cglm-common.h"
|
||||||
#include "cglm-vec.h"
|
|
||||||
#include "cglm-intrin.h"
|
#include "cglm-intrin.h"
|
||||||
#include "cglm-quat-simd.h"
|
#include "cglm-quat-simd.h"
|
||||||
#include <math.h>
|
#include "cglm-vec.h"
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
|
25
include/cglm-types.h
Normal file
25
include/cglm-types.h
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c), Recep Aslantas.
|
||||||
|
*
|
||||||
|
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||||
|
* Full license can be found in the LICENSE file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cglm_types_h
|
||||||
|
#define cglm_types_h
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# define CGLM_ALIGN(X) /* __declspec(align(X)) */
|
||||||
|
#else
|
||||||
|
# define CGLM_ALIGN(X) __attribute((aligned(X)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef float vec3[3];
|
||||||
|
typedef CGLM_ALIGN(16) float vec4[4];
|
||||||
|
|
||||||
|
typedef vec3 mat3[3];
|
||||||
|
typedef vec4 mat4[4];
|
||||||
|
|
||||||
|
typedef vec4 versor;
|
||||||
|
|
||||||
|
#endif /* cglm_types_h */
|
@@ -8,7 +8,8 @@
|
|||||||
#ifndef cglm_util_h
|
#ifndef cglm_util_h
|
||||||
#define cglm_util_h
|
#define cglm_util_h
|
||||||
|
|
||||||
#include "cglm.h"
|
#include "cglm-common.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@@ -13,9 +13,8 @@
|
|||||||
#ifndef cglm_vec_h
|
#ifndef cglm_vec_h
|
||||||
#define cglm_vec_h
|
#define cglm_vec_h
|
||||||
|
|
||||||
#include "cglm.h"
|
#include "cglm-common.h"
|
||||||
#include "cglm-intrin.h"
|
#include "cglm-intrin.h"
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief copy all members of [a] to [dest]
|
* @brief copy all members of [a] to [dest]
|
||||||
|
@@ -5,19 +5,10 @@
|
|||||||
* Full license can be found in the LICENSE file
|
* Full license can be found in the LICENSE file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef glm_h
|
#ifndef cglm_h
|
||||||
#define glm_h
|
#define cglm_h
|
||||||
|
|
||||||
#include "cglm-common.h"
|
#include "cglm-common.h"
|
||||||
|
|
||||||
typedef float vec3[3];
|
|
||||||
typedef CGLM_ALIGN(16) float vec4[4];
|
|
||||||
|
|
||||||
typedef vec3 mat3[3];
|
|
||||||
typedef vec4 mat4[4];
|
|
||||||
|
|
||||||
typedef vec4 versor;
|
|
||||||
|
|
||||||
#include "cglm-vec.h"
|
#include "cglm-vec.h"
|
||||||
#include "cglm-mat.h"
|
#include "cglm-mat.h"
|
||||||
#include "cglm-mat3.h"
|
#include "cglm-mat3.h"
|
||||||
@@ -27,4 +18,4 @@ typedef vec4 versor;
|
|||||||
#include "cglm-quat.h"
|
#include "cglm-quat.h"
|
||||||
#include "cglm-euler.h"
|
#include "cglm-euler.h"
|
||||||
|
|
||||||
#endif /* glm_h */
|
#endif /* cglm_h */
|
||||||
|
Reference in New Issue
Block a user