Mesh and Material Serializations

This commit is contained in:
Dynamitos
2023-11-01 13:38:49 +01:00
parent 4e7f4a56b8
commit 5a9cb13e74
20 changed files with 233 additions and 111 deletions
+8 -3
View File
@@ -174,9 +174,9 @@ void MeshLoader::loadGlobalMeshes(const aiScene* scene, const Array<PMaterialAss
indices[faceIndex * 3 + 2] = mesh->mFaces[faceIndex].mIndices[2];
}
Array<Meshlet> meshlets;
if (Gfx::useMeshShading)
{
Array<Meshlet> meshlets;
meshlets.reserve(indices.size() / (3ull * Gfx::numPrimitivesPerMeshlet));
std::set<uint32> uniqueVertices;
Meshlet current = {
@@ -233,6 +233,7 @@ void MeshLoader::loadGlobalMeshes(const aiScene* scene, const Array<PMaterialAss
completeMeshlet();
}
}
vertexData->loadMesh(id, meshlets);
}
else
{
@@ -250,10 +251,14 @@ void MeshLoader::loadGlobalMeshes(const aiScene* scene, const Array<PMaterialAss
Gfx::PIndexBuffer indexBuffer = graphics->createIndexBuffer(idxInfo);
indexBuffer->transferOwnership(Gfx::QueueType::GRAPHICS);
globalMeshes[meshIndex] = new Mesh(vertexShaderInput, indexBuffer);
globalMeshes[meshIndex]->referencedMaterial = materials[mesh->mMaterialIndex];
globalMeshes[meshIndex] = new Mesh();
globalMeshes[meshIndex]->vertexData = vertexData;
globalMeshes[meshIndex]->id = id;
globalMeshes[meshIndex]->referencedMaterial = materials[mesh->mMaterialIndex]->getMaterial()->instantiate();
globalMeshes[meshIndex]->meshlets = std::move(meshlets);
}
}
void MeshLoader::convertAssimpARGB(unsigned char* dst, aiTexel* src, uint32 numPixels)
{
for(uint32 i = 0; i < numPixels; ++i)