diff --git a/meshers/blocky/voxel_mesher_blocky.cpp b/meshers/blocky/voxel_mesher_blocky.cpp index e2872b1..5c7b6b2 100644 --- a/meshers/blocky/voxel_mesher_blocky.cpp +++ b/meshers/blocky/voxel_mesher_blocky.cpp @@ -67,6 +67,17 @@ void VoxelMesherBlocky::_add_chunk(Ref p_chunk) { channel_rao = chunk->get_channel(VoxelChunkDefault::DEFAULT_CHANNEL_RANDOM_AO); } + Vector liquids; + for (int i = 0; i < _library->get_num_surfaces(); ++i) { + Ref surface = _library->get_voxel_surface(i); + + if (!surface.is_valid()) + continue; + + if (surface->get_liquid()) + liquids.push_back(static_cast(i + 1)); + } + 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 x = chunk->get_margin_start(); x < x_size + chunk->get_margin_start(); ++x) { @@ -84,6 +95,9 @@ void VoxelMesherBlocky::_add_chunk(Ref p_chunk) { if (type == 0) continue; + if (liquids.find(type) != -1) + continue; + Ref surface = _library->get_voxel_surface(type - 1); if (!surface.is_valid()) @@ -98,6 +112,12 @@ void VoxelMesherBlocky::_add_chunk(Ref p_chunk) { channel_type[indexzn], }; + for (int i = 0; i < 6; ++i) { + if (liquids.find(neighbours[i]) != -1) { + neighbours[i] = 0; + } + } + //x + 1 if (neighbours[0] == 0) { if (use_lighting) {