fix a crash in assetloader

use std::partition instead of std::sort to partition the entities 
such as the renderables are first.
This commit is contained in:
Mathias Agopian
2022-05-05 16:59:19 -07:00
committed by Philip Rideout
parent 434dce2b9f
commit 7baffe34ac

View File

@@ -322,8 +322,7 @@ void FAssetLoader::createAsset(const cgltf_data* srcAsset, size_t numInstances)
// Sort the entities so that the renderable ones come first. This allows us to expose
// a "renderables only" pointer without storing a separate list.
const auto& rm = mEngine->getRenderableManager();
std::sort(mResult->mEntities.begin(), mResult->mEntities.end(),
[&rm](const Entity& a, const Entity& b) {
std::partition(mResult->mEntities.begin(), mResult->mEntities.end(), [&rm](Entity a) {
return rm.hasComponent(a);
});