mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-04-20 11:35:07 +02:00
BlockType: allow specifying visible and green value per damage value
This commit is contained in:
parent
292f4f4f3b
commit
b04e1cb056
4 changed files with 4617 additions and 266 deletions
File diff suppressed because it is too large
Load diff
|
@ -34,10 +34,10 @@ namespace Resource {
|
||||||
struct BlockType {
|
struct BlockType {
|
||||||
bool opaque;
|
bool opaque;
|
||||||
bool green;
|
bool green;
|
||||||
uint32_t colors[16];
|
uint32_t color;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const BlockType BLOCK_TYPES[256];
|
extern const BlockType BLOCK_TYPES[256][16];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,16 +33,14 @@ namespace MinedMap {
|
||||||
namespace World {
|
namespace World {
|
||||||
|
|
||||||
uint32_t Block::getColor() const {
|
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)
|
if (!t.opaque)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uint32_t color = t.colors[data];
|
unsigned r = uint8_t(t.color >> 16);
|
||||||
|
unsigned g = uint8_t(t.color >> 8);
|
||||||
unsigned r = uint8_t(color >> 16);
|
unsigned b = uint8_t(t.color);
|
||||||
unsigned g = uint8_t(color >> 8);
|
|
||||||
unsigned b = uint8_t(color);
|
|
||||||
|
|
||||||
float heightCoef = height/255.0f + 0.5f;
|
float heightCoef = height/255.0f + 0.5f;
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,8 @@ Chunk::Blocks Chunk::getTopLayer() const {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint8_t id = getBlockAt(x, y, z);
|
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;
|
continue;
|
||||||
|
|
||||||
ret.blocks[x][z] = getBlock(x, y, z);
|
ret.blocks[x][z] = getBlock(x, y, z);
|
||||||
|
|
Loading…
Add table
Reference in a new issue