BlockType: allow specifying visible and green value per damage value

This commit is contained in:
Matthias Schiffer 2017-08-19 13:01:01 +02:00
parent 292f4f4f3b
commit b04e1cb056
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
4 changed files with 4617 additions and 266 deletions

File diff suppressed because it is too large Load diff

View file

@ -34,10 +34,10 @@ namespace Resource {
struct BlockType {
bool opaque;
bool green;
uint32_t colors[16];
uint32_t color;
};
extern const BlockType BLOCK_TYPES[256];
extern const BlockType BLOCK_TYPES[256][16];
}
}

View file

@ -33,16 +33,14 @@ namespace MinedMap {
namespace World {
uint32_t Block::getColor() const {
const Resource::BlockType &t = Resource::BLOCK_TYPES[id];
const Resource::BlockType &t = Resource::BLOCK_TYPES[id][data];
if (!t.opaque)
return 0;
uint32_t color = t.colors[data];
unsigned r = uint8_t(color >> 16);
unsigned g = uint8_t(color >> 8);
unsigned b = uint8_t(color);
unsigned r = uint8_t(t.color >> 16);
unsigned g = uint8_t(t.color >> 8);
unsigned b = uint8_t(t.color);
float heightCoef = height/255.0f + 0.5f;

View file

@ -182,7 +182,8 @@ Chunk::Blocks Chunk::getTopLayer() const {
continue;
uint8_t id = getBlockAt(x, y, z);
if (!Resource::BLOCK_TYPES[id].opaque)
uint8_t data = getDataAt(x, y, z);
if (!Resource::BLOCK_TYPES[id][data].opaque)
continue;
ret.blocks[x][z] = getBlock(x, y, z);