summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-04 19:04:04 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-04 19:04:43 -0500
commita04565b7796fdfcff0b652644a0983145abbba87 (patch)
tree45d5ce88fe1a9915632211d765d07e3c83ce0166 /math.c
parent9c96427ba61f17d4cb91235bef2a77483a0278bf (diff)
small modern gl geometry api
Diffstat (limited to 'math.c')
-rw-r--r--math.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/math.c b/math.c
index 1443267..00735cf 100644
--- a/math.c
+++ b/math.c
@@ -772,10 +772,16 @@ static void gl_color2f(float v, float a) {
}
static void rgba_u32_to_floats(u32 rgba, float floats[4]) {
- floats[0] = (float)(rgba >> 24) / 255.f;
- floats[1] = (float)(rgba >> 16) / 255.f;
- floats[2] = (float)(rgba >> 8) / 255.f;
- floats[3] = (float)(rgba >> 0) / 255.f;
+ floats[0] = (float)((rgba >> 24) & 0xFF) / 255.f;
+ floats[1] = (float)((rgba >> 16) & 0xFF) / 255.f;
+ floats[2] = (float)((rgba >> 8) & 0xFF) / 255.f;
+ floats[3] = (float)((rgba >> 0) & 0xFF) / 255.f;
+}
+
+static v4 rgba_u32_to_v4(u32 rgba) {
+ float c[4];
+ rgba_u32_to_floats(rgba, c);
+ return V4(c[0], c[1], c[2], c[3]);
}
// color is 0xRRGGBBAA