diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 79deef236a..6f87bcf1f8 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -80,6 +80,19 @@ bool FBXGeometry::hasBlendedMeshes() const { return false; } +Extents FBXGeometry::getUnscaledMeshExtents() const { + const Extents& extents = meshExtents; + + // 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(offset * glm::vec4(extents.minimum, 1.0f)); + glm::vec3 maximum = glm::vec3(offset * glm::vec4(extents.maximum, 1.0f)); + Extents scaledExtents = { minimum, maximum }; + + return scaledExtents; +} + + static int fbxGeometryMetaTypeId = qRegisterMetaType(); static int fbxAnimationFrameMetaTypeId = qRegisterMetaType(); static int fbxAnimationFrameVectorMetaTypeId = qRegisterMetaType >(); diff --git a/libraries/fbx/src/FBXReader.h b/libraries/fbx/src/FBXReader.h index b5340978c1..d07a33f3d4 100644 --- a/libraries/fbx/src/FBXReader.h +++ b/libraries/fbx/src/FBXReader.h @@ -234,6 +234,9 @@ public: QStringList getJointNames() const; bool hasBlendedMeshes() const; + + /// Returns the unscaled extents of the model's mesh + Extents getUnscaledMeshExtents() const; }; Q_DECLARE_METATYPE(FBXGeometry)