diff --git a/terrain/voxel_block.cpp b/terrain/voxel_block.cpp index fd6d20d..53164ed 100644 --- a/terrain/voxel_block.cpp +++ b/terrain/voxel_block.cpp @@ -12,14 +12,14 @@ VoxelBlock *VoxelBlock::create(Vector3i bpos, Ref buffer, unsigned block->_position_in_voxels = bpos * (size << p_lod_index); block->voxels = buffer; - //block->map = ↦ return block; } VoxelBlock::VoxelBlock() : - voxels(NULL), - _mesh_update_count(0) { + voxels(NULL) { +} +VoxelBlock::~VoxelBlock() { VisualServer &vs = *VisualServer::get_singleton(); if (_mesh_instance.is_valid()) { diff --git a/terrain/voxel_block.h b/terrain/voxel_block.h index 09bd678..8e5c866 100644 --- a/terrain/voxel_block.h +++ b/terrain/voxel_block.h @@ -19,6 +19,8 @@ public: static VoxelBlock *create(Vector3i bpos, Ref buffer, unsigned int size, unsigned int p_lod_index); + ~VoxelBlock(); + void set_mesh(Ref mesh, Ref world); bool has_mesh() const; @@ -34,7 +36,7 @@ private: Ref _mesh; RID _mesh_instance; - int _mesh_update_count; + int _mesh_update_count = 0; bool _visible = true; };