Make getter and setter types match to fix an issue with C# bindings
This commit is contained in:
parent
d53e7dd530
commit
14cc77eb7c
@ -285,7 +285,7 @@ void VoxelLodTerrain::_on_stream_params_changed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The whole map might change, so make all area dirty
|
// The whole map might change, so make all area dirty
|
||||||
for (unsigned int i = 0; i < get_lod_count(); ++i) {
|
for (unsigned int i = 0; i < _lod_count; ++i) {
|
||||||
Lod &lod = _lods[i];
|
Lod &lod = _lods[i];
|
||||||
lod.last_view_distance_data_blocks = 0;
|
lod.last_view_distance_data_blocks = 0;
|
||||||
lod.last_view_distance_mesh_blocks = 0;
|
lod.last_view_distance_mesh_blocks = 0;
|
||||||
@ -519,7 +519,7 @@ void VoxelLodTerrain::set_lod_count(int p_lod_count) {
|
|||||||
ERR_FAIL_COND(p_lod_count >= (int)VoxelConstants::MAX_LOD);
|
ERR_FAIL_COND(p_lod_count >= (int)VoxelConstants::MAX_LOD);
|
||||||
ERR_FAIL_COND(p_lod_count < 1);
|
ERR_FAIL_COND(p_lod_count < 1);
|
||||||
|
|
||||||
if (static_cast<int>(get_lod_count()) != p_lod_count) {
|
if (get_lod_count() != p_lod_count) {
|
||||||
_set_lod_count(p_lod_count);
|
_set_lod_count(p_lod_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -551,7 +551,7 @@ void VoxelLodTerrain::reset_maps() {
|
|||||||
Lod &lod = _lods[lod_index];
|
Lod &lod = _lods[lod_index];
|
||||||
|
|
||||||
// Instance new maps if we have more lods, or clear them otherwise
|
// Instance new maps if we have more lods, or clear them otherwise
|
||||||
if (lod_index < get_lod_count()) {
|
if (lod_index < _lod_count) {
|
||||||
lod.data_map.create(lod.data_map.get_block_size_pow2(), lod_index);
|
lod.data_map.create(lod.data_map.get_block_size_pow2(), lod_index);
|
||||||
lod.mesh_map.create(lod.mesh_map.get_block_size_pow2(), lod_index);
|
lod.mesh_map.create(lod.mesh_map.get_block_size_pow2(), lod_index);
|
||||||
lod.blocks_to_load.clear();
|
lod.blocks_to_load.clear();
|
||||||
@ -571,7 +571,7 @@ void VoxelLodTerrain::reset_maps() {
|
|||||||
_lod_octrees.clear();
|
_lod_octrees.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int VoxelLodTerrain::get_lod_count() const {
|
int VoxelLodTerrain::get_lod_count() const {
|
||||||
return _lod_count;
|
return _lod_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,7 +581,7 @@ void VoxelLodTerrain::set_generate_collisions(bool enabled) {
|
|||||||
|
|
||||||
void VoxelLodTerrain::set_collision_lod_count(int lod_count) {
|
void VoxelLodTerrain::set_collision_lod_count(int lod_count) {
|
||||||
ERR_FAIL_COND(lod_count < 0);
|
ERR_FAIL_COND(lod_count < 0);
|
||||||
_collision_lod_count = min(static_cast<unsigned int>(lod_count), get_lod_count());
|
_collision_lod_count = static_cast<unsigned int>(min(lod_count, get_lod_count()));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int VoxelLodTerrain::get_collision_lod_count() const {
|
unsigned int VoxelLodTerrain::get_collision_lod_count() const {
|
||||||
@ -598,7 +598,7 @@ int VoxelLodTerrain::get_mesh_block_region_extent() const {
|
|||||||
|
|
||||||
Vector3 VoxelLodTerrain::voxel_to_data_block_position(Vector3 vpos, int lod_index) const {
|
Vector3 VoxelLodTerrain::voxel_to_data_block_position(Vector3 vpos, int lod_index) const {
|
||||||
ERR_FAIL_COND_V(lod_index < 0, Vector3());
|
ERR_FAIL_COND_V(lod_index < 0, Vector3());
|
||||||
ERR_FAIL_COND_V(lod_index >= static_cast<int>(get_lod_count()), Vector3());
|
ERR_FAIL_COND_V(lod_index >= get_lod_count(), Vector3());
|
||||||
const Lod &lod = _lods[lod_index];
|
const Lod &lod = _lods[lod_index];
|
||||||
Vector3i bpos = lod.data_map.voxel_to_block(Vector3i(vpos)) >> lod_index;
|
Vector3i bpos = lod.data_map.voxel_to_block(Vector3i(vpos)) >> lod_index;
|
||||||
return bpos.to_vec3();
|
return bpos.to_vec3();
|
||||||
@ -606,7 +606,7 @@ Vector3 VoxelLodTerrain::voxel_to_data_block_position(Vector3 vpos, int lod_inde
|
|||||||
|
|
||||||
Vector3 VoxelLodTerrain::voxel_to_mesh_block_position(Vector3 vpos, int lod_index) const {
|
Vector3 VoxelLodTerrain::voxel_to_mesh_block_position(Vector3 vpos, int lod_index) const {
|
||||||
ERR_FAIL_COND_V(lod_index < 0, Vector3());
|
ERR_FAIL_COND_V(lod_index < 0, Vector3());
|
||||||
ERR_FAIL_COND_V(lod_index >= static_cast<int>(get_lod_count()), Vector3());
|
ERR_FAIL_COND_V(lod_index >= get_lod_count(), Vector3());
|
||||||
const Lod &lod = _lods[lod_index];
|
const Lod &lod = _lods[lod_index];
|
||||||
Vector3i bpos = lod.mesh_map.voxel_to_block(Vector3i(vpos)) >> lod_index;
|
Vector3i bpos = lod.mesh_map.voxel_to_block(Vector3i(vpos)) >> lod_index;
|
||||||
return bpos.to_vec3();
|
return bpos.to_vec3();
|
||||||
@ -912,7 +912,7 @@ bool VoxelLodTerrain::check_block_mesh_updated(VoxelMeshBlock *block) {
|
|||||||
void VoxelLodTerrain::send_block_data_requests() {
|
void VoxelLodTerrain::send_block_data_requests() {
|
||||||
// Blocks to load
|
// Blocks to load
|
||||||
const bool request_instances = _instancer != nullptr;
|
const bool request_instances = _instancer != nullptr;
|
||||||
for (unsigned int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {
|
for (unsigned int lod_index = 0; lod_index < _lod_count; ++lod_index) {
|
||||||
Lod &lod = _lods[lod_index];
|
Lod &lod = _lods[lod_index];
|
||||||
|
|
||||||
for (unsigned int i = 0; i < lod.blocks_to_load.size(); ++i) {
|
for (unsigned int i = 0; i < lod.blocks_to_load.size(); ++i) {
|
||||||
@ -969,7 +969,7 @@ void VoxelLodTerrain::_process(float delta) {
|
|||||||
// Ignore largest lod because it can extend a little beyond due to the view distance setting.
|
// Ignore largest lod because it can extend a little beyond due to the view distance setting.
|
||||||
// Instead, those blocks are unloaded by the octree forest management.
|
// Instead, those blocks are unloaded by the octree forest management.
|
||||||
// Iterating from big to small LOD so we can exit earlier if bounds don't intersect.
|
// Iterating from big to small LOD so we can exit earlier if bounds don't intersect.
|
||||||
for (int lod_index = static_cast<int>(get_lod_count()) - 2; lod_index >= 0; --lod_index) {
|
for (int lod_index = get_lod_count() - 2; lod_index >= 0; --lod_index) {
|
||||||
VOXEL_PROFILE_SCOPE();
|
VOXEL_PROFILE_SCOPE();
|
||||||
Lod &lod = _lods[lod_index];
|
Lod &lod = _lods[lod_index];
|
||||||
|
|
||||||
@ -1053,7 +1053,7 @@ void VoxelLodTerrain::_process(float delta) {
|
|||||||
// Ignore largest lod because it can extend a little beyond due to the view distance setting.
|
// Ignore largest lod because it can extend a little beyond due to the view distance setting.
|
||||||
// Instead, those blocks are unloaded by the octree forest management.
|
// Instead, those blocks are unloaded by the octree forest management.
|
||||||
// Iterating from big to small LOD so we can exit earlier if bounds don't intersect.
|
// Iterating from big to small LOD so we can exit earlier if bounds don't intersect.
|
||||||
for (int lod_index = static_cast<int>(get_lod_count()) - 2; lod_index >= 0; --lod_index) {
|
for (int lod_index = get_lod_count() - 2; lod_index >= 0; --lod_index) {
|
||||||
VOXEL_PROFILE_SCOPE();
|
VOXEL_PROFILE_SCOPE();
|
||||||
Lod &lod = _lods[lod_index];
|
Lod &lod = _lods[lod_index];
|
||||||
|
|
||||||
@ -1380,7 +1380,7 @@ void VoxelLodTerrain::_process(float delta) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ob.lod >= get_lod_count()) {
|
if (ob.lod >= _lod_count) {
|
||||||
// That block was requested at a time where LOD was higher... drop it
|
// That block was requested at a time where LOD was higher... drop it
|
||||||
++_stats.dropped_block_loads;
|
++_stats.dropped_block_loads;
|
||||||
continue;
|
continue;
|
||||||
@ -1441,7 +1441,7 @@ void VoxelLodTerrain::_process(float delta) {
|
|||||||
|
|
||||||
const int render_to_data_factor = get_mesh_block_size() / get_data_block_size();
|
const int render_to_data_factor = get_mesh_block_size() / get_data_block_size();
|
||||||
|
|
||||||
for (unsigned int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {
|
for (unsigned int lod_index = 0; lod_index < _lod_count; ++lod_index) {
|
||||||
VOXEL_PROFILE_SCOPE();
|
VOXEL_PROFILE_SCOPE();
|
||||||
Lod &lod = _lods[lod_index];
|
Lod &lod = _lods[lod_index];
|
||||||
|
|
||||||
@ -1507,7 +1507,7 @@ void VoxelLodTerrain::_process(float delta) {
|
|||||||
VOXEL_PROFILE_SCOPE();
|
VOXEL_PROFILE_SCOPE();
|
||||||
const VoxelServer::BlockMeshOutput &ob = _reception_buffers.mesh_output[queue_index];
|
const VoxelServer::BlockMeshOutput &ob = _reception_buffers.mesh_output[queue_index];
|
||||||
|
|
||||||
if (ob.lod >= get_lod_count()) {
|
if (ob.lod >= _lod_count) {
|
||||||
// Sorry, LOD configuration changed, drop that mesh
|
// Sorry, LOD configuration changed, drop that mesh
|
||||||
++_stats.dropped_block_meshs;
|
++_stats.dropped_block_meshs;
|
||||||
continue;
|
continue;
|
||||||
@ -1811,7 +1811,7 @@ void VoxelLodTerrain::set_instancer(VoxelInstancer *instancer) {
|
|||||||
|
|
||||||
void VoxelLodTerrain::unload_data_block(Vector3i block_pos, int lod_index) {
|
void VoxelLodTerrain::unload_data_block(Vector3i block_pos, int lod_index) {
|
||||||
VOXEL_PROFILE_SCOPE();
|
VOXEL_PROFILE_SCOPE();
|
||||||
ERR_FAIL_COND(lod_index >= static_cast<int>(get_lod_count()));
|
ERR_FAIL_COND(lod_index >= get_lod_count());
|
||||||
|
|
||||||
Lod &lod = _lods[lod_index];
|
Lod &lod = _lods[lod_index];
|
||||||
|
|
||||||
@ -1830,7 +1830,7 @@ void VoxelLodTerrain::unload_data_block(Vector3i block_pos, int lod_index) {
|
|||||||
|
|
||||||
void VoxelLodTerrain::unload_mesh_block(Vector3i block_pos, int lod_index) {
|
void VoxelLodTerrain::unload_mesh_block(Vector3i block_pos, int lod_index) {
|
||||||
VOXEL_PROFILE_SCOPE();
|
VOXEL_PROFILE_SCOPE();
|
||||||
ERR_FAIL_COND(lod_index >= static_cast<int>(get_lod_count()));
|
ERR_FAIL_COND(lod_index >= get_lod_count());
|
||||||
|
|
||||||
Lod &lod = _lods[lod_index];
|
Lod &lod = _lods[lod_index];
|
||||||
|
|
||||||
@ -2150,7 +2150,7 @@ Array VoxelLodTerrain::debug_raycast_mesh_block(Vector3 world_origin, Vector3 wo
|
|||||||
Dictionary VoxelLodTerrain::debug_get_data_block_info(Vector3 fbpos, int lod_index) const {
|
Dictionary VoxelLodTerrain::debug_get_data_block_info(Vector3 fbpos, int lod_index) const {
|
||||||
Dictionary d;
|
Dictionary d;
|
||||||
ERR_FAIL_COND_V(lod_index < 0, d);
|
ERR_FAIL_COND_V(lod_index < 0, d);
|
||||||
ERR_FAIL_COND_V(lod_index >= static_cast<int>(get_lod_count()), d);
|
ERR_FAIL_COND_V(lod_index >= get_lod_count(), d);
|
||||||
|
|
||||||
const Lod &lod = _lods[lod_index];
|
const Lod &lod = _lods[lod_index];
|
||||||
Vector3i bpos = Vector3i::from_floored(fbpos);
|
Vector3i bpos = Vector3i::from_floored(fbpos);
|
||||||
@ -2172,7 +2172,7 @@ Dictionary VoxelLodTerrain::debug_get_data_block_info(Vector3 fbpos, int lod_ind
|
|||||||
Dictionary VoxelLodTerrain::debug_get_mesh_block_info(Vector3 fbpos, int lod_index) const {
|
Dictionary VoxelLodTerrain::debug_get_mesh_block_info(Vector3 fbpos, int lod_index) const {
|
||||||
Dictionary d;
|
Dictionary d;
|
||||||
ERR_FAIL_COND_V(lod_index < 0, d);
|
ERR_FAIL_COND_V(lod_index < 0, d);
|
||||||
ERR_FAIL_COND_V(lod_index >= static_cast<int>(get_lod_count()), d);
|
ERR_FAIL_COND_V(lod_index >= get_lod_count(), d);
|
||||||
|
|
||||||
const Lod &lod = _lods[lod_index];
|
const Lod &lod = _lods[lod_index];
|
||||||
Vector3i bpos = Vector3i::from_floored(fbpos);
|
Vector3i bpos = Vector3i::from_floored(fbpos);
|
||||||
@ -2325,7 +2325,7 @@ Array VoxelLodTerrain::_b_debug_print_sdf_top_down(Vector3 center, Vector3 exten
|
|||||||
Array image_array;
|
Array image_array;
|
||||||
image_array.resize(get_lod_count());
|
image_array.resize(get_lod_count());
|
||||||
|
|
||||||
for (unsigned int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {
|
for (unsigned int lod_index = 0; lod_index < _lod_count; ++lod_index) {
|
||||||
const Rect3i world_box = Rect3i::from_center_extents(Vector3i(center) >> lod_index, Vector3i(extents) >> lod_index);
|
const Rect3i world_box = Rect3i::from_center_extents(Vector3i(center) >> lod_index, Vector3i(extents) >> lod_index);
|
||||||
|
|
||||||
if (world_box.size.volume() == 0) {
|
if (world_box.size.volume() == 0) {
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
float get_lod_distance() const;
|
float get_lod_distance() const;
|
||||||
|
|
||||||
void set_lod_count(int p_lod_count);
|
void set_lod_count(int p_lod_count);
|
||||||
unsigned int get_lod_count() const;
|
int get_lod_count() const;
|
||||||
|
|
||||||
void set_generate_collisions(bool enabled);
|
void set_generate_collisions(bool enabled);
|
||||||
bool get_generate_collisions() const { return _generate_collisions; }
|
bool get_generate_collisions() const { return _generate_collisions; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user