diff --git a/include/cglm/cglm.h b/include/cglm/cglm.h index 3b0611c..e99bb09 100644 --- a/include/cglm/cglm.h +++ b/include/cglm/cglm.h @@ -20,6 +20,7 @@ #include "euler.h" #include "plane.h" #include "box.h" +#include "color.h" #include "util.h" #include "io.h" 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 */ diff --git a/makefile.am b/makefile.am index f5a78ab..f6d1471 100644 --- a/makefile.am +++ b/makefile.am @@ -53,7 +53,8 @@ cglm_HEADERS = include/cglm/version.h \ include/cglm/affine-mat.h \ include/cglm/plane.h \ include/cglm/frustum.h \ - include/cglm/box.h + include/cglm/box.h \ + include/cglm/color.h cglm_calldir=$(includedir)/cglm/call cglm_call_HEADERS = include/cglm/call/mat4.h \ diff --git a/win/cglm.vcxproj b/win/cglm.vcxproj index 36000c0..4a0463d 100644 --- a/win/cglm.vcxproj +++ b/win/cglm.vcxproj @@ -52,6 +52,7 @@ + diff --git a/win/cglm.vcxproj.filters b/win/cglm.vcxproj.filters index 559f2f7..506f3d8 100644 --- a/win/cglm.vcxproj.filters +++ b/win/cglm.vcxproj.filters @@ -203,5 +203,8 @@ include\cglm + + include\cglm + \ No newline at end of file