Skip to content

Commit

Permalink
fix uv and binary stream
Browse files Browse the repository at this point in the history
  • Loading branch information
VTui22 committed Apr 2, 2024
1 parent bb66bf5 commit 2faac81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions private/Producers/FbxProducer/FbxProducerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void FindFbxSkeletalMeshRecursively(fbxsdk::FbxScene* pScene, fbxsdk::FbxNode* p
fbxsdk::FbxNode* pNodeToAdd = pNode;
fbxsdk::FbxVector4 noScale(1.0, 1.0, 1.0);

if (pNode->GetMesh() && pNode->GetMesh()->GetDeformerCount(FbxDeformer::eSkin) > 0)
if (pNode->GetMesh() && pNode->GetMesh()->GetDeformerCount(fbxsdk::FbxDeformer::eSkin) > 0)
{
pSkeletalMeshNode = pNode;
}
Expand Down Expand Up @@ -326,7 +326,7 @@ void FixSkeletonRecursively(fbxsdk::FbxManager* pManager, fbxsdk::FbxNode* pNode
// Replace with skeleton
auto* pSkeleton = fbxsdk::FbxSkeleton::Create(pManager, "");
pNode->SetNodeAttribute(pSkeleton);
pSkeleton->SetSkeletonType(FbxSkeleton::eLimbNode);
pSkeleton->SetSkeletonType(fbxsdk::FbxSkeleton::eLimbNode);
}
}

Expand Down Expand Up @@ -1152,7 +1152,7 @@ cd::MeshID FbxProducerImpl::ImportMesh(const fbxsdk::FbxMesh* pFbxMesh, cd::Scen
uint32_t uvMapIndex = fbxsdk::FbxLayerElement::eByControlPoint == pLayerElementUVData->GetMappingMode() ? controlPointIndex : vertexInstanceID;
uint32_t uvValueIndex = fbxsdk::FbxLayerElement::eDirect == pLayerElementUVData->GetReferenceMode() ? uvMapIndex : pLayerElementUVData->GetIndexArray().GetAt(uvMapIndex);
fbxsdk::FbxVector2 uvValue = pLayerElementUVData->GetDirectArray().GetAt(uvValueIndex);
mesh.SetVertexUV(uvSetIndex, vertexInstanceID, cd::UV(uvValue[0], uvValue[1]));
mesh.SetVertexUV(uvSetIndex, vertexInstanceID, cd::UV(uvValue[0], -uvValue[1]));
}
}
}
Expand Down Expand Up @@ -1410,6 +1410,7 @@ void FbxProducerImpl::ImportSkeletonBones(fbxsdk::FbxScene* pScene, const std::v
}

cdBone.SetTransform(details::ConvertFbxTransform(localLinkT, localLinkQ, localLinkS));
cdBone.SetOffset(details::ConvertFbxMatrixToCDMatrix(globalTransformPerLinkBone[cdBoneID].Inverse()));
}

// Add to scene database.
Expand Down
6 changes: 4 additions & 2 deletions private/Scene/BoneImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,22 @@ class BoneImpl final
{
uint32_t boneChildIDCount;

inputArchive >> GetID().Data() >> GetParentID().Data() >> GetName() >> boneChildIDCount;
inputArchive >> GetID().Data() >> GetParentID().Data() >> GetSkeletonID().Data() >> GetName() >> boneChildIDCount;
SetChildIDCount(boneChildIDCount);
inputArchive.ImportBuffer(GetChildIDs().data());
inputArchive >> GetOffset() >> GetTransform();
inputArchive >> GetLimbLength() >> GetLimbSize();

return *this;
}

template<bool SwapBytesOrder>
const BoneImpl& operator>>(TOutputArchive<SwapBytesOrder>& outputArchive) const
{
outputArchive << GetID().Data() << GetParentID().Data() << GetName() << GetChildIDCount();
outputArchive << GetID().Data() << GetParentID().Data() << GetSkeletonID().Data() << GetName() << GetChildIDCount();
outputArchive.ExportBuffer(GetChildIDs().data(), GetChildIDs().size());
outputArchive << GetOffset() << GetTransform();
outputArchive << GetLimbLength() << GetLimbSize();

return *this;
}
Expand Down

0 comments on commit 2faac81

Please sign in to comment.