mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 20:36:38 +02:00
Merge pull request #1257 from ZappoMan/new_voxel_scene_stats
Adds details about the connected voxel servers to allow debugging of client side jurisdictions
This commit is contained in:
commit
91c3327736
4 changed files with 100 additions and 2 deletions
|
@ -249,6 +249,7 @@ Application::~Application() {
|
|||
|
||||
_audio.shutdown();
|
||||
|
||||
VoxelNode::removeDeleteHook(&_voxels); // we don't need to do this processing on shutdown
|
||||
delete Menu::getInstance();
|
||||
|
||||
delete _oculusProgram;
|
||||
|
|
|
@ -170,6 +170,8 @@ public:
|
|||
PointShader& getPointShader() { return _pointShader; }
|
||||
|
||||
glm::vec2 getViewportDimensions() const{ return glm::vec2(_glWidget->width(),_glWidget->height()); }
|
||||
NodeToJurisdictionMap& getVoxelServerJurisdictions() { return _voxelServerJurisdictions; }
|
||||
|
||||
|
||||
public slots:
|
||||
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
|
||||
|
|
|
@ -23,6 +23,11 @@ VoxelStatsDialog::VoxelStatsDialog(QWidget* parent, NodeToVoxelSceneStats* model
|
|||
_model(model) {
|
||||
|
||||
_statCount = 0;
|
||||
_voxelServerLabelsCount = 0;
|
||||
|
||||
for (int i = 0; i < MAX_VOXEL_SERVERS; i++) {
|
||||
_voxelServerLables[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_STATS; i++) {
|
||||
_labels[i] = NULL;
|
||||
|
@ -51,9 +56,19 @@ VoxelStatsDialog::VoxelStatsDialog(QWidget* parent, NodeToVoxelSceneStats* model
|
|||
**/
|
||||
}
|
||||
|
||||
void VoxelStatsDialog::RemoveStatItem(int item) {
|
||||
QLabel* myLabel = _labels[item];
|
||||
QWidget* automaticLabel = _form->labelForField(myLabel);
|
||||
_form->removeWidget(myLabel);
|
||||
_form->removeWidget(automaticLabel);
|
||||
automaticLabel->deleteLater();
|
||||
myLabel->deleteLater();
|
||||
_labels[item] = NULL;
|
||||
}
|
||||
|
||||
int VoxelStatsDialog::AddStatItem(const char* caption, unsigned colorRGBA) {
|
||||
char strBuf[64];
|
||||
const int STATS_LABEL_WIDTH = 550;
|
||||
const int STATS_LABEL_WIDTH = 900;
|
||||
|
||||
_statCount++; // increment our current stat count
|
||||
|
||||
|
@ -183,10 +198,85 @@ void VoxelStatsDialog::paintEvent(QPaintEvent* event) {
|
|||
"Leaves: " << serversLeavesString.toLocal8Bit().constData() << "";
|
||||
label->setText(statsValue.str().c_str());
|
||||
|
||||
showAllVoxelServers();
|
||||
|
||||
this->QDialog::paintEvent(event);
|
||||
//this->setFixedSize(this->width(), this->height());
|
||||
}
|
||||
|
||||
void VoxelStatsDialog::showAllVoxelServers() {
|
||||
int serverNumber = 0;
|
||||
int serverCount = 0;
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
|
||||
// only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER
|
||||
if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
||||
serverNumber++;
|
||||
serverCount++;
|
||||
|
||||
if (serverCount > _voxelServerLabelsCount) {
|
||||
char label[128] = { 0 };
|
||||
sprintf(label, "Voxel Server %d",serverCount);
|
||||
_voxelServerLables[serverCount-1] = AddStatItem(label, GREENISH);
|
||||
_voxelServerLabelsCount++;
|
||||
}
|
||||
|
||||
std::stringstream serverDetails("");
|
||||
|
||||
if (nodeList->getNodeActiveSocketOrPing(&(*node))) {
|
||||
serverDetails << "active ";
|
||||
} else {
|
||||
serverDetails << "inactive ";
|
||||
}
|
||||
|
||||
QUuid nodeUUID = node->getUUID();
|
||||
serverDetails << " " << nodeUUID.toString().toLocal8Bit().constData() << " ";
|
||||
|
||||
NodeToJurisdictionMap& voxelServerJurisdictions = Application::getInstance()->getVoxelServerJurisdictions();
|
||||
|
||||
// lookup our nodeUUID in the jurisdiction map, if it's missing then we're
|
||||
// missing at least one jurisdiction
|
||||
if (voxelServerJurisdictions.find(nodeUUID) == voxelServerJurisdictions.end()) {
|
||||
serverDetails << " unknown jurisdiction ";
|
||||
} else {
|
||||
const JurisdictionMap& map = voxelServerJurisdictions[nodeUUID];
|
||||
|
||||
unsigned char* rootCode = map.getRootOctalCode();
|
||||
|
||||
if (rootCode) {
|
||||
QString rootCodeHex = octalCodeToHexString(rootCode);
|
||||
|
||||
VoxelPositionSize rootDetails;
|
||||
voxelDetailsForCode(rootCode, rootDetails);
|
||||
AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s);
|
||||
serverBounds.scale(TREE_SCALE);
|
||||
serverDetails << " jurisdiction: "
|
||||
<< rootCodeHex.toLocal8Bit().constData()
|
||||
<< " ["
|
||||
<< rootDetails.x << ", "
|
||||
<< rootDetails.y << ", "
|
||||
<< rootDetails.z << ": "
|
||||
<< rootDetails.s << "] ";
|
||||
} else {
|
||||
serverDetails << " jurisdiction has no rootCode";
|
||||
} // root code
|
||||
} // jurisdiction
|
||||
|
||||
_labels[_voxelServerLables[serverCount - 1]]->setText(serverDetails.str().c_str());
|
||||
|
||||
} // is VOXEL_SERVER
|
||||
} // Node Loop
|
||||
|
||||
if (_voxelServerLabelsCount > serverCount) {
|
||||
for (int i = serverCount; i < _voxelServerLabelsCount; i++) {
|
||||
int serverLabel = _voxelServerLables[i];
|
||||
RemoveStatItem(serverLabel);
|
||||
_voxelServerLables[i] = 0;
|
||||
}
|
||||
_voxelServerLabelsCount = serverCount;
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelStatsDialog::reject() {
|
||||
// Just regularly close upon ESC
|
||||
this->QDialog::close();
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
|
||||
#include <VoxelSceneStats.h>
|
||||
|
||||
#define MAX_STATS 40
|
||||
#define MAX_STATS 100
|
||||
#define MAX_VOXEL_SERVERS 50
|
||||
|
||||
class VoxelStatsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
@ -38,6 +39,8 @@ protected:
|
|||
void closeEvent(QCloseEvent*);
|
||||
|
||||
int AddStatItem(const char* caption, unsigned colorRGBA);
|
||||
void RemoveStatItem(int item);
|
||||
void showAllVoxelServers();
|
||||
|
||||
private:
|
||||
QFormLayout* _form;
|
||||
|
@ -50,6 +53,8 @@ private:
|
|||
int _localVoxels;
|
||||
int _localVoxelsMemory;
|
||||
int _voxelsRendered;
|
||||
int _voxelServerLables[MAX_VOXEL_SERVERS];
|
||||
int _voxelServerLabelsCount;
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__VoxelStatsDialog__) */
|
||||
|
|
Loading…
Reference in a new issue