mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add modeltree:get_matrix, :set_matrix
This commit is contained in:
parent
8a10ed24da
commit
42ea88501d
7 changed files with 53 additions and 18 deletions
|
|
@ -78,9 +78,9 @@ entityid_t Entities::spawn(
|
|||
auto& scripting = registry.emplace<Scripting>(
|
||||
entity, entity_funcs_set {}, nullptr);
|
||||
entities[id] = entity;
|
||||
registry.emplace<rigging::Rig>(entity, rig->instance());
|
||||
scripting.env = scripting::on_entity_spawn(
|
||||
def, id, scripting.funcsset, std::move(args));
|
||||
registry.emplace<rigging::Rig>(entity, rig->instance());
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,10 +42,11 @@ size_t RigConfig::update(
|
|||
glm::mat4 matrix) const
|
||||
{
|
||||
rig.calculated.matrices[index] = matrix * rig.pose.matrices[index];
|
||||
size_t count = 1;
|
||||
for (auto& subnode : node->getSubnodes()) {
|
||||
index = update(index+1, rig, subnode.get(), rig.calculated.matrices[index]);
|
||||
count += update(index+count, rig, subnode.get(), rig.calculated.matrices[index]);
|
||||
}
|
||||
return index;
|
||||
return count;
|
||||
}
|
||||
|
||||
void RigConfig::update(Rig& rig, glm::mat4 matrix) const {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef OBJECTS_SKELETON_HPP_
|
||||
#define OBJECTS_SKELETON_HPP_
|
||||
#ifndef OBJECTS_RIGGING_HPP_
|
||||
#define OBJECTS_RIGGING_HPP_
|
||||
|
||||
#include "../typedefs.hpp"
|
||||
|
||||
|
|
@ -23,11 +23,8 @@ namespace rigging {
|
|||
struct Pose {
|
||||
std::vector<glm::mat4> matrices;
|
||||
|
||||
Pose(size_t size) : matrices(size) {
|
||||
matrices.resize(size);
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
matrices[i] = glm::mat4(1.0f);
|
||||
}
|
||||
Pose(size_t size) {
|
||||
matrices.resize(size, glm::mat4(1.0f));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -115,4 +112,4 @@ namespace rigging {
|
|||
};
|
||||
};
|
||||
|
||||
#endif // OBJECTS_SKELETON_HPP_
|
||||
#endif // OBJECTS_RIGGING_HPP_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue