| 294 | } |
| 295 | |
| 296 | void 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 | |
| 341 | Tr2TexturePipeline* TriTextureRes::GetPipeline() const |
| 342 | { |
nothing calls this directly
no test coverage detected