mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 20:44:14 +02:00
Unfortunately, the early test for subdivision doesn't work, which means that,
for now, we need to traverse the entire tree to find subdivided nodes. To be revisited.
This commit is contained in:
parent
e2c8bdbdbe
commit
ebcb8d00d6
1 changed files with 2 additions and 7 deletions
|
@ -47,13 +47,8 @@ bool MetavoxelLOD::becameSubdivided(const glm::vec3& minimum, float size,
|
|||
if (!shouldSubdivide(minimum, size, multiplier)) {
|
||||
return false; // this one must be subdivided
|
||||
}
|
||||
// the general check is whether we've gotten closer (as multiplied by the threshold) to any point in the volume,
|
||||
// which we approximate as a sphere for simplicity
|
||||
float halfSize = size * 0.5f;
|
||||
glm::vec3 center = minimum + glm::vec3(halfSize, halfSize, halfSize);
|
||||
float radius = sqrtf(3 * halfSize * halfSize);
|
||||
return qMax(0.0f, glm::distance(position, center) - radius) * threshold <=
|
||||
qMax(0.0f, glm::distance(reference.position, center) - radius) * reference.threshold;
|
||||
// TODO: find some way of culling subtrees that can't possibly contain subdivided nodes
|
||||
return true;
|
||||
}
|
||||
|
||||
MetavoxelData::MetavoxelData() : _size(1.0f) {
|
||||
|
|
Loading…
Reference in a new issue