Fix collision data cooking from model asset by favoring CPU data fetching

This commit is contained in:
Wojtek Figat
2023-04-22 18:15:49 +02:00
parent 9e222d222c
commit 37032810c9

View File

@@ -118,12 +118,7 @@ bool CollisionCooking::CookCollision(const Argument& arg, CollisionData::Seriali
indexCounts.Resize(needIndexBuffer ? meshesCount : 0);
vertexCounts.SetAll(0);
indexCounts.SetAll(0);
bool useCpuData = IsInMainThread() && !arg.Model->IsVirtual();
if (!useCpuData)
{
// If mesh data is already cached in memory then we could use it instead of GPU
useCpuData |= arg.Model->HasChunkLoaded(MODEL_LOD_TO_CHUNK_INDEX(lodIndex));
}
bool useCpuData = IsInMainThread() || !arg.Model->IsVirtual();
if (useCpuData)
{
// Read directly from the asset storage