Send spherical view from Interface rather than creating in ES

This commit is contained in:
Simon Walton 2018-07-30 18:03:45 -07:00
parent be1bbc07c2
commit 8c512ec19b
3 changed files with 18 additions and 18 deletions

View file

@ -17,9 +17,6 @@
#include "EntityServer.h"
// Initially just send all items within this distance.
const float EntityTreeSendThread::INITIAL_RADIUS = 10.0f;
EntityTreeSendThread::EntityTreeSendThread(OctreeServer* myServer, const SharedNodePointer& node) :
OctreeSendThread(myServer, node)
{
@ -113,14 +110,7 @@ bool EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O
int32_t lodLevelOffset = nodeData->getBoundaryLevelAdjust() + (viewFrustumChanged ? LOW_RES_MOVING_ADJUST : NO_BOUNDARY_ADJUST);
newView.lodScaleFactor = powf(2.0f, lodLevelOffset);
if (nodeData->wantReportInitialCompletion() && !newView.viewFrustums.empty()) {
auto& mainView = newView.viewFrustums[0];
// Force acceptance within INITIAL_RADIUS.
mainView.setSimpleRadius(INITIAL_RADIUS);
newView.lodScaleFactor = 0.0f;
}
startNewTraversal(newView, root);
// When the viewFrustum changed the sort order may be incorrect, so we re-sort

View file

@ -58,8 +58,6 @@ private:
int32_t _numEntitiesOffset { 0 };
uint16_t _numEntities { 0 };
const static float INITIAL_RADIUS;
private slots:
void editingEntityPointer(const EntityItemPointer& entity);
void deletingEntityPointer(EntityItem* entity);

View file

@ -374,6 +374,7 @@ static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SI
static const uint32_t INVALID_FRAME = UINT32_MAX;
static const float PHYSICS_READY_RANGE = 3.0f; // how far from avatar to check for entities that aren't ready for simulation
static const float INITIAL_QUERY_RADIUS = 10.0f; // priority radius for entities before physics enabled
static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
@ -6130,12 +6131,23 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) {
return; // bail early if settings are not loaded
}
_octreeQuery.setConicalViews(_conicalViews);
const bool isModifiedQuery = !_physicsEnabled;
if (isModifiedQuery) {
// Create modified view that is a simple sphere.
ConicalViewFrustum sphericalView;
sphericalView.setSimpleRadius(INITIAL_QUERY_RADIUS);
_octreeQuery.setConicalViews({ sphericalView });
_octreeQuery.setOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE);
static constexpr float MIN_LOD_ADJUST = -20.0f;
_octreeQuery.setBoundaryLevelAdjust(MIN_LOD_ADJUST);
} else {
_octreeQuery.setConicalViews(_conicalViews);
auto lodManager = DependencyManager::get<LODManager>();
_octreeQuery.setOctreeSizeScale(lodManager->getOctreeSizeScale());
_octreeQuery.setBoundaryLevelAdjust(lodManager->getBoundaryLevelAdjust());
}
_octreeQuery.setReportInitialCompletion(isModifiedQuery);
auto lodManager = DependencyManager::get<LODManager>();
_octreeQuery.setOctreeSizeScale(lodManager->getOctreeSizeScale());
_octreeQuery.setBoundaryLevelAdjust(lodManager->getBoundaryLevelAdjust());
_octreeQuery.setReportInitialCompletion(!_physicsEnabled);
auto nodeList = DependencyManager::get<NodeList>();