mirror of
https://github.com/Relintai/voxelman.git
synced 2025-04-25 21:25:00 +02:00
Now the blocky mesher will not mesh the liquid blocks.
This commit is contained in:
parent
21ad01ca80
commit
e07bb3850d
@ -67,6 +67,17 @@ void VoxelMesherBlocky::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
|||||||
channel_rao = chunk->get_channel(VoxelChunkDefault::DEFAULT_CHANNEL_RANDOM_AO);
|
channel_rao = chunk->get_channel(VoxelChunkDefault::DEFAULT_CHANNEL_RANDOM_AO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector<uint8_t> liquids;
|
||||||
|
for (int i = 0; i < _library->get_num_surfaces(); ++i) {
|
||||||
|
Ref<VoxelSurface> surface = _library->get_voxel_surface(i);
|
||||||
|
|
||||||
|
if (!surface.is_valid())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (surface->get_liquid())
|
||||||
|
liquids.push_back(static_cast<uint8_t>(i + 1));
|
||||||
|
}
|
||||||
|
|
||||||
for (int y = chunk->get_margin_start(); y < y_size + chunk->get_margin_start(); ++y) {
|
for (int y = chunk->get_margin_start(); y < y_size + chunk->get_margin_start(); ++y) {
|
||||||
for (int z = chunk->get_margin_start(); z < z_size + chunk->get_margin_start(); ++z) {
|
for (int z = chunk->get_margin_start(); z < z_size + chunk->get_margin_start(); ++z) {
|
||||||
for (int x = chunk->get_margin_start(); x < x_size + chunk->get_margin_start(); ++x) {
|
for (int x = chunk->get_margin_start(); x < x_size + chunk->get_margin_start(); ++x) {
|
||||||
@ -84,6 +95,9 @@ void VoxelMesherBlocky::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
|||||||
if (type == 0)
|
if (type == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (liquids.find(type) != -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
Ref<VoxelSurface> surface = _library->get_voxel_surface(type - 1);
|
Ref<VoxelSurface> surface = _library->get_voxel_surface(type - 1);
|
||||||
|
|
||||||
if (!surface.is_valid())
|
if (!surface.is_valid())
|
||||||
@ -98,6 +112,12 @@ void VoxelMesherBlocky::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
|||||||
channel_type[indexzn],
|
channel_type[indexzn],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < 6; ++i) {
|
||||||
|
if (liquids.find(neighbours[i]) != -1) {
|
||||||
|
neighbours[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//x + 1
|
//x + 1
|
||||||
if (neighbours[0] == 0) {
|
if (neighbours[0] == 0) {
|
||||||
if (use_lighting) {
|
if (use_lighting) {
|
||||||
|
Loading…
Reference in New Issue
Block a user