Biome: return FloatColor for block colors

This commit is contained in:
Matthias Schiffer 2020-06-20 00:26:01 +02:00
parent 50f798f89e
commit 19ef022a67
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
5 changed files with 53 additions and 49 deletions

View file

@ -39,10 +39,13 @@ struct Block {
unsigned depth;
uint8_t blockLight;
bool isVisible() const {
return type && (type->flags & BLOCK_OPAQUE);
}
Resource::Color getColor(uint8_t biome) const {
if (!type || !(type->flags & BLOCK_OPAQUE))
return Resource::Color {};
Resource::FloatColor getColor(uint8_t biome) const {
if (!isVisible())
return Resource::FloatColor {};
return (Resource::BIOMES[biome] ?: Resource::BIOME_DEFAULT)->getBlockColor(type, depth);
}