MCPcopy Create free account
hub / github.com/carbonengine/trinity / SaveMesh

Method SaveMesh

trinity/Resources/TriGeometryRes.cpp:2468–2502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2466#endif
2467
2468Be::Result<std::string> TriGeometryRes::SaveMesh( const char* filename, uint32_t meshIndex ) const
2469{
2470 if( !IsGood() )
2471 {
2472 return Be::Result<std::string>( "Geometry is not prepared" );
2473 }
2474 auto meshData = GetMeshData( meshIndex );
2475 if( !meshData )
2476 {
2477 return Be::Result<std::string>( "Invalid mesh index" );
2478 }
2479
2480 if( IsUsingCMF() )
2481 {
2482 if( !SaveMeshToCMFFile( *meshData, filename ) )
2483 {
2484 return Be::Result<std::string>( "Failed to save the mesh" );
2485 }
2486 }
2487#if WITH_GRANNY
2488 else
2489 {
2490 if( !SaveMeshToGrannyFile( *meshData, filename ) )
2491 {
2492 return Be::Result<std::string>( "Failed to save the mesh" );
2493 }
2494 }
2495#else
2496 else
2497 {
2498 return Be::Result<std::string>( "Failed to save the mesh. Use CMF!" );
2499 }
2500#endif
2501 return Be::Result<std::string>();
2502}
2503
2504bool TriGeometryRes::SaveMeshToCMFFile( TriGeometryResMeshData& mesh, const char* filename )
2505{

Callers

nothing calls this directly

Calls 2

IsUsingCMFFunction · 0.85
ifFunction · 0.70

Tested by

no test coverage detected