mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 11:22:24 +02:00
fixed LOD issue in client
This commit is contained in:
parent
0f71627923
commit
6a7ebb3a55
2 changed files with 2 additions and 1 deletions
|
@ -164,7 +164,7 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) {
|
||||||
float childBoundary = boundaryDistanceForRenderLevel(*node->octalCode + 2);
|
float childBoundary = boundaryDistanceForRenderLevel(*node->octalCode + 2);
|
||||||
bool inBoundary = (distanceToNode <= boundary);
|
bool inBoundary = (distanceToNode <= boundary);
|
||||||
bool inChildBoundary = (distanceToNode <= childBoundary);
|
bool inChildBoundary = (distanceToNode <= childBoundary);
|
||||||
bool shouldRender = node->isColored() && ((node->isLeaf() && inChildBoundary) || (inBoundary && !inChildBoundary));
|
bool shouldRender = node->isColored() && ((node->isLeaf() && inChildBoundary) || (inBoundary && !inChildBoundary));
|
||||||
|
|
||||||
node->setShouldRender(shouldRender);
|
node->setShouldRender(shouldRender);
|
||||||
// let children figure out their renderness
|
// let children figure out their renderness
|
||||||
|
|
|
@ -234,6 +234,7 @@ bool VoxelNode::isInView(const ViewFrustum& viewFrustum) const {
|
||||||
float VoxelNode::distanceToCamera(const ViewFrustum& viewFrustum) const {
|
float VoxelNode::distanceToCamera(const ViewFrustum& viewFrustum) const {
|
||||||
AABox box;
|
AABox box;
|
||||||
getAABox(box);
|
getAABox(box);
|
||||||
|
box.scale(TREE_SCALE);
|
||||||
float distanceToVoxelCenter = sqrtf(powf(viewFrustum.getPosition().x - (box.getCorner().x + box.getSize().x), 2) +
|
float distanceToVoxelCenter = sqrtf(powf(viewFrustum.getPosition().x - (box.getCorner().x + box.getSize().x), 2) +
|
||||||
powf(viewFrustum.getPosition().y - (box.getCorner().y + box.getSize().y), 2) +
|
powf(viewFrustum.getPosition().y - (box.getCorner().y + box.getSize().y), 2) +
|
||||||
powf(viewFrustum.getPosition().z - (box.getCorner().z + box.getSize().z), 2));
|
powf(viewFrustum.getPosition().z - (box.getCorner().z + box.getSize().z), 2));
|
||||||
|
|
Loading…
Reference in a new issue