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>
|
2024-01-01 18:47:01 +00:00
|
|
|
#include <osg/PositionAttitudeTransform>
|
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
|
2022-10-06 17:39:46 +00:00
|
|
|
Actor(const ESM::RefId& 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:
|
2022-10-06 17:39:46 +00:00
|
|
|
void handleActorChanged(const ESM::RefId& refId);
|
2018-08-24 02:40:43 +00:00
|
|
|
|
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);
|
|
|
|
|
2023-03-03 10:42:30 +00:00
|
|
|
std::string getBodyPartMesh(const ESM::RefId& bodyPartId);
|
2018-07-22 20:38:30 +00:00
|
|
|
|
|
|
|
static const std::string MeshPrefix;
|
|
|
|
|
2022-10-06 17:39:46 +00:00
|
|
|
ESM::RefId mId;
|
2018-07-14 02:48:59 +00:00
|
|
|
CSMWorld::Data& mData;
|
2018-08-26 05:13:50 +00:00
|
|
|
CSMWorld::ActorAdapter::ActorDataPtr mActorData;
|
2018-07-14 02:48:59 +00:00
|
|
|
|
2024-01-01 18:47:01 +00:00
|
|
|
osg::ref_ptr<osg::PositionAttitudeTransform> mBaseNode;
|
2018-07-28 17:23:43 +00:00
|
|
|
SceneUtil::Skeleton* mSkeleton;
|
2024-04-11 02:01:00 +00:00
|
|
|
SceneUtil::NodeMap mNodeMap;
|
2018-07-14 02:48:59 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|