remove bone::addBone

This commit is contained in:
MihailRis 2026-01-15 23:17:47 +03:00
parent 6760d16052
commit 587c140a6b
4 changed files with 23 additions and 23 deletions

View file

@ -333,7 +333,7 @@ static void debug_render_skeleton(
const rigging::Skeleton& skeleton
) {
size_t pindex = bone->getIndex();
for (auto& sub : bone->getSubnodes()) {
for (auto& sub : bone->getBones()) {
size_t sindex = sub->getIndex();
const auto& matrices = skeleton.calculated.matrices;
batch.line(

View file

@ -32,11 +32,6 @@ Bone::Bone(
model({model, nullptr, true}) {
}
Bone& Bone::addBone(Bone&& bone) {
bones.push_back(std::make_unique<Bone>(std::move(bone)));
return *bones[bones.size() - 1];
}
void Bone::setModel(const std::string& name) {
if (model.name == name) {
return;
@ -93,7 +88,7 @@ void Skeleton::deserialize(const dv::value& root) {
static void get_all_nodes(std::vector<Bone*>& nodes, Bone* node) {
nodes[node->getIndex()] = node;
for (auto& subnode : node->getSubnodes()) {
for (auto& subnode : node->getBones()) {
get_all_nodes(nodes, subnode.get());
}
}
@ -116,7 +111,7 @@ size_t SkeletonConfig::update(
}
skeleton.calculated.matrices[index] = matrix * baseMatrix * boneMatrix;
size_t count = 1;
for (auto& subnode : node->getSubnodes()) {
for (auto& subnode : node->getBones()) {
count += update(
index + count,
skeleton,
@ -192,7 +187,7 @@ void SkeletonConfig::render(
}
}
Bone* SkeletonConfig::find(std::string_view str) const {
const Bone* SkeletonConfig::find(std::string_view str) const {
for (size_t i = 0; i < nodes.size(); i++) {
auto* node = nodes[i];
if (node->getName() == str) {

View file

@ -54,8 +54,6 @@ namespace rigging {
const glm::vec3& offset
);
Bone& addBone(Bone&& bone);
void setModel(const std::string& name);
const std::string& getName() const {
@ -70,7 +68,7 @@ namespace rigging {
return offset;
}
const auto& getSubnodes() const {
const auto& getBones() const {
return bones;
}
};
@ -140,7 +138,7 @@ namespace rigging {
return Skeleton(this);
}
Bone* find(std::string_view str) const;
const Bone* find(std::string_view str) const;
static std::unique_ptr<SkeletonConfig> parse(
std::string_view src, std::string_view file, std::string_view name