13 static constexpr std::array<uint3, 3> grass_color_triangle = { uint3{ 71, 205, 51 }, uint3{ 191, 183, 85 }, uint3{ 128, 180, 151 } };
14 static constexpr std::array<uint3, 3> leaves_color_triangle = { uint3{ 26, 191, 0 }, uint3{ 174, 164, 42 }, uint3{ 96, 161, 123 } };
42 if (height <= sea_level)
59 const int relativ_height = std::max(0, height - sea_level);
72 const int relativ_height = std::max(0, height - sea_level);
76 return ((((base_color ^ 0xFF28340A) & 0xFFFEFEFE) >> 1) + (base_color & 0xFF28340A));
80 return is_grass ? 0xFF90814D : 0xFF9E814D;
81#if PROTOCOL_VERSION > 767
83 return is_grass ? 0xFF778373 : 0xFF878D76;
129 const float local_temperature = std::max(0.0f, std::min(1.0f,
temperature - height * 0.0016667f));
130 const float local_rainfall = std::max(0.0f, std::min(1.0f,
rainfall)) * local_temperature;
132 std::array<float, 3> triangle_coordinates;
133 triangle_coordinates[0] = local_rainfall;
134 triangle_coordinates[1] = local_temperature - local_rainfall;
135 triangle_coordinates[2] = 1.0f - local_temperature;
137 std::array<float, 3> color;
138 for (
int i = 0; i < 3; ++i)
140 for (
int j = 0; j < 3; ++j)
142 color[j] += triangle_coordinates[i] * (is_grass ? grass_color_triangle[i][j] : leaves_color_triangle[i][j]);
146 const unsigned char r =
static_cast<unsigned char>(std::max(0.0f, std::min(255.0f, color[0])));
147 const unsigned char g =
static_cast<unsigned char>(std::max(0.0f, std::min(255.0f, color[1])));
148 const unsigned char b =
static_cast<unsigned char>(std::max(0.0f, std::min(255.0f, color[2])));
149 const unsigned char a = 255;
151 return ((a << 24) | (b << 16) | (g << 8) | r);