2014-01-05 17:22:29 +00:00
|
|
|
#ifndef GAME_RENDER_OBJECTS_H
|
|
|
|
#define GAME_RENDER_OBJECTS_H
|
2011-11-12 20:58:22 +00:00
|
|
|
|
2015-04-22 17:08:56 +00:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2015-04-12 13:34:50 +00:00
|
|
|
|
|
|
|
#include <osg/ref_ptr>
|
2015-05-24 01:36:34 +00:00
|
|
|
#include <osg/Object>
|
|
|
|
|
|
|
|
#include "../mwworld/ptr.hpp"
|
2015-04-12 13:34:50 +00:00
|
|
|
|
|
|
|
namespace osg
|
|
|
|
{
|
|
|
|
class Group;
|
|
|
|
}
|
2012-02-06 09:29:18 +00:00
|
|
|
|
2015-04-22 17:08:56 +00:00
|
|
|
namespace Resource
|
|
|
|
{
|
|
|
|
class ResourceSystem;
|
|
|
|
}
|
|
|
|
|
2012-07-03 11:55:53 +00:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class CellStore;
|
|
|
|
}
|
2011-11-01 03:59:16 +00:00
|
|
|
|
2016-02-09 14:30:53 +00:00
|
|
|
namespace SceneUtil
|
|
|
|
{
|
|
|
|
class UnrefQueue;
|
|
|
|
}
|
|
|
|
|
2011-11-01 03:59:16 +00:00
|
|
|
namespace MWRender{
|
2011-11-08 04:35:39 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
class Animation;
|
2013-08-07 02:45:07 +00:00
|
|
|
|
2015-05-24 01:36:34 +00:00
|
|
|
class PtrHolder : public osg::Object
|
|
|
|
{
|
|
|
|
public:
|
2017-04-20 11:36:14 +00:00
|
|
|
PtrHolder(const MWWorld::Ptr& ptr)
|
2015-05-24 01:36:34 +00:00
|
|
|
: mPtr(ptr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
PtrHolder()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
PtrHolder(const PtrHolder& copy, const osg::CopyOp& copyop)
|
|
|
|
: mPtr(copy.mPtr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
META_Object(MWRender, PtrHolder)
|
|
|
|
|
|
|
|
MWWorld::Ptr mPtr;
|
|
|
|
};
|
2013-08-07 02:45:07 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
class Objects{
|
2017-02-22 14:22:40 +00:00
|
|
|
typedef std::map<MWWorld::ConstPtr,osg::ref_ptr<Animation> > PtrAnimationMap;
|
2013-08-07 02:45:07 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
typedef std::map<const MWWorld::CellStore*, osg::ref_ptr<osg::Group> > CellMap;
|
|
|
|
CellMap mCellSceneNodes;
|
2013-08-07 02:45:07 +00:00
|
|
|
PtrAnimationMap mObjects;
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
osg::ref_ptr<osg::Group> mRootNode;
|
2013-08-07 02:45:07 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
Resource::ResourceSystem* mResourceSystem;
|
2013-11-19 23:07:26 +00:00
|
|
|
|
2016-02-09 14:30:53 +00:00
|
|
|
osg::ref_ptr<SceneUtil::UnrefQueue> mUnrefQueue;
|
|
|
|
|
|
|
|
void insertBegin(const MWWorld::Ptr& ptr);
|
|
|
|
|
2011-11-01 03:59:16 +00:00
|
|
|
public:
|
2016-02-09 14:30:53 +00:00
|
|
|
Objects(Resource::ResourceSystem* resourceSystem, osg::ref_ptr<osg::Group> rootNode, SceneUtil::UnrefQueue* unrefQueue);
|
2015-04-12 13:34:50 +00:00
|
|
|
~Objects();
|
|
|
|
|
|
|
|
/// @param animated Attempt to load separate keyframes from a .kf file matching the model file?
|
2015-04-14 13:55:56 +00:00
|
|
|
/// @param allowLight If false, no lights will be created, and particles systems will be removed.
|
2015-04-12 13:34:50 +00:00
|
|
|
void insertModel(const MWWorld::Ptr& ptr, const std::string &model, bool animated=false, bool allowLight=true);
|
2011-11-21 11:52:28 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
void insertNPC(const MWWorld::Ptr& ptr);
|
|
|
|
void insertCreature (const MWWorld::Ptr& ptr, const std::string& model, bool weaponsShields);
|
|
|
|
|
|
|
|
Animation* getAnimation(const MWWorld::Ptr &ptr);
|
2015-12-18 16:21:51 +00:00
|
|
|
const Animation* getAnimation(const MWWorld::ConstPtr &ptr) const;
|
2013-11-17 22:15:57 +00:00
|
|
|
|
2015-05-21 22:55:43 +00:00
|
|
|
bool removeObject (const MWWorld::Ptr& ptr);
|
2011-11-21 11:52:28 +00:00
|
|
|
///< \return found?
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
void removeCell(const MWWorld::CellStore* store);
|
2012-07-30 19:28:14 +00:00
|
|
|
|
2012-07-31 12:52:21 +00:00
|
|
|
/// Updates containing cell for object rendering data
|
2015-05-14 15:34:55 +00:00
|
|
|
void updatePtr(const MWWorld::Ptr &old, const MWWorld::Ptr &cur);
|
2015-04-12 13:34:50 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void operator = (const Objects&);
|
|
|
|
Objects(const Objects&);
|
2011-11-01 03:59:16 +00:00
|
|
|
};
|
2011-11-12 20:58:22 +00:00
|
|
|
}
|
2011-11-21 11:52:28 +00:00
|
|
|
#endif
|