resurrection of threadsafe ViewFrustum
Showing the changes to libraries/entities/src/EntityTreeElement.cpp (1 of 51 files). Show all
Unified · Split
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | #include <FBXReader.h> |
| 15 | 15 | #include <GeometryUtil.h> |
| 16 | +#include <OctreeUtils.h> | |
| 16 | 17 | |
| 17 | 18 | #include "EntitiesLogging.h" |
| 18 | 19 | #include "EntityItemProperties.h" |
| @@ -295,7 +296,7 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData · 276 unmodified lines | ||
| 295 | 296 | entityTreeElementExtraEncodeData->entities.contains(entity->getEntityItemID()); |
| 296 | 297 | } |
| 297 | 298 | |
| 298 | − if (includeThisEntity && params.viewFrustum) { | |
| 299 | + if (includeThisEntity || params.recurseEverything) { | |
| 299 | 300 | |
| 300 | 301 | // we want to use the maximum possible box for this, so that we don't have to worry about the nuance of |
| 301 | 302 | // simulation changing what's visible. consider the case where the entity contains an angular velocity |
| @@ -303,7 +304,7 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData · 1 unmodified line | ||
| 303 | 304 | // frustum culling on rendering. |
| 304 | 305 | bool success; |
| 305 | 306 | AACube entityCube = entity->getQueryAACube(success); |
| 306 | − if (!success || !params.viewFrustum->cubeIntersectsKeyhole(entityCube)) { | |
| 307 | + if (!success || !params.viewFrustum.cubeIntersectsKeyhole(entityCube)) { | |
| 307 | 308 | includeThisEntity = false; // out of view, don't include it |
| 308 | 309 | } else { |
| 309 | 310 | // Check the size of the entity, it's possible that a "too small to see" entity is included in a |
| @@ -320,9 +321,10 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData · 10 unmodified lines | ||
| 320 | 321 | // AABox. If this happens, fall back to the queryAACube. |
| 321 | 322 | entityBounds = AABox(entityCube); |
| 322 | 323 | } |
| 323 | − auto renderAccuracy = params.viewFrustum->calculateRenderAccuracy(entityBounds, | |
| 324 | − params.octreeElementSizeScale, | |
| 325 | − params.boundaryLevelAdjust); | |
| 324 | + auto renderAccuracy = calculateRenderAccuracy(params.viewFrustum.getPosition(), | |
| 325 | + entityBounds, | |
| 326 | + params.octreeElementSizeScale, | |
| 327 | + params.boundaryLevelAdjust); | |
| 326 | 328 | if (renderAccuracy <= 0.0f) { |
| 327 | 329 | includeThisEntity = false; // too small, don't include it |
| 328 | 330 | |