This gets called on the background loading thread
| 557 | |
| 558 | // This gets called on the background loading thread |
| 559 | BlueAsyncRes::LoadingResult TriGeometryRes::DoLoad() |
| 560 | { |
| 561 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 562 | |
| 563 | if( m_cmfContents ) |
| 564 | { |
| 565 | if( !m_cmfContents.GetData() || !SetupMeshes( *m_cmfContents.GetData() ) ) |
| 566 | { |
| 567 | return LR_FAILED; |
| 568 | }; |
| 569 | return LR_SUCCESS; |
| 570 | } |
| 571 | #if WITH_GRANNY |
| 572 | else if( m_pGrannyFile ) |
| 573 | { |
| 574 | // The granny file already exists so we only have to recreate |
| 575 | // the meshes. |
| 576 | SetupMeshes( GrannyGetFileInfo( m_pGrannyFile ) ); |
| 577 | return LR_SUCCESS; |
| 578 | } |
| 579 | #endif |
| 580 | |
| 581 | if( !m_dataStream ) |
| 582 | { |
| 583 | return LR_FAILED; |
| 584 | } |
| 585 | |
| 586 | if( m_path.size() >= 4 && m_path.compare( m_path.size() - 4, 4, L".cmf" ) == 0 ) |
| 587 | { |
| 588 | if( ReadCMFFile() ) |
| 589 | { |
| 590 | // Decompress sections we will use in Prepare |
| 591 | for( uint32_t i = 0; i < m_meshes.size(); i++ ) |
| 592 | { |
| 593 | auto& mesh = m_meshes[i]; |
| 594 | auto& cmfMesh = m_cmfContents.GetData()->meshes[i]; |
| 595 | |
| 596 | for( const auto& lod : mesh->m_lods ) |
| 597 | { |
| 598 | auto& cmfLod = cmfMesh.lods[lod->m_originalLodIndex]; |
| 599 | m_cmfContents.GetViewData( cmfLod.vb ); |
| 600 | m_cmfContents.GetViewData( cmfLod.ib ); |
| 601 | for( const auto& morph : cmfLod.morphTargets ) |
| 602 | { |
| 603 | m_cmfContents.GetViewData( morph.vb ); |
| 604 | } |
| 605 | } |
| 606 | } |
| 607 | |
| 608 | return LR_SUCCESS; |
| 609 | } |
| 610 | } |
| 611 | else |
| 612 | { |
| 613 | HandleGrannyDeprecation( m_path ); |
| 614 | #if WITH_GRANNY |
| 615 | if( ReadGrannyFile() ) |
| 616 | { |
nothing calls this directly
no test coverage detected