From 1a1c0ade1221b83d5e30674d22d72788634d6d3a Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 19 Apr 2020 23:55:06 +0200 Subject: [PATCH] Liquid mesher will only mesh liquid blocks now. --- meshers/blocky/voxel_mesher_liquid_blocky.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/meshers/blocky/voxel_mesher_liquid_blocky.cpp b/meshers/blocky/voxel_mesher_liquid_blocky.cpp index 61c8b83..a181fcf 100644 --- a/meshers/blocky/voxel_mesher_liquid_blocky.cpp +++ b/meshers/blocky/voxel_mesher_liquid_blocky.cpp @@ -67,6 +67,17 @@ void VoxelMesherLiquidBlocky::_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 VoxelMesherLiquidBlocky::_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())