12 #ifndef hifi_OctreeQueryNode_h
13 #define hifi_OctreeQueryNode_h
19 #include "OctreeConstants.h"
20 #include "OctreeElementBag.h"
21 #include "OctreePacketData.h"
22 #include "OctreeQuery.h"
23 #include "OctreeSceneStats.h"
24 #include "SentPacketHistory.h"
29 class OctreeQueryNode :
public OctreeQuery {
32 OctreeQueryNode() =
default;
33 virtual ~OctreeQueryNode() =
default;
36 virtual PacketType getMyPacketType()
const = 0;
38 void resetOctreePacket();
40 void writeToPacket(
const unsigned char* buffer,
unsigned int bytes);
42 NLPacket& getPacket()
const {
return *_octreePacket; }
43 bool isPacketWaiting()
const {
return _octreePacketWaiting; }
45 bool packetIsDuplicate()
const;
46 bool shouldSuppressDuplicatePacket();
48 unsigned int getAvailable()
const {
return _octreePacket->bytesAvailableForWrite(); }
50 OctreeElementExtraEncodeData extraEncodeData;
52 const ConicalViewFrustums& getCurrentViews()
const {
return _currentConicalViews; }
56 bool updateCurrentViewFrustum();
58 bool getViewSent()
const {
return _viewSent; }
59 void setViewSent(
bool viewSent);
61 bool getViewFrustumChanging()
const {
return _viewFrustumChanging; }
62 bool getViewFrustumJustStoppedChanging()
const {
return _viewFrustumJustStoppedChanging; }
64 bool hasLodChanged()
const {
return _lodChanged; }
68 unsigned int getlastOctreePacketLength()
const {
return _lastOctreePacketLength; }
69 int getDuplicatePacketCount()
const {
return _duplicatePacketCount; }
72 bool isShuttingDown()
const {
return _isShuttingDown; }
74 void octreePacketSent() { packetSent(*_octreePacket); }
75 void packetSent(
const NLPacket& packet);
77 OCTREE_PACKET_SEQUENCE getSequenceNumber()
const {
return _sequenceNumber; }
79 void parseNackPacket(ReceivedMessage& message);
80 bool hasNextNackedPacket()
const;
81 const NLPacket* getNextNackedPacket();
84 bool haveJSONParametersChanged();
86 bool shouldForceFullScene()
const {
return _shouldForceFullScene; }
87 void setShouldForceFullScene(
bool shouldForceFullScene) { _shouldForceFullScene = shouldForceFullScene; }
90 bool _viewSent {
false };
91 std::unique_ptr<NLPacket> _octreePacket;
92 bool _octreePacketWaiting;
94 unsigned int _lastOctreePacketLength { 0 };
95 int _duplicatePacketCount { 0 };
96 quint64 _firstSuppressedPacket { usecTimestampNow() };
98 ConicalViewFrustums _currentConicalViews;
99 bool _viewFrustumChanging {
false };
100 bool _viewFrustumJustStoppedChanging {
true };
103 int _lastClientBoundaryLevelAdjust { 0 };
104 float _lastClientOctreeSizeScale { DEFAULT_OCTREE_SIZE_SCALE };
105 bool _lodChanged {
false };
106 bool _lodInitialized {
false };
108 OCTREE_PACKET_SEQUENCE _sequenceNumber { 0 };
110 PacketType _myPacketType { PacketType::Unknown };
111 bool _isShuttingDown {
false };
113 SentPacketHistory _sentPacketHistory;
114 QQueue<OCTREE_PACKET_SEQUENCE> _nackedSequenceNumbers;
116 std::array<char, udt::MAX_PACKET_SIZE> _lastOctreePayload;
118 QJsonObject _lastCheckJSONParameters;
120 bool _shouldForceFullScene {
false };
Collects statistics for calculating and sending a scene from a octree server to an interface client.
Definition: OctreeSceneStats.h:31
Threaded processor for sending octree packets to a single client.
Definition: OctreeSendThread.h:30
Handles assignments of type OctreeServer - sending octrees to various clients.
Definition: OctreeServer.h:38