Changed: #1193 The status bar displays profiling information. Particle texture widget displays texture name.

This commit is contained in:
dnk-88 2011-01-20 13:58:22 +02:00
parent 79638b567e
commit 105278b781
6 changed files with 33 additions and 22 deletions

View file

@ -49,6 +49,7 @@ namespace NLQT
CGraphicsViewport::CGraphicsViewport(QWidget *parent)
: QNLWidget(parent)
{
this->setStatusTip("Status ready");
}
CGraphicsViewport::~CGraphicsViewport()

View file

@ -106,8 +106,10 @@ CMainWindow::CMainWindow(QWidget *parent)
_statusBarTimer = new QTimer(this);
connect(_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
_statusBarTimer->start(5000);
_statusBarTimer->start(1000);
_statusInfo = new QLabel(this);
this->statusBar()->addPermanentWidget(_statusInfo);
Modules::config().setAndCallback("SoundEnabled", CConfigCallback(this, &CMainWindow::cfcbSoundEnabled));
}
@ -216,7 +218,13 @@ void CMainWindow::about()
void CMainWindow::updateStatusBar()
{
if (_isGraphicsInitialized)
statusBar()->showMessage(QString(Modules::objView().getDriver()->getVideocardInformation()));
{
_statusInfo->setText(QString("%1, Nb tri: %2, Texture used (Mb): %3, fps: %4 ").arg(
Modules::objView().getDriver()->getVideocardInformation()).arg(
_numTri).arg(
_texMem, 0,'f',4).arg(
_fps, 0,'f',2));
}
}
void CMainWindow::updateInitialization(bool visible)
@ -615,6 +623,12 @@ void CMainWindow::updateRender()
// 14. Update Debug (stuff for dev)
// ...
// 15. Calc FPS
static sint64 lastTime = NLMISC::CTime::getPerformanceTime ();
sint64 newTime = NLMISC::CTime::getPerformanceTime ();
_fps = float(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime));
lastTime = newTime;
if (_isGraphicsInitialized && !Modules::objView().getDriver()->isLost())
{
@ -643,6 +657,13 @@ void CMainWindow::updateRender()
// 09. Render Debug 2D (stuff for dev)
Modules::objView().renderDebug2D();
// 10. Get profile information
NL3D::CPrimitiveProfile in, out;
Modules::objView().getDriver()->profileRenderedPrimitives (in, out);
_numTri = in.NLines+in.NPoints+in.NQuads*2+in.NTriangles+in.NTriangleStrips;
_texMem = float(Modules::objView().getDriver()->getUsedTextureMemory() / float(1024*1024));
// swap 3d buffers
Modules::objView().getDriver()->swapBuffers();
}

View file

@ -24,6 +24,7 @@
// Qt includes
#include <QtGui/QMainWindow>
#include <QtGui/QLabel>
// NeL includes
#include <nel/misc/config_file.h>
@ -140,6 +141,12 @@ private:
QAction *_settingsAction;
QAction *_aboutAction;
QAction *_aboutQtAction;
QLabel *_statusInfo;
float _fps;
uint _numTri;
float _texMem;
};/* class CMainWindow */
} /* namespace NLQT */

View file

@ -84,6 +84,7 @@ void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h)
// initialize the window with config file values
_Driver->setDisplay(wnd, NL3D::UDriver::CMode(w, h, 32));
_Driver->enableUsedTextureMemorySum();
_Light = ULight::createLight();
@ -175,24 +176,6 @@ void CObjectViewer::updateInput()
{
_Driver->EventServer.pump();
// Test some keys
if (_Driver->AsyncListener.isKeyPushed(KeyQ))
{
// Change render mode
switch (_Driver->getPolygonMode())
{
case UDriver::Filled:
_Driver->setPolygonMode (UDriver::Line);
break;
case UDriver::Line:
_Driver->setPolygonMode (UDriver::Point);
break;
case UDriver::Point:
_Driver->setPolygonMode (UDriver::Filled);
break;
}
}
// New matrix from camera
_Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix);
_Scene->getCam().setMatrix (_MouseListener->getViewMatrix());

View file

@ -21,7 +21,6 @@
#include "particle_property_dialog.h"
// Qt includes
// Project includes
#include "modules.h"
@ -42,7 +41,6 @@ CPropertyDialog::~CPropertyDialog()
void CPropertyDialog::setupUi()
{
setObjectName(QString::fromUtf8("CPropertyDialog"));
QIcon icon;
icon.addFile(QString::fromUtf8(":/images/pqrticles.png"), QSize(), QIcon::Normal, QIcon::Off);
setWindowIcon(icon);

View file

@ -117,6 +117,7 @@ void CParticleTextureWidget::updateTexture()
if (dynamic_cast<NL3D::CTextureFile *>(_Wrapper->get()))
{
std::string texName = (static_cast<NL3D::CTextureFile *>(_Wrapper->get()))->getFileName().c_str();
_ui.nameLabel->setText(tr("Name: %1").arg(texName.c_str()));
if (!NLMISC::CFile::getFilename(texName).empty())
_ui.imageLabel->setPixmap(QPixmap(NLMISC::CPath::lookup(texName).c_str()));
else