update entities render to use rigs

This commit is contained in:
MihailRis
2024-07-02 15:04:41 +03:00
parent 8e08f79b54
commit 56ef207b7d
4 changed files with 63 additions and 24 deletions
+17 -4
View File
@@ -10,6 +10,7 @@
#include <unordered_map>
class Assets;
class ModelBatch;
namespace model {
struct Model;
@@ -24,6 +25,9 @@ namespace rigging {
Pose(size_t size) : matrices(size) {
matrices.resize(size);
for (size_t i = 0; i < size; i++) {
matrices[i] = glm::mat4(1.0f);
}
}
};
@@ -46,6 +50,10 @@ namespace rigging {
return modelName;
}
model::Model* getModel() const {
return model;
}
size_t getIndex() const {
return index;
}
@@ -71,12 +79,17 @@ namespace rigging {
size_t index,
Rig& rig,
RigNode* node,
glm::mat4 matrix);
glm::mat4 matrix) const;
public:
RigConfig(std::unique_ptr<RigNode> root);
RigConfig(std::unique_ptr<RigNode> root, size_t nodesCount);
void update(Rig& rig, glm::mat4 matrix);
void setup(const Assets* assets, RigNode* node=nullptr);
void update(Rig& rig, glm::mat4 matrix) const;
void setup(const Assets* assets, RigNode* node=nullptr) const;
void render(
Assets* assets,
ModelBatch& batch,
Rig& rig,
const glm::mat4& matrix) const;
Rig instance() {
return Rig {