removes unused code (#3129)

* scenemanager.cpp

* scenemanager.hpp

* scenemanager.cpp

* stats.cpp

* renderingmanager.cpp
pull/3130/head
Bo Svensson 3 years ago committed by GitHub
parent d854e247b8
commit 5fde6867a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -262,7 +262,7 @@ namespace MWRender
try
{
for (std::vector<std::string>::const_iterator it = mModels.begin(); it != mModels.end(); ++it)
mResourceSystem->getSceneManager()->cacheInstance(*it);
mResourceSystem->getSceneManager()->getTemplate(*it);
for (std::vector<std::string>::const_iterator it = mTextures.begin(); it != mTextures.end(); ++it)
mResourceSystem->getImageManager()->getImage(*it);
for (std::vector<std::string>::const_iterator it = mKeyframes.begin(); it != mKeyframes.end(); ++it)

@ -35,7 +35,6 @@
#include "imagemanager.hpp"
#include "niffilemanager.hpp"
#include "objectcache.hpp"
#include "multiobjectcache.hpp"
namespace
{
@ -306,7 +305,6 @@ namespace Resource
, mLightingMethod(SceneUtil::LightingMethod::FFP)
, mConvertAlphaTestToAlphaToCoverage(false)
, mDepthFormat(0)
, mInstanceCache(new MultiObjectCache)
, mSharedStateManager(new SharedStateManager)
, mImageManager(imageManager)
, mNifFileManager(nifFileManager)
@ -682,21 +680,6 @@ namespace Resource
}
}
osg::ref_ptr<osg::Node> SceneManager::cacheInstance(const std::string &name)
{
const std::string normalized = mVFS->normalizeFilename(name);
osg::ref_ptr<osg::Node> node = createInstance(normalized);
// Note: osg::clone() does not calculate bound volumes.
// Do it immediately, otherwise we will need to update them for all objects
// during first update traversal, what may lead to stuttering during cell transitions
node->getBound();
mInstanceCache->addEntryToObjectCache(normalized, node.get());
return node;
}
osg::ref_ptr<osg::Node> SceneManager::createInstance(const std::string& name)
{
osg::ref_ptr<const osg::Node> scene = getTemplate(name);
@ -722,14 +705,7 @@ namespace Resource
osg::ref_ptr<osg::Node> SceneManager::getInstance(const std::string &name)
{
const std::string normalized = mVFS->normalizeFilename(name);
osg::ref_ptr<osg::Object> obj = mInstanceCache->takeFromObjectCache(normalized);
if (obj.get())
return static_cast<osg::Node*>(obj.get());
return createInstance(normalized);
return createInstance(name);
}
osg::ref_ptr<osg::Node> SceneManager::getInstance(const std::string &name, osg::Group* parentNode)
@ -747,7 +723,6 @@ namespace Resource
void SceneManager::releaseGLObjects(osg::State *state)
{
mCache->releaseGLObjects(state);
mInstanceCache->releaseGLObjects(state);
mShaderManager->releaseGLObjects(state);
@ -835,8 +810,6 @@ namespace Resource
{
ResourceManager::updateCache(referenceTime);
mInstanceCache->removeUnreferencedObjectsInCache();
mSharedStateMutex.lock();
mSharedStateManager->prune();
mSharedStateMutex.unlock();
@ -866,7 +839,6 @@ namespace Resource
std::lock_guard<std::mutex> lock(mSharedStateMutex);
mSharedStateManager->clearCache();
mInstanceCache->clear();
}
void SceneManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const
@ -884,7 +856,6 @@ namespace Resource
}
stats->setAttribute(frameNumber, "Node", mCache->getCacheSize());
stats->setAttribute(frameNumber, "Node Instance", mInstanceCache->getCacheSize());
}
Shader::ShaderVisitor *SceneManager::createShaderVisitor(const std::string& shaderPrefix, bool translucentFramebuffer)

@ -65,8 +65,6 @@ namespace Resource
std::vector<osg::ref_ptr<const Object>> mObjects;
};
class MultiObjectCache;
/// @brief Handles loading and caching of scenes, e.g. .nif files or .osg files
/// @note Some methods of the scene manager can be used from any thread, see the methods documentation for more details.
class SceneManager : public ResourceManager
@ -129,12 +127,6 @@ namespace Resource
/// @note Thread safe.
osg::ref_ptr<const osg::Node> getTemplate(const std::string& name, bool compile=true);
/// Create an instance of the given scene template and cache it for later use, so that future calls to getInstance() can simply
/// return this cached object instead of creating a new one.
/// @note The returned ref_ptr may be kept around by the caller to ensure that the object stays in cache for as long as needed.
/// @note Thread safe.
osg::ref_ptr<osg::Node> cacheInstance(const std::string& name);
osg::ref_ptr<osg::Node> createInstance(const std::string& name);
osg::ref_ptr<osg::Node> createInstance(const osg::Node* base);
@ -207,8 +199,6 @@ namespace Resource
bool mConvertAlphaTestToAlphaToCoverage;
GLenum mDepthFormat;
osg::ref_ptr<MultiObjectCache> mInstanceCache;
osg::ref_ptr<Resource::SharedStateManager> mSharedStateManager;
mutable std::mutex mSharedStateMutex;

@ -376,7 +376,6 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase *viewer)
"Texture",
"StateSet",
"Node",
"Node Instance",
"Shape",
"Shape Instance",
"Image",

Loading…
Cancel
Save