Fix more GCC warnings

This commit is contained in:
Marc Gilleron 2021-04-18 01:48:53 +01:00
parent b846194bea
commit 7d93a4646d

View File

@ -285,7 +285,7 @@ void VoxelLodTerrain::_on_stream_params_changed() {
}
// The whole map might change, so make all area dirty
for (int i = 0; i < get_lod_count(); ++i) {
for (unsigned int i = 0; i < get_lod_count(); ++i) {
Lod &lod = _lods[i];
lod.last_view_distance_data_blocks = 0;
lod.last_view_distance_mesh_blocks = 0;
@ -547,7 +547,7 @@ void VoxelLodTerrain::reset_maps() {
// Don't reset while streaming, the result can be dirty?
//CRASH_COND(_stream_thread != nullptr);
for (int lod_index = 0; lod_index < (int)_lods.size(); ++lod_index) {
for (unsigned int lod_index = 0; lod_index < _lods.size(); ++lod_index) {
Lod &lod = _lods[lod_index];
// Instance new maps if we have more lods, or clear them otherwise
@ -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 {
ERR_FAIL_COND_V(lod_index < 0, Vector3());
ERR_FAIL_COND_V(lod_index >= get_lod_count(), Vector3());
ERR_FAIL_COND_V(lod_index >= static_cast<int>(get_lod_count()), Vector3());
const Lod &lod = _lods[lod_index];
Vector3i bpos = lod.data_map.voxel_to_block(Vector3i(vpos)) >> lod_index;
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 {
ERR_FAIL_COND_V(lod_index < 0, Vector3());
ERR_FAIL_COND_V(lod_index >= get_lod_count(), Vector3());
ERR_FAIL_COND_V(lod_index >= static_cast<int>(get_lod_count()), Vector3());
const Lod &lod = _lods[lod_index];
Vector3i bpos = lod.mesh_map.voxel_to_block(Vector3i(vpos)) >> lod_index;
return bpos.to_vec3();
@ -912,7 +912,7 @@ bool VoxelLodTerrain::check_block_mesh_updated(VoxelMeshBlock *block) {
void VoxelLodTerrain::send_block_data_requests() {
// Blocks to load
const bool request_instances = _instancer != nullptr;
for (int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {
for (unsigned int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {
Lod &lod = _lods[lod_index];
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.
// 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.
for (int lod_index = get_lod_count() - 2; lod_index >= 0; --lod_index) {
for (unsigned int lod_index = get_lod_count() - 2; lod_index >= 0; --lod_index) {
VOXEL_PROFILE_SCOPE();
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.
// 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.
for (int lod_index = get_lod_count() - 2; lod_index >= 0; --lod_index) {
for (unsigned int lod_index = get_lod_count() - 2; lod_index >= 0; --lod_index) {
VOXEL_PROFILE_SCOPE();
Lod &lod = _lods[lod_index];
@ -1148,7 +1148,7 @@ void VoxelLodTerrain::_process(float delta) {
OctreeItem &item = E->value();
const Vector3i block_pos_maxlod = E->key();
const int last_lod_index = self->get_lod_count() - 1;
const unsigned int last_lod_index = self->get_lod_count() - 1;
// We just drop the octree and hide blocks it was considering as visible.
// Normally such octrees shouldn't bee too deep as they will likely be at the edge
@ -1441,7 +1441,7 @@ void VoxelLodTerrain::_process(float delta) {
const int render_to_data_factor = get_mesh_block_size() / get_data_block_size();
for (int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {
for (unsigned int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {
VOXEL_PROFILE_SCOPE();
Lod &lod = _lods[lod_index];
@ -1811,7 +1811,7 @@ void VoxelLodTerrain::set_instancer(VoxelInstancer *instancer) {
void VoxelLodTerrain::unload_data_block(Vector3i block_pos, int lod_index) {
VOXEL_PROFILE_SCOPE();
ERR_FAIL_COND(lod_index >= get_lod_count());
ERR_FAIL_COND(lod_index >= static_cast<unsigned int>(get_lod_count()));
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) {
VOXEL_PROFILE_SCOPE();
ERR_FAIL_COND(lod_index >= get_lod_count());
ERR_FAIL_COND(lod_index >= static_cast<unsigned int>(get_lod_count()));
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 d;
ERR_FAIL_COND_V(lod_index < 0, d);
ERR_FAIL_COND_V(lod_index >= get_lod_count(), d);
ERR_FAIL_COND_V(lod_index >= static_cast<int>(get_lod_count()), d);
const Lod &lod = _lods[lod_index];
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 d;
ERR_FAIL_COND_V(lod_index < 0, d);
ERR_FAIL_COND_V(lod_index >= get_lod_count(), d);
ERR_FAIL_COND_V(lod_index >= static_cast<int>(get_lod_count()), d);
const Lod &lod = _lods[lod_index];
Vector3i bpos = Vector3i::from_floored(fbpos);
@ -2326,7 +2326,7 @@ Array VoxelLodTerrain::_b_debug_print_sdf_top_down(Vector3 center, Vector3 exten
Array image_array;
image_array.resize(get_lod_count());
for (int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {
for (unsigned int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {
const Rect3i world_box = Rect3i::from_center_extents(Vector3i(center) >> lod_index, Vector3i(extents) >> lod_index);
if (world_box.size.volume() == 0) {