mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 10:48:15 +02:00
Read quats from fst
This commit is contained in:
parent
8310dd0cba
commit
599b7761b2
1 changed files with 9 additions and 10 deletions
|
@ -623,15 +623,14 @@ QMap<QString, glm::quat> getJointRotationOffsets(const QVariantHash& mapping) {
|
||||||
for (auto itr = offsets.begin(); itr != offsets.end(); itr++) {
|
for (auto itr = offsets.begin(); itr != offsets.end(); itr++) {
|
||||||
QString jointName = itr.key();
|
QString jointName = itr.key();
|
||||||
QString line = itr.value().toString();
|
QString line = itr.value().toString();
|
||||||
auto eulerAngles = line.split(',');
|
auto quatCoords = line.split(',');
|
||||||
if (eulerAngles.size() == 3) {
|
if (quatCoords.size() == 4) {
|
||||||
float eulerX = eulerAngles[0].mid(1).toFloat();
|
float quatX = quatCoords[0].mid(1).toFloat();
|
||||||
float eulerY = eulerAngles[1].toFloat();
|
float quatY = quatCoords[1].toFloat();
|
||||||
float eulerZ = eulerAngles[2].mid(0, eulerAngles[2].size() - 1).toFloat();
|
float quatZ = quatCoords[2].toFloat();
|
||||||
if (!isNaN(eulerX) && !isNaN(eulerY) && !isNaN(eulerZ)) {
|
float quatW = quatCoords[3].mid(0, quatCoords[3].size() - 1).toFloat();
|
||||||
glm::quat rotationOffset = (glm::angleAxis(eulerX * RADIANS_PER_DEGREE, Vectors::UNIT_X) *
|
if (!isNaN(quatX) && !isNaN(quatY) && !isNaN(quatZ) && !isNaN(quatW)) {
|
||||||
glm::angleAxis(eulerY * RADIANS_PER_DEGREE, Vectors::UNIT_Y) *
|
glm::quat rotationOffset = glm::quat(quatW, quatX, quatY, quatZ);
|
||||||
glm::angleAxis(eulerZ * RADIANS_PER_DEGREE, Vectors::UNIT_Z));
|
|
||||||
jointRotationOffsets.insert(jointName, rotationOffset);
|
jointRotationOffsets.insert(jointName, rotationOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2026,7 +2025,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
if (jointIndex != -1) {
|
if (jointIndex != -1) {
|
||||||
geometry.jointRotationOffsets.insert(jointIndex, rotationOffset);
|
geometry.jointRotationOffsets.insert(jointIndex, rotationOffset);
|
||||||
}
|
}
|
||||||
qCDebug(modelformat) << "Joint Rotation Offset added to Rig._jointRotationOffsets : " << " jointName: " << jointName << " jointIndex: " << jointIndex << " rotation offset: " << rotationOffset;
|
qDebug() << "Joint Rotation Offset added to Rig._jointRotationOffsets : " << " jointName: " << jointName << " jointIndex: " << jointIndex << " rotation offset: " << rotationOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
return geometryPtr;
|
return geometryPtr;
|
||||||
|
|
Loading…
Reference in a new issue