2015-02-23 20:06:10 +00:00
# ifndef OPENMW_COMPONENTS_NIFOSG_LOADER
# define OPENMW_COMPONENTS_NIFOSG_LOADER
# include <components/nif/niffile.hpp>
2015-03-23 15:17:40 +00:00
# include <osg/ref_ptr>
2015-04-02 15:34:44 +00:00
# include <osg/Referenced>
# include "controller.hpp"
2015-03-23 15:17:40 +00:00
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
{
2016-02-05 22:03:53 +00:00
class ImageManager ;
2015-03-28 01:20:20 +00:00
}
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-04-02 15:34:44 +00:00
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 )
} ;
2015-12-12 17:52:06 +00:00
class KeyframeHolder : public osg : : Object
2015-04-02 15:34:44 +00:00
{
public :
2015-12-12 17:52:06 +00:00
KeyframeHolder ( ) { }
KeyframeHolder ( const KeyframeHolder & copy , const osg : : CopyOp & copyop )
: mTextKeys ( copy . mTextKeys )
, mKeyframeControllers ( copy . mKeyframeControllers )
{
}
2015-04-02 15:34:44 +00:00
TextKeyMap mTextKeys ;
2015-12-12 17:52:06 +00:00
META_Object ( OpenMW , KeyframeHolder )
2015-04-23 18:41:31 +00:00
typedef std : : map < std : : string , osg : : ref_ptr < const KeyframeController > > KeyframeControllerMap ;
KeyframeControllerMap mKeyframeControllers ;
2015-04-02 15:34:44 +00:00
} ;
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-04-22 17:16:49 +00:00
/// Create a scene graph for the given NIF. Auto-detects when skinning is used and wraps the graph in a Skeleton if so.
2016-02-05 22:10:27 +00:00
static osg : : ref_ptr < osg : : Node > load ( Nif : : NIFFilePtr file , Resource : : ImageManager * imageManager ) ;
2015-03-23 00:31:16 +00:00
2015-04-02 15:34:44 +00:00
/// Load keyframe controllers from the given kf file.
static void loadKf ( Nif : : NIFFilePtr kf , KeyframeHolder & target ) ;
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.
2015-06-05 00:06:13 +00:00
/// These should be hidden ingame, but visible in the editor.
2015-03-23 00:57:03 +00:00
/// Default: false.
static void setShowMarkers ( bool show ) ;
2015-04-02 15:34:44 +00:00
static bool getShowMarkers ( ) ;
2015-02-23 20:06:10 +00:00
2020-04-22 11:34:19 +00:00
/// Set the mask to use for hidden nodes. The default is 0, i.e. updates to those nodes can no longer happen.
/// If you need to run animations or physics for hidden nodes, you may want to set this to a non-zero mask and remove exactly that mask from the camera's cull mask.
static void setHiddenNodeMask ( unsigned int mask ) ;
static unsigned int getHiddenNodeMask ( ) ;
2015-02-23 20:06:10 +00:00
2020-04-22 11:34:19 +00:00
private :
static unsigned int sHiddenNodeMask ;
2015-03-23 00:57:03 +00:00
static bool sShowMarkers ;
2015-02-23 20:06:10 +00:00
} ;
}
# endif