Make MatrixToFloat and Vector3ToFloat reentrant

Besides making it thread-safe, it suppresses a GCC warning
when making them static inline in an upcoming patch.
This commit is contained in:
Ahmad Fatoum
2018-02-22 03:22:59 +01:00
parent a5881fb9cc
commit ed6962edd3
2 changed files with 53 additions and 27 deletions

View File

@@ -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)