mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 03:51:50 +00:00
refactor WorldGenerator
This commit is contained in:
parent
ba3ac11b41
commit
5966ca5617
3 changed files with 33 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue