mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:28:09 +02:00
adding jurisdiction to scene stats to implement add/drop effect, added command line to voxel server to not send environments
This commit is contained in:
parent
7a3d254aca
commit
01ba5ee81a
5 changed files with 51 additions and 5 deletions
|
@ -24,7 +24,9 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) {
|
||||||
|
|
||||||
case PACKET_TYPE_AVATAR_FACE_VIDEO:
|
case PACKET_TYPE_AVATAR_FACE_VIDEO:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
case PACKET_TYPE_VOXEL_STATS:
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ public:
|
||||||
|
|
||||||
bool writeToFile(const char* filename);
|
bool writeToFile(const char* filename);
|
||||||
bool readFromFile(const char* filename);
|
bool readFromFile(const char* filename);
|
||||||
|
|
||||||
|
unsigned char* getRootOctalCode() const { return _rootOctalCode; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clear();
|
void clear();
|
||||||
|
|
|
@ -22,9 +22,10 @@ VoxelSceneStats::VoxelSceneStats() :
|
||||||
reset();
|
reset();
|
||||||
_isReadyToSend = false;
|
_isReadyToSend = false;
|
||||||
_isStarted = false;
|
_isStarted = false;
|
||||||
|
_jurisdictionRoot = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelSceneStats::sceneStarted(bool isFullScene, bool isMoving, VoxelNode* root) {
|
void VoxelSceneStats::sceneStarted(bool isFullScene, bool isMoving, VoxelNode* root, JurisdictionMap* jurisdictionMap) {
|
||||||
reset(); // resets packet and voxel stats
|
reset(); // resets packet and voxel stats
|
||||||
_isStarted = true;
|
_isStarted = true;
|
||||||
_start = usecTimestampNow();
|
_start = usecTimestampNow();
|
||||||
|
@ -34,6 +35,7 @@ void VoxelSceneStats::sceneStarted(bool isFullScene, bool isMoving, VoxelNode* r
|
||||||
|
|
||||||
_isFullScene = isFullScene;
|
_isFullScene = isFullScene;
|
||||||
_isMoving = isMoving;
|
_isMoving = isMoving;
|
||||||
|
_jurisdictionRoot = jurisdictionMap->getRootOctalCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelSceneStats::sceneCompleted() {
|
void VoxelSceneStats::sceneCompleted() {
|
||||||
|
@ -273,6 +275,20 @@ int VoxelSceneStats::packIntoMessage(unsigned char* destinationBuffer, int avail
|
||||||
destinationBuffer += sizeof(_existsInPacketBitsWritten);
|
destinationBuffer += sizeof(_existsInPacketBitsWritten);
|
||||||
memcpy(destinationBuffer, &_treesRemoved, sizeof(_treesRemoved));
|
memcpy(destinationBuffer, &_treesRemoved, sizeof(_treesRemoved));
|
||||||
destinationBuffer += sizeof(_treesRemoved);
|
destinationBuffer += sizeof(_treesRemoved);
|
||||||
|
|
||||||
|
// add the root jurisdiction
|
||||||
|
if (_jurisdictionRoot) {
|
||||||
|
// copy the
|
||||||
|
int bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(_jurisdictionRoot));
|
||||||
|
memcpy(destinationBuffer, &bytes, sizeof(bytes));
|
||||||
|
destinationBuffer += sizeof(bytes);
|
||||||
|
memcpy(destinationBuffer, _jurisdictionRoot, bytes);
|
||||||
|
destinationBuffer += bytes;
|
||||||
|
} else {
|
||||||
|
int bytes = 0;
|
||||||
|
memcpy(destinationBuffer, &bytes, sizeof(bytes));
|
||||||
|
destinationBuffer += sizeof(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
return destinationBuffer - bufferStart; // includes header!
|
return destinationBuffer - bufferStart; // includes header!
|
||||||
}
|
}
|
||||||
|
@ -363,6 +379,19 @@ int VoxelSceneStats::unpackFromMessage(unsigned char* sourceBuffer, int availabl
|
||||||
sourceBuffer += sizeof(_existsInPacketBitsWritten);
|
sourceBuffer += sizeof(_existsInPacketBitsWritten);
|
||||||
memcpy(&_treesRemoved, sourceBuffer, sizeof(_treesRemoved));
|
memcpy(&_treesRemoved, sourceBuffer, sizeof(_treesRemoved));
|
||||||
sourceBuffer += sizeof(_treesRemoved);
|
sourceBuffer += sizeof(_treesRemoved);
|
||||||
|
|
||||||
|
// read the root jurisdiction
|
||||||
|
int bytes = 0;
|
||||||
|
memcpy(&bytes, sourceBuffer, sizeof(bytes));
|
||||||
|
sourceBuffer += sizeof(bytes);
|
||||||
|
|
||||||
|
if (bytes == 0) {
|
||||||
|
_jurisdictionRoot = NULL;
|
||||||
|
} else {
|
||||||
|
_jurisdictionRoot = new unsigned char[bytes];
|
||||||
|
memcpy(_jurisdictionRoot, sourceBuffer, bytes);
|
||||||
|
sourceBuffer += bytes;
|
||||||
|
}
|
||||||
|
|
||||||
// running averages
|
// running averages
|
||||||
_elapsedAverage.updateAverage((float)_elapsed);
|
_elapsedAverage.updateAverage((float)_elapsed);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
|
#include "JurisdictionMap.h"
|
||||||
|
|
||||||
class VoxelNode;
|
class VoxelNode;
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ class VoxelSceneStats {
|
||||||
public:
|
public:
|
||||||
VoxelSceneStats();
|
VoxelSceneStats();
|
||||||
void reset();
|
void reset();
|
||||||
void sceneStarted(bool fullScene, bool moving, VoxelNode* root);
|
void sceneStarted(bool fullScene, bool moving, VoxelNode* root, JurisdictionMap* jurisdictionMap);
|
||||||
void sceneCompleted();
|
void sceneCompleted();
|
||||||
|
|
||||||
void printDebugDetails();
|
void printDebugDetails();
|
||||||
|
@ -165,6 +166,8 @@ private:
|
||||||
static ItemInfo _ITEMS[];
|
static ItemInfo _ITEMS[];
|
||||||
static int const MAX_ITEM_VALUE_LENGTH = 128;
|
static int const MAX_ITEM_VALUE_LENGTH = 128;
|
||||||
char _itemValueBuffer[MAX_ITEM_VALUE_LENGTH];
|
char _itemValueBuffer[MAX_ITEM_VALUE_LENGTH];
|
||||||
|
|
||||||
|
unsigned char* _jurisdictionRoot;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__VoxelSceneStats__) */
|
#endif /* defined(__hifi__VoxelSceneStats__) */
|
||||||
|
|
|
@ -64,6 +64,7 @@ bool debugVoxelSending = false;
|
||||||
bool shouldShowAnimationDebug = false;
|
bool shouldShowAnimationDebug = false;
|
||||||
bool displayVoxelStats = false;
|
bool displayVoxelStats = false;
|
||||||
bool debugVoxelReceiving = false;
|
bool debugVoxelReceiving = false;
|
||||||
|
bool sendEnvironments = true;
|
||||||
|
|
||||||
EnvironmentData environmentData[3];
|
EnvironmentData environmentData[3];
|
||||||
|
|
||||||
|
@ -255,7 +256,7 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
|
||||||
|
|
||||||
// start tracking our stats
|
// start tracking our stats
|
||||||
bool isFullScene = (!viewFrustumChanged || !nodeData->getWantDelta()) && nodeData->getViewFrustumJustStoppedChanging();
|
bool isFullScene = (!viewFrustumChanged || !nodeData->getWantDelta()) && nodeData->getViewFrustumJustStoppedChanging();
|
||||||
nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged, ::serverTree.rootNode);
|
nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged, ::serverTree.rootNode, ::jurisdiction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have something in our nodeBag, then turn them into packets and send them out...
|
// If we have something in our nodeBag, then turn them into packets and send them out...
|
||||||
|
@ -265,7 +266,7 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
|
||||||
int packetsSentThisInterval = 0;
|
int packetsSentThisInterval = 0;
|
||||||
uint64_t start = usecTimestampNow();
|
uint64_t start = usecTimestampNow();
|
||||||
|
|
||||||
bool shouldSendEnvironments = shouldDo(ENVIRONMENT_SEND_INTERVAL_USECS, VOXEL_SEND_INTERVAL_USECS);
|
bool shouldSendEnvironments = ::sendEnvironments && shouldDo(ENVIRONMENT_SEND_INTERVAL_USECS, VOXEL_SEND_INTERVAL_USECS);
|
||||||
while (packetsSentThisInterval < PACKETS_PER_CLIENT_PER_INTERVAL - (shouldSendEnvironments ? 1 : 0)) {
|
while (packetsSentThisInterval < PACKETS_PER_CLIENT_PER_INTERVAL - (shouldSendEnvironments ? 1 : 0)) {
|
||||||
// Check to see if we're taking too long, and if so bail early...
|
// Check to see if we're taking too long, and if so bail early...
|
||||||
uint64_t now = usecTimestampNow();
|
uint64_t now = usecTimestampNow();
|
||||||
|
@ -473,6 +474,15 @@ int main(int argc, const char * argv[]) {
|
||||||
jurisdiction = new JurisdictionMap(jurisdictionRoot, jurisdictionEndNodes);
|
jurisdiction = new JurisdictionMap(jurisdictionRoot, jurisdictionEndNodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// should we send environments? Default is yes, but this command line suppresses sending
|
||||||
|
const char* DONT_SEND_ENVIRONMENTS = "--dontSendEnvironments";
|
||||||
|
bool dontSendEnvironments = cmdOptionExists(argc, argv, DONT_SEND_ENVIRONMENTS);
|
||||||
|
if (dontSendEnvironments) {
|
||||||
|
printf("Sending environments suppressed...\n");
|
||||||
|
::sendEnvironments = false;
|
||||||
|
}
|
||||||
|
printf("Sending environments=%s\n", debug::valueOf(::sendEnvironments));
|
||||||
|
|
||||||
NodeList* nodeList = NodeList::createInstance(NODE_TYPE_VOXEL_SERVER, listenPort);
|
NodeList* nodeList = NodeList::createInstance(NODE_TYPE_VOXEL_SERVER, listenPort);
|
||||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||||
|
|
Loading…
Reference in a new issue