载入中...
搜索中...
未找到
SkeletonImpl.h
浏览该文件的文档.
1#pragma once
2
8#include "ik/Skeleton2D.h"
9#include "ik/Skeleton3D.h"
10
11#include "ik.hpp"
12
13namespace eve::ik {
14
16 ::ik::skeleton2d sk;
17 ::ik::ecs2d state;
18
19 void ensureSorted() {
20 if (sk.bones().empty()) {
21 sk.topologicalSort();
22 }
23 }
24
27 const unsigned n = static_cast<unsigned>(sk.bones().size());
28 if (state.size() < n) {
29 state.position_.resize(n);
30 state.orientation_.resize(n);
31 state.scale_.resize(n);
32 state.rotation_.resize(n);
33 }
34 }
35
36 ::ik::bone2d *boneAt(int boneId) const {
37 if (boneId < 0) return nullptr;
38 const auto &bones = sk.bones();
39 if (static_cast<size_t>(boneId) >= bones.size()) return nullptr;
40 return bones[static_cast<size_t>(boneId)];
41 }
42};
43
45 ::ik::skeleton3d sk;
46 ::ik::ecs3d state;
47
48 void ensureSorted() {
49 if (sk.bones().empty()) {
50 sk.topologicalSort();
51 }
52 }
53
56 const unsigned n = static_cast<unsigned>(sk.bones().size());
57 if (state.size() < n) {
58 state.position_.resize(n);
59 state.orientation_.resize(n);
60 state.scale_.resize(n);
61 state.rotation_.resize(n);
62 }
63 }
64
65 ::ik::bone3d *boneAt(int boneId) const {
66 if (boneId < 0) return nullptr;
67 const auto &bones = sk.bones();
68 if (static_cast<size_t>(boneId) >= bones.size()) return nullptr;
69 return bones[static_cast<size_t>(boneId)];
70 }
71};
72
73} // namespace eve::ik
glm::vec3 n
Definition Grass.cpp:63
std::vector< Bone > bones
::ik::bone2d * boneAt(int boneId) const
::ik::bone3d * boneAt(int boneId) const