mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 19:50:38 +02:00
added doxygen comments and cleanup for VoxelSceneStats class
This commit is contained in:
parent
7045dff7d3
commit
68845da901
3 changed files with 55 additions and 7 deletions
|
@ -30,7 +30,7 @@ VoxelStatsDialog::VoxelStatsDialog(QWidget* parent, VoxelSceneStats* model) :
|
||||||
this->QDialog::setLayout(form);
|
this->QDialog::setLayout(form);
|
||||||
|
|
||||||
// Setup labels
|
// Setup labels
|
||||||
for (int i = 0; i < VoxelSceneStats::ITEM_COUNT; ++i) {
|
for (VoxelSceneStats::Item i = VoxelSceneStats::ITEM_ELAPSED; i < VoxelSceneStats::ITEM_COUNT; ++i) {
|
||||||
VoxelSceneStats::ItemInfo& itemInfo = _model->getItemInfo(i);
|
VoxelSceneStats::ItemInfo& itemInfo = _model->getItemInfo(i);
|
||||||
QLabel* label = _labels[i] = new QLabel();
|
QLabel* label = _labels[i] = new QLabel();
|
||||||
label->setAlignment(Qt::AlignRight);
|
label->setAlignment(Qt::AlignRight);
|
||||||
|
@ -56,7 +56,7 @@ void VoxelStatsDialog::paintEvent(QPaintEvent* event) {
|
||||||
|
|
||||||
// Update labels
|
// Update labels
|
||||||
char strBuf[256];
|
char strBuf[256];
|
||||||
for (int i = 0; i < VoxelSceneStats::ITEM_COUNT; ++i) {
|
for (VoxelSceneStats::Item i = VoxelSceneStats::ITEM_ELAPSED; i < VoxelSceneStats::ITEM_COUNT; ++i) {
|
||||||
QLabel* label = _labels[i];
|
QLabel* label = _labels[i];
|
||||||
snprintf(strBuf, sizeof(strBuf), "%s", _model->getItemValue(i));
|
snprintf(strBuf, sizeof(strBuf), "%s", _model->getItemValue(i));
|
||||||
label->setText(strBuf);
|
label->setText(strBuf);
|
||||||
|
|
|
@ -543,7 +543,7 @@ VoxelSceneStats::ItemInfo VoxelSceneStats::_ITEMS[] = {
|
||||||
{ "Mode" , greenish },
|
{ "Mode" , greenish },
|
||||||
};
|
};
|
||||||
|
|
||||||
char* VoxelSceneStats::getItemValue(int item) {
|
char* VoxelSceneStats::getItemValue(Item item) {
|
||||||
const uint64_t USECS_PER_SECOND = 1000 * 1000;
|
const uint64_t USECS_PER_SECOND = 1000 * 1000;
|
||||||
int calcFPS, calcAverageFPS, calculatedKBPS;
|
int calcFPS, calcAverageFPS, calculatedKBPS;
|
||||||
switch(item) {
|
switch(item) {
|
||||||
|
|
|
@ -16,42 +16,83 @@
|
||||||
|
|
||||||
class VoxelNode;
|
class VoxelNode;
|
||||||
|
|
||||||
|
/// Collects statistics for calculating and sending a scene from a voxel server to an interface client
|
||||||
class VoxelSceneStats {
|
class VoxelSceneStats {
|
||||||
public:
|
public:
|
||||||
VoxelSceneStats();
|
VoxelSceneStats();
|
||||||
~VoxelSceneStats();
|
~VoxelSceneStats();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
/// Call when beginning the computation of a scene. Initializes internal structures
|
||||||
void sceneStarted(bool fullScene, bool moving, VoxelNode* root, JurisdictionMap* jurisdictionMap);
|
void sceneStarted(bool fullScene, bool moving, VoxelNode* root, JurisdictionMap* jurisdictionMap);
|
||||||
|
|
||||||
|
/// Call when the computation of a scene is completed. Finalizes internal structures
|
||||||
void sceneCompleted();
|
void sceneCompleted();
|
||||||
|
|
||||||
void printDebugDetails();
|
void printDebugDetails();
|
||||||
|
|
||||||
|
/// Track that a packet was sent as part of the scene.
|
||||||
void packetSent(int bytes);
|
void packetSent(int bytes);
|
||||||
|
|
||||||
|
/// Tracks the beginning of an encode pass during scene calculation.
|
||||||
void encodeStarted();
|
void encodeStarted();
|
||||||
|
|
||||||
|
/// Tracks the ending of an encode pass during scene calculation.
|
||||||
void encodeStopped();
|
void encodeStopped();
|
||||||
|
|
||||||
|
/// Track that a node was traversed as part of computation of a scene.
|
||||||
void traversed(const VoxelNode* node);
|
void traversed(const VoxelNode* node);
|
||||||
|
|
||||||
|
/// Track that a node was skipped as part of computation of a scene due to being beyond the LOD distance.
|
||||||
void skippedDistance(const VoxelNode* node);
|
void skippedDistance(const VoxelNode* node);
|
||||||
|
|
||||||
|
/// Track that a node was skipped as part of computation of a scene due to being out of view.
|
||||||
void skippedOutOfView(const VoxelNode* node);
|
void skippedOutOfView(const VoxelNode* node);
|
||||||
|
|
||||||
|
/// Track that a node was skipped as part of computation of a scene due to previously being in view while in delta sending
|
||||||
void skippedWasInView(const VoxelNode* node);
|
void skippedWasInView(const VoxelNode* node);
|
||||||
|
|
||||||
|
/// Track that a node was skipped as part of computation of a scene due to not having changed since last full scene sent
|
||||||
void skippedNoChange(const VoxelNode* node);
|
void skippedNoChange(const VoxelNode* node);
|
||||||
|
|
||||||
|
/// Track that a node was skipped as part of computation of a scene due to being occluded
|
||||||
void skippedOccluded(const VoxelNode* node);
|
void skippedOccluded(const VoxelNode* node);
|
||||||
|
|
||||||
|
/// Track that a node's color was was sent as part of computation of a scene
|
||||||
void colorSent(const VoxelNode* node);
|
void colorSent(const VoxelNode* node);
|
||||||
|
|
||||||
|
/// Track that a node was due to be sent, but didn't fit in the packet and was moved to next packet
|
||||||
void didntFit(const VoxelNode* node);
|
void didntFit(const VoxelNode* node);
|
||||||
|
|
||||||
|
/// Track that the color bitmask was was sent as part of computation of a scene
|
||||||
void colorBitsWritten();
|
void colorBitsWritten();
|
||||||
|
|
||||||
|
/// Track that the exists in tree bitmask was was sent as part of computation of a scene
|
||||||
void existsBitsWritten();
|
void existsBitsWritten();
|
||||||
|
|
||||||
|
/// Track that the exists in packet bitmask was was sent as part of computation of a scene
|
||||||
void existsInPacketBitsWritten();
|
void existsInPacketBitsWritten();
|
||||||
|
|
||||||
|
/// Fix up tracking statistics in case where bitmasks were removed for some reason
|
||||||
void childBitsRemoved(bool includesExistsBits, bool includesColors);
|
void childBitsRemoved(bool includesExistsBits, bool includesColors);
|
||||||
|
|
||||||
|
/// Pack the details of the statistics into a buffer for sending as a network packet
|
||||||
int packIntoMessage(unsigned char* destinationBuffer, int availableBytes);
|
int packIntoMessage(unsigned char* destinationBuffer, int availableBytes);
|
||||||
|
|
||||||
|
/// Unpack the details of the statistics from a buffer typically received as a network packet
|
||||||
int unpackFromMessage(unsigned char* sourceBuffer, int availableBytes);
|
int unpackFromMessage(unsigned char* sourceBuffer, int availableBytes);
|
||||||
|
|
||||||
|
/// Indicates that a scene has been completed and the statistics are ready to be sent
|
||||||
bool isReadyToSend() const { return _isReadyToSend; }
|
bool isReadyToSend() const { return _isReadyToSend; }
|
||||||
|
|
||||||
|
/// Mark that the scene statistics have been sent
|
||||||
void markAsSent() { _isReadyToSend = false; }
|
void markAsSent() { _isReadyToSend = false; }
|
||||||
|
|
||||||
unsigned char* getStatsMessage() { return &_statsMessage[0]; }
|
unsigned char* getStatsMessage() { return &_statsMessage[0]; }
|
||||||
int getStatsMessageLength() const { return _statsMessageLength; }
|
int getStatsMessageLength() const { return _statsMessageLength; }
|
||||||
|
|
||||||
enum {
|
/// List of various items tracked by VoxelSceneStats which can be accessed via getItemInfo() and getItemValue()
|
||||||
|
enum Item {
|
||||||
ITEM_ELAPSED,
|
ITEM_ELAPSED,
|
||||||
ITEM_ENCODE,
|
ITEM_ENCODE,
|
||||||
ITEM_PACKETS,
|
ITEM_PACKETS,
|
||||||
|
@ -71,16 +112,23 @@ public:
|
||||||
ITEM_COUNT
|
ITEM_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
// Meta information about each stats item
|
/// Meta information about each stats item
|
||||||
struct ItemInfo {
|
struct ItemInfo {
|
||||||
char const* const caption;
|
char const* const caption;
|
||||||
unsigned colorRGBA;
|
unsigned colorRGBA;
|
||||||
};
|
};
|
||||||
|
|
||||||
ItemInfo& getItemInfo(int item) { return _ITEMS[item]; };
|
/// Returns details about items tracked by VoxelSceneStats
|
||||||
char* getItemValue(int item);
|
/// \param
|
||||||
|
ItemInfo& getItemInfo(Item item) { return _ITEMS[item]; };
|
||||||
|
|
||||||
|
/// Returns a UI formatted value of an item tracked by VoxelSceneStats
|
||||||
|
char* getItemValue(Item item);
|
||||||
|
|
||||||
|
/// Returns OctCode for root node of the jurisdiction of this particular voxel server
|
||||||
unsigned char* getJurisdictionRoot() const { return _jurisdictionRoot; }
|
unsigned char* getJurisdictionRoot() const { return _jurisdictionRoot; }
|
||||||
|
|
||||||
|
/// Returns list of OctCodes for end nodes of the jurisdiction of this particular voxel server
|
||||||
const std::vector<unsigned char*>& getJurisdictionEndNodes() const { return _jurisdictionEndNodes; }
|
const std::vector<unsigned char*>& getJurisdictionEndNodes() const { return _jurisdictionEndNodes; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue