From 88c01588aa0830e219eaa62588839e4d1e2883ce Mon Sep 17 00:00:00 2001 From: untodesu Date: Wed, 25 Jun 2025 00:44:36 +0500 Subject: Clang-format the entire source code --- game/shared/ray_dda.cc | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'game/shared/ray_dda.cc') diff --git a/game/shared/ray_dda.cc b/game/shared/ray_dda.cc index 132d05a..3520817 100644 --- a/game/shared/ray_dda.cc +++ b/game/shared/ray_dda.cc @@ -1,20 +1,21 @@ #include "shared/pch.hh" + #include "shared/ray_dda.hh" #include "shared/coord.hh" #include "shared/dimension.hh" -RayDDA::RayDDA(const Dimension *dimension, const chunk_pos &start_chunk, const glm::fvec3 &start_fpos, const glm::fvec3 &direction) +RayDDA::RayDDA(const Dimension* dimension, const chunk_pos& start_chunk, const glm::fvec3& start_fpos, const glm::fvec3& direction) { reset(dimension, start_chunk, start_fpos, direction); } -RayDDA::RayDDA(const Dimension &dimension, const chunk_pos &start_chunk, const glm::fvec3 &start_fpos, const glm::fvec3 &direction) +RayDDA::RayDDA(const Dimension& dimension, const chunk_pos& start_chunk, const glm::fvec3& start_fpos, const glm::fvec3& direction) { reset(dimension, start_chunk, start_fpos, direction); } -void RayDDA::reset(const Dimension *dimension, const chunk_pos &start_chunk, const glm::fvec3 &start_fpos, const glm::fvec3 &direction) +void RayDDA::reset(const Dimension* dimension, const chunk_pos& start_chunk, const glm::fvec3& start_fpos, const glm::fvec3& direction) { this->dimension = dimension; this->start_chunk = start_chunk; @@ -35,8 +36,7 @@ void RayDDA::reset(const Dimension *dimension, const chunk_pos &start_chunk, con 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); } @@ -44,8 +44,7 @@ void RayDDA::reset(const Dimension *dimension, const chunk_pos &start_chunk, con 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); } @@ -53,14 +52,13 @@ void RayDDA::reset(const Dimension *dimension, const chunk_pos &start_chunk, con 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); } } -void RayDDA::reset(const Dimension &dimension, const chunk_pos &start_chunk, const glm::fvec3 &start_fpos, const glm::fvec3 &direction) +void RayDDA::reset(const Dimension& dimension, const chunk_pos& start_chunk, const glm::fvec3& start_fpos, const glm::fvec3& direction) { reset(&dimension, start_chunk, start_fpos, direction); } @@ -73,22 +71,19 @@ voxel_id 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; @@ -99,4 +94,3 @@ voxel_id RayDDA::step(void) // This is slower than I want it to be return dimension->get_voxel(vpos); } - -- cgit