mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
loading rig pose, textures, body settings
This commit is contained in:
parent
a68be271c6
commit
d8c9fa1fe2
11 changed files with 96 additions and 17 deletions
|
|
@ -202,10 +202,10 @@ Map_sptr Map::map(const std::string& key) const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
List* Map::list(const std::string& key) const {
|
||||
List_sptr Map::list(const std::string& key) const {
|
||||
auto found = values.find(key);
|
||||
if (found != values.end())
|
||||
return std::get<List_sptr>(found->second).get();
|
||||
return std::get<List_sptr>(found->second);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace dynamic {
|
|||
void num(const std::string& key, ubyte& dst) const;
|
||||
void num(const std::string& key, double& dst) const;
|
||||
Map_sptr map(const std::string& key) const;
|
||||
List* list(const std::string& key) const;
|
||||
List_sptr list(const std::string& key) const;
|
||||
void flag(const std::string& key, bool& dst) const;
|
||||
|
||||
Map& put(std::string key, std::unique_ptr<Map> value) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,37 @@ namespace dynamic {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<int n>
|
||||
void get_vec(const dynamic::List_sptr& root, size_t index, glm::vec<n, float>& vec) {
|
||||
if (const auto& list = root->list(index)) {
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
vec[i] = list->num(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<int n, int m>
|
||||
void get_mat(const dynamic::Map_sptr& root, const std::string& name, glm::mat<n, m, float>& mat) {
|
||||
if (const auto& list = root->list(name)) {
|
||||
for (size_t y = 0; y < n; y++) {
|
||||
for (size_t x = 0; x < m; x++) {
|
||||
mat[y][x] = list->num(y*m+x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<int n, int m>
|
||||
void get_mat(const dynamic::List_sptr& root, size_t index, glm::mat<n, m, float>& mat) {
|
||||
if (const auto& list = root->list(index)) {
|
||||
for (size_t y = 0; y < n; y++) {
|
||||
for (size_t x = 0; x < m; x++) {
|
||||
mat[y][x] = list->num(y*m+x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DATA_DYNAMIC_UTIL_HPP_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue