From 9363f54e8d06fdfd46253c4404f7ce04d51ab1f5 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Sat, 4 May 2019 00:00:50 +0100 Subject: [PATCH] Comments --- terrain/voxel_terrain.cpp | 9 ++++++--- terrain/voxel_terrain.h | 12 ++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/terrain/voxel_terrain.cpp b/terrain/voxel_terrain.cpp index 2e56e19..e83bf35 100644 --- a/terrain/voxel_terrain.cpp +++ b/terrain/voxel_terrain.cpp @@ -285,6 +285,8 @@ void VoxelTerrain::reset_updater() { params.smooth_surface = _smooth_meshing_enabled; _block_updater = memnew(VoxelMeshUpdater(_library, params)); + + // TODO Revert any pending update states! } inline int get_border_index(int x, int max) { @@ -447,6 +449,8 @@ void VoxelTerrain::make_area_dirty(Rect3i box) { } } +namespace { + struct EnterWorldAction { World *world; EnterWorldAction(World *w) : @@ -471,6 +475,8 @@ struct SetVisibilityAction { } }; +} // namespace + void VoxelTerrain::_notification(int p_what) { switch (p_what) { @@ -820,7 +826,6 @@ void VoxelTerrain::_process() { CRASH_COND(surface.size() != Mesh::ARRAY_MAX); mesh->add_surface_from_arrays(ob.blocky_surfaces.primitive_type, surface); mesh->surface_set_material(surface_index, _materials[i]); - ++surface_index; } @@ -832,10 +837,8 @@ void VoxelTerrain::_process() { } CRASH_COND(surface.size() != Mesh::ARRAY_MAX); - // TODO Problem here, the mesher could be configured to output wireframe! Need to output some MeshData struct instead mesh->add_surface_from_arrays(ob.smooth_surfaces.primitive_type, surface); mesh->surface_set_material(surface_index, _materials[i]); - // No material supported yet ++surface_index; } diff --git a/terrain/voxel_terrain.h b/terrain/voxel_terrain.h index c1fd5de..618e37f 100644 --- a/terrain/voxel_terrain.h +++ b/terrain/voxel_terrain.h @@ -14,17 +14,17 @@ class VoxelMap; class VoxelLibrary; // Infinite paged terrain made of voxel blocks. -// Voxels are polygonized around the viewer. +// Voxels are polygonized around the viewer by distance in a large cubic space. // Data is streamed using a VoxelProvider. class VoxelTerrain : public Spatial { GDCLASS(VoxelTerrain, Spatial) public: enum BlockDirtyState { - BLOCK_NONE, - BLOCK_LOAD, - BLOCK_UPDATE_NOT_SENT, - BLOCK_UPDATE_SENT, - BLOCK_IDLE + BLOCK_NONE, // There is no block + BLOCK_LOAD, // The block is loading + BLOCK_UPDATE_NOT_SENT, // The block needs an update but wasn't sent yet + BLOCK_UPDATE_SENT, // The block needs an update which was sent + BLOCK_IDLE // The block is up to date }; VoxelTerrain();