2015-02-23 21:06:10 +01:00
# ifndef OPENMW_COMPONENTS_NIFOSG_LOADER
# define OPENMW_COMPONENTS_NIFOSG_LOADER
# include <components/nif/niffile.hpp>
2015-03-23 16:17:40 +01:00
# include <osg/ref_ptr>
2015-04-02 17:34:44 +02:00
# include <osg/Referenced>
# include "controller.hpp"
2020-05-21 15:24:06 +02:00
# include "textkeymap.hpp"
2015-03-23 16:17:40 +01:00
2015-02-23 21:06:10 +01:00
namespace osg
{
2015-03-23 01:57:03 +01:00
class Node ;
2015-02-23 21:06:10 +01:00
}
2015-03-28 02:20:20 +01:00
namespace Resource
{
2016-02-05 23:03:53 +01:00
class ImageManager ;
2015-03-28 02:20:20 +01:00
}
2015-02-23 21:06:10 +01:00
namespace NifOsg
{
2015-04-02 17:34:44 +02: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 18:52:06 +01:00
class KeyframeHolder : public osg : : Object
2015-04-02 17:34:44 +02:00
{
public :
2015-12-12 18:52:06 +01:00
KeyframeHolder ( ) { }
KeyframeHolder ( const KeyframeHolder & copy , const osg : : CopyOp & copyop )
: mTextKeys ( copy . mTextKeys )
, mKeyframeControllers ( copy . mKeyframeControllers )
{
}
2015-04-02 17:34:44 +02:00
TextKeyMap mTextKeys ;
2015-12-12 18:52:06 +01:00
META_Object ( OpenMW , KeyframeHolder )
2015-04-23 20:41:31 +02:00
typedef std : : map < std : : string , osg : : ref_ptr < const KeyframeController > > KeyframeControllerMap ;
KeyframeControllerMap mKeyframeControllers ;
2015-04-02 17:34:44 +02:00
} ;
2015-02-23 21:06:10 +01:00
/// The main class responsible for loading NIF files into an OSG-Scenegraph.
2015-03-23 17:49:06 +01: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 21:06:10 +01:00
class Loader
{
public :
2015-04-22 19:16:49 +02: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 23:10:27 +01:00
static osg : : ref_ptr < osg : : Node > load ( Nif : : NIFFilePtr file , Resource : : ImageManager * imageManager ) ;
2015-03-23 01:31:16 +01:00
2015-04-02 17:34:44 +02:00
/// Load keyframe controllers from the given kf file.
static void loadKf ( Nif : : NIFFilePtr kf , KeyframeHolder & target ) ;
2015-02-23 21:06:10 +01:00
2015-03-23 01:57:03 +01:00
/// Set whether or not nodes marked as "MRK" should be shown.
2015-06-05 02:06:13 +02:00
/// These should be hidden ingame, but visible in the editor.
2015-03-23 01:57:03 +01:00
/// Default: false.
static void setShowMarkers ( bool show ) ;
2015-04-02 17:34:44 +02:00
static bool getShowMarkers ( ) ;
2015-02-23 21:06:10 +01:00
2020-04-22 13:34:19 +02: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 21:06:10 +01:00
2020-04-29 16:20:03 +03:00
// Set the mask to use for nodes that ignore the crosshair intersection. The default is the default node mask.
// This is used for NiCollisionSwitch nodes with NiCollisionSwitch state set to disabled.
static void setIntersectionDisabledNodeMask ( unsigned int mask ) ;
static unsigned int getIntersectionDisabledNodeMask ( ) ;
2020-04-22 13:34:19 +02:00
private :
static unsigned int sHiddenNodeMask ;
2020-04-29 16:20:03 +03:00
static unsigned int sIntersectionDisabledNodeMask ;
2015-03-23 01:57:03 +01:00
static bool sShowMarkers ;
2015-02-23 21:06:10 +01:00
} ;
}
# endif