Add biome color computation

Rather than using fixed values for all biomes, generate grass and foliage
colors based on (height-dependent) temperature and rainfall parameters.

This changes a lot of colors; in general, the new colors should be closer
to the actual Minecraft rendering. It also fixes a few colors that were
completely off (like in the badlands biomes) and adds the MC 1.13 biomes
(which were rendered in black).

Some of the newer biomes (warm/cold/... oceans) don't have proper
parameters yet, and we do not derive the water color from the biome yet.

Fixes #1.
This commit is contained in:
Matthias Schiffer 2018-11-08 17:12:40 +01:00
parent 4ffa28dd63
commit 0bdf249307
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
7 changed files with 382 additions and 219 deletions

View file

@ -27,6 +27,7 @@
#pragma once
#include "../NBT/CompoundTag.hpp"
#include "../Resource/Biome.hpp"
#include "../Resource/BlockType.hpp"
@ -34,17 +35,18 @@ namespace MinedMap {
namespace World {
struct Block {
struct Color {
uint8_t r, g, b, a;
};
const Resource::BlockType *type;
unsigned height;
uint8_t blockLight;
uint8_t biome;
Color getColor() const;
Resource::Color getColor() const {
if (!type || !type->opaque)
return Resource::Color {};
return (Resource::BIOMES[biome] ?: Resource::BIOME_DEFAULT)->getBlockColor(type, height);
}
operator bool() const {
return type;