mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:49:05 +02:00
Merge branch 'master' of https://github.com/worklist/hifi into experimental_scaling
This commit is contained in:
commit
aab2ca826f
25 changed files with 96 additions and 96 deletions
12
BUILD.md
12
BUILD.md
|
@ -104,9 +104,7 @@ We don't currently have a Windows installer, so before running Interface, you wi
|
||||||
|
|
||||||
CMake will need to know where the headers and libraries for required external dependencies are. If you installed ZLIB using the installer, the FindZLIB cmake module will be able to find it. This isn't the case for the others.
|
CMake will need to know where the headers and libraries for required external dependencies are. If you installed ZLIB using the installer, the FindZLIB cmake module will be able to find it. This isn't the case for the others.
|
||||||
|
|
||||||
You have the choice of setting a variable specific to each library, or having a folder using a defined structure that contains all of the libs.
|
The recommended route for CMake to find external dependencies is to place all of the dependencies in one folder and set one ENV variable - HIFI_LIB_DIR. That ENV variable should point to a directory with the following structure:
|
||||||
|
|
||||||
The recommended route is to place all of the dependencies in one place and set one ENV variable - HIFI_LIB_DIR. That ENV variable should point to a directory with the following structure:
|
|
||||||
|
|
||||||
root_lib_dir
|
root_lib_dir
|
||||||
-> glm
|
-> glm
|
||||||
|
@ -128,14 +126,6 @@ The recommended route is to place all of the dependencies in one place and set o
|
||||||
|
|
||||||
For many of the external libraries where precompiled binaries are readily available you should be able to simply copy the extracted folder that you get from the download links provided at the top of the guide. Otherwise you may need to build from source and install the built product to this directory. The `root_lib_dir` in the above example can be wherever you choose on your system - as long as the environment variable HIFI_LIB_DIR is set to it.
|
For many of the external libraries where precompiled binaries are readily available you should be able to simply copy the extracted folder that you get from the download links provided at the top of the guide. Otherwise you may need to build from source and install the built product to this directory. The `root_lib_dir` in the above example can be wherever you choose on your system - as long as the environment variable HIFI_LIB_DIR is set to it.
|
||||||
|
|
||||||
Should you want to define a location for each library, these are the associated variables you will want to set:
|
|
||||||
|
|
||||||
`GLM_ROOT_DIR, GLUT_ROOT_DIR, GLEW_ROOT_DIR`
|
|
||||||
|
|
||||||
They can be set in your ENV or by passing them to the cmake command on the command line. (There is an example of this in the CMake section earlier in this guide.)
|
|
||||||
|
|
||||||
Each of those designates the root directory that contains the sub-folders for each library. For example, if the GLEW_ROOT_DIR is `C:\libs\glew`, then we would expect to find an `include` folder and a `lib` folder inside `C:\libs\glew`.
|
|
||||||
|
|
||||||
*NOTE: Qt does not support 64-bit builds on Windows 7, so you must use the 32-bit version of libraries for interface.exe to run. The 32-bit version of the static library is the one linked by our CMake find modules*
|
*NOTE: Qt does not support 64-bit builds on Windows 7, so you must use the 32-bit version of libraries for interface.exe to run. The 32-bit version of the static library is the one linked by our CMake find modules*
|
||||||
|
|
||||||
#### DLLs
|
#### DLLs
|
||||||
|
|
|
@ -40,13 +40,13 @@ bool waitForVoxelServer = true;
|
||||||
const int ANIMATION_LISTEN_PORT = 40107;
|
const int ANIMATION_LISTEN_PORT = 40107;
|
||||||
int ANIMATE_FPS = 60;
|
int ANIMATE_FPS = 60;
|
||||||
double ANIMATE_FPS_IN_MILLISECONDS = 1000.0/ANIMATE_FPS; // determines FPS from our desired FPS
|
double ANIMATE_FPS_IN_MILLISECONDS = 1000.0/ANIMATE_FPS; // determines FPS from our desired FPS
|
||||||
int ANIMATE_VOXELS_INTERVAL_USECS = (ANIMATE_FPS_IN_MILLISECONDS * 1000.0); // converts from milliseconds to usecs
|
quint64 ANIMATE_VOXELS_INTERVAL_USECS = (ANIMATE_FPS_IN_MILLISECONDS * 1000); // converts from milliseconds to usecs
|
||||||
|
|
||||||
|
|
||||||
int PROCESSING_FPS = 60;
|
int PROCESSING_FPS = 60;
|
||||||
double PROCESSING_FPS_IN_MILLISECONDS = 1000.0/PROCESSING_FPS; // determines FPS from our desired FPS
|
double PROCESSING_FPS_IN_MILLISECONDS = 1000.0/PROCESSING_FPS; // determines FPS from our desired FPS
|
||||||
int FUDGE_USECS = 650; // a little bit of fudge to actually do some processing
|
int FUDGE_USECS = 650; // a little bit of fudge to actually do some processing
|
||||||
int PROCESSING_INTERVAL_USECS = (PROCESSING_FPS_IN_MILLISECONDS * 1000.0) - FUDGE_USECS; // converts from milliseconds to usecs
|
quint64 PROCESSING_INTERVAL_USECS = (PROCESSING_FPS_IN_MILLISECONDS * 1000) - FUDGE_USECS; // converts from milliseconds to usecs
|
||||||
|
|
||||||
bool wantLocalDomain = false;
|
bool wantLocalDomain = false;
|
||||||
|
|
||||||
|
@ -611,9 +611,6 @@ void* animateVoxels(void* args) {
|
||||||
}
|
}
|
||||||
lastProcessTime = usecTimestampNow();
|
lastProcessTime = usecTimestampNow();
|
||||||
|
|
||||||
int packetsStarting = 0;
|
|
||||||
int packetsEnding = 0;
|
|
||||||
|
|
||||||
// The while loop will be running at PROCESSING_FPS, but we only want to call these animation functions at
|
// The while loop will be running at PROCESSING_FPS, but we only want to call these animation functions at
|
||||||
// ANIMATE_FPS. So we check out last animate time and only call these if we've elapsed that time.
|
// ANIMATE_FPS. So we check out last animate time and only call these if we've elapsed that time.
|
||||||
quint64 now = usecTimestampNow();
|
quint64 now = usecTimestampNow();
|
||||||
|
@ -627,8 +624,6 @@ void* animateVoxels(void* args) {
|
||||||
animateLoopsPerAnimate++;
|
animateLoopsPerAnimate++;
|
||||||
|
|
||||||
lastAnimateTime = now;
|
lastAnimateTime = now;
|
||||||
packetsStarting = ::voxelEditPacketSender->packetsToSendCount();
|
|
||||||
|
|
||||||
// some animations
|
// some animations
|
||||||
//sendVoxelBlinkMessage();
|
//sendVoxelBlinkMessage();
|
||||||
|
|
||||||
|
@ -652,8 +647,6 @@ void* animateVoxels(void* args) {
|
||||||
doBuildStreet();
|
doBuildStreet();
|
||||||
}
|
}
|
||||||
|
|
||||||
packetsEnding = ::voxelEditPacketSender->packetsToSendCount();
|
|
||||||
|
|
||||||
if (animationElapsed > ANIMATE_VOXELS_INTERVAL_USECS) {
|
if (animationElapsed > ANIMATE_VOXELS_INTERVAL_USECS) {
|
||||||
animationElapsed -= ANIMATE_VOXELS_INTERVAL_USECS; // credit ourselves one animation frame
|
animationElapsed -= ANIMATE_VOXELS_INTERVAL_USECS; // credit ourselves one animation frame
|
||||||
} else {
|
} else {
|
||||||
|
@ -670,9 +663,9 @@ void* animateVoxels(void* args) {
|
||||||
processesPerAnimate++;
|
processesPerAnimate++;
|
||||||
}
|
}
|
||||||
// dynamically sleep until we need to fire off the next set of voxels
|
// dynamically sleep until we need to fire off the next set of voxels
|
||||||
quint64 usecToSleep = PROCESSING_INTERVAL_USECS - (usecTimestampNow() - lastProcessTime);
|
quint64 usecToSleep = ::PROCESSING_INTERVAL_USECS - (usecTimestampNow() - lastProcessTime);
|
||||||
if (usecToSleep > PROCESSING_INTERVAL_USECS) {
|
if (usecToSleep > ::PROCESSING_INTERVAL_USECS) {
|
||||||
usecToSleep = PROCESSING_INTERVAL_USECS;
|
usecToSleep = ::PROCESSING_INTERVAL_USECS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usecToSleep > 0) {
|
if (usecToSleep > 0) {
|
||||||
|
@ -758,7 +751,7 @@ AnimationServer::AnimationServer(int &argc, char **argv) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("ANIMATE_FPS=%d\n",ANIMATE_FPS);
|
printf("ANIMATE_FPS=%d\n",ANIMATE_FPS);
|
||||||
printf("ANIMATE_VOXELS_INTERVAL_USECS=%d\n",ANIMATE_VOXELS_INTERVAL_USECS);
|
printf("ANIMATE_VOXELS_INTERVAL_USECS=%llu\n",ANIMATE_VOXELS_INTERVAL_USECS);
|
||||||
|
|
||||||
const char* processingFPSCommand = getCmdOption(argc, (const char**) argv, "--ProcessingFPS");
|
const char* processingFPSCommand = getCmdOption(argc, (const char**) argv, "--ProcessingFPS");
|
||||||
const char* processingIntervalCommand = getCmdOption(argc, (const char**) argv, "--ProcessingInterval");
|
const char* processingIntervalCommand = getCmdOption(argc, (const char**) argv, "--ProcessingInterval");
|
||||||
|
@ -774,7 +767,7 @@ AnimationServer::AnimationServer(int &argc, char **argv) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("PROCESSING_FPS=%d\n",PROCESSING_FPS);
|
printf("PROCESSING_FPS=%d\n",PROCESSING_FPS);
|
||||||
printf("PROCESSING_INTERVAL_USECS=%d\n",PROCESSING_INTERVAL_USECS);
|
printf("PROCESSING_INTERVAL_USECS=%llu\n",PROCESSING_INTERVAL_USECS);
|
||||||
|
|
||||||
nodeList->linkedDataCreateCallback = NULL; // do we need a callback?
|
nodeList->linkedDataCreateCallback = NULL; // do we need a callback?
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,6 @@ void AudioMixer::addBufferToMixForListeningNodeWithBuffer(PositionalAudioRingBuf
|
||||||
if (bufferToAdd != listeningNodeBuffer) {
|
if (bufferToAdd != listeningNodeBuffer) {
|
||||||
// if the two buffer pointers do not match then these are different buffers
|
// if the two buffer pointers do not match then these are different buffers
|
||||||
|
|
||||||
glm::vec3 listenerPosition = listeningNodeBuffer->getPosition();
|
|
||||||
glm::vec3 relativePosition = bufferToAdd->getPosition() - listeningNodeBuffer->getPosition();
|
glm::vec3 relativePosition = bufferToAdd->getPosition() - listeningNodeBuffer->getPosition();
|
||||||
glm::quat inverseOrientation = glm::inverse(listeningNodeBuffer->getOrientation());
|
glm::quat inverseOrientation = glm::inverse(listeningNodeBuffer->getOrientation());
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ void OctreeQueryNode::resetOctreePacket(bool lastWasSurpressed) {
|
||||||
_octreePacketWaiting = false;
|
_octreePacketWaiting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctreeQueryNode::writeToPacket(const unsigned char* buffer, int bytes) {
|
void OctreeQueryNode::writeToPacket(const unsigned char* buffer, unsigned int bytes) {
|
||||||
// compressed packets include lead bytes which contain compressed size, this allows packing of
|
// compressed packets include lead bytes which contain compressed size, this allows packing of
|
||||||
// multiple compressed portions together
|
// multiple compressed portions together
|
||||||
if (_currentPacketIsCompressed) {
|
if (_currentPacketIsCompressed) {
|
||||||
|
|
|
@ -32,16 +32,16 @@ public:
|
||||||
|
|
||||||
void resetOctreePacket(bool lastWasSurpressed = false); // resets octree packet to after "V" header
|
void resetOctreePacket(bool lastWasSurpressed = false); // resets octree packet to after "V" header
|
||||||
|
|
||||||
void writeToPacket(const unsigned char* buffer, int bytes); // writes to end of packet
|
void writeToPacket(const unsigned char* buffer, unsigned int bytes); // writes to end of packet
|
||||||
|
|
||||||
const unsigned char* getPacket() const { return _octreePacket; }
|
const unsigned char* getPacket() const { return _octreePacket; }
|
||||||
int getPacketLength() const { return (MAX_PACKET_SIZE - _octreePacketAvailableBytes); }
|
unsigned int getPacketLength() const { return (MAX_PACKET_SIZE - _octreePacketAvailableBytes); }
|
||||||
bool isPacketWaiting() const { return _octreePacketWaiting; }
|
bool isPacketWaiting() const { return _octreePacketWaiting; }
|
||||||
|
|
||||||
bool packetIsDuplicate() const;
|
bool packetIsDuplicate() const;
|
||||||
bool shouldSuppressDuplicatePacket();
|
bool shouldSuppressDuplicatePacket();
|
||||||
|
|
||||||
int getAvailable() const { return _octreePacketAvailableBytes; }
|
unsigned int getAvailable() const { return _octreePacketAvailableBytes; }
|
||||||
int getMaxSearchLevel() const { return _maxSearchLevel; }
|
int getMaxSearchLevel() const { return _maxSearchLevel; }
|
||||||
void resetMaxSearchLevel() { _maxSearchLevel = 1; }
|
void resetMaxSearchLevel() { _maxSearchLevel = 1; }
|
||||||
void incrementMaxSearchLevel() { _maxSearchLevel++; }
|
void incrementMaxSearchLevel() { _maxSearchLevel++; }
|
||||||
|
@ -96,11 +96,11 @@ private:
|
||||||
bool _viewSent;
|
bool _viewSent;
|
||||||
unsigned char* _octreePacket;
|
unsigned char* _octreePacket;
|
||||||
unsigned char* _octreePacketAt;
|
unsigned char* _octreePacketAt;
|
||||||
int _octreePacketAvailableBytes;
|
unsigned int _octreePacketAvailableBytes;
|
||||||
bool _octreePacketWaiting;
|
bool _octreePacketWaiting;
|
||||||
|
|
||||||
unsigned char* _lastOctreePacket;
|
unsigned char* _lastOctreePacket;
|
||||||
int _lastOctreePacketLength;
|
unsigned int _lastOctreePacketLength;
|
||||||
int _duplicatePacketCount;
|
int _duplicatePacketCount;
|
||||||
quint64 _firstSuppressedPacket;
|
quint64 _firstSuppressedPacket;
|
||||||
|
|
||||||
|
|
|
@ -53,15 +53,13 @@ bool OctreeSendThread::process() {
|
||||||
|
|
||||||
nodeData = (OctreeQueryNode*) node->getLinkedData();
|
nodeData = (OctreeQueryNode*) node->getLinkedData();
|
||||||
|
|
||||||
int packetsSent = 0;
|
|
||||||
|
|
||||||
// Sometimes the node data has not yet been linked, in which case we can't really do anything
|
// Sometimes the node data has not yet been linked, in which case we can't really do anything
|
||||||
if (nodeData) {
|
if (nodeData) {
|
||||||
bool viewFrustumChanged = nodeData->updateCurrentViewFrustum();
|
bool viewFrustumChanged = nodeData->updateCurrentViewFrustum();
|
||||||
if (_myServer->wantsDebugSending() && _myServer->wantsVerboseDebug()) {
|
if (_myServer->wantsDebugSending() && _myServer->wantsVerboseDebug()) {
|
||||||
printf("nodeData->updateCurrentViewFrustum() changed=%s\n", debug::valueOf(viewFrustumChanged));
|
printf("nodeData->updateCurrentViewFrustum() changed=%s\n", debug::valueOf(viewFrustumChanged));
|
||||||
}
|
}
|
||||||
packetsSent = packetDistributor(node, nodeData, viewFrustumChanged);
|
packetDistributor(node, nodeData, viewFrustumChanged);
|
||||||
}
|
}
|
||||||
if (nodeData->isScheduledForDelete()) {
|
if (nodeData->isScheduledForDelete()) {
|
||||||
nodeData->deleteLater();
|
nodeData->deleteLater();
|
||||||
|
@ -146,9 +144,10 @@ int OctreeSendThread::handlePacketSend(const SharedNodePointer& node, OctreeQuer
|
||||||
// Send the stats message to the client
|
// Send the stats message to the client
|
||||||
unsigned char* statsMessage = nodeData->stats.getStatsMessage();
|
unsigned char* statsMessage = nodeData->stats.getStatsMessage();
|
||||||
int statsMessageLength = nodeData->stats.getStatsMessageLength();
|
int statsMessageLength = nodeData->stats.getStatsMessageLength();
|
||||||
|
int piggyBackSize = nodeData->getPacketLength() + statsMessageLength;
|
||||||
|
|
||||||
// If the size of the stats message and the voxel message will fit in a packet, then piggyback them
|
// If the size of the stats message and the voxel message will fit in a packet, then piggyback them
|
||||||
if (nodeData->getPacketLength() + statsMessageLength < MAX_PACKET_SIZE) {
|
if (piggyBackSize < MAX_PACKET_SIZE) {
|
||||||
|
|
||||||
// copy voxel message to back of stats message
|
// copy voxel message to back of stats message
|
||||||
memcpy(statsMessage + statsMessageLength, nodeData->getPacket(), nodeData->getPacketLength());
|
memcpy(statsMessage + statsMessageLength, nodeData->getPacket(), nodeData->getPacketLength());
|
||||||
|
@ -507,7 +506,7 @@ int OctreeSendThread::packetDistributor(const SharedNodePointer& node, OctreeQue
|
||||||
// if for some reason the finalized size is greater than our available size, then probably the "compressed"
|
// if for some reason the finalized size is greater than our available size, then probably the "compressed"
|
||||||
// form actually inflated beyond our padding, and in this case we will send the current packet, then
|
// form actually inflated beyond our padding, and in this case we will send the current packet, then
|
||||||
// write to out new packet...
|
// write to out new packet...
|
||||||
int writtenSize = _packetData.getFinalizedSize()
|
unsigned int writtenSize = _packetData.getFinalizedSize()
|
||||||
+ (nodeData->getCurrentPacketIsCompressed() ? sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE) : 0);
|
+ (nodeData->getCurrentPacketIsCompressed() ? sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE) : 0);
|
||||||
|
|
||||||
|
|
||||||
|
@ -521,7 +520,7 @@ int OctreeSendThread::packetDistributor(const SharedNodePointer& node, OctreeQue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forceDebugging || (_myServer->wantsDebugSending() && _myServer->wantsVerboseDebug())) {
|
if (forceDebugging || (_myServer->wantsDebugSending() && _myServer->wantsVerboseDebug())) {
|
||||||
qDebug(">>>>>> calling writeToPacket() available=%d compressedSize=%d uncompressedSize=%d target=%d",
|
qDebug(">>>>>> calling writeToPacket() available=%d compressedSize=%d uncompressedSize=%d target=%u",
|
||||||
nodeData->getAvailable(), _packetData.getFinalizedSize(),
|
nodeData->getAvailable(), _packetData.getFinalizedSize(),
|
||||||
_packetData.getUncompressedSize(), _packetData.getTargetSize());
|
_packetData.getUncompressedSize(), _packetData.getTargetSize());
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,17 +423,25 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif
|
||||||
QDataStream broadcastDataStream(&broadcastPacket, QIODevice::Append);
|
QDataStream broadcastDataStream(&broadcastPacket, QIODevice::Append);
|
||||||
broadcastDataStream << node->getUUID();
|
broadcastDataStream << node->getUUID();
|
||||||
|
|
||||||
|
int numBroadcastPacketLeadBytes = broadcastDataStream.device()->pos();
|
||||||
|
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||||
|
|
||||||
NodeList* nodeList = NodeList::getInstance();
|
NodeList* nodeList = NodeList::getInstance();
|
||||||
|
|
||||||
|
|
||||||
if (nodeInterestList.size() > 0) {
|
if (nodeInterestList.size() > 0) {
|
||||||
// if the node has any interest types, send back those nodes as well
|
// if the node has any interest types, send back those nodes as well
|
||||||
foreach (const SharedNodePointer& otherNode, nodeList->getNodeHash()) {
|
foreach (const SharedNodePointer& otherNode, nodeList->getNodeHash()) {
|
||||||
|
|
||||||
|
// reset our nodeByteArray and nodeDataStream
|
||||||
|
QByteArray nodeByteArray;
|
||||||
|
QDataStream nodeDataStream(&nodeByteArray, QIODevice::Append);
|
||||||
|
|
||||||
if (otherNode->getUUID() != node->getUUID() && nodeInterestList.contains(otherNode->getType())) {
|
if (otherNode->getUUID() != node->getUUID() && nodeInterestList.contains(otherNode->getType())) {
|
||||||
|
|
||||||
// don't send avatar nodes to other avatars, that will come from avatar mixer
|
// don't send avatar nodes to other avatars, that will come from avatar mixer
|
||||||
broadcastDataStream << *otherNode.data();
|
nodeDataStream << *otherNode.data();
|
||||||
|
|
||||||
// pack the secret that these two nodes will use to communicate with each other
|
// pack the secret that these two nodes will use to communicate with each other
|
||||||
QUuid secretUUID = nodeData->getSessionSecretHash().value(otherNode->getUUID());
|
QUuid secretUUID = nodeData->getSessionSecretHash().value(otherNode->getUUID());
|
||||||
|
@ -450,11 +458,26 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcastDataStream << secretUUID;
|
nodeDataStream << secretUUID;
|
||||||
|
|
||||||
|
if (broadcastPacket.size() + nodeByteArray.size() > MAX_PACKET_SIZE) {
|
||||||
|
// we need to break here and start a new packet
|
||||||
|
// so send the current one
|
||||||
|
|
||||||
|
nodeList->writeDatagram(broadcastPacket, node, senderSockAddr);
|
||||||
|
|
||||||
|
// reset the broadcastPacket structure
|
||||||
|
broadcastPacket.resize(numBroadcastPacketLeadBytes);
|
||||||
|
broadcastDataStream.device()->seek(numBroadcastPacketLeadBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// append the nodeByteArray to the current state of broadcastDataStream
|
||||||
|
broadcastPacket.append(nodeByteArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// always write the last broadcastPacket
|
||||||
nodeList->writeDatagram(broadcastPacket, node, senderSockAddr);
|
nodeList->writeDatagram(broadcastPacket, node, senderSockAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ void fsBinaryStream::received(long int sz, const char *data) {
|
||||||
new_end = m_end + sz;
|
new_end = m_end + sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_end > Size(m_buffer.size())) m_buffer.resize(1.5*new_end);
|
if (new_end > Size(m_buffer.size())) m_buffer.resize((int)(1.5f * (float)new_end)); // HIFI: to get 1.5 without warnings
|
||||||
|
|
||||||
memcpy(&m_buffer[0] + m_end, data, sz);
|
memcpy(&m_buffer[0] + m_end, data, sz);
|
||||||
m_end += sz;
|
m_end += sz;
|
||||||
|
@ -172,7 +172,7 @@ static bool decodeInfo(fsTrackingData & _trackingData, const std::string &buffer
|
||||||
success &= read_pod<double>(_trackingData.m_timestamp, buffer, start);
|
success &= read_pod<double>(_trackingData.m_timestamp, buffer, start);
|
||||||
unsigned char tracking_successfull = 0;
|
unsigned char tracking_successfull = 0;
|
||||||
success &= read_pod<unsigned char>( tracking_successfull, buffer, start );
|
success &= read_pod<unsigned char>( tracking_successfull, buffer, start );
|
||||||
_trackingData.m_trackingSuccessful = bool(tracking_successfull);
|
_trackingData.m_trackingSuccessful = bool(tracking_successfull != 0); // HIFI: get rid of windows warning
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -535,7 +535,7 @@ void runTimingTests() {
|
||||||
}
|
}
|
||||||
gettimeofday(&endTime, NULL);
|
gettimeofday(&endTime, NULL);
|
||||||
elapsedMsecs = diffclock(&startTime, &endTime);
|
elapsedMsecs = diffclock(&startTime, &endTime);
|
||||||
qDebug("rand() stored in array usecs: %f", 1000.0f * elapsedMsecs / (float) numTests);
|
qDebug("rand() stored in array usecs: %f, first result:%d", 1000.0f * elapsedMsecs / (float) numTests, iResults[0]);
|
||||||
|
|
||||||
// Random number generation using randFloat()
|
// Random number generation using randFloat()
|
||||||
gettimeofday(&startTime, NULL);
|
gettimeofday(&startTime, NULL);
|
||||||
|
@ -544,7 +544,7 @@ void runTimingTests() {
|
||||||
}
|
}
|
||||||
gettimeofday(&endTime, NULL);
|
gettimeofday(&endTime, NULL);
|
||||||
elapsedMsecs = diffclock(&startTime, &endTime);
|
elapsedMsecs = diffclock(&startTime, &endTime);
|
||||||
qDebug("randFloat() stored in array usecs: %f", 1000.0f * elapsedMsecs / (float) numTests);
|
qDebug("randFloat() stored in array usecs: %f, first result: %f", 1000.0f * elapsedMsecs / (float) numTests, fResults[0]);
|
||||||
|
|
||||||
// PowF function
|
// PowF function
|
||||||
fTest = 1145323.2342f;
|
fTest = 1145323.2342f;
|
||||||
|
@ -567,8 +567,8 @@ void runTimingTests() {
|
||||||
}
|
}
|
||||||
gettimeofday(&endTime, NULL);
|
gettimeofday(&endTime, NULL);
|
||||||
elapsedMsecs = diffclock(&startTime, &endTime);
|
elapsedMsecs = diffclock(&startTime, &endTime);
|
||||||
qDebug("vector math usecs: %f [%f msecs total for %d tests]",
|
qDebug("vector math usecs: %f [%f msecs total for %d tests], last result:%f",
|
||||||
1000.0f * elapsedMsecs / (float) numTests, elapsedMsecs, numTests);
|
1000.0f * elapsedMsecs / (float) numTests, elapsedMsecs, numTests, distance);
|
||||||
|
|
||||||
// Vec3 test
|
// Vec3 test
|
||||||
glm::vec3 vecA(randVector()), vecB(randVector());
|
glm::vec3 vecA(randVector()), vecB(randVector());
|
||||||
|
@ -581,7 +581,7 @@ void runTimingTests() {
|
||||||
}
|
}
|
||||||
gettimeofday(&endTime, NULL);
|
gettimeofday(&endTime, NULL);
|
||||||
elapsedMsecs = diffclock(&startTime, &endTime);
|
elapsedMsecs = diffclock(&startTime, &endTime);
|
||||||
qDebug("vec3 assign and dot() usecs: %f", 1000.0f * elapsedMsecs / (float) numTests);
|
qDebug("vec3 assign and dot() usecs: %f, last result:%f", 1000.0f * elapsedMsecs / (float) numTests, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
float loadSetting(QSettings* settings, const char* name, float defaultValue) {
|
float loadSetting(QSettings* settings, const char* name, float defaultValue) {
|
||||||
|
|
|
@ -243,7 +243,7 @@ VoxelSystem::~VoxelSystem() {
|
||||||
|
|
||||||
// This is called by the main application thread on both the initialization of the application and when
|
// This is called by the main application thread on both the initialization of the application and when
|
||||||
// the preferences dialog box is called/saved
|
// the preferences dialog box is called/saved
|
||||||
void VoxelSystem::setMaxVoxels(int maxVoxels) {
|
void VoxelSystem::setMaxVoxels(unsigned long maxVoxels) {
|
||||||
if (maxVoxels == _maxVoxels) {
|
if (maxVoxels == _maxVoxels) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,7 @@ int VoxelSystem::parseData(const QByteArray& packet) {
|
||||||
int flightTime = arrivedAt - sentAt;
|
int flightTime = arrivedAt - sentAt;
|
||||||
|
|
||||||
OCTREE_PACKET_INTERNAL_SECTION_SIZE sectionLength = 0;
|
OCTREE_PACKET_INTERNAL_SECTION_SIZE sectionLength = 0;
|
||||||
int dataBytes = packet.size() - (numBytesPacketHeader + OCTREE_PACKET_EXTRA_HEADERS_SIZE);
|
unsigned int dataBytes = packet.size() - (numBytesPacketHeader + OCTREE_PACKET_EXTRA_HEADERS_SIZE);
|
||||||
|
|
||||||
int subsection = 1;
|
int subsection = 1;
|
||||||
while (dataBytes > 0) {
|
while (dataBytes > 0) {
|
||||||
|
@ -576,7 +576,7 @@ int VoxelSystem::parseData(const QByteArray& packet) {
|
||||||
packetData.loadFinalizedContent(dataAt, sectionLength);
|
packetData.loadFinalizedContent(dataAt, sectionLength);
|
||||||
if (Application::getInstance()->getLogger()->extraDebugging()) {
|
if (Application::getInstance()->getLogger()->extraDebugging()) {
|
||||||
qDebug("VoxelSystem::parseData() ... Got Packet Section"
|
qDebug("VoxelSystem::parseData() ... Got Packet Section"
|
||||||
" color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%d"
|
" color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%u"
|
||||||
" subsection:%d sectionLength:%d uncompressed:%d",
|
" subsection:%d sectionLength:%d uncompressed:%d",
|
||||||
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
|
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
|
||||||
sequence, flightTime, packet.size(), dataBytes, subsection, sectionLength,
|
sequence, flightTime, packet.size(), dataBytes, subsection, sectionLength,
|
||||||
|
@ -919,13 +919,11 @@ void VoxelSystem::copyWrittenDataSegmentToReadArrays(glBufferIndex segmentStart,
|
||||||
// Depending on if we're using per vertex normals, we will need more or less vertex points per voxel
|
// Depending on if we're using per vertex normals, we will need more or less vertex points per voxel
|
||||||
int vertexPointsPerVoxel = GLOBAL_NORMALS_VERTEX_POINTS_PER_VOXEL;
|
int vertexPointsPerVoxel = GLOBAL_NORMALS_VERTEX_POINTS_PER_VOXEL;
|
||||||
|
|
||||||
GLintptr segmentStartAt = segmentStart * vertexPointsPerVoxel * sizeof(GLfloat);
|
|
||||||
GLsizeiptr segmentSizeBytes = segmentLength * vertexPointsPerVoxel * sizeof(GLfloat);
|
GLsizeiptr segmentSizeBytes = segmentLength * vertexPointsPerVoxel * sizeof(GLfloat);
|
||||||
GLfloat* readVerticesAt = _readVerticesArray + (segmentStart * vertexPointsPerVoxel);
|
GLfloat* readVerticesAt = _readVerticesArray + (segmentStart * vertexPointsPerVoxel);
|
||||||
GLfloat* writeVerticesAt = _writeVerticesArray + (segmentStart * vertexPointsPerVoxel);
|
GLfloat* writeVerticesAt = _writeVerticesArray + (segmentStart * vertexPointsPerVoxel);
|
||||||
memcpy(readVerticesAt, writeVerticesAt, segmentSizeBytes);
|
memcpy(readVerticesAt, writeVerticesAt, segmentSizeBytes);
|
||||||
|
|
||||||
segmentStartAt = segmentStart * vertexPointsPerVoxel * sizeof(GLubyte);
|
|
||||||
segmentSizeBytes = segmentLength * vertexPointsPerVoxel * sizeof(GLubyte);
|
segmentSizeBytes = segmentLength * vertexPointsPerVoxel * sizeof(GLubyte);
|
||||||
GLubyte* readColorsAt = _readColorsArray + (segmentStart * vertexPointsPerVoxel);
|
GLubyte* readColorsAt = _readColorsArray + (segmentStart * vertexPointsPerVoxel);
|
||||||
GLubyte* writeColorsAt = _writeColorsArray + (segmentStart * vertexPointsPerVoxel);
|
GLubyte* writeColorsAt = _writeColorsArray + (segmentStart * vertexPointsPerVoxel);
|
||||||
|
@ -1958,10 +1956,8 @@ bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraDat
|
||||||
// If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine
|
// If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine
|
||||||
// how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not
|
// how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not
|
||||||
// consider that case.
|
// consider that case.
|
||||||
ViewFrustum::location inLastCulledFrustum;
|
|
||||||
|
|
||||||
if (args->culledOnce && args->wantDeltaFrustums) {
|
if (args->culledOnce && args->wantDeltaFrustums) {
|
||||||
inLastCulledFrustum = voxel->inFrustum(args->lastViewFrustum);
|
ViewFrustum::location inLastCulledFrustum = voxel->inFrustum(args->lastViewFrustum);
|
||||||
|
|
||||||
// if this node is fully inside our last culled view frustum, then we don't need to recurse further
|
// if this node is fully inside our last culled view frustum, then we don't need to recurse further
|
||||||
if (inLastCulledFrustum == ViewFrustum::INSIDE) {
|
if (inLastCulledFrustum == ViewFrustum::INSIDE) {
|
||||||
|
@ -2001,7 +1997,7 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData
|
||||||
// If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine
|
// If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine
|
||||||
// how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not
|
// how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not
|
||||||
// consider that case.
|
// consider that case.
|
||||||
ViewFrustum::location inLastCulledFrustum;
|
ViewFrustum::location inLastCulledFrustum = ViewFrustum::OUTSIDE; // assume outside, but should get reset to actual value
|
||||||
|
|
||||||
if (args->culledOnce && args->wantDeltaFrustums) {
|
if (args->culledOnce && args->wantDeltaFrustums) {
|
||||||
inLastCulledFrustum = voxel->inFrustum(args->lastViewFrustum);
|
inLastCulledFrustum = voxel->inFrustum(args->lastViewFrustum);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
|
|
||||||
ViewFrustum* getLastCulledViewFrustum() { return &_lastCulledViewFrustum; }
|
ViewFrustum* getLastCulledViewFrustum() { return &_lastCulledViewFrustum; }
|
||||||
|
|
||||||
void setMaxVoxels(int maxVoxels);
|
void setMaxVoxels(unsigned long maxVoxels);
|
||||||
long int getMaxVoxels() const { return _maxVoxels; }
|
long int getMaxVoxels() const { return _maxVoxels; }
|
||||||
unsigned long getVoxelMemoryUsageRAM() const { return _memoryUsageRAM; }
|
unsigned long getVoxelMemoryUsageRAM() const { return _memoryUsageRAM; }
|
||||||
unsigned long getVoxelMemoryUsageVBO() const { return _memoryUsageVBO; }
|
unsigned long getVoxelMemoryUsageVBO() const { return _memoryUsageVBO; }
|
||||||
|
@ -263,7 +263,7 @@ private:
|
||||||
bool _usePrimitiveRenderer; ///< Flag primitive renderer for use
|
bool _usePrimitiveRenderer; ///< Flag primitive renderer for use
|
||||||
PrimitiveRenderer* _renderer; ///< Voxel renderer
|
PrimitiveRenderer* _renderer; ///< Voxel renderer
|
||||||
|
|
||||||
static const int _sNumOctantsPerHemiVoxel = 4;
|
static const unsigned int _sNumOctantsPerHemiVoxel = 4;
|
||||||
static int _sCorrectedChildIndex[8];
|
static int _sCorrectedChildIndex[8];
|
||||||
static unsigned short _sSwizzledOcclusionBits[64]; ///< Swizzle value of bit pairs of the value of index
|
static unsigned short _sSwizzledOcclusionBits[64]; ///< Swizzle value of bit pairs of the value of index
|
||||||
static unsigned char _sOctantIndexToBitMask[8]; ///< Map octant index to partition mask
|
static unsigned char _sOctantIndexToBitMask[8]; ///< Map octant index to partition mask
|
||||||
|
|
|
@ -41,7 +41,7 @@ void LocalVoxelsOverlay::update(float deltatime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_tree->lockForRead();
|
_tree->lockForRead();
|
||||||
if (_visible && _voxelCount != (int)_tree->getOctreeElementsCount()) {
|
if (_visible && _voxelCount != _tree->getOctreeElementsCount()) {
|
||||||
_voxelCount = _tree->getOctreeElementsCount();
|
_voxelCount = _tree->getOctreeElementsCount();
|
||||||
_voxelSystem->forceRedrawEntireTree();
|
_voxelSystem->forceRedrawEntireTree();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ private:
|
||||||
|
|
||||||
QString _treeName;
|
QString _treeName;
|
||||||
StrongVoxelTreePointer _tree; // so that the tree doesn't get freed
|
StrongVoxelTreePointer _tree; // so that the tree doesn't get freed
|
||||||
int _voxelCount;
|
unsigned long _voxelCount;
|
||||||
StrongVoxelSystemPointer _voxelSystem;
|
StrongVoxelSystemPointer _voxelSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,7 @@ int AvatarData::parseData(const QByteArray& packet) {
|
||||||
// joint data
|
// joint data
|
||||||
int jointCount = *sourceBuffer++;
|
int jointCount = *sourceBuffer++;
|
||||||
_jointData.resize(jointCount);
|
_jointData.resize(jointCount);
|
||||||
unsigned char validity;
|
unsigned char validity = 0; // although always set below, this fixes a warning of potential uninitialized use
|
||||||
int validityBit = 0;
|
int validityBit = 0;
|
||||||
for (int i = 0; i < jointCount; i++) {
|
for (int i = 0; i < jointCount; i++) {
|
||||||
if (validityBit == 0) {
|
if (validityBit == 0) {
|
||||||
|
|
|
@ -217,10 +217,11 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
||||||
palm.setActive(false);
|
palm.setActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// One byte for error checking safety.
|
// One byte for error checking safety. Last byte contains the expected length (less itself)
|
||||||
unsigned char requiredLength = (unsigned char)(sourceBuffer - startPosition);
|
// actualLength less expected byte = (sourceBuffer - startPosition)
|
||||||
unsigned char checkLength = *sourceBuffer++;
|
// expectedLength less expected byte = (*sourceBuffer)
|
||||||
assert(checkLength == requiredLength);
|
assert((unsigned char)(sourceBuffer - startPosition) == (unsigned char)(*sourceBuffer));
|
||||||
|
sourceBuffer++; // skip the trailing byte which is expected length
|
||||||
|
|
||||||
return sourceBuffer - startPosition;
|
return sourceBuffer - startPosition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -796,13 +796,14 @@ int Octree::encodeTreeBitstream(OctreeElement* node,
|
||||||
|
|
||||||
// write the octal code
|
// write the octal code
|
||||||
bool roomForOctalCode = false; // assume the worst
|
bool roomForOctalCode = false; // assume the worst
|
||||||
int codeLength;
|
int codeLength = 1; // assume root
|
||||||
if (params.chopLevels) {
|
if (params.chopLevels) {
|
||||||
unsigned char* newCode = chopOctalCode(node->getOctalCode(), params.chopLevels);
|
unsigned char* newCode = chopOctalCode(node->getOctalCode(), params.chopLevels);
|
||||||
roomForOctalCode = packetData->startSubTree(newCode);
|
roomForOctalCode = packetData->startSubTree(newCode);
|
||||||
|
|
||||||
if (newCode) {
|
if (newCode) {
|
||||||
delete newCode;
|
delete newCode;
|
||||||
|
codeLength = numberOfThreeBitSectionsInCode(newCode);
|
||||||
} else {
|
} else {
|
||||||
codeLength = 1;
|
codeLength = 1;
|
||||||
}
|
}
|
||||||
|
@ -1545,14 +1546,13 @@ void Octree::copySubTreeIntoNewTree(OctreeElement* startNode, Octree* destinatio
|
||||||
}
|
}
|
||||||
|
|
||||||
static OctreePacketData packetData;
|
static OctreePacketData packetData;
|
||||||
int bytesWritten = 0;
|
|
||||||
|
|
||||||
while (!nodeBag.isEmpty()) {
|
while (!nodeBag.isEmpty()) {
|
||||||
OctreeElement* subTree = nodeBag.extract();
|
OctreeElement* subTree = nodeBag.extract();
|
||||||
packetData.reset(); // reset the packet between usage
|
packetData.reset(); // reset the packet between usage
|
||||||
// ask our tree to write a bitsteam
|
// ask our tree to write a bitsteam
|
||||||
EncodeBitstreamParams params(INT_MAX, IGNORE_VIEW_FRUSTUM, WANT_COLOR, NO_EXISTS_BITS, chopLevels);
|
EncodeBitstreamParams params(INT_MAX, IGNORE_VIEW_FRUSTUM, WANT_COLOR, NO_EXISTS_BITS, chopLevels);
|
||||||
bytesWritten = encodeTreeBitstream(subTree, &packetData, nodeBag, params);
|
encodeTreeBitstream(subTree, &packetData, nodeBag, params);
|
||||||
// ask destination tree to read the bitstream
|
// ask destination tree to read the bitstream
|
||||||
ReadBitstreamToTreeParams args(WANT_COLOR, NO_EXISTS_BITS);
|
ReadBitstreamToTreeParams args(WANT_COLOR, NO_EXISTS_BITS);
|
||||||
destinationTree->readBitstreamToTree(packetData.getUncompressedData(), packetData.getUncompressedSize(), args);
|
destinationTree->readBitstreamToTree(packetData.getUncompressedData(), packetData.getUncompressedSize(), args);
|
||||||
|
@ -1581,7 +1581,6 @@ void Octree::copyFromTreeIntoSubTree(Octree* sourceTree, OctreeElement* destinat
|
||||||
nodeBag.insert(sourceTree->_rootNode);
|
nodeBag.insert(sourceTree->_rootNode);
|
||||||
|
|
||||||
static OctreePacketData packetData;
|
static OctreePacketData packetData;
|
||||||
int bytesWritten = 0;
|
|
||||||
|
|
||||||
while (!nodeBag.isEmpty()) {
|
while (!nodeBag.isEmpty()) {
|
||||||
OctreeElement* subTree = nodeBag.extract();
|
OctreeElement* subTree = nodeBag.extract();
|
||||||
|
@ -1590,7 +1589,7 @@ void Octree::copyFromTreeIntoSubTree(Octree* sourceTree, OctreeElement* destinat
|
||||||
|
|
||||||
// ask our tree to write a bitsteam
|
// ask our tree to write a bitsteam
|
||||||
EncodeBitstreamParams params(INT_MAX, IGNORE_VIEW_FRUSTUM, WANT_COLOR, NO_EXISTS_BITS);
|
EncodeBitstreamParams params(INT_MAX, IGNORE_VIEW_FRUSTUM, WANT_COLOR, NO_EXISTS_BITS);
|
||||||
bytesWritten = sourceTree->encodeTreeBitstream(subTree, &packetData, nodeBag, params);
|
sourceTree->encodeTreeBitstream(subTree, &packetData, nodeBag, params);
|
||||||
|
|
||||||
// ask destination tree to read the bitstream
|
// ask destination tree to read the bitstream
|
||||||
bool wantImportProgress = true;
|
bool wantImportProgress = true;
|
||||||
|
|
|
@ -23,7 +23,7 @@ OctreePacketData::OctreePacketData(bool enableCompression, int targetSize) {
|
||||||
changeSettings(enableCompression, targetSize); // does reset...
|
changeSettings(enableCompression, targetSize); // does reset...
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctreePacketData::changeSettings(bool enableCompression, int targetSize) {
|
void OctreePacketData::changeSettings(bool enableCompression, unsigned int targetSize) {
|
||||||
_enableCompression = enableCompression;
|
_enableCompression = enableCompression;
|
||||||
_targetSize = std::min(MAX_OCTREE_UNCOMRESSED_PACKET_SIZE, targetSize);
|
_targetSize = std::min(MAX_OCTREE_UNCOMRESSED_PACKET_SIZE, targetSize);
|
||||||
reset();
|
reset();
|
||||||
|
@ -369,7 +369,7 @@ bool OctreePacketData::compressContent() {
|
||||||
|
|
||||||
QByteArray compressedData = qCompress(uncompressedData, uncompressedSize, MAX_COMPRESSION);
|
QByteArray compressedData = qCompress(uncompressedData, uncompressedSize, MAX_COMPRESSION);
|
||||||
|
|
||||||
if (compressedData.size() < MAX_OCTREE_PACKET_DATA_SIZE) {
|
if (compressedData.size() < (int)MAX_OCTREE_PACKET_DATA_SIZE) {
|
||||||
_compressedBytes = compressedData.size();
|
_compressedBytes = compressedData.size();
|
||||||
for (int i = 0; i < _compressedBytes; i++) {
|
for (int i = 0; i < _compressedBytes; i++) {
|
||||||
_compressed[i] = compressedData[i];
|
_compressed[i] = compressedData[i];
|
||||||
|
|
|
@ -30,15 +30,15 @@ typedef uint16_t OCTREE_PACKET_INTERNAL_SECTION_SIZE;
|
||||||
const int MAX_OCTREE_PACKET_SIZE = MAX_PACKET_SIZE;
|
const int MAX_OCTREE_PACKET_SIZE = MAX_PACKET_SIZE;
|
||||||
|
|
||||||
// this is overly conservative - sizeof(PacketType) is 8 bytes but a packed PacketType could be as small as one byte
|
// this is overly conservative - sizeof(PacketType) is 8 bytes but a packed PacketType could be as small as one byte
|
||||||
const int OCTREE_PACKET_EXTRA_HEADERS_SIZE = sizeof(OCTREE_PACKET_FLAGS)
|
const unsigned int OCTREE_PACKET_EXTRA_HEADERS_SIZE = sizeof(OCTREE_PACKET_FLAGS)
|
||||||
+ sizeof(OCTREE_PACKET_SEQUENCE) + sizeof(OCTREE_PACKET_SENT_TIME);
|
+ sizeof(OCTREE_PACKET_SEQUENCE) + sizeof(OCTREE_PACKET_SENT_TIME);
|
||||||
|
|
||||||
const int MAX_OCTREE_PACKET_DATA_SIZE = MAX_PACKET_SIZE - (MAX_PACKET_HEADER_BYTES + OCTREE_PACKET_EXTRA_HEADERS_SIZE);
|
const unsigned int MAX_OCTREE_PACKET_DATA_SIZE = MAX_PACKET_SIZE - (MAX_PACKET_HEADER_BYTES + OCTREE_PACKET_EXTRA_HEADERS_SIZE);
|
||||||
|
|
||||||
const int MAX_OCTREE_UNCOMRESSED_PACKET_SIZE = MAX_OCTREE_PACKET_DATA_SIZE;
|
const unsigned int MAX_OCTREE_UNCOMRESSED_PACKET_SIZE = MAX_OCTREE_PACKET_DATA_SIZE;
|
||||||
|
|
||||||
const int MINIMUM_ATTEMPT_MORE_PACKING = sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE) + 40;
|
const unsigned int MINIMUM_ATTEMPT_MORE_PACKING = sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE) + 40;
|
||||||
const int COMPRESS_PADDING = 15;
|
const unsigned int COMPRESS_PADDING = 15;
|
||||||
const int REASONABLE_NUMBER_OF_PACKING_ATTEMPTS = 5;
|
const int REASONABLE_NUMBER_OF_PACKING_ATTEMPTS = 5;
|
||||||
|
|
||||||
const int PACKET_IS_COLOR_BIT = 0;
|
const int PACKET_IS_COLOR_BIT = 0;
|
||||||
|
@ -69,7 +69,7 @@ public:
|
||||||
~OctreePacketData();
|
~OctreePacketData();
|
||||||
|
|
||||||
/// change compression and target size settings
|
/// change compression and target size settings
|
||||||
void changeSettings(bool enableCompression = false, int targetSize = MAX_OCTREE_PACKET_DATA_SIZE);
|
void changeSettings(bool enableCompression = false, unsigned int targetSize = MAX_OCTREE_PACKET_DATA_SIZE);
|
||||||
|
|
||||||
/// reset completely, all data is discarded
|
/// reset completely, all data is discarded
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -168,7 +168,7 @@ public:
|
||||||
bool isCompressed() const { return _enableCompression; }
|
bool isCompressed() const { return _enableCompression; }
|
||||||
|
|
||||||
/// returns the target uncompressed size
|
/// returns the target uncompressed size
|
||||||
int getTargetSize() const { return _targetSize; }
|
unsigned int getTargetSize() const { return _targetSize; }
|
||||||
|
|
||||||
/// displays contents for debugging
|
/// displays contents for debugging
|
||||||
void debugContent();
|
void debugContent();
|
||||||
|
@ -186,7 +186,7 @@ private:
|
||||||
/// append a single byte, might fail if byte would cause packet to be too large
|
/// append a single byte, might fail if byte would cause packet to be too large
|
||||||
bool append(unsigned char byte);
|
bool append(unsigned char byte);
|
||||||
|
|
||||||
int _targetSize;
|
unsigned int _targetSize;
|
||||||
bool _enableCompression;
|
bool _enableCompression;
|
||||||
|
|
||||||
unsigned char _uncompressed[MAX_OCTREE_UNCOMRESSED_PACKET_SIZE];
|
unsigned char _uncompressed[MAX_OCTREE_UNCOMRESSED_PACKET_SIZE];
|
||||||
|
|
|
@ -57,9 +57,9 @@ void OctreeRenderer::processDatagram(const QByteArray& dataByteArray, const Shar
|
||||||
bool showTimingDetails = false; // Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
bool showTimingDetails = false; // Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
||||||
PerformanceWarning warn(showTimingDetails, "OctreeRenderer::processDatagram()",showTimingDetails);
|
PerformanceWarning warn(showTimingDetails, "OctreeRenderer::processDatagram()",showTimingDetails);
|
||||||
|
|
||||||
int packetLength = dataByteArray.size();
|
unsigned int packetLength = dataByteArray.size();
|
||||||
PacketType command = packetTypeForPacket(dataByteArray);
|
PacketType command = packetTypeForPacket(dataByteArray);
|
||||||
int numBytesPacketHeader = numBytesForPacketHeader(dataByteArray);
|
unsigned int numBytesPacketHeader = numBytesForPacketHeader(dataByteArray);
|
||||||
QUuid sourceUUID = uuidFromPacketHeader(dataByteArray);
|
QUuid sourceUUID = uuidFromPacketHeader(dataByteArray);
|
||||||
PacketType expectedType = getExpectedPacketType();
|
PacketType expectedType = getExpectedPacketType();
|
||||||
|
|
||||||
|
@ -86,11 +86,11 @@ void OctreeRenderer::processDatagram(const QByteArray& dataByteArray, const Shar
|
||||||
int flightTime = arrivedAt - sentAt + clockSkew;
|
int flightTime = arrivedAt - sentAt + clockSkew;
|
||||||
|
|
||||||
OCTREE_PACKET_INTERNAL_SECTION_SIZE sectionLength = 0;
|
OCTREE_PACKET_INTERNAL_SECTION_SIZE sectionLength = 0;
|
||||||
int dataBytes = packetLength - (numBytesPacketHeader + OCTREE_PACKET_EXTRA_HEADERS_SIZE);
|
unsigned int dataBytes = packetLength - (numBytesPacketHeader + OCTREE_PACKET_EXTRA_HEADERS_SIZE);
|
||||||
|
|
||||||
if (extraDebugging) {
|
if (extraDebugging) {
|
||||||
qDebug("OctreeRenderer::processDatagram() ... Got Packet Section"
|
qDebug("OctreeRenderer::processDatagram() ... Got Packet Section"
|
||||||
" color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%d",
|
" color:%s compressed:%s sequence: %u flight:%d usec size:%u data:%u",
|
||||||
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
|
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
|
||||||
sequence, flightTime, packetLength, dataBytes);
|
sequence, flightTime, packetLength, dataBytes);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ void OctreeRenderer::processDatagram(const QByteArray& dataByteArray, const Shar
|
||||||
packetData.loadFinalizedContent(dataAt, sectionLength);
|
packetData.loadFinalizedContent(dataAt, sectionLength);
|
||||||
if (extraDebugging) {
|
if (extraDebugging) {
|
||||||
qDebug("OctreeRenderer::processDatagram() ... Got Packet Section"
|
qDebug("OctreeRenderer::processDatagram() ... Got Packet Section"
|
||||||
" color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%d"
|
" color:%s compressed:%s sequence: %u flight:%d usec size:%u data:%u"
|
||||||
" subsection:%d sectionLength:%d uncompressed:%d",
|
" subsection:%d sectionLength:%d uncompressed:%d",
|
||||||
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
|
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
|
||||||
sequence, flightTime, packetLength, dataBytes, subsection, sectionLength,
|
sequence, flightTime, packetLength, dataBytes, subsection, sectionLength,
|
||||||
|
|
|
@ -919,13 +919,13 @@ void OctreeSceneStats::trackIncomingOctreePacket(const QByteArray& packet,
|
||||||
if (wantExtraDebugging) {
|
if (wantExtraDebugging) {
|
||||||
qDebug() << "too many _missingSequenceNumbers:" << _missingSequenceNumbers.size();
|
qDebug() << "too many _missingSequenceNumbers:" << _missingSequenceNumbers.size();
|
||||||
}
|
}
|
||||||
foreach(unsigned int missingItem, _missingSequenceNumbers) {
|
foreach(uint16_t missingItem, _missingSequenceNumbers) {
|
||||||
if (wantExtraDebugging) {
|
if (wantExtraDebugging) {
|
||||||
qDebug() << "checking item:" << missingItem << "is it in need of pruning?";
|
qDebug() << "checking item:" << missingItem << "is it in need of pruning?";
|
||||||
qDebug() << "(_incomingLastSequence - MAX_MISSING_SEQUENCE_OLD_AGE):"
|
qDebug() << "(_incomingLastSequence - MAX_MISSING_SEQUENCE_OLD_AGE):"
|
||||||
<< (_incomingLastSequence - MAX_MISSING_SEQUENCE_OLD_AGE);
|
<< (_incomingLastSequence - MAX_MISSING_SEQUENCE_OLD_AGE);
|
||||||
}
|
}
|
||||||
if (missingItem <= (unsigned int)std::max(0, (int)_incomingLastSequence - (int)MAX_MISSING_SEQUENCE_OLD_AGE)) {
|
if (missingItem <= std::max(0, _incomingLastSequence - MAX_MISSING_SEQUENCE_OLD_AGE)) {
|
||||||
if (wantExtraDebugging) {
|
if (wantExtraDebugging) {
|
||||||
qDebug() << "pruning really old missing sequence:" << missingItem;
|
qDebug() << "pruning really old missing sequence:" << missingItem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,7 @@ private:
|
||||||
unsigned int _incomingLate; /// out of order later than expected
|
unsigned int _incomingLate; /// out of order later than expected
|
||||||
unsigned int _incomingReallyLate; /// out of order and later than MAX_MISSING_SEQUENCE_OLD_AGE late
|
unsigned int _incomingReallyLate; /// out of order and later than MAX_MISSING_SEQUENCE_OLD_AGE late
|
||||||
unsigned int _incomingPossibleDuplicate; /// out of order possibly a duplicate
|
unsigned int _incomingPossibleDuplicate; /// out of order possibly a duplicate
|
||||||
QSet<unsigned int> _missingSequenceNumbers;
|
QSet<uint16_t> _missingSequenceNumbers;
|
||||||
SimpleMovingAverage _incomingFlightTimeAverage;
|
SimpleMovingAverage _incomingFlightTimeAverage;
|
||||||
|
|
||||||
// features related items
|
// features related items
|
||||||
|
|
|
@ -348,7 +348,7 @@ void NodeList::addSetOfNodeTypesToNodeInterestSet(const NodeSet& setOfNodeTypes)
|
||||||
|
|
||||||
const uint32_t RFC_5389_MAGIC_COOKIE = 0x2112A442;
|
const uint32_t RFC_5389_MAGIC_COOKIE = 0x2112A442;
|
||||||
const int NUM_BYTES_STUN_HEADER = 20;
|
const int NUM_BYTES_STUN_HEADER = 20;
|
||||||
const int NUM_STUN_REQUESTS_BEFORE_FALLBACK = 5;
|
const unsigned int NUM_STUN_REQUESTS_BEFORE_FALLBACK = 5;
|
||||||
|
|
||||||
void NodeList::sendSTUNRequest() {
|
void NodeList::sendSTUNRequest() {
|
||||||
const char STUN_SERVER_HOSTNAME[] = "stun.highfidelity.io";
|
const char STUN_SERVER_HOSTNAME[] = "stun.highfidelity.io";
|
||||||
|
|
|
@ -313,7 +313,7 @@ bool capsuleCapsule(const CapsuleShape* capsuleA, const CapsuleShape* capsuleB,
|
||||||
|
|
||||||
// Since there are only three comparisons to do we unroll the sort algorithm...
|
// Since there are only three comparisons to do we unroll the sort algorithm...
|
||||||
// and use a fifth slot as temp during swap.
|
// and use a fifth slot as temp during swap.
|
||||||
if (points[4] > points[2]) {
|
if (points[1] > points[2]) {
|
||||||
points[4] = points[1];
|
points[4] = points[1];
|
||||||
points[1] = points[2];
|
points[1] = points[2];
|
||||||
points[2] = points[4];
|
points[2] = points[4];
|
||||||
|
|
|
@ -631,8 +631,7 @@ void debug::setDeadBeef(void* memoryVoid, int size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void debug::checkDeadBeef(void* memoryVoid, int size) {
|
void debug::checkDeadBeef(void* memoryVoid, int size) {
|
||||||
unsigned char* memoryAt = (unsigned char*)memoryVoid;
|
assert(memcmp((unsigned char*)memoryVoid, DEADBEEF, std::min(size, DEADBEEF_SIZE)) != 0);
|
||||||
assert(memcmp(memoryAt, DEADBEEF, std::min(size, DEADBEEF_SIZE)) != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Safe version of glm::eulerAngles; uses the factorization method described in David Eberly's
|
// Safe version of glm::eulerAngles; uses the factorization method described in David Eberly's
|
||||||
|
|
|
@ -178,13 +178,14 @@ void VoxelTreeElement::calculateAverageFromChildren() {
|
||||||
bool VoxelTreeElement::collapseChildren() {
|
bool VoxelTreeElement::collapseChildren() {
|
||||||
// scan children, verify that they are ALL present and accounted for
|
// scan children, verify that they are ALL present and accounted for
|
||||||
bool allChildrenMatch = true; // assume the best (ottimista)
|
bool allChildrenMatch = true; // assume the best (ottimista)
|
||||||
int red,green,blue;
|
int red = 0;
|
||||||
|
int green = 0;
|
||||||
|
int blue = 0;
|
||||||
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
|
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
|
||||||
VoxelTreeElement* childAt = getChildAtIndex(i);
|
VoxelTreeElement* childAt = getChildAtIndex(i);
|
||||||
// if no child, child isn't a leaf, or child doesn't have a color
|
// if no child, child isn't a leaf, or child doesn't have a color
|
||||||
if (!childAt || !childAt->isLeaf() || !childAt->isColored()) {
|
if (!childAt || !childAt->isLeaf() || !childAt->isColored()) {
|
||||||
allChildrenMatch=false;
|
allChildrenMatch = false;
|
||||||
//qDebug("SADNESS child missing or not colored! i=%d\n",i);
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (i==0) {
|
if (i==0) {
|
||||||
|
|
Loading…
Reference in a new issue