Merge remote branch 'scrawl/trianglebatchcount'

actorid
Marc Zinnschlag 13 years ago
commit 2b68e4d489

@ -126,9 +126,9 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
// update GUI
Ogre::RenderWindow* window = mOgre->getWindow();
MWBase::Environment::get().getWindowManager()->wmUpdateFps(window->getLastFPS(),
window->getTriangleCount(),
window->getBatchCount());
unsigned int tri, batch;
MWBase::Environment::get().getWorld()->getTriangleBatchCount(tri, batch);
MWBase::Environment::get().getWindowManager()->wmUpdateFps(window->getLastFPS(), tri, batch);
MWBase::Environment::get().getWindowManager()->onFrame(evt.timeSinceLastFrame);
}

@ -143,12 +143,12 @@ void HUD::setFPS(float fps)
fpscounter->setCaption(boost::lexical_cast<std::string>((int)fps));
}
void HUD::setTriangleCount(size_t count)
void HUD::setTriangleCount(unsigned int count)
{
trianglecounter->setCaption(boost::lexical_cast<std::string>(count));
}
void HUD::setBatchCount(size_t count)
void HUD::setBatchCount(unsigned int count)
{
batchcounter->setCaption(boost::lexical_cast<std::string>(count));
}

@ -16,8 +16,8 @@ namespace MWGui
void setEffect(const char *img);
void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
void setFPS(float fps);
void setTriangleCount(size_t count);
void setBatchCount(size_t count);
void setTriangleCount(unsigned int count);
void setBatchCount(unsigned int count);
void setBottomLeftVisibility(bool hmsVisible, bool weapVisible, bool spellVisible);
void setBottomRightVisibility(bool effectBoxVisible, bool minimapVisible);
void setFpsLevel(const int level);

@ -159,7 +159,7 @@ namespace MWGui
MyGUI::Gui* getGui() const { return gui; }
void wmUpdateFps(float fps, size_t triangleCount, size_t batchCount)
void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount)
{
mFPS = fps;
mTriangleCount = triangleCount;
@ -295,8 +295,8 @@ namespace MWGui
int showFPSLevel;
float mFPS;
size_t mTriangleCount;
size_t mBatchCount;
unsigned int mTriangleCount;
unsigned int mBatchCount;
void onDialogueWindowBye();

@ -2,6 +2,8 @@
#include <OgreViewport.h>
#include <OgreCompositorManager.h>
#include <OgreCompositorChain.h>
#include <OgreCompositionTargetPass.h>
using namespace MWRender;
@ -69,3 +71,38 @@ void Compositors::removeAll()
mCompositors.clear();
}
bool Compositors::anyCompositorEnabled()
{
for (CompositorMap::iterator it=mCompositors.begin();
it != mCompositors.end(); ++it)
{
if (it->second.first && mEnabled)
return true;
}
return false;
}
void Compositors::countTrianglesBatches(unsigned int &triangles, unsigned int &batches)
{
triangles = 0;
batches = 0;
Ogre::CompositorInstance* c = NULL;
Ogre::CompositorChain* chain = Ogre::CompositorManager::getSingleton().getCompositorChain (mViewport);
// accumulate tris & batches from all compositors with all their render targets
for (unsigned int i=0; i < chain->getNumCompositors(); ++i)
{
if (chain->getCompositor(i)->getEnabled())
{
c = chain->getCompositor(i);
for (unsigned int j = 0; j < c->getTechnique()->getNumTargetPasses(); ++j)
{
std::string textureName = c->getTechnique()->getTargetPass(j)->getOutputName();
Ogre::RenderTarget* rt = c->getRenderTarget(textureName);
triangles += rt->getTriangleCount();
batches += rt->getBatchCount();
}
}
}
}

@ -44,6 +44,10 @@ namespace MWRender
*/
void addCompositor (const std::string& name, const int priority);
bool anyCompositorEnabled();
void countTrianglesBatches(unsigned int &triangles, unsigned int &batches);
void removeAll ();
protected:

@ -677,4 +677,17 @@ void RenderingManager::applyCompositors()
mWater->assignTextures();
}
void RenderingManager::getTriangleBatchCount(unsigned int &triangles, unsigned int &batches)
{
if (mCompositors->anyCompositorEnabled())
{
mCompositors->countTrianglesBatches(triangles, batches);
}
else
{
triangles = mRendering.getWindow()->getTriangleCount();
batches = mRendering.getWindow()->getBatchCount();
}
}
} // namespace

@ -118,14 +118,16 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
void disableLights();
void enableLights();
bool occlusionQuerySupported() { return mOcclusionQuery->supported(); };
OcclusionQuery* getOcclusionQuery() { return mOcclusionQuery; };
bool occlusionQuerySupported() { return mOcclusionQuery->supported(); }
OcclusionQuery* getOcclusionQuery() { return mOcclusionQuery; }
Shadows* getShadows();
void switchToInterior();
void switchToExterior();
void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches);
void setGlare(bool glare);
void skyEnable ();
void skyDisable ();

@ -1039,4 +1039,9 @@ namespace MWWorld
{
mRendering->processChangedSettings(settings);
}
void World::getTriangleBatchCount(unsigned int &triangles, unsigned int &batches)
{
mRendering->getTriangleBatchCount(triangles, batches);
}
}

@ -133,6 +133,8 @@ namespace MWWorld
void adjustSky();
void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches);
void setFallbackValues(std::map<std::string,std::string> fallbackMap);
std::string getFallback(std::string key);

Loading…
Cancel
Save