|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
#include <osg/PolygonMode>
|
|
|
|
|
|
|
|
|
@ -255,7 +256,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase *viewer)
|
|
|
|
|
stateset->setAttribute(new osg::PolygonMode(), osg::StateAttribute::PROTECTED);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
osg::Vec3 pos(_statsWidth-300.f, _statsHeight-500.0f,0.0f);
|
|
|
|
|
osg::Vec3 pos(_statsWidth-420.f, _statsHeight-500.0f,0.0f);
|
|
|
|
|
osg::Vec4 backgroundColor(0.0, 0.0, 0.0f, 0.3);
|
|
|
|
|
osg::Vec4 staticTextColor(1.0, 1.0, 0.0f, 1.0);
|
|
|
|
|
osg::Vec4 dynamicTextColor(1.0, 1.0, 1.0f, 1.0);
|
|
|
|
@ -290,12 +291,20 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase *viewer)
|
|
|
|
|
"Composite",
|
|
|
|
|
"",
|
|
|
|
|
"UnrefQueue",
|
|
|
|
|
"",
|
|
|
|
|
"NavMesh UpdateJobs",
|
|
|
|
|
"NavMesh CacheSize",
|
|
|
|
|
"NavMesh UsedTiles",
|
|
|
|
|
"NavMesh CachedTiles",
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
static const auto longest = std::max_element(statNames.begin(), statNames.end(),
|
|
|
|
|
[] (const std::string& lhs, const std::string& rhs) { return lhs.size() < rhs.size(); });
|
|
|
|
|
const int numLines = statNames.size();
|
|
|
|
|
const float statNamesWidth = 13 * _characterSize + 2 * backgroundMargin;
|
|
|
|
|
|
|
|
|
|
group->addChild(createBackgroundRectangle(pos + osg::Vec3(-backgroundMargin, _characterSize + backgroundMargin, 0),
|
|
|
|
|
10 * _characterSize + 2 * backgroundMargin,
|
|
|
|
|
statNamesWidth,
|
|
|
|
|
numLines * _characterSize + 2 * backgroundMargin,
|
|
|
|
|
backgroundColor));
|
|
|
|
|
|
|
|
|
@ -309,7 +318,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase *viewer)
|
|
|
|
|
std::ostringstream viewStr;
|
|
|
|
|
viewStr.clear();
|
|
|
|
|
viewStr.setf(std::ios::left, std::ios::adjustfield);
|
|
|
|
|
viewStr.width(14);
|
|
|
|
|
viewStr.width(longest->size());
|
|
|
|
|
for (const auto& statName : statNames)
|
|
|
|
|
{
|
|
|
|
|
viewStr << statName << std::endl;
|
|
|
|
@ -317,10 +326,10 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase *viewer)
|
|
|
|
|
|
|
|
|
|
staticText->setText(viewStr.str());
|
|
|
|
|
|
|
|
|
|
pos.x() += 10 * _characterSize + 2 * backgroundMargin + backgroundSpacing;
|
|
|
|
|
pos.x() += statNamesWidth + backgroundSpacing;
|
|
|
|
|
|
|
|
|
|
group->addChild(createBackgroundRectangle(pos + osg::Vec3(-backgroundMargin, _characterSize + backgroundMargin, 0),
|
|
|
|
|
5 * _characterSize + 2 * backgroundMargin,
|
|
|
|
|
7 * _characterSize + 2 * backgroundMargin,
|
|
|
|
|
numLines * _characterSize + 2 * backgroundMargin,
|
|
|
|
|
backgroundColor));
|
|
|
|
|
|
|
|
|
|