OpenMW
|
Handles loading and caching of scenes, e.g. .nif files or .osg files. More...
#include <scenemanager.hpp>
Public Member Functions | |
SceneManager (const VFS::Manager *vfs, Resource::ImageManager *imageManager, Resource::NifFileManager *nifFileManager) | |
~SceneManager () | |
Shader::ShaderManager & | getShaderManager () |
void | recreateShaders (osg::ref_ptr< osg::Node > node) |
Re-create shaders for this node, need to call this if texture stages or vertex color mode have changed. More... | |
void | setForceShaders (bool force) |
bool | getForceShaders () const |
void | setClampLighting (bool clamp) |
bool | getClampLighting () const |
void | setForcePerPixelLighting (bool force) |
bool | getForcePerPixelLighting () const |
void | setAutoUseNormalMaps (bool use) |
void | setNormalMapPattern (const std::string &pattern) |
void | setNormalHeightMapPattern (const std::string &pattern) |
void | setAutoUseSpecularMaps (bool use) |
void | setSpecularMapPattern (const std::string &pattern) |
void | setShaderPath (const std::string &path) |
bool | checkLoaded (const std::string &name, double referenceTime) |
Check if a given scene is loaded and if so, update its usage timestamp to prevent it from being unloaded. More... | |
osg::ref_ptr< const osg::Node > | getTemplate (const std::string &name) |
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) |
osg::ref_ptr< osg::Node > | getInstance (const std::string &name) |
osg::ref_ptr< osg::Node > | getInstance (const std::string &name, osg::Group *parentNode) |
void | attachTo (osg::Node *instance, osg::Group *parentNode) const |
void | releaseGLObjects (osg::State *state) override |
void | setIncrementalCompileOperation (osgUtil::IncrementalCompileOperation *ico) |
Set up an IncrementalCompileOperation for background compiling of loaded scenes. More... | |
osgUtil::IncrementalCompileOperation * | getIncrementalCompileOperation () |
Resource::ImageManager * | getImageManager () |
void | setParticleSystemMask (unsigned int mask) |
void | setFilterSettings (const std::string &magfilter, const std::string &minfilter, const std::string &mipmap, int maxAnisotropy) |
void | applyFilterSettings (osg::Texture *tex) |
void | setUnRefImageDataAfterApply (bool unref) |
void | updateCache (double referenceTime) override |
void | clearCache () override |
Clear all cache entries. More... | |
void | reportStats (unsigned int frameNumber, osg::Stats *stats) const override |
![]() | |
ResourceManager (const VFS::Manager *vfs) | |
virtual | ~ResourceManager () |
void | setExpiryDelay (double expiryDelay) |
How long to keep objects in cache after no longer being referenced. More... | |
const VFS::Manager * | getVFS () const |
Private Member Functions | |
Shader::ShaderVisitor * | createShaderVisitor () |
SceneManager (const SceneManager &) | |
void | operator= (const SceneManager &) |
Private Attributes | |
std::unique_ptr < Shader::ShaderManager > | mShaderManager |
bool | mForceShaders |
bool | mClampLighting |
bool | mForcePerPixelLighting |
bool | mAutoUseNormalMaps |
std::string | mNormalMapPattern |
std::string | mNormalHeightMapPattern |
bool | mAutoUseSpecularMaps |
std::string | mSpecularMapPattern |
osg::ref_ptr< MultiObjectCache > | mInstanceCache |
osg::ref_ptr < Resource::SharedStateManager > | mSharedStateManager |
OpenThreads::Mutex | mSharedStateMutex |
Resource::ImageManager * | mImageManager |
Resource::NifFileManager * | mNifFileManager |
osg::Texture::FilterMode | mMinFilter |
osg::Texture::FilterMode | mMagFilter |
int | mMaxAnisotropy |
bool | mUnRefImageDataAfterApply |
osg::ref_ptr < osgUtil::IncrementalCompileOperation > | mIncrementalCompileOperation |
unsigned int | mParticleSystemMask |
Additional Inherited Members | |
![]() | |
const VFS::Manager * | mVFS |
osg::ref_ptr < Resource::ObjectCache > | mCache |
double | mExpiryDelay |
Handles loading and caching of scenes, e.g. .nif files or .osg files.
Resource::SceneManager::SceneManager | ( | const VFS::Manager * | vfs, |
Resource::ImageManager * | imageManager, | ||
Resource::NifFileManager * | nifFileManager | ||
) |
Resource::SceneManager::~SceneManager | ( | ) |
|
private |
void Resource::SceneManager::applyFilterSettings | ( | osg::Texture * | tex | ) |
Apply filter settings to the given texture. Note, when loading an object through this scene manager (i.e. calling getTemplate or createInstance) the filter settings are applied automatically. This method is provided for textures that were created outside of the SceneManager.
void Resource::SceneManager::attachTo | ( | osg::Node * | instance, |
osg::Group * | parentNode | ||
) | const |
Attach the given scene instance to the given parent node
osg::ref_ptr< osg::Node > Resource::SceneManager::cacheInstance | ( | const std::string & | name | ) |
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.
bool Resource::SceneManager::checkLoaded | ( | const std::string & | name, |
double | referenceTime | ||
) |
Check if a given scene is loaded and if so, update its usage timestamp to prevent it from being unloaded.
|
overridevirtual |
Clear all cache entries.
Reimplemented from Resource::ResourceManager.
osg::ref_ptr< osg::Node > Resource::SceneManager::createInstance | ( | const std::string & | name | ) |
osg::ref_ptr< osg::Node > Resource::SceneManager::createInstance | ( | const osg::Node * | base | ) |
|
private |
bool Resource::SceneManager::getClampLighting | ( | ) | const |
bool Resource::SceneManager::getForcePerPixelLighting | ( | ) | const |
bool Resource::SceneManager::getForceShaders | ( | ) | const |
Resource::ImageManager * Resource::SceneManager::getImageManager | ( | ) |
osgUtil::IncrementalCompileOperation * Resource::SceneManager::getIncrementalCompileOperation | ( | ) |
osg::ref_ptr< osg::Node > Resource::SceneManager::getInstance | ( | const std::string & | name | ) |
Get an instance of the given scene template
osg::ref_ptr< osg::Node > Resource::SceneManager::getInstance | ( | const std::string & | name, |
osg::Group * | parentNode | ||
) |
Get an instance of the given scene template and immediately attach it to a parent node
Shader::ShaderManager & Resource::SceneManager::getShaderManager | ( | ) |
osg::ref_ptr< const osg::Node > Resource::SceneManager::getTemplate | ( | const std::string & | name | ) |
Get a read-only copy of this scene "template"
|
private |
void Resource::SceneManager::recreateShaders | ( | osg::ref_ptr< osg::Node > | node | ) |
Re-create shaders for this node, need to call this if texture stages or vertex color mode have changed.
|
overridevirtual |
Manually release created OpenGL objects for the given graphics context. This may be required in cases where multiple contexts are used over the lifetime of the application.
Reimplemented from Resource::ResourceManager.
|
overridevirtual |
Reimplemented from Resource::ResourceManager.
void Resource::SceneManager::setAutoUseNormalMaps | ( | bool | use | ) |
void Resource::SceneManager::setAutoUseSpecularMaps | ( | bool | use | ) |
void Resource::SceneManager::setClampLighting | ( | bool | clamp | ) |
void Resource::SceneManager::setFilterSettings | ( | const std::string & | magfilter, |
const std::string & | minfilter, | ||
const std::string & | mipmap, | ||
int | maxAnisotropy | ||
) |
void Resource::SceneManager::setForcePerPixelLighting | ( | bool | force | ) |
void Resource::SceneManager::setForceShaders | ( | bool | force | ) |
void Resource::SceneManager::setIncrementalCompileOperation | ( | osgUtil::IncrementalCompileOperation * | ico | ) |
Set up an IncrementalCompileOperation for background compiling of loaded scenes.
void Resource::SceneManager::setNormalHeightMapPattern | ( | const std::string & | pattern | ) |
void Resource::SceneManager::setNormalMapPattern | ( | const std::string & | pattern | ) |
void Resource::SceneManager::setParticleSystemMask | ( | unsigned int | mask | ) |
mask | The node mask to apply to loaded particle system nodes. |
void Resource::SceneManager::setShaderPath | ( | const std::string & | path | ) |
void Resource::SceneManager::setSpecularMapPattern | ( | const std::string & | pattern | ) |
void Resource::SceneManager::setUnRefImageDataAfterApply | ( | bool | unref | ) |
Keep a copy of the texture data around in system memory? This is needed when using multiple graphics contexts, otherwise should be disabled to reduce memory usage.
|
overridevirtual |
Reimplemented from Resource::ResourceManager.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |