2015-02-23 20:06:10 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_NIFOSG_LOADER
|
|
|
|
#define OPENMW_COMPONENTS_NIFOSG_LOADER
|
|
|
|
|
|
|
|
#include <components/nif/niffile.hpp>
|
|
|
|
|
|
|
|
#include <components/nifcache/nifcache.hpp> // NIFFilePtr
|
|
|
|
|
2015-03-23 15:17:40 +00:00
|
|
|
#include <osg/ref_ptr>
|
|
|
|
|
2015-02-23 20:06:10 +00:00
|
|
|
namespace osg
|
|
|
|
{
|
2015-03-23 00:57:03 +00:00
|
|
|
class Node;
|
2015-02-23 20:06:10 +00:00
|
|
|
}
|
|
|
|
|
2015-03-28 01:20:20 +00:00
|
|
|
namespace Resource
|
|
|
|
{
|
|
|
|
class TextureManager;
|
|
|
|
}
|
|
|
|
|
2015-02-23 20:06:10 +00:00
|
|
|
namespace NifOsg
|
|
|
|
{
|
2015-03-23 00:31:16 +00:00
|
|
|
typedef std::multimap<float,std::string> TextKeyMap;
|
|
|
|
|
2015-02-23 20:06:10 +00:00
|
|
|
/// The main class responsible for loading NIF files into an OSG-Scenegraph.
|
2015-03-23 16:49:06 +00:00
|
|
|
/// @par This scene graph is self-contained and can be cloned using osg::clone if desired. Particle emitters
|
|
|
|
/// and programs hold a pointer to their ParticleSystem, which would need to be manually updated when cloning.
|
2015-02-23 20:06:10 +00:00
|
|
|
class Loader
|
|
|
|
{
|
|
|
|
public:
|
2015-03-25 14:39:41 +00:00
|
|
|
/// Create a scene graph for the given NIF. Auto-detects when skinning is used and calls loadAsSkeleton instead.
|
2015-03-23 00:31:16 +00:00
|
|
|
/// @param node The parent of the new root node for the created scene graph.
|
2015-03-23 15:17:40 +00:00
|
|
|
osg::ref_ptr<osg::Node> load(Nif::NIFFilePtr file, TextKeyMap* textKeys = NULL);
|
2015-03-23 00:31:16 +00:00
|
|
|
|
2015-03-25 14:39:41 +00:00
|
|
|
/// Create a scene graph for the given NIF. Always creates a skeleton so that rigs can be attached on the created scene.
|
2015-03-23 15:17:40 +00:00
|
|
|
osg::ref_ptr<osg::Node> loadAsSkeleton(Nif::NIFFilePtr file, TextKeyMap* textKeys = NULL);
|
2015-02-23 20:06:10 +00:00
|
|
|
|
2015-03-23 00:31:16 +00:00
|
|
|
/// Load keyframe controllers from the given kf file onto the given scene graph.
|
|
|
|
/// @param sourceIndex The source index for this animation source, used for identifying
|
|
|
|
/// which animation source a keyframe controller came from.
|
2015-03-23 00:51:44 +00:00
|
|
|
void loadKf(Nif::NIFFilePtr kf, osg::Node* rootNode, int sourceIndex, TextKeyMap &textKeys);
|
2015-02-23 20:06:10 +00:00
|
|
|
|
2015-03-23 00:57:03 +00:00
|
|
|
/// Set whether or not nodes marked as "MRK" should be shown.
|
|
|
|
/// These should be hidden ingame, but visible in the editior.
|
|
|
|
/// Default: false.
|
|
|
|
static void setShowMarkers(bool show);
|
|
|
|
|
2015-03-28 01:20:20 +00:00
|
|
|
Resource::TextureManager* mTextureManager;
|
2015-02-23 20:06:10 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2015-03-23 00:57:03 +00:00
|
|
|
static bool sShowMarkers;
|
2015-02-23 20:06:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|