X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=libs%2Fcgmath%2Fcgmath.h;h=b343c7301808dc83d4258af6b2a004f1f58a1c93;hb=HEAD;hp=cd3de51c358ef4ce14d27a92ed38cabd28dd5c3b;hpb=7fccf8b3543c8cdb993252f0cf9a6b9ed826408e;p=retroray diff --git a/libs/cgmath/cgmath.h b/libs/cgmath/cgmath.h index cd3de51..b343c73 100644 --- a/libs/cgmath/cgmath.h +++ b/libs/cgmath/cgmath.h @@ -1,5 +1,5 @@ /* gph-cmath - C graphics math library - * Copyright (C) 2018 John Tsiombikas + * Copyright (C) 2018-2023 John Tsiombikas * * This program is free software. Feel free to use, modify, and/or redistribute * it under the terms of the MIT/X11 license. See LICENSE for details. @@ -23,16 +23,10 @@ #ifndef CGMATH_H_ #define CGMATH_H_ -#if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES) -#define _USE_MATH_DEFINES -#endif - #include #include -#ifndef M_PI -#define M_PI 3.141592653589793 -#endif +#define CGM_PI 3.141592653589793 typedef struct { float x, y; @@ -66,6 +60,8 @@ typedef enum cgm_euler_mode { } cgm_euler_mode; #ifdef __cplusplus +#define CGM_INLINE inline + extern "C" { #else @@ -81,6 +77,7 @@ extern "C" { static CGM_INLINE void cgm_vcons(cgm_vec3 *v, float x, float y, float z); static CGM_INLINE cgm_vec3 cgm_vvec(float x, float y, float z); +static CGM_INLINE void cgm_vneg(cgm_vec3 *v); static CGM_INLINE void cgm_vadd(cgm_vec3 *a, const cgm_vec3 *b); static CGM_INLINE void cgm_vadd_scaled(cgm_vec3 *a, const cgm_vec3 *b, float s); /* a+b*s */ static CGM_INLINE void cgm_vsub(cgm_vec3 *a, const cgm_vec3 *b); @@ -270,10 +267,6 @@ static CGM_INLINE void cgm_bary(cgm_vec3 *bary, const cgm_vec3 *a, static CGM_INLINE void cgm_uvec_to_sph(float *theta, float *phi, const cgm_vec3 *v); static CGM_INLINE void cgm_sph_to_uvec(cgm_vec3 *v, float theta, float phi); -#ifdef _MSC_VER -#pragma warning (disable: 4244) -#endif - #include "cgmvec3.inl" #include "cgmvec4.inl" #include "cgmquat.inl"