summaryrefslogtreecommitdiffstats
path: root/game/shared/ray_dda.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-06-25 00:44:36 +0500
committeruntodesu <kirill@untode.su>2025-06-25 00:44:36 +0500
commit88c01588aa0830e219eaa62588839e4d1e2883ce (patch)
tree602bb27dd3399aab4aae8c19630e3b7a8dac824b /game/shared/ray_dda.cc
parent99cf6cca8dbbc1e563c10cf0167432d3d8af9783 (diff)
downloadvoxelius-88c01588aa0830e219eaa62588839e4d1e2883ce.tar.bz2
voxelius-88c01588aa0830e219eaa62588839e4d1e2883ce.zip
Clang-format the entire source code
Diffstat (limited to 'game/shared/ray_dda.cc')
-rw-r--r--game/shared/ray_dda.cc28
1 files changed, 11 insertions, 17 deletions
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);
}
-