|
|
|
@ -24,6 +24,11 @@ namespace osgUtil
|
|
|
|
|
class IncrementalCompileOperation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace osgDB
|
|
|
|
|
{
|
|
|
|
|
class ObjectCache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace osgViewer
|
|
|
|
|
{
|
|
|
|
|
class Viewer;
|
|
|
|
@ -32,7 +37,8 @@ namespace osgViewer
|
|
|
|
|
namespace Resource
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/// @brief Handles loading and caching of scenes, e.g. NIF 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.
|
|
|
|
|
class SceneManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
@ -42,20 +48,24 @@ namespace Resource
|
|
|
|
|
/// 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.
|
|
|
|
|
/// @note Thread safe.
|
|
|
|
|
osg::ref_ptr<const osg::Node> getTemplate(const std::string& name);
|
|
|
|
|
|
|
|
|
|
/// Create an instance of the given scene template
|
|
|
|
|
/// @see getTemplate
|
|
|
|
|
/// @note Thread safe.
|
|
|
|
|
osg::ref_ptr<osg::Node> createInstance(const std::string& name);
|
|
|
|
|
|
|
|
|
|
/// Create an instance of the given scene template and immediately attach it to a parent node
|
|
|
|
|
/// @see getTemplate
|
|
|
|
|
/// @note Not thread safe, unless parentNode is not part of the main scene graph yet.
|
|
|
|
|
osg::ref_ptr<osg::Node> createInstance(const std::string& name, osg::Group* parentNode);
|
|
|
|
|
|
|
|
|
|
/// 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 \a instance get transformed correctly.
|
|
|
|
|
/// @note Assumes the given instance was not attached to any parents before.
|
|
|
|
|
/// @note Not thread safe, unless parentNode is not part of the main scene graph yet.
|
|
|
|
|
void attachTo(osg::Node* instance, osg::Group* parentNode) const;
|
|
|
|
|
|
|
|
|
|
/// Manually release created OpenGL objects for the given graphics context. This may be required
|
|
|
|
@ -75,11 +85,12 @@ namespace Resource
|
|
|
|
|
/// @param mask The node mask to apply to loaded particle system nodes.
|
|
|
|
|
void setParticleSystemMask(unsigned int mask);
|
|
|
|
|
|
|
|
|
|
/// @param viewer used to apply the new filter settings to the existing scene graph. If there is no scene yet, you can pass a NULL viewer.
|
|
|
|
|
void setFilterSettings(const std::string &magfilter, const std::string &minfilter,
|
|
|
|
|
const std::string &mipmap, int maxAnisotropy,
|
|
|
|
|
osgViewer::Viewer *viewer);
|
|
|
|
|
|
|
|
|
|
/// Apply filter settings to the given texture. Note, when loading an object through this scene manager (i.e. calling getTemplate / createInstance)
|
|
|
|
|
/// 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 applyFilterSettings (osg::Texture* tex);
|
|
|
|
|
|
|
|
|
@ -101,16 +112,10 @@ namespace Resource
|
|
|
|
|
|
|
|
|
|
unsigned int mParticleSystemMask;
|
|
|
|
|
|
|
|
|
|
// observer_ptr?
|
|
|
|
|
typedef std::map<std::string, osg::ref_ptr<osg::Node> > Index;
|
|
|
|
|
Index mIndex;
|
|
|
|
|
osg::ref_ptr<osgDB::ObjectCache> mCache;
|
|
|
|
|
|
|
|
|
|
SceneManager(const SceneManager&);
|
|
|
|
|
void operator = (const SceneManager&);
|
|
|
|
|
|
|
|
|
|
/// @warning It is unsafe to call this function when a draw thread is using the textures. Call stopThreading() first!
|
|
|
|
|
void setFilterSettings(osg::Texture::FilterMode minFilter, osg::Texture::FilterMode maxFilter, int maxAnisotropy);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|