summaryrefslogtreecommitdiff
path: root/include/cglm/color.h
diff options
context:
space:
mode:
authorAaditya Dhruv <[email protected]>2026-01-25 15:10:37 -0600
committerAaditya Dhruv <[email protected]>2026-01-25 15:10:37 -0600
commit118980e02e59ff31871df59dce257075394f3533 (patch)
tree26fba4492bb4b561d21bf49b35d892a821d54fab /include/cglm/color.h
parent0e6e1245b70df4dfcba135d50e1b53d1a8ef7eb8 (diff)
wip
Diffstat (limited to 'include/cglm/color.h')
-rw-r--r--include/cglm/color.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/cglm/color.h b/include/cglm/color.h
new file mode 100644
index 0000000..69566ad
--- /dev/null
+++ b/include/cglm/color.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c), Recep Aslantas.
+ *
+ * MIT License (MIT), http://opensource.org/licenses/MIT
+ * Full license can be found in the LICENSE file
+ */
+
+#ifndef cglm_color_h
+#define cglm_color_h
+
+#include "common.h"
+#include "vec3.h"
+
+/*!
+ * @brief averages the color channels into one value
+ *
+ * @param[in] rgb RGB color
+ */
+CGLM_INLINE
+float
+glm_luminance(vec3 rgb) {
+ vec3 l = {0.212671f, 0.715160f, 0.072169f};
+ return glm_dot(rgb, l);
+}
+
+#endif /* cglm_color_h */