mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 10:37:56 +02:00
make server resend scene when LOD changes
This commit is contained in:
parent
580102bb38
commit
baafea05af
3 changed files with 33 additions and 13 deletions
|
@ -23,7 +23,10 @@ VoxelNodeData::VoxelNodeData(Node* owningNode) :
|
||||||
_viewFrustumChanging(false),
|
_viewFrustumChanging(false),
|
||||||
_viewFrustumJustStoppedChanging(true),
|
_viewFrustumJustStoppedChanging(true),
|
||||||
_currentPacketIsColor(true),
|
_currentPacketIsColor(true),
|
||||||
_voxelSendThread(NULL)
|
_voxelSendThread(NULL),
|
||||||
|
_lastClientBoundaryLevelAdjust(0),
|
||||||
|
_lastClientVoxelSizeScale(DEFAULT_VOXEL_SIZE_SCALE),
|
||||||
|
_lodChanged(false)
|
||||||
{
|
{
|
||||||
_voxelPacket = new unsigned char[MAX_VOXEL_PACKET_SIZE];
|
_voxelPacket = new unsigned char[MAX_VOXEL_PACKET_SIZE];
|
||||||
_voxelPacketAt = _voxelPacket;
|
_voxelPacketAt = _voxelPacket;
|
||||||
|
@ -140,6 +143,17 @@ bool VoxelNodeData::updateCurrentViewFrustum() {
|
||||||
currentViewFrustumChanged = true;
|
currentViewFrustumChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Also check for LOD changes from the client
|
||||||
|
if (_lastClientBoundaryLevelAdjust != getBoundaryLevelAdjust()) {
|
||||||
|
_lastClientBoundaryLevelAdjust = getBoundaryLevelAdjust();
|
||||||
|
_lodChanged = true;
|
||||||
|
}
|
||||||
|
if (_lastClientVoxelSizeScale != getVoxelSizeScale()) {
|
||||||
|
_lastClientVoxelSizeScale = getVoxelSizeScale();
|
||||||
|
_lodChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// When we first detect that the view stopped changing, we record this.
|
// When we first detect that the view stopped changing, we record this.
|
||||||
// but we don't change it back to false until we've completely sent this
|
// but we don't change it back to false until we've completely sent this
|
||||||
// scene.
|
// scene.
|
||||||
|
@ -154,6 +168,7 @@ void VoxelNodeData::setViewSent(bool viewSent) {
|
||||||
_viewSent = viewSent;
|
_viewSent = viewSent;
|
||||||
if (viewSent) {
|
if (viewSent) {
|
||||||
_viewFrustumJustStoppedChanging = false;
|
_viewFrustumJustStoppedChanging = false;
|
||||||
|
_lodChanged = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,25 +48,27 @@ public:
|
||||||
VoxelNodeBag nodeBag;
|
VoxelNodeBag nodeBag;
|
||||||
CoverageMap map;
|
CoverageMap map;
|
||||||
|
|
||||||
ViewFrustum& getCurrentViewFrustum() { return _currentViewFrustum; };
|
ViewFrustum& getCurrentViewFrustum() { return _currentViewFrustum; };
|
||||||
ViewFrustum& getLastKnownViewFrustum() { return _lastKnownViewFrustum; };
|
ViewFrustum& getLastKnownViewFrustum() { return _lastKnownViewFrustum; };
|
||||||
|
|
||||||
// These are not classic setters because they are calculating and maintaining state
|
// These are not classic setters because they are calculating and maintaining state
|
||||||
// which is set asynchronously through the network receive
|
// which is set asynchronously through the network receive
|
||||||
bool updateCurrentViewFrustum();
|
bool updateCurrentViewFrustum();
|
||||||
void updateLastKnownViewFrustum();
|
void updateLastKnownViewFrustum();
|
||||||
|
|
||||||
bool getViewSent() const { return _viewSent; };
|
bool getViewSent() const { return _viewSent; };
|
||||||
void setViewSent(bool viewSent);
|
void setViewSent(bool viewSent);
|
||||||
|
|
||||||
bool getViewFrustumChanging() const { return _viewFrustumChanging; };
|
bool getViewFrustumChanging() const { return _viewFrustumChanging; };
|
||||||
bool getViewFrustumJustStoppedChanging() const { return _viewFrustumJustStoppedChanging; };
|
bool getViewFrustumJustStoppedChanging() const { return _viewFrustumJustStoppedChanging; };
|
||||||
|
|
||||||
|
|
||||||
uint64_t getLastTimeBagEmpty() const { return _lastTimeBagEmpty; };
|
uint64_t getLastTimeBagEmpty() const { return _lastTimeBagEmpty; };
|
||||||
void setLastTimeBagEmpty(uint64_t lastTimeBagEmpty) { _lastTimeBagEmpty = lastTimeBagEmpty; };
|
void setLastTimeBagEmpty(uint64_t lastTimeBagEmpty) { _lastTimeBagEmpty = lastTimeBagEmpty; };
|
||||||
|
|
||||||
bool getCurrentPacketIsColor() const { return _currentPacketIsColor; };
|
bool getCurrentPacketIsColor() const { return _currentPacketIsColor; };
|
||||||
|
|
||||||
|
bool hasLodChanged() const { return _lodChanged; };
|
||||||
|
|
||||||
VoxelSceneStats stats;
|
VoxelSceneStats stats;
|
||||||
|
|
||||||
|
@ -98,6 +100,11 @@ private:
|
||||||
bool _currentPacketIsColor;
|
bool _currentPacketIsColor;
|
||||||
|
|
||||||
VoxelSendThread* _voxelSendThread;
|
VoxelSendThread* _voxelSendThread;
|
||||||
|
|
||||||
|
// watch for LOD changes
|
||||||
|
int _lastClientBoundaryLevelAdjust;
|
||||||
|
float _lastClientVoxelSizeScale;
|
||||||
|
bool _lodChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__VoxelNodeData__) */
|
#endif /* defined(__hifi__VoxelNodeData__) */
|
||||||
|
|
|
@ -194,7 +194,8 @@ void VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* no
|
||||||
}
|
}
|
||||||
|
|
||||||
// start tracking our stats
|
// start tracking our stats
|
||||||
bool isFullScene = (!viewFrustumChanged || !nodeData->getWantDelta()) && nodeData->getViewFrustumJustStoppedChanging();
|
bool isFullScene = ((!viewFrustumChanged || !nodeData->getWantDelta())
|
||||||
|
&& nodeData->getViewFrustumJustStoppedChanging()) || nodeData->hasLodChanged();
|
||||||
|
|
||||||
// If we're starting a full scene, then definitely we want to empty the nodeBag
|
// If we're starting a full scene, then definitely we want to empty the nodeBag
|
||||||
if (isFullScene) {
|
if (isFullScene) {
|
||||||
|
@ -258,11 +259,8 @@ void VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* no
|
||||||
? LOW_RES_MOVING_ADJUST : NO_BOUNDARY_ADJUST);
|
? LOW_RES_MOVING_ADJUST : NO_BOUNDARY_ADJUST);
|
||||||
|
|
||||||
|
|
||||||
printf("packetLoop() voxelSizeScale=%f boundaryLevelAdjustClient=%d boundaryLevelAdjust=%d\n",
|
bool isFullScene = ((!viewFrustumChanged || !nodeData->getWantDelta()) &&
|
||||||
voxelSizeScale, boundaryLevelAdjustClient, boundaryLevelAdjust);
|
nodeData->getViewFrustumJustStoppedChanging()) || nodeData->hasLodChanged();
|
||||||
|
|
||||||
bool isFullScene = (!viewFrustumChanged || !nodeData->getWantDelta()) &&
|
|
||||||
nodeData->getViewFrustumJustStoppedChanging();
|
|
||||||
|
|
||||||
EncodeBitstreamParams params(INT_MAX, &nodeData->getCurrentViewFrustum(), wantColor,
|
EncodeBitstreamParams params(INT_MAX, &nodeData->getCurrentViewFrustum(), wantColor,
|
||||||
WANT_EXISTS_BITS, DONT_CHOP, wantDelta, lastViewFrustum,
|
WANT_EXISTS_BITS, DONT_CHOP, wantDelta, lastViewFrustum,
|
||||||
|
|
Loading…
Reference in a new issue