Skip to content

Commit

Permalink
Merge pull request #120 from tinmanjuggernaut/fix_gcc_warnings
Browse files Browse the repository at this point in the history
Fix gcc warnings
  • Loading branch information
Zylann authored Feb 15, 2020
2 parents 17e3651 + db98d58 commit 5925196
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 23 deletions.
4 changes: 4 additions & 0 deletions generators/voxel_generator_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ void VoxelGeneratorTest::generate_block(VoxelBlockRequest &input) {
case MODE_WAVES:
generate_block_waves(**input.voxel_buffer, input.origin_in_voxels, input.lod);
break;

default:
CRASH_NOW_MSG("Mode is unrecognized.");
break;
}
}

Expand Down
4 changes: 2 additions & 2 deletions meshers/blocky/voxel_mesher_blocky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ void VoxelMesherBlocky::build(VoxelMesher::Output &output, const VoxelMesher::In

ArraySlice<uint8_t> raw_channel;
if (!voxels.get_channel_raw(channel, raw_channel)) {
// _
/* _
// | \
// /\ \\
// / /|\\\
Expand All @@ -399,7 +399,7 @@ void VoxelMesherBlocky::build(VoxelMesher::Output &output, const VoxelMesher::In
// | | )
// \ | |
// \ /
//
*/
// Case supposedly handled before...
ERR_PRINT("Something wrong happened");
return;
Expand Down
10 changes: 5 additions & 5 deletions meshers/transvoxel/voxel_mesher_transvoxel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ inline uint8_t get_border_mask(const Vector3i &pos, const Vector3i &block_size)
// 16: -Z
// 32: +Z

for (int i = 0; i < Vector3i::AXIS_COUNT; i++) {
for (unsigned int i = 0; i < Vector3i::AXIS_COUNT; i++) {
// Close to negative face.
if (pos[i] == 0) {
mask |= (1 << (i * 2));
Expand Down Expand Up @@ -908,20 +908,20 @@ void VoxelMesherTransvoxel::build_transition(const VoxelBuffer &p_voxels, unsign
void VoxelMesherTransvoxel::reset_reuse_cells(Vector3i block_size) {
_block_size = block_size;
unsigned int deck_area = block_size.x * block_size.y;
for (int i = 0; i < _cache.size(); ++i) {
for (unsigned int i = 0; i < _cache.size(); ++i) {
std::vector<ReuseCell> &deck = _cache[i];
deck.resize(deck_area);
for (int j = 0; j < deck.size(); ++j) {
for (size_t j = 0; j < deck.size(); ++j) {
deck[j].vertices.fill(-1);
}
}
}

void VoxelMesherTransvoxel::reset_reuse_cells_2d(Vector3i block_size) {
for (int i = 0; i < _cache_2d.size(); ++i) {
for (unsigned int i = 0; i < _cache_2d.size(); ++i) {
std::vector<ReuseTransitionCell> &row = _cache_2d[i];
row.resize(block_size.x);
for (int j = 0; j < row.size(); ++j) {
for (size_t j = 0; j < row.size(); ++j) {
row[j].vertices.fill(-1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion streams/voxel_stream_region_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ void VoxelStreamRegionFiles::_convert_files(Meta new_meta) {
int lod;
};

ERR_FAIL_COND(old_stream->load_meta() != OK);
ERR_FAIL_COND(old_stream->load_meta() != VOXEL_FILE_OK);

std::vector<PositionAndLod> old_region_list;
Meta old_meta = old_stream->_meta;
Expand Down
22 changes: 11 additions & 11 deletions terrain/voxel_lod_terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void VoxelLodTerrain::stop_updater() {

_blocks_pending_main_thread_update.clear();

for (int i = 0; i < _lods.size(); ++i) {
for (unsigned int i = 0; i < _lods.size(); ++i) {

Lod &lod = _lods[i];
lod.blocks_pending_update.clear();
Expand All @@ -307,7 +307,7 @@ void VoxelLodTerrain::stop_streamer() {
_stream_thread = nullptr;
}

for (int i = 0; i < _lods.size(); ++i) {
for (unsigned int i = 0; i < _lods.size(); ++i) {
Lod &lod = _lods[i];
lod.blocks_to_load.clear();
}
Expand Down Expand Up @@ -337,7 +337,7 @@ float VoxelLodTerrain::get_lod_split_scale() const {

void VoxelLodTerrain::set_lod_count(int p_lod_count) {

ERR_FAIL_COND(p_lod_count >= VoxelConstants::MAX_LOD);
ERR_FAIL_COND(p_lod_count >= (int)VoxelConstants::MAX_LOD);
ERR_FAIL_COND(p_lod_count < 1);

if (get_lod_count() != p_lod_count) {
Expand All @@ -347,7 +347,7 @@ void VoxelLodTerrain::set_lod_count(int p_lod_count) {

void VoxelLodTerrain::_set_lod_count(int p_lod_count) {

CRASH_COND(p_lod_count >= VoxelConstants::MAX_LOD);
CRASH_COND(p_lod_count >= (int)VoxelConstants::MAX_LOD);
CRASH_COND(p_lod_count < 1);

_lod_count = p_lod_count;
Expand All @@ -365,7 +365,7 @@ void VoxelLodTerrain::_set_lod_count(int p_lod_count) {
void VoxelLodTerrain::reset_maps() {
// Clears all blocks and reconfigures maps to account for new LOD count and block sizes

for (int lod_index = 0; lod_index < _lods.size(); ++lod_index) {
for (int lod_index = 0; lod_index < (int)_lods.size(); ++lod_index) {

Lod &lod = _lods[lod_index];

Expand Down Expand Up @@ -447,7 +447,7 @@ void VoxelLodTerrain::_notification(int p_what) {

case NOTIFICATION_ENTER_WORLD: {
World *world = *get_world();
for (int lod_index = 0; lod_index < _lods.size(); ++lod_index) {
for (unsigned int lod_index = 0; lod_index < _lods.size(); ++lod_index) {
if (_lods[lod_index].map.is_valid()) {
_lods[lod_index].map->for_all_blocks([world](VoxelBlock *block) {
block->set_world(world);
Expand All @@ -457,7 +457,7 @@ void VoxelLodTerrain::_notification(int p_what) {
} break;

case NOTIFICATION_EXIT_WORLD: {
for (int lod_index = 0; lod_index < _lods.size(); ++lod_index) {
for (unsigned int lod_index = 0; lod_index < _lods.size(); ++lod_index) {
if (_lods[lod_index].map.is_valid()) {
_lods[lod_index].map->for_all_blocks([](VoxelBlock *block) {
block->set_world(nullptr);
Expand All @@ -468,7 +468,7 @@ void VoxelLodTerrain::_notification(int p_what) {

case NOTIFICATION_VISIBILITY_CHANGED: {
bool visible = is_visible();
for (int lod_index = 0; lod_index < _lods.size(); ++lod_index) {
for (unsigned int lod_index = 0; lod_index < _lods.size(); ++lod_index) {
if (_lods[lod_index].map.is_valid()) {
_lods[lod_index].map->for_all_blocks([visible](VoxelBlock *block) {
block->set_parent_visible(visible);
Expand Down Expand Up @@ -1203,7 +1203,7 @@ void VoxelLodTerrain::_process() {

{
VOXEL_PROFILE_SCOPE(profile_process_receive_mesh_updates_block_update_transitions);
for (int dir = 0; dir < mesh_data.transition_surfaces.size(); ++dir) {
for (unsigned int dir = 0; dir < mesh_data.transition_surfaces.size(); ++dir) {

Ref<ArrayMesh> transition_mesh = build_mesh(
mesh_data.transition_surfaces[dir],
Expand Down Expand Up @@ -1420,7 +1420,7 @@ uint8_t VoxelLodTerrain::get_transition_mask(Vector3i block_pos, int lod_index)

uint8_t transition_mask = 0;

if (lod_index + 1 >= _lods.size()) {
if (lod_index + 1 >= (int)_lods.size()) {
return transition_mask;
}

Expand Down Expand Up @@ -1480,7 +1480,7 @@ uint8_t VoxelLodTerrain::get_transition_mask(Vector3i block_pos, int lod_index)
// There are always 4 on each side, checking any is enough

Vector3i upper_neighbor_pos = upper_pos;
for (int i = 0; i < Vector3i::AXIS_COUNT; ++i) {
for (unsigned int i = 0; i < Vector3i::AXIS_COUNT; ++i) {
if (side_normal[i] == -1) {
--upper_neighbor_pos[i];
} else if (side_normal[i] == 1) {
Expand Down
2 changes: 1 addition & 1 deletion terrain/voxel_terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ void VoxelTerrain::_process() {
} else {
CRASH_COND(block->voxels.is_null());

int air_type = 0;
uint64_t air_type = 0;
if (
block->voxels->is_uniform(VoxelBuffer::CHANNEL_TYPE) &&
block->voxels->is_uniform(VoxelBuffer::CHANNEL_SDF) &&
Expand Down
6 changes: 3 additions & 3 deletions voxel_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,19 +360,19 @@ void VoxelBuffer::fill_area(uint64_t defval, Vector3i min, Vector3i max, unsigne
break;

case DEPTH_16_BIT:
for (unsigned int i = 0; i < area_size.y; ++i) {
for (int i = 0; i < area_size.y; ++i) {
((uint16_t *)channel.data)[dst_ri + i] = defval;
}
break;

case DEPTH_32_BIT:
for (unsigned int i = 0; i < area_size.y; ++i) {
for (int i = 0; i < area_size.y; ++i) {
((uint32_t *)channel.data)[dst_ri + i] = defval;
}
break;

case DEPTH_64_BIT:
for (unsigned int i = 0; i < area_size.y; ++i) {
for (int i = 0; i < area_size.y; ++i) {
((uint64_t *)channel.data)[dst_ri + i] = defval;
}
break;
Expand Down

0 comments on commit 5925196

Please sign in to comment.