| 2466 | #endif |
| 2467 | |
| 2468 | Be::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 | |
| 2504 | bool TriGeometryRes::SaveMeshToCMFFile( TriGeometryResMeshData& mesh, const char* filename ) |
| 2505 | { |
nothing calls this directly
no test coverage detected