summaryrefslogtreecommitdiffhomepage
path: root/src/raylib.h
diff options
context:
space:
mode:
authorAhmad Fatoum <[email protected]>2018-02-22 03:22:59 +0100
committerAhmad Fatoum <[email protected]>2018-02-24 23:39:17 +0100
commited6962edd37d362db2425c6d476dc4688243256c (patch)
tree581a8802b8873c43e639ef21542f43b00125183c /src/raylib.h
parenta5881fb9ccaf60ea0ff4f6afd7f3925e24330cac (diff)
downloadraylib-ed6962edd37d362db2425c6d476dc4688243256c.tar.gz
raylib-ed6962edd37d362db2425c6d476dc4688243256c.zip
Make MatrixToFloat and Vector3ToFloat reentrant
Besides making it thread-safe, it suppresses a GCC warning when making them static inline in an upcoming patch.
Diffstat (limited to 'src/raylib.h')
-rw-r--r--src/raylib.h18
1 files changed, 16 insertions, 2 deletions
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)