1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

General code refactoring/improvements in server, treegen and connection

This commit is contained in:
sfan5 2024-03-12 14:13:24 +01:00
parent 24f2c38093
commit bc4ab8b99e
34 changed files with 330 additions and 439 deletions

View file

@ -70,8 +70,8 @@ RaycastState::RaycastState(const core::line3d<f32> &shootline,
}
bool boxLineCollision(const aabb3f &box, const v3f &start,
const v3f &dir, v3f *collision_point, v3f *collision_normal)
bool boxLineCollision(const aabb3f &box, const v3f start,
const v3f dir, v3f *collision_point, v3f *collision_normal)
{
if (box.isPointInside(start)) {
*collision_point = start;
@ -139,8 +139,8 @@ bool boxLineCollision(const aabb3f &box, const v3f &start,
return false;
}
bool boxLineCollision(const aabb3f &box, const v3f &rotation,
const v3f &start, const v3f &dir,
bool boxLineCollision(const aabb3f &box, const v3f rotation,
const v3f start, const v3f dir,
v3f *collision_point, v3f *collision_normal, v3f *raw_collision_normal)
{
// Inversely transform the ray rather than rotating the box faces;
@ -149,7 +149,8 @@ bool boxLineCollision(const aabb3f &box, const v3f &rotation,
rot.makeInverse();
bool collision = boxLineCollision(box, rot * start, rot * dir, collision_point, collision_normal);
if (!collision) return collision;
if (!collision)
return collision;
// Transform the results back
rot.makeInverse();