diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-04 16:57:41 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-04 16:57:41 +0100 |
commit | 6ccb5835ff55d85156be91473c598eca9d6cb9a6 (patch) | |
tree | 7f1eaf8b94694c8e24e206909ba8f55a1ebfbb3e /src/raycast.cpp | |
parent | 244713971a976e43e8740b6a9d9d122e37020ef2 (diff) | |
download | dragonfireclient-6ccb5835ff55d85156be91473c598eca9d6cb9a6.tar.xz |
Revert "Make Lint Happy"
This reverts commit ad148587dcf5244c2d2011dba339786c765c54c4.
Diffstat (limited to 'src/raycast.cpp')
-rw-r--r-- | src/raycast.cpp | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/src/raycast.cpp b/src/raycast.cpp index bb13e6108..a1993606f 100644 --- a/src/raycast.cpp +++ b/src/raycast.cpp @@ -22,7 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irr_aabb3d.h" #include "constants.h" -bool RaycastSort::operator()(const PointedThing &pt1, const PointedThing &pt2) const +bool RaycastSort::operator() (const PointedThing &pt1, + const PointedThing &pt2) const { // "nothing" can not be sorted assert(pt1.type != POINTEDTHING_NOTHING); @@ -45,27 +46,30 @@ bool RaycastSort::operator()(const PointedThing &pt1, const PointedThing &pt2) c if (pt1_distSq == pt2.distanceSq) { // Sort them to allow only one order if (pt1.type == POINTEDTHING_OBJECT) - return (pt2.type == POINTEDTHING_OBJECT && - pt1.object_id < pt2.object_id); + return (pt2.type == POINTEDTHING_OBJECT + && pt1.object_id < pt2.object_id); - return (pt2.type == POINTEDTHING_OBJECT || - pt1.node_undersurface < pt2.node_undersurface); + return (pt2.type == POINTEDTHING_OBJECT + || pt1.node_undersurface < pt2.node_undersurface); } return true; } -RaycastState::RaycastState(const core::line3d<f32> &shootline, bool objects_pointable, - bool liquids_pointable, bool nodes_pointable) : - m_shootline(shootline), - m_iterator(shootline.start / BS, shootline.getVector() / BS), - m_previous_node(m_iterator.m_current_node_pos), - m_objects_pointable(objects_pointable), - m_liquids_pointable(liquids_pointable), m_nodes_pointable(nodes_pointable) + +RaycastState::RaycastState(const core::line3d<f32> &shootline, + bool objects_pointable, bool liquids_pointable, bool nodes_pointable) : + m_shootline(shootline), + m_iterator(shootline.start / BS, shootline.getVector() / BS), + m_previous_node(m_iterator.m_current_node_pos), + m_objects_pointable(objects_pointable), + m_liquids_pointable(liquids_pointable), + m_nodes_pointable(nodes_pointable) { } -bool boxLineCollision(const aabb3f &box, const v3f &start, const v3f &dir, - v3f *collision_point, v3s16 *collision_normal) + +bool boxLineCollision(const aabb3f &box, const v3f &start, + const v3f &dir, v3f *collision_point, v3s16 *collision_normal) { if (box.isPointInside(start)) { *collision_point = start; @@ -83,10 +87,10 @@ bool boxLineCollision(const aabb3f &box, const v3f &start, const v3f &dir, if (m >= 0 && m <= 1) { *collision_point = start + dir * m; - if ((collision_point->Y >= box.MinEdge.Y) && - (collision_point->Y <= box.MaxEdge.Y) && - (collision_point->Z >= box.MinEdge.Z) && - (collision_point->Z <= box.MaxEdge.Z)) { + if ((collision_point->Y >= box.MinEdge.Y) + && (collision_point->Y <= box.MaxEdge.Y) + && (collision_point->Z >= box.MinEdge.Z) + && (collision_point->Z <= box.MaxEdge.Z)) { collision_normal->set((dir.X > 0) ? -1 : 1, 0, 0); return true; } @@ -102,10 +106,10 @@ bool boxLineCollision(const aabb3f &box, const v3f &start, const v3f &dir, if (m >= 0 && m <= 1) { *collision_point = start + dir * m; - if ((collision_point->X >= box.MinEdge.X) && - (collision_point->X <= box.MaxEdge.X) && - (collision_point->Z >= box.MinEdge.Z) && - (collision_point->Z <= box.MaxEdge.Z)) { + if ((collision_point->X >= box.MinEdge.X) + && (collision_point->X <= box.MaxEdge.X) + && (collision_point->Z >= box.MinEdge.Z) + && (collision_point->Z <= box.MaxEdge.Z)) { collision_normal->set(0, (dir.Y > 0) ? -1 : 1, 0); return true; } @@ -121,10 +125,10 @@ bool boxLineCollision(const aabb3f &box, const v3f &start, const v3f &dir, if (m >= 0 && m <= 1) { *collision_point = start + dir * m; - if ((collision_point->X >= box.MinEdge.X) && - (collision_point->X <= box.MaxEdge.X) && - (collision_point->Y >= box.MinEdge.Y) && - (collision_point->Y <= box.MaxEdge.Y)) { + if ((collision_point->X >= box.MinEdge.X) + && (collision_point->X <= box.MaxEdge.X) + && (collision_point->Y >= box.MinEdge.Y) + && (collision_point->Y <= box.MaxEdge.Y)) { collision_normal->set(0, 0, (dir.Z > 0) ? -1 : 1); return true; } |