diff options
Diffstat (limited to 'game/shared/world/ray_dda.cc')
| -rw-r--r-- | game/shared/world/ray_dda.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/game/shared/world/ray_dda.cc b/game/shared/world/ray_dda.cc index b12fa48..9f85e6b 100644 --- a/game/shared/world/ray_dda.cc +++ b/game/shared/world/ray_dda.cc @@ -40,7 +40,8 @@ void world::RayDDA::reset( if(direction.x < 0.0f) { this->side_dist.x = this->delta_dist.x * (start_fpos.x - lpos.x); this->vstep.x = voxel_pos::value_type(-1); - } else { + } + else { this->side_dist.x = this->delta_dist.x * (lpos.x + 1.0f - start_fpos.x); this->vstep.x = voxel_pos::value_type(+1); } @@ -48,7 +49,8 @@ void world::RayDDA::reset( if(direction.y < 0.0f) { this->side_dist.y = this->delta_dist.y * (start_fpos.y - lpos.y); this->vstep.y = voxel_pos::value_type(-1); - } else { + } + else { this->side_dist.y = this->delta_dist.y * (lpos.y + 1.0f - start_fpos.y); this->vstep.y = voxel_pos::value_type(+1); } @@ -56,7 +58,8 @@ void world::RayDDA::reset( if(direction.z < 0.0f) { this->side_dist.z = this->delta_dist.z * (start_fpos.z - lpos.z); this->vstep.z = voxel_pos::value_type(-1); - } else { + } + else { this->side_dist.z = this->delta_dist.z * (lpos.z + 1.0f - start_fpos.z); this->vstep.z = voxel_pos::value_type(+1); } @@ -76,19 +79,22 @@ voxel_id world::RayDDA::step(void) distance = side_dist.x; side_dist.x += delta_dist.x; vpos.x += vstep.x; - } else { + } + else { vnormal = voxel_pos(0, -vstep.y, 0); distance = side_dist.y; side_dist.y += delta_dist.y; vpos.y += vstep.y; } - } else { + } + else { if(side_dist.z < side_dist.y) { vnormal = voxel_pos(0, 0, -vstep.z); distance = side_dist.z; side_dist.z += delta_dist.z; vpos.z += vstep.z; - } else { + } + else { vnormal = voxel_pos(0, -vstep.y, 0); distance = side_dist.y; side_dist.y += delta_dist.y; |
