2018-07-14 02:48:59 +00:00
|
|
|
#ifndef OPENCS_VIEW_RENDER_ACTOR_H
|
|
|
|
#define OPENCS_VIEW_RENDER_ACTOR_H
|
|
|
|
|
|
|
|
#include <string>
|
2021-09-04 16:07:23 +00:00
|
|
|
#include <string_view>
|
2018-07-14 02:48:59 +00:00
|
|
|
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <osg/Group>
|
2018-07-14 02:48:59 +00:00
|
|
|
#include <osg/ref_ptr>
|
|
|
|
|
2018-08-24 02:40:43 +00:00
|
|
|
#include <QObject>
|
|
|
|
|
2022-01-22 14:58:41 +00:00
|
|
|
#include <components/esm3/loadarmo.hpp>
|
2018-07-28 17:23:43 +00:00
|
|
|
#include <components/sceneutil/visitor.hpp>
|
|
|
|
|
2018-08-26 05:13:50 +00:00
|
|
|
#include "../../model/world/actoradapter.hpp"
|
|
|
|
|
2018-07-14 02:48:59 +00:00
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class Data;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace SceneUtil
|
|
|
|
{
|
|
|
|
class Skeleton;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace CSVRender
|
|
|
|
{
|
|
|
|
/// Handles loading an npc or creature
|
2018-08-24 02:40:43 +00:00
|
|
|
class Actor : public QObject
|
2018-07-14 02:48:59 +00:00
|
|
|
{
|
2018-08-24 02:40:43 +00:00
|
|
|
Q_OBJECT
|
2018-07-14 02:48:59 +00:00
|
|
|
public:
|
|
|
|
/// Creates an actor.
|
|
|
|
/// \param id The referenceable id
|
|
|
|
/// \param type The record type
|
|
|
|
/// \param data The data store
|
2018-09-08 06:06:48 +00:00
|
|
|
Actor(const std::string& id, CSMWorld::Data& data);
|
2018-07-14 02:48:59 +00:00
|
|
|
|
|
|
|
/// Retrieves the base node that meshes are attached to
|
|
|
|
osg::Group* getBaseNode();
|
|
|
|
|
|
|
|
/// (Re)creates the npc or creature renderable
|
|
|
|
void update();
|
|
|
|
|
2018-08-24 02:40:43 +00:00
|
|
|
private slots:
|
|
|
|
void handleActorChanged(const std::string& refId);
|
|
|
|
|
2018-07-14 02:48:59 +00:00
|
|
|
private:
|
2018-07-28 17:23:43 +00:00
|
|
|
void loadSkeleton(const std::string& model);
|
2018-09-08 06:06:48 +00:00
|
|
|
void loadBodyParts();
|
2018-07-28 17:23:43 +00:00
|
|
|
void attachBodyPart(ESM::PartReferenceType, const std::string& mesh);
|
|
|
|
|
2021-09-04 16:07:23 +00:00
|
|
|
std::string getBodyPartMesh(std::string_view bodyPartId);
|
2018-07-22 20:38:30 +00:00
|
|
|
|
|
|
|
static const std::string MeshPrefix;
|
|
|
|
|
2018-07-14 02:48:59 +00:00
|
|
|
std::string mId;
|
|
|
|
CSMWorld::Data& mData;
|
2018-08-26 05:13:50 +00:00
|
|
|
CSMWorld::ActorAdapter::ActorDataPtr mActorData;
|
2018-07-14 02:48:59 +00:00
|
|
|
|
|
|
|
osg::ref_ptr<osg::Group> mBaseNode;
|
2018-07-28 17:23:43 +00:00
|
|
|
SceneUtil::Skeleton* mSkeleton;
|
|
|
|
SceneUtil::NodeMapVisitor::NodeMap mNodeMap;
|
2018-07-14 02:48:59 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|