mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:17:45 +02:00
fix model not loading in bounding box
This commit is contained in:
parent
c1516df58d
commit
dfb17c922b
1 changed files with 5 additions and 1 deletions
|
@ -739,8 +739,10 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const QUrl& url) {
|
||||||
//Build dependencies
|
//Build dependencies
|
||||||
QVector<QVector<int>> nodeDependencies(_file.nodes.size());
|
QVector<QVector<int>> nodeDependencies(_file.nodes.size());
|
||||||
int nodecount = 0;
|
int nodecount = 0;
|
||||||
|
bool hasChildren = false;
|
||||||
foreach(auto &node, _file.nodes) {
|
foreach(auto &node, _file.nodes) {
|
||||||
//nodes_transforms.push_back(getModelTransform(node));
|
//nodes_transforms.push_back(getModelTransform(node));
|
||||||
|
hasChildren |= !node.children.isEmpty();
|
||||||
foreach(int child, node.children) nodeDependencies[child].push_back(nodecount);
|
foreach(int child, node.children) nodeDependencies[child].push_back(nodecount);
|
||||||
nodecount++;
|
nodecount++;
|
||||||
}
|
}
|
||||||
|
@ -772,8 +774,10 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const QUrl& url) {
|
||||||
hfmModel.jointIndices["x"] = _file.nodes.size();
|
hfmModel.jointIndices["x"] = _file.nodes.size();
|
||||||
int jointInd = 0;
|
int jointInd = 0;
|
||||||
for (auto& node : _file.nodes) {
|
for (auto& node : _file.nodes) {
|
||||||
|
int size = node.transforms.size();
|
||||||
|
if (hasChildren) { size--; }
|
||||||
joint.preTransform = glm::mat4(1);
|
joint.preTransform = glm::mat4(1);
|
||||||
for (int i = 0; i < node.transforms.size(); i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
joint.preTransform = node.transforms[i] * joint.preTransform;
|
joint.preTransform = node.transforms[i] * joint.preTransform;
|
||||||
}
|
}
|
||||||
joint.name = node.name;
|
joint.name = node.name;
|
||||||
|
|
Loading…
Reference in a new issue