skipping chunks added.

This commit is contained in:
Yggdrasil75
2026-01-20 09:30:23 -05:00
parent 840a3f1517
commit 58555f96c8
2 changed files with 47 additions and 45 deletions

View File

@@ -267,15 +267,17 @@ public:
float dist = 0; float dist = 0;
while (lv != cv && visitedVoxel.size() < 10 && dist < maxDist) { while (lv != cv && visitedVoxel.size() < 10 && dist < maxDist && inGrid(cv)) {
Vec3i currentChunk = getChunkCoord(cv); Vec3i currentChunk = getChunkCoord(cv);
auto it = activeChunks.find(currentChunk); auto it = activeChunks.find(currentChunk);
bool isChunkActive = (it != activeChunks.end() && it->second); bool isChunkActive = (it != activeChunks.end() && it->second);
if (get(cv).active) {
visitedVoxel.push_back(cv);
}
if (!isChunkActive) { if (!isChunkActive) {
while (getChunkCoord(cv) == currentChunk && inGrid(cv)) {
Vec3f chunkStep = step * CHUNK_THRESHOLD / 2; Vec3f chunkStep = step * CHUNK_THRESHOLD / 2;
Vec3d chunkDelta = tDelta * CHUNK_THRESHOLD / 2; Vec3d chunkDelta = tDelta * CHUNK_THRESHOLD / 2;
if (tMax.x < tMax.y) { if (tMax.x < tMax.y) {
@@ -299,14 +301,9 @@ public:
tMax.z += chunkDelta.z; tMax.z += chunkDelta.z;
} }
} }
}
continue; continue;
} } else {
if (get(cv).active) {
visitedVoxel.push_back(cv);
}
if (tMax.x < tMax.y) { if (tMax.x < tMax.y) {
if (tMax.x < tMax.z) { if (tMax.x < tMax.z) {
dist += tDelta.x; dist += tDelta.x;
@@ -329,6 +326,7 @@ public:
} }
} }
} }
}
return; return;
} }

View File

@@ -260,6 +260,10 @@ public:
return Vec3<int>(static_cast<int>(std::floor(x)), static_cast<int>(std::floor(x)), static_cast<int>(std::floor(z))); return Vec3<int>(static_cast<int>(std::floor(x)), static_cast<int>(std::floor(x)), static_cast<int>(std::floor(z)));
} }
Vec3<uint8_t> floorToI8() const {
return Vec3<uint8_t>(static_cast<uint8_t>(std::floor(x)), static_cast<uint8_t>(std::floor(x)), static_cast<uint8_t>(std::floor(z)));
}
Vec3<size_t> floorToT() const { Vec3<size_t> floorToT() const {
return Vec3<size_t>(static_cast<size_t>(std::floor(x)), static_cast<size_t>(std::floor(x)), static_cast<size_t>(std::floor(z))); return Vec3<size_t>(static_cast<size_t>(std::floor(x)), static_cast<size_t>(std::floor(x)), static_cast<size_t>(std::floor(z)));
} }