Handles loading and caching of scenes, e.g. .nif files or .osg files.
More...
#include <scenemanager.hpp>
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.
Resource::SceneManager::~SceneManager |
( |
| ) |
|
Resource::SceneManager::SceneManager |
( |
const 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
- Note
- You should have the parentNode in its intended position before calling this method, so that world space particles of the instance get transformed correctly.
-
Assumes the given instance was not attached to any parents before.
-
Not thread safe, unless parentNode is not part of the main scene graph yet.
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.
- 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.
-
Thread safe.
osg::ref_ptr< osg::Node > Resource::SceneManager::createInstance |
( |
const std::string & |
name | ) |
|
|
private |
bool Resource::SceneManager::getClampLighting |
( |
| ) |
const |
bool Resource::SceneManager::getForcePerPixelLighting |
( |
| ) |
const |
bool Resource::SceneManager::getForceShaders |
( |
| ) |
const |
osg::ref_ptr< osg::Node > Resource::SceneManager::getInstance |
( |
const std::string & |
name | ) |
|
Get an instance of the given scene template
- See Also
- getTemplate
- Note
- Thread safe.
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
- See Also
- getTemplate
- Note
- Not thread safe, unless parentNode is not part of the main scene graph yet.
osg::ref_ptr< const osg::Node > Resource::SceneManager::getTemplate |
( |
const std::string & |
name | ) |
|
Get a read-only copy of this scene "template"
- Note
- If the given filename does not exist or fails to load, an error marker mesh will be used instead. If even the error marker mesh can not be found, an exception is thrown.
-
Thread safe.
void Resource::SceneManager::notifyAttached |
( |
osg::Node * |
node | ) |
const |
- Note
- SceneManager::attachTo calls this method automatically, only needs to be called by users if manually attaching
void Resource::SceneManager::operator= |
( |
const SceneManager & |
| ) |
|
|
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.
void Resource::SceneManager::releaseGLObjects |
( |
osg::State * |
state | ) |
|
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.
void Resource::SceneManager::setAutoUseNormalMaps |
( |
bool |
use | ) |
|
- See Also
- ShaderVisitor::setAutoUseNormalMaps
void Resource::SceneManager::setAutoUseSpecularMaps |
( |
bool |
use | ) |
|
void Resource::SceneManager::setClampLighting |
( |
bool |
clamp | ) |
|
- See Also
- ShaderVisitor::setClampLighting
void Resource::SceneManager::setFilterSettings |
( |
const std::string & |
magfilter, |
|
|
const std::string & |
minfilter, |
|
|
const std::string & |
mipmap, |
|
|
int |
maxAnisotropy |
|
) |
| |
- Warning
- It is unsafe to call this method while the draw thread is using textures! call Viewer::stopThreading first.
void Resource::SceneManager::setForcePerPixelLighting |
( |
bool |
force | ) |
|
- See Also
- ShaderVisitor::setForcePerPixelLighting
void Resource::SceneManager::setForceShaders |
( |
bool |
force | ) |
|
- See Also
- ShaderVisitor::setForceShaders
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 | ) |
|
- See Also
- ShaderVisitor::setNormalHeightMapPattern
void Resource::SceneManager::setNormalMapPattern |
( |
const std::string & |
pattern | ) |
|
- See Also
- ShaderVisitor::setNormalMapPattern
void Resource::SceneManager::setParticleSystemMask |
( |
unsigned int |
mask | ) |
|
- Parameters
-
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.
void Resource::SceneManager::updateCache |
( |
double |
referenceTime | ) |
|
|
virtual |
bool Resource::SceneManager::mAutoUseNormalMaps |
|
private |
bool Resource::SceneManager::mAutoUseSpecularMaps |
|
private |
bool Resource::SceneManager::mClampLighting |
|
private |
bool Resource::SceneManager::mForcePerPixelLighting |
|
private |
bool Resource::SceneManager::mForceShaders |
|
private |
osg::ref_ptr<osgUtil::IncrementalCompileOperation> Resource::SceneManager::mIncrementalCompileOperation |
|
private |
osg::Texture::FilterMode Resource::SceneManager::mMagFilter |
|
private |
int Resource::SceneManager::mMaxAnisotropy |
|
private |
osg::Texture::FilterMode Resource::SceneManager::mMinFilter |
|
private |
std::string Resource::SceneManager::mNormalHeightMapPattern |
|
private |
std::string Resource::SceneManager::mNormalMapPattern |
|
private |
unsigned int Resource::SceneManager::mParticleSystemMask |
|
private |
OpenThreads::Mutex Resource::SceneManager::mSharedStateMutex |
|
private |
std::string Resource::SceneManager::mSpecularMapPattern |
|
private |
bool Resource::SceneManager::mUnRefImageDataAfterApply |
|
private |
The documentation for this class was generated from the following files: