Code style

This commit is contained in:
Marc Gilleron 2019-05-19 18:24:03 +01:00
parent d5236239bf
commit 38062b32fe
2 changed files with 8 additions and 5 deletions

View File

@ -28,8 +28,9 @@ inline bool is_face_visible(const VoxelLibrary &lib, const Voxel &vt, int other_
}
inline bool is_transparent(const VoxelLibrary &lib, int voxel_id) {
if (lib.has_voxel(voxel_id))
if (lib.has_voxel(voxel_id)) {
return lib.get_voxel_const(voxel_id).is_transparent();
}
return true;
}
@ -45,10 +46,11 @@ void VoxelMesherBlocky::set_library(Ref<VoxelLibrary> library) {
void VoxelMesherBlocky::set_occlusion_darkness(float darkness) {
_baked_occlusion_darkness = darkness;
if (_baked_occlusion_darkness < 0.0)
if (_baked_occlusion_darkness < 0.0) {
_baked_occlusion_darkness = 0.0;
else if (_baked_occlusion_darkness >= 1.0)
} else if (_baked_occlusion_darkness >= 1.0) {
_baked_occlusion_darkness = 1.0;
}
}
void VoxelMesherBlocky::set_occlusion_enabled(bool enable) {

View File

@ -549,10 +549,11 @@ void VoxelTerrain::_process() {
} else {
// TODO Use viewport camera, much easier
Spatial *viewer = get_viewer(_viewer_path);
if (viewer)
if (viewer) {
viewer_block_pos = _map->voxel_to_block(viewer->get_translation());
else
} else {
viewer_block_pos = Vector3i();
}
}
// Find out which blocks need to appear and which need to be unloaded