Liquid mesher will only mesh liquid blocks now.

This commit is contained in:
Relintai 2020-04-19 23:55:06 +02:00
parent e07bb3850d
commit 1a1c0ade12

View File

@ -67,6 +67,17 @@ void VoxelMesherLiquidBlocky::_add_chunk(Ref<VoxelChunk> p_chunk) {
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 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 VoxelMesherLiquidBlocky::_add_chunk(Ref<VoxelChunk> p_chunk) {
if (type == 0)
continue;
if (liquids.find(type) == -1)
continue;
Ref<VoxelSurface> surface = _library->get_voxel_surface(type - 1);
if (!surface.is_valid())