You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/components/nifosg/nifloader.hpp

85 lines
2.2 KiB
C++

#ifndef OPENMW_COMPONENTS_NIFOSG_LOADER
#define OPENMW_COMPONENTS_NIFOSG_LOADER
#include <components/nif/niffile.hpp>
#include <osg/ref_ptr>
#include <osg/Referenced>
#include "controller.hpp"
namespace osg
{
class Node;
}
namespace Resource
{
class ImageManager;
}
namespace NifOsg
{
10 years ago
typedef std::multimap<float,std::string> TextKeyMap;
struct TextKeyMapHolder : public osg::Object
{
public:
TextKeyMapHolder() {}
TextKeyMapHolder(const TextKeyMapHolder& copy, const osg::CopyOp& copyop)
: osg::Object(copy, copyop)
, mTextKeys(copy.mTextKeys)
{}
TextKeyMap mTextKeys;
META_Object(NifOsg, TextKeyMapHolder)
};
class KeyframeHolder : public osg::Object
{
public:
KeyframeHolder() {}
KeyframeHolder(const KeyframeHolder& copy, const osg::CopyOp& copyop)
: mTextKeys(copy.mTextKeys)
, mKeyframeControllers(copy.mKeyframeControllers)
{
}
TextKeyMap mTextKeys;
META_Object(OpenMW, KeyframeHolder)
typedef std::map<std::string, osg::ref_ptr<const KeyframeController> > KeyframeControllerMap;
KeyframeControllerMap mKeyframeControllers;
};
/// The main class responsible for loading NIF files into an OSG-Scenegraph.
10 years ago
/// @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.
class Loader
{
public:
/// Create a scene graph for the given NIF. Auto-detects when skinning is used and wraps the graph in a Skeleton if so.
static osg::ref_ptr<osg::Node> load(Nif::NIFFilePtr file, Resource::ImageManager* imageManager);
10 years ago
/// Load keyframe controllers from the given kf file.
static void loadKf(Nif::NIFFilePtr kf, KeyframeHolder& target);
/// Set whether or not nodes marked as "MRK" should be shown.
10 years ago
/// These should be hidden ingame, but visible in the editor.
/// Default: false.
static void setShowMarkers(bool show);
static bool getShowMarkers();
private:
static bool sShowMarkers;
};
}
#endif