Add origin updating for LargeWorlds

This commit is contained in:
Wojtek Figat
2022-06-27 23:33:51 +02:00
parent a7463872a8
commit d861518d2e
2 changed files with 21 additions and 0 deletions

View File

@@ -50,6 +50,9 @@ void LargeWorlds::UpdateOrigin(Vector3& origin, const Vector3& position)
{
if (Enable)
{
constexpr Real chunkSizeInv = 1.0 / ChunkSize;
constexpr Real chunkSizeHalf = ChunkSize * 0.5;
origin = Vector3(Int3((position - chunkSizeHalf) * chunkSizeInv)) * ChunkSize;
}
}