You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto retval = interm_getAssetInHierarchy( filename.svalue, loadParams, hierarchyLevel/*+ICPUScene::MESH_HIERARCHY_LEVELS_BELOW*/, ctx.override_);
700
+
#if0
701
+
auto retval = interm_getAssetInHierarchy(filename,inner.params,hierarchyLevel+/*ICPUScene::GEOMETRY_COLLECTION_HIERARCHY_LEVELS_BELOW*/1,override_);
708
702
if (retval.getContents().empty())
709
703
{
710
704
os::Printer::log(std::string("[ERROR] Could Not Find Mesh: ") + filename.svalue, ELL_ERROR);
711
-
return nullptr;
712
-
}
713
-
if (retval.getAssetType()!=asset::IAsset::ET_MESH)
714
-
{
715
-
os::Printer::log("[ERROR] Loaded an Asset but it wasn't a mesh, was E_ASSET_TYPE " + std::to_string(retval.getAssetType()), ELL_ERROR);
716
-
return nullptr;
705
+
return;
717
706
}
718
-
auto contentRange = retval.getContents();
719
-
auto serializedMeta = retval.getMetadata()->selfCast<CMitsubaSerializedMetadata>();
720
-
//
707
+
721
708
uint32_t actualIndex = 0;
722
-
if (index>=0ll && serializedMeta)
723
-
for (auto it=contentRange.begin(); it!=contentRange.end(); it++)
709
+
switch (retval.getAssetType())
724
710
{
725
-
auto meshMeta = static_cast<const CMitsubaSerializedMetadata::CMesh*>(serializedMeta->getAssetSpecificMetadata(IAsset::castDown<ICPUMesh>(*it).get()));
726
-
if (meshMeta->m_id!=static_cast<uint32_t>(index))
727
-
continue;
728
-
actualIndex = it-contentRange.begin();
729
-
break;
711
+
case IAsset::ET_GEOMETRY:
712
+
{
713
+
auto contentRange = retval.getContents();
714
+
auto serializedMeta = retval.getMetadata()->selfCast<CMitsubaSerializedMetadata>();
715
+
//
716
+
if (index>=0ll && serializedMeta)
717
+
for (auto it=contentRange.begin(); it!=contentRange.end(); it++)
718
+
{
719
+
auto meshMeta = static_cast<const CMitsubaSerializedMetadata::CMesh*>(serializedMeta->getAssetSpecificMetadata(IAsset::castDown<ICPUMesh>(*it).get()));
720
+
if (meshMeta->m_id!=static_cast<uint32_t>(index))
721
+
continue;
722
+
actualIndex = it-contentRange.begin();
723
+
break;
724
+
}
725
+
//
726
+
if (contentRange.begin()+actualIndex < contentRange.end())
727
+
{
728
+
auto asset = contentRange.begin()[actualIndex];
729
+
if (!asset)
730
+
{
731
+
return;
732
+
}
733
+
addGeometry(asset);
734
+
}
735
+
}
736
+
case IAsset::ET_GEOMETRY_COLLECTION:
737
+
{
738
+
// TODO: replace the collection
739
+
break;
740
+
}
741
+
case IAsset::ET_MORPH_TARGETS:
742
+
{
743
+
// TODO: take first target and replace the collection
744
+
_NBL_DEBUG_BREAK_IF(true); // we have no such loaders right now
745
+
break;
746
+
}
747
+
case IAsset::ET_SCENE:
748
+
{
749
+
// TODO: flatten the scene into a single instance, this is path for OBJ loading
750
+
// NOTE: also need to preserve/forward the materials somehow (need to chape the `shape_ass_type` to have a default Material Binding Table)
751
+
}
752
+
default:
753
+
os::Printer::log("[ERROR] Loaded an Asset but it wasn't a mesh, was E_ASSET_TYPE " + std::to_string(retval.getAssetType()), ELL_ERROR);
754
+
break;
730
755
}
731
-
//
732
-
if (contentRange.begin()+actualIndex < contentRange.end())
756
+
#endif
757
+
// we used to load with the IAssetLoader::ELPF_RIGHT_HANDED_MESHES flag, this means flipping the mesh x-axis
0 commit comments