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

Method ResourcePrepFinished

trinity/Resources/TriTextureRes.cpp:296–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296void TriTextureRes::ResourcePrepFinished()
297{
298 if( m_pipeline != nullptr )
299 {
300 m_isLoading = false;
301 m_isPrepared = true;
302 m_isGood = false;
303
304 ON_BLOCK_EXIT( [&] { m_pipelineInputs.clear(); m_pipeline = nullptr; } );
305
306 std::unordered_map<std::wstring, const ImageIO::HostBitmap*> inputs;
307 for( auto it = begin( m_pipelineInputs ); it != end( m_pipelineInputs ); ++it )
308 {
309 inputs[it->first] = ( it->second && it->second->IsGood() ) ? &it->second->GetBitmap() : nullptr;
310 }
311 ImageIO::HostBitmap result;
312 if( m_pipeline->Execute( result, inputs, Tr2TexturePipelineParams() ) )
313 {
314 m_ownTexture = Tr2TextureAL();
315 SetTexture( m_ownTexture );
316
317 // No need to check for texture load disabled - we wouldn't have gotten here
318 // if it were.
319
320 if( !Tr2Renderer::IsResourceCreationAllowed() )
321 {
322 return;
323 }
324
325 Tr2TextureAL face;
326 USE_MAIN_THREAD_RENDER_CONTEXT();
327 uint32_t memoryUse;
328 if( !Tr2ImageIOHelpers::CreateTexture( result, m_ownTexture, memoryUse, renderContext, USAGE_IMMUTABLE ) )
329 {
330 CCP_LOGWARN( "Tr2ImageHandler failed to create texture '%S'", GetPath() );
331 return;
332 }
333
334 SetTexture( m_ownTexture );
335 }
336 m_isGood = true;
337 NotifyRebuildCachedData();
338 }
339}
340
341Tr2TexturePipeline* TriTextureRes::GetPipeline() const
342{

Callers

nothing calls this directly

Calls 7

CreateTextureFunction · 0.85
beginFunction · 0.50
endFunction · 0.50
Tr2TextureALClass · 0.50
IsGoodMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected