color.h 471 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c), Recep Aslantas.
  3. *
  4. * MIT License (MIT), http://opensource.org/licenses/MIT
  5. * Full license can be found in the LICENSE file
  6. */
  7. #ifndef cglm_color_h
  8. #define cglm_color_h
  9. #include "common.h"
  10. #include "vec3.h"
  11. /*!
  12. * @brief averages the color channels into one value
  13. *
  14. * @param[in] rgb RGB color
  15. */
  16. CGLM_INLINE
  17. float
  18. glm_luminance(vec3 rgb) {
  19. vec3 l = {0.212671f, 0.715160f, 0.072169f};
  20. return glm_dot(rgb, l);
  21. }
  22. #endif /* cglm_color_h */