Collect biome data

We store the biome data as grayscale images, as biome indices are
represented as bytes and we get PNG compression for free.
This commit is contained in:
Matthias Schiffer 2020-06-19 20:34:42 +02:00
parent dc97c4a8c1
commit f539d668eb
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
3 changed files with 81 additions and 23 deletions

View file

@ -75,8 +75,10 @@ uint8_t Chunk::getBiome(size_t x, size_t y, size_t z) const {
return biomeInts->getValue((y/BGROUP)*BSIZE*BSIZE + (z/BGROUP)*BSIZE + (x/BGROUP));
else if (biomeIntsPre115)
return biomeIntsPre115->getValue(z*SIZE + x);
else
else if (biomeBytes)
return biomeBytes->getValue(z*SIZE + x);
else
return 0;
}
bool Chunk::getBlock(Block *block, const Section *section, size_t x, size_t y, size_t z, uint8_t prev_light) const {

View file

@ -62,7 +62,6 @@ private:
std::shared_ptr<const NBT::IntArrayTag> biomeIntsPre115;
std::shared_ptr<const NBT::IntArrayTag> biomeInts;
uint8_t getBiome(size_t x, size_t y, size_t z) const;
bool getBlock(Block *block, const Section *section, size_t x, size_t y, size_t z, uint8_t prev_light) const;
public:
@ -72,6 +71,8 @@ public:
return *level;
}
uint8_t getBiome(size_t x, size_t y, size_t z) const;
const Resource::BlockType * getBlockStateAt(size_t x, size_t y, size_t z) const {
size_t Y = y / SIZE;