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 15:37:37 +0100
commite4d7bbec1ef08279495ac41f5f8c4be359c58cf0 (patch)
treee0d4a8d7d55acf34c8f7a4fc60dc409661d5c434 /src/raylib.h
parent077bef42861644f1f25070d23363a1bfa2e7a4a6 (diff)
downloadraylib-e4d7bbec1ef08279495ac41f5f8c4be359c58cf0.tar.gz
raylib-e4d7bbec1ef08279495ac41f5f8c4be359c58cf0.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)