mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
properly handle FSTs that have translations and rotations
This commit is contained in:
parent
899c89eda7
commit
1278470a91
3 changed files with 12 additions and 8 deletions
|
@ -435,8 +435,12 @@ Extents Model::getMeshExtents() const {
|
|||
return Extents();
|
||||
}
|
||||
const Extents& extents = _geometry->getFBXGeometry().meshExtents;
|
||||
glm::vec3 scale = _scale * _geometry->getFBXGeometry().fstScaled;
|
||||
Extents scaledExtents = { extents.minimum * scale, extents.maximum * scale };
|
||||
|
||||
// even though our caller asked for "unscaled" we need to include any fst scaling, translation, and rotation, which
|
||||
// is captured in the offset matrix
|
||||
glm::vec3 minimum = glm::vec3(_geometry->getFBXGeometry().offset * glm::vec4(extents.minimum, 1.0));
|
||||
glm::vec3 maximum = glm::vec3(_geometry->getFBXGeometry().offset * glm::vec4(extents.maximum, 1.0));
|
||||
Extents scaledExtents = { minimum * _scale, maximum * _scale };
|
||||
return scaledExtents;
|
||||
}
|
||||
|
||||
|
@ -447,9 +451,12 @@ Extents Model::getUnscaledMeshExtents() const {
|
|||
|
||||
const Extents& extents = _geometry->getFBXGeometry().meshExtents;
|
||||
|
||||
// even though our caller asked for "unscaled" we need to include any fst scaling
|
||||
float scale = _geometry->getFBXGeometry().fstScaled;
|
||||
Extents scaledExtents = { extents.minimum * scale, extents.maximum * scale };
|
||||
// even though our caller asked for "unscaled" we need to include any fst scaling, translation, and rotation, which
|
||||
// is captured in the offset matrix
|
||||
glm::vec3 minimum = glm::vec3(_geometry->getFBXGeometry().offset * glm::vec4(extents.minimum, 1.0));
|
||||
glm::vec3 maximum = glm::vec3(_geometry->getFBXGeometry().offset * glm::vec4(extents.maximum, 1.0));
|
||||
Extents scaledExtents = { minimum, maximum };
|
||||
|
||||
return scaledExtents;
|
||||
}
|
||||
|
||||
|
|
|
@ -1399,7 +1399,6 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
|||
|
||||
// get offset transform from mapping
|
||||
float offsetScale = mapping.value("scale", 1.0f).toFloat();
|
||||
geometry.fstScaled = offsetScale;
|
||||
glm::quat offsetRotation = glm::quat(glm::radians(glm::vec3(mapping.value("rx").toFloat(),
|
||||
mapping.value("ry").toFloat(), mapping.value("rz").toFloat())));
|
||||
geometry.offset = glm::translate(glm::vec3(mapping.value("tx").toFloat(), mapping.value("ty").toFloat(),
|
||||
|
|
|
@ -211,8 +211,6 @@ public:
|
|||
Extents bindExtents;
|
||||
Extents meshExtents;
|
||||
|
||||
float fstScaled;
|
||||
|
||||
QVector<FBXAnimationFrame> animationFrames;
|
||||
|
||||
QVector<FBXAttachment> attachments;
|
||||
|
|
Loading…
Reference in a new issue