mirror of
https://github.com/recp/cglm.git
synced 2025-10-03 08:41:55 +00:00
color: add luminance function
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "euler.h"
|
||||
#include "plane.h"
|
||||
#include "box.h"
|
||||
#include "color.h"
|
||||
#include "util.h"
|
||||
#include "io.h"
|
||||
|
||||
|
26
include/cglm/color.h
Normal file
26
include/cglm/color.h
Normal file
@@ -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 */
|
@@ -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 \
|
||||
|
@@ -52,6 +52,7 @@
|
||||
<ClInclude Include="..\include\cglm\call\vec4.h" />
|
||||
<ClInclude Include="..\include\cglm\cam.h" />
|
||||
<ClInclude Include="..\include\cglm\cglm.h" />
|
||||
<ClInclude Include="..\include\cglm\color.h" />
|
||||
<ClInclude Include="..\include\cglm\common.h" />
|
||||
<ClInclude Include="..\include\cglm\euler.h" />
|
||||
<ClInclude Include="..\include\cglm\frustum.h" />
|
||||
|
@@ -203,5 +203,8 @@
|
||||
<ClInclude Include="..\include\cglm\box.h">
|
||||
<Filter>include\cglm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\cglm\color.h">
|
||||
<Filter>include\cglm</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Reference in New Issue
Block a user