update RigConfig

This commit is contained in:
MihailRis
2024-07-01 05:30:27 +03:00
parent 1b41a75cf4
commit beac332c96
15 changed files with 230 additions and 62 deletions
+34 -1
View File
@@ -9,6 +9,12 @@
#include <glm/glm.hpp>
#include <unordered_map>
class Assets;
namespace model {
struct Model;
}
namespace rigging {
struct Rig;
@@ -19,9 +25,21 @@ namespace rigging {
class RigNode {
size_t index;
std::string name;
std::string modelName;
std::vector<std::unique_ptr<RigNode>> subnodes;
model::Model* model = nullptr;
public:
RigNode(size_t index, std::string name, std::vector<std::unique_ptr<RigNode>> subnodes);
RigNode(
size_t index,
std::string name,
std::string model,
std::vector<std::unique_ptr<RigNode>> subnodes);
void setModel(const Assets* assets, const std::string& name);
const std::string& getModelName() const {
return modelName;
}
size_t getIndex() const {
return index;
@@ -36,13 +54,28 @@ namespace rigging {
std::unique_ptr<RigNode> root;
std::unordered_map<std::string, size_t> indices;
std::vector<RigNode*> nodes;
size_t update(
size_t index,
Rig& rig,
RigNode* node,
glm::mat4 matrix);
public:
RigConfig(std::unique_ptr<RigNode> root);
void update(Rig& rig, glm::mat4 matrix);
void setup(const Assets* assets, RigNode* node=nullptr);
static std::unique_ptr<RigConfig> parse(
std::string_view src,
std::string_view file
);
};
struct Rig {
RigConfig* config;
Pose pose;
Pose calculated;
std::vector<std::string> textures;
};
};