From 40dcf89f576535fb3953b634f0d5c094d67e04f3 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Sun, 20 Aug 2017 19:15:36 +0200 Subject: [PATCH] Don't parse smooth voxels if the buffer is uniform --- voxel_mesher_smooth.cpp | 5 +++++ voxel_terrain.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/voxel_mesher_smooth.cpp b/voxel_mesher_smooth.cpp index 3dd4202..811cc09 100644 --- a/voxel_mesher_smooth.cpp +++ b/voxel_mesher_smooth.cpp @@ -129,6 +129,11 @@ void VoxelMesherSmooth::build_mesh(const VoxelBuffer &voxels, unsigned int chann // Each 2x2 voxel group is a "cell" + if(voxels.is_uniform(channel)) { + // Nothing to extract, because constant isolevels never cross the surface + return; + } + const Vector3i block_size = voxels.get_size(); // TODO No lod yet, but it's planned const int lod_index = 0; diff --git a/voxel_terrain.cpp b/voxel_terrain.cpp index 7989a11..697dabc 100644 --- a/voxel_terrain.cpp +++ b/voxel_terrain.cpp @@ -102,6 +102,7 @@ void VoxelTerrain::set_view_distance(int distance_in_voxels) { _view_distance_blocks = d; make_all_view_dirty(); // TODO Immerge blocks too far away + // TODO Cancel updates that are scheduled too far away } } @@ -545,7 +546,6 @@ void VoxelTerrain::_bind_methods() { ClassDB::bind_method(D_METHOD("get_storage"), &VoxelTerrain::get_map); - // TODO Make those two static in VoxelMap? ClassDB::bind_method(D_METHOD("voxel_to_block", "voxel_pos"), &VoxelTerrain::_voxel_to_block_binding); ClassDB::bind_method(D_METHOD("block_to_voxel", "block_pos"), &VoxelTerrain::_block_to_voxel_binding);