From ed6962edd37d362db2425c6d476dc4688243256c Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 22 Feb 2018 03:22:59 +0100 Subject: Make MatrixToFloat and Vector3ToFloat reentrant Besides making it thread-safe, it suppresses a GCC warning when making them static inline in an upcoming patch. --- src/raylib.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 41755dc3..a740e234 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -338,6 +338,14 @@ typedef struct Matrix { float m3, m7, m11, m15; } Matrix; +typedef struct Float3 { + float f[3]; +} Float3; + +typedef struct Float16 { + float f[16]; +} Float16; + // Color type, RGBA (32bit) typedef struct Color { unsigned char r; @@ -743,11 +751,17 @@ RLAPI Color GetColor(int hexValue); // Returns a C RLAPI Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f // Math useful functions (available from raymath.h) -RLAPI float *Vector3ToFloat(Vector3 vec); // Returns Vector3 as float array -RLAPI float *MatrixToFloat(Matrix mat); // Returns Matrix as float array RLAPI Vector3 Vector3Zero(void); // Vector with components value 0.0f RLAPI Vector3 Vector3One(void); // Vector with components value 1.0f RLAPI Matrix MatrixIdentity(void); // Returns identity matrix +#ifndef Vector3ToFloat +#define Vector3ToFloat(vec) (Vector3ToFloat_(vec).f) // Returns Vector3 as float array +RLAPI Float3 Vector3ToFloat_(Vector3 vec); // don't use, use above +#endif +#ifndef MatrixToFloat +#define MatrixToFloat(mat) (MatrixToFloat_(mat).f) // Returns Matrix as float array +RLAPI Float16 MatrixToFloat_(Matrix mat); // don't use, use above +#endif // Misc. functions RLAPI void ShowLogo(void); // Activate raylib logo at startup (can be done with flags) -- cgit v1.2.3