refactor WorldGenerator

This commit is contained in:
MihailRis
2024-10-08 16:57:24 +03:00
parent ba3ac11b41
commit 5966ca5617
3 changed files with 33 additions and 10 deletions
+12
View File
@@ -78,12 +78,24 @@ namespace util {
(b.z - a.z) * (b.z - a.z);
}
/// @return integer square of distance between two points
inline int distance2(int ax, int ay, int az, int bx, int by, int bz) {
return (bx - ax) * (bx - ax) +
(by - ay) * (by - ay) +
(bz - az) * (bz - az);
}
/// @return integer square of vector length
/// @note glm::length2 does not support integer vectors
inline int length2(const glm::ivec3& a) {
return a.x * a.x + a.y * a.y + a.z * a.z;
}
/// @return integer square of vector length
inline int length2(int x, int y, int z) {
return x * x + y * y + z * z;
}
/// @brief Find nearest point on segment to given
/// @param a segment point A
/// @param b segment point B