mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-29 04:06:40 +00:00
removes unused code (#3129)
* scenemanager.cpp * scenemanager.hpp * scenemanager.cpp * stats.cpp * renderingmanager.cpp
This commit is contained in:
parent
d854e247b8
commit
5fde6867a2
4 changed files with 2 additions and 42 deletions
|
@ -262,7 +262,7 @@ namespace MWRender
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (std::vector<std::string>::const_iterator it = mModels.begin(); it != mModels.end(); ++it)
|
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)
|
for (std::vector<std::string>::const_iterator it = mTextures.begin(); it != mTextures.end(); ++it)
|
||||||
mResourceSystem->getImageManager()->getImage(*it);
|
mResourceSystem->getImageManager()->getImage(*it);
|
||||||
for (std::vector<std::string>::const_iterator it = mKeyframes.begin(); it != mKeyframes.end(); ++it)
|
for (std::vector<std::string>::const_iterator it = mKeyframes.begin(); it != mKeyframes.end(); ++it)
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "imagemanager.hpp"
|
#include "imagemanager.hpp"
|
||||||
#include "niffilemanager.hpp"
|
#include "niffilemanager.hpp"
|
||||||
#include "objectcache.hpp"
|
#include "objectcache.hpp"
|
||||||
#include "multiobjectcache.hpp"
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -306,7 +305,6 @@ namespace Resource
|
||||||
, mLightingMethod(SceneUtil::LightingMethod::FFP)
|
, mLightingMethod(SceneUtil::LightingMethod::FFP)
|
||||||
, mConvertAlphaTestToAlphaToCoverage(false)
|
, mConvertAlphaTestToAlphaToCoverage(false)
|
||||||
, mDepthFormat(0)
|
, mDepthFormat(0)
|
||||||
, mInstanceCache(new MultiObjectCache)
|
|
||||||
, mSharedStateManager(new SharedStateManager)
|
, mSharedStateManager(new SharedStateManager)
|
||||||
, mImageManager(imageManager)
|
, mImageManager(imageManager)
|
||||||
, mNifFileManager(nifFileManager)
|
, 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<osg::Node> SceneManager::createInstance(const std::string& name)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<const osg::Node> scene = getTemplate(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)
|
osg::ref_ptr<osg::Node> SceneManager::getInstance(const std::string &name)
|
||||||
{
|
{
|
||||||
const std::string normalized = mVFS->normalizeFilename(name);
|
return createInstance(name);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Object> obj = mInstanceCache->takeFromObjectCache(normalized);
|
|
||||||
if (obj.get())
|
|
||||||
return static_cast<osg::Node*>(obj.get());
|
|
||||||
|
|
||||||
return createInstance(normalized);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> SceneManager::getInstance(const std::string &name, osg::Group* parentNode)
|
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)
|
void SceneManager::releaseGLObjects(osg::State *state)
|
||||||
{
|
{
|
||||||
mCache->releaseGLObjects(state);
|
mCache->releaseGLObjects(state);
|
||||||
mInstanceCache->releaseGLObjects(state);
|
|
||||||
|
|
||||||
mShaderManager->releaseGLObjects(state);
|
mShaderManager->releaseGLObjects(state);
|
||||||
|
|
||||||
|
@ -835,8 +810,6 @@ namespace Resource
|
||||||
{
|
{
|
||||||
ResourceManager::updateCache(referenceTime);
|
ResourceManager::updateCache(referenceTime);
|
||||||
|
|
||||||
mInstanceCache->removeUnreferencedObjectsInCache();
|
|
||||||
|
|
||||||
mSharedStateMutex.lock();
|
mSharedStateMutex.lock();
|
||||||
mSharedStateManager->prune();
|
mSharedStateManager->prune();
|
||||||
mSharedStateMutex.unlock();
|
mSharedStateMutex.unlock();
|
||||||
|
@ -866,7 +839,6 @@ namespace Resource
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(mSharedStateMutex);
|
std::lock_guard<std::mutex> lock(mSharedStateMutex);
|
||||||
mSharedStateManager->clearCache();
|
mSharedStateManager->clearCache();
|
||||||
mInstanceCache->clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const
|
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", mCache->getCacheSize());
|
||||||
stats->setAttribute(frameNumber, "Node Instance", mInstanceCache->getCacheSize());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Shader::ShaderVisitor *SceneManager::createShaderVisitor(const std::string& shaderPrefix, bool translucentFramebuffer)
|
Shader::ShaderVisitor *SceneManager::createShaderVisitor(const std::string& shaderPrefix, bool translucentFramebuffer)
|
||||||
|
|
|
@ -65,8 +65,6 @@ namespace Resource
|
||||||
std::vector<osg::ref_ptr<const Object>> mObjects;
|
std::vector<osg::ref_ptr<const Object>> mObjects;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MultiObjectCache;
|
|
||||||
|
|
||||||
/// @brief Handles loading and caching of scenes, e.g. .nif files or .osg files
|
/// @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.
|
/// @note Some methods of the scene manager can be used from any thread, see the methods documentation for more details.
|
||||||
class SceneManager : public ResourceManager
|
class SceneManager : public ResourceManager
|
||||||
|
@ -129,12 +127,6 @@ namespace Resource
|
||||||
/// @note Thread safe.
|
/// @note Thread safe.
|
||||||
osg::ref_ptr<const osg::Node> getTemplate(const std::string& name, bool compile=true);
|
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 std::string& name);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> createInstance(const osg::Node* base);
|
osg::ref_ptr<osg::Node> createInstance(const osg::Node* base);
|
||||||
|
@ -207,8 +199,6 @@ namespace Resource
|
||||||
bool mConvertAlphaTestToAlphaToCoverage;
|
bool mConvertAlphaTestToAlphaToCoverage;
|
||||||
GLenum mDepthFormat;
|
GLenum mDepthFormat;
|
||||||
|
|
||||||
osg::ref_ptr<MultiObjectCache> mInstanceCache;
|
|
||||||
|
|
||||||
osg::ref_ptr<Resource::SharedStateManager> mSharedStateManager;
|
osg::ref_ptr<Resource::SharedStateManager> mSharedStateManager;
|
||||||
mutable std::mutex mSharedStateMutex;
|
mutable std::mutex mSharedStateMutex;
|
||||||
|
|
||||||
|
|
|
@ -376,7 +376,6 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase *viewer)
|
||||||
"Texture",
|
"Texture",
|
||||||
"StateSet",
|
"StateSet",
|
||||||
"Node",
|
"Node",
|
||||||
"Node Instance",
|
|
||||||
"Shape",
|
"Shape",
|
||||||
"Shape Instance",
|
"Shape Instance",
|
||||||
"Image",
|
"Image",
|
||||||
|
|
Loading…
Reference in a new issue