mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 01:24:03 +02:00
Merge pull request #598 from LionTurtle/master
Added menu toggle for displaying ping
This commit is contained in:
commit
800bcdfd18
2 changed files with 21 additions and 16 deletions
|
@ -848,8 +848,11 @@ void sendPingPackets() {
|
|||
// Every second, check the frame rates and other stuff
|
||||
void Application::timer() {
|
||||
gettimeofday(&_timerEnd, NULL);
|
||||
sendPingPackets();
|
||||
|
||||
if (_testPing->isChecked()) {
|
||||
sendPingPackets();
|
||||
}
|
||||
|
||||
_fps = (float)_frameCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
|
||||
_packetsPerSecond = (float)_packetCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
|
||||
_bytesPerSecond = (float)_bytesCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
|
||||
|
@ -1352,6 +1355,8 @@ void Application::initMenu() {
|
|||
(_gravityUse = optionsMenu->addAction("Use Gravity"))->setCheckable(true);
|
||||
_gravityUse->setChecked(true);
|
||||
_gravityUse->setShortcut(Qt::SHIFT | Qt::Key_G);
|
||||
(_testPing = optionsMenu->addAction("Test Ping"))->setCheckable(true);
|
||||
_testPing->setChecked(true);
|
||||
(_fullScreenMode = optionsMenu->addAction("Fullscreen", this, SLOT(setFullscreen(bool)), Qt::Key_F))->setCheckable(true);
|
||||
optionsMenu->addAction("Webcam", &_webcam, SLOT(setEnabled(bool)))->setCheckable(true);
|
||||
|
||||
|
@ -2294,24 +2299,23 @@ void Application::displayStats() {
|
|||
_fps, _packetsPerSecond, (float)_bytesPerSecond * 8.f / 1000000.f);
|
||||
drawtext(10, statsVerticalOffset + 15, 0.10f, 0, 1.0, 0, stats);
|
||||
|
||||
int pingAudio = 0, pingAvatar = 0, pingVoxel = 0;
|
||||
if (_testPing->isChecked()) {
|
||||
int pingAudio = 0, pingAvatar = 0, pingVoxel = 0;
|
||||
|
||||
AgentList *agentList = AgentList::getInstance();
|
||||
Agent *audioMixerAgent = agentList->soloAgentOfType(AGENT_TYPE_AUDIO_MIXER);
|
||||
Agent *avatarMixerAgent = agentList->soloAgentOfType(AGENT_TYPE_AVATAR_MIXER);
|
||||
Agent *voxelServerAgent = agentList->soloAgentOfType(AGENT_TYPE_VOXEL_SERVER);
|
||||
AgentList *agentList = AgentList::getInstance();
|
||||
Agent *audioMixerAgent = agentList->soloAgentOfType(AGENT_TYPE_AUDIO_MIXER);
|
||||
Agent *avatarMixerAgent = agentList->soloAgentOfType(AGENT_TYPE_AVATAR_MIXER);
|
||||
Agent *voxelServerAgent = agentList->soloAgentOfType(AGENT_TYPE_VOXEL_SERVER);
|
||||
|
||||
if (audioMixerAgent != NULL)
|
||||
pingAudio = audioMixerAgent->getPingMs();
|
||||
if (avatarMixerAgent != NULL)
|
||||
pingAvatar = avatarMixerAgent->getPingMs();
|
||||
if (voxelServerAgent != NULL)
|
||||
pingVoxel = voxelServerAgent->getPingMs();
|
||||
pingAudio = audioMixerAgent ? audioMixerAgent->getPingMs() : 0;
|
||||
pingAvatar = avatarMixerAgent ? avatarMixerAgent->getPingMs() : 0;
|
||||
pingVoxel = voxelServerAgent ? voxelServerAgent->getPingMs() : 0;
|
||||
|
||||
char pingStats[200];
|
||||
sprintf(pingStats, "Ping audio/avatar/voxel: %d / %d / %d ", pingAudio, pingAvatar, pingVoxel);
|
||||
drawtext(10, statsVerticalOffset + 35, 0.10f, 0, 1.0, 0, pingStats);
|
||||
|
||||
char pingStats[200];
|
||||
sprintf(pingStats, "Ping audio/avatar/voxel: %d / %d / %d ", pingAudio, pingAvatar, pingVoxel);
|
||||
drawtext(10, statsVerticalOffset + 35, 0.10f, 0, 1.0, 0, pingStats);
|
||||
}
|
||||
|
||||
std::stringstream voxelStats;
|
||||
voxelStats.precision(4);
|
||||
voxelStats << "Voxels Rendered: " << _voxels.getVoxelsRendered() / 1000.f << "K Updated: " << _voxels.getVoxelsUpdated()/1000.f << "K";
|
||||
|
|
|
@ -199,6 +199,7 @@ private:
|
|||
QAction* _showHeadMouse; // Whether the have the mouse near edge of screen move your view
|
||||
QAction* _transmitterDrives; // Whether to have Transmitter data move/steer the Avatar
|
||||
QAction* _gravityUse; // Whether gravity is on or not
|
||||
QAction* _testPing; // Whether to display ping or not
|
||||
QAction* _renderVoxels; // Whether to render voxels
|
||||
QAction* _renderVoxelTextures; // Whether to render noise textures on voxels
|
||||
QAction* _renderStarsOn; // Whether to display the stars
|
||||
|
|
Loading…
Reference in a new issue