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