History

Merge pull request #7827 from AndrewMeadows/threadsafe-viewfrustum

resurrection of threadsafe ViewFrustum

Brad Hefta-Gaub committed 10 years ago

Commit d7eee982 parents 466b535 db9a4d651 files · +622 −552Browse files

Showing the changes to libraries/entities/src/EntityTreeElement.cpp (1 of 51 files). Show all

Unified · Split

libraries/entities/src/EntityTreeElement.cpp+7−5
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313
1414 #include <FBXReader.h>
1515 #include <GeometryUtil.h>
16+#include <OctreeUtils.h>
1617
1718 #include "EntitiesLogging.h"
1819 #include "EntityItemProperties.h"
@@ -295,7 +296,7 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData · 276 unmodified lines
295296 entityTreeElementExtraEncodeData->entities.contains(entity->getEntityItemID());
296297 }
297298
298− if (includeThisEntity && params.viewFrustum) {
299+ if (includeThisEntity || params.recurseEverything) {
299300
300301 // we want to use the maximum possible box for this, so that we don't have to worry about the nuance of
301302 // 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
303304 // frustum culling on rendering.
304305 bool success;
305306 AACube entityCube = entity->getQueryAACube(success);
306− if (!success || !params.viewFrustum->cubeIntersectsKeyhole(entityCube)) {
307+ if (!success || !params.viewFrustum.cubeIntersectsKeyhole(entityCube)) {
307308 includeThisEntity = false; // out of view, don't include it
308309 } else {
309310 // 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
320321 // AABox. If this happens, fall back to the queryAACube.
321322 entityBounds = AABox(entityCube);
322323 }
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);
326328 if (renderAccuracy <= 0.0f) {
327329 includeThisEntity = false; // too small, don't include it
328330