RayMarching  0.0.1
Simple 3D engine based on a ray marching rendering
colors.h
1 #ifndef RAYMARCHING_COLORS_H
2 #define RAYMARCHING_COLORS_H
3 
4 
5 namespace RayMarching {
6  using pixel = unsigned char;
7 
11  typedef struct color {
12  pixel R;
13  pixel G;
14  pixel B;
21  [[nodiscard]] struct color mix(const struct color &other) const {
22  return {
23  static_cast<pixel>((R + other.R) / 2),
24  static_cast<pixel>((G + other.G) / 2),
25  static_cast<pixel>((B + other.B) / 2)
26  };
27  }
29 
30  constexpr color_t WHITE = {0xff, 0xff, 0xff};
31  constexpr color_t GRAY = {0xbf, 0xbf, 0xbf};
32  constexpr color_t BLACK = {0x00, 0x00, 0x00};
33  constexpr color_t RED = {0xff, 0x00, 0x00};
34  constexpr color_t GREEN = {0x00, 0xff, 0x00};
35  constexpr color_t BLUE = {0x00, 0x00, 0xff};
36 }
37 
38 
39 #endif //RAYMARCHING_COLORS_H
Namespace containing all tools implemented within RayMarching package.
Definition: algebra.h:9
constexpr color_t GRAY
Definition: colors.h:31
struct RayMarching::color color_t
3 byte color representation structure
constexpr color_t WHITE
Definition: colors.h:30
constexpr color_t GREEN
Definition: colors.h:34
constexpr color_t BLACK
Definition: colors.h:32
constexpr color_t RED
Definition: colors.h:33
constexpr color_t BLUE
Definition: colors.h:35
3 byte color representation structure
Definition: colors.h:11
struct color mix(const struct color &other) const
Definition: colors.h:21
pixel R
Definition: colors.h:12
pixel B
Definition: colors.h:14
pixel G
Definition: colors.h:13