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

Method Save

trinity/Resources/TriTextureRes.cpp:465–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

463}
464
465bool TriTextureRes::Save( const wchar_t* filename )
466{
467 USE_MAIN_THREAD_RENDER_CONTEXT();
468
469 // Only permit saving of 2d and cube textures
470 if( m_type == TEX_TYPE_INVALID )
471 {
472 CCP_LOGERR( "Texture save failed - texture is invalid" );
473 return false;
474 }
475 else if( m_type != TEX_TYPE_2D && m_type != TEX_TYPE_CUBE )
476 {
477 CCP_LOGERR( "Texture save failed - only 2d and cubemap textures can be saved" );
478 return false;
479 }
480
481 if( !ImageIO::IsSaveSupported( filename, *this ) )
482 {
483 CCP_LOGERR( "Unsupported format for saving (%S)", filename );
484 return false;
485 }
486
487 Tr2HostBitmapPtr saveBitmap;
488
489 if( !saveBitmap.CreateInstance() ||
490 !saveBitmap->CreateFromBitmapDimensions( *this ) ||
491 !saveBitmap->CopyFromTextureRes( *this, renderContext ) )
492 {
493 return false;
494 }
495
496 return saveBitmap->Save( filename );
497}
498
499bool TriTextureRes::SaveAsync( const wchar_t* filename )
500{

Callers 2

PythonSaveFunction · 0.45
DoExecuteAsyncSaveMethod · 0.45

Calls 2

CreateInstanceMethod · 0.80
CopyFromTextureResMethod · 0.80

Tested by

no test coverage detected