|
@@ -182,10 +182,7 @@ static void ReadMesh(
|
|
|
const FbxVector4 meshTranslation = pNode->GetGeometricTranslation(FbxNode::eSourcePivot);
|
|
|
const FbxVector4 meshRotation = pNode->GetGeometricRotation(FbxNode::eSourcePivot);
|
|
|
const FbxVector4 meshScaling = pNode->GetGeometricScaling(FbxNode::eSourcePivot);
|
|
|
- FbxAMatrix meshTransform(meshTranslation, meshRotation, meshScaling);
|
|
|
- const FbxVector4 meshRotationPivot = pNode->GetRotationPivot(FbxNode::eSourcePivot);
|
|
|
- const FbxAMatrix meshPivotTransform(-meshRotationPivot, FbxVector4(0, 0, 0, 0), FbxVector4(1, 1, 1, 1));
|
|
|
- meshTransform *= meshPivotTransform;
|
|
|
+ const FbxAMatrix meshTransform(meshTranslation, meshRotation, meshScaling);
|
|
|
const FbxMatrix transform = meshTransform;
|
|
|
|
|
|
// Remove translation & scaling from transforms that will bi applied to normals, tangents &
|
|
@@ -686,23 +683,6 @@ static FbxVector4 computeLocalScale(FbxNode* pNode, FbxTime pTime = FBXSDK_TIME_
|
|
|
return FbxVector4(1, 1, 1, 1);
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * Compute the local position incorporating the rotation pivot offset, and subtracting out the pivot
|
|
|
- * of the parent node.
|
|
|
- */
|
|
|
-static FbxVector4 computeLocalTranslation(FbxNode* pNode, FbxTime pTime = FBXSDK_TIME_INFINITE) {
|
|
|
- const FbxVector4 meshRotationPivot = pNode->GetRotationPivot(FbxNode::eSourcePivot);
|
|
|
- const FbxAMatrix meshPivotTransform(meshRotationPivot, FbxVector4(0, 0, 0, 0), FbxVector4(1, 1, 1, 1));
|
|
|
- FbxAMatrix localTransform = pNode->EvaluateLocalTransform(pTime);
|
|
|
- localTransform *= meshPivotTransform;
|
|
|
- FbxVector4 lTranslation = localTransform.GetT();
|
|
|
- FbxNode* parent = pNode->GetParent();
|
|
|
- if (pNode->GetParent() != nullptr) {
|
|
|
- lTranslation -= parent->GetRotationPivot(FbxNode::eSourcePivot);
|
|
|
- }
|
|
|
- return lTranslation;
|
|
|
-}
|
|
|
-
|
|
|
static void ReadNodeHierarchy(
|
|
|
RawModel& raw,
|
|
|
FbxScene* pScene,
|
|
@@ -745,9 +725,9 @@ static void ReadNodeHierarchy(
|
|
|
|
|
|
// Set the initial node transform.
|
|
|
const FbxAMatrix localTransform = pNode->EvaluateLocalTransform();
|
|
|
- FbxVector4 localTranslation = computeLocalTranslation(pNode);
|
|
|
- FbxQuaternion localRotation = localTransform.GetQ();
|
|
|
- FbxVector4 localScaling = computeLocalScale(pNode);
|
|
|
+ const FbxVector4 localTranslation = localTransform.GetT();
|
|
|
+ const FbxQuaternion localRotation = localTransform.GetQ();
|
|
|
+ const FbxVector4 localScaling = computeLocalScale(pNode);
|
|
|
|
|
|
node.translation = toVec3f(localTranslation) * scaleFactor;
|
|
|
node.rotation = toQuatf(localRotation);
|
|
@@ -855,7 +835,7 @@ static void ReadAnimations(RawModel& raw, FbxScene* pScene, const GltfOptions& o
|
|
|
for (int nodeIndex = 0; nodeIndex < nodeCount; nodeIndex++) {
|
|
|
FbxNode* pNode = pScene->GetNode(nodeIndex);
|
|
|
const FbxAMatrix baseTransform = pNode->EvaluateLocalTransform();
|
|
|
- const FbxVector4 baseTranslation = computeLocalTranslation(pNode);
|
|
|
+ const FbxVector4 baseTranslation = baseTransform.GetT();
|
|
|
const FbxQuaternion baseRotation = baseTransform.GetQ();
|
|
|
const FbxVector4 baseScaling = computeLocalScale(pNode);
|
|
|
|
|
@@ -867,7 +847,7 @@ static void ReadAnimations(RawModel& raw, FbxScene* pScene, const GltfOptions& o
|
|
|
pTime.SetFrame(frameIndex, eMode);
|
|
|
|
|
|
const FbxAMatrix localTransform = pNode->EvaluateLocalTransform(pTime);
|
|
|
- const FbxVector4 localTranslation = computeLocalTranslation(pNode, pTime);
|
|
|
+ const FbxVector4 localTranslation = localTransform.GetT();
|
|
|
const FbxQuaternion localRotation = localTransform.GetQ();
|
|
|
const FbxVector4 localScale = computeLocalScale(pNode, pTime);
|
|
|
|