Fixed bug when processing nodes in scene
Rewrote bone writing because i discarded like a moron
This commit is contained in:
parent
b99c9e6ebf
commit
d590a3894f
|
@ -50,15 +50,14 @@ namespace SH_COMP
|
|||
else if (node->mParent != nullptr)
|
||||
{
|
||||
BuildArmature(node, rig);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (auto i{ 0 }; i < node->mNumChildren; ++i)
|
||||
{
|
||||
ProcessNode(node->mChildren[i], scene, meshes, rig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MeshCompiler::GetMesh(aiMesh const& mesh, MeshData& meshData) noexcept
|
||||
{
|
||||
|
|
|
@ -55,6 +55,32 @@ namespace SH_COMP
|
|||
reinterpret_cast<char const*>(asset.indices.data()),
|
||||
sizeof(uint32_t) * header.indexCount
|
||||
);
|
||||
|
||||
if (header.boneCount)
|
||||
{
|
||||
file.write(
|
||||
reinterpret_cast<char const*>(asset.bonesInfo.data()),
|
||||
sizeof(MeshBoneInfo) * header.boneCount
|
||||
);
|
||||
|
||||
for (auto const& bone : asset.bones)
|
||||
{
|
||||
file.write(
|
||||
bone.name.data(),
|
||||
bone.name.size()
|
||||
);
|
||||
|
||||
file.write(
|
||||
reinterpret_cast<char const*>(&bone.offset),
|
||||
sizeof(SHMat4)
|
||||
);
|
||||
|
||||
file.write(
|
||||
reinterpret_cast<char const*>(bone.weights.data()),
|
||||
sizeof(BoneWeight) * bone.weights.size()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace SH_COMP
|
|||
struct MeshBoneInfo
|
||||
{
|
||||
uint32_t charCount;
|
||||
uint32_t weightCount; // Size should be same as boneCount
|
||||
uint32_t weightCount;
|
||||
};
|
||||
|
||||
struct BoneWeight
|
||||
|
|
Loading…
Reference in New Issue