-------------------------------------------------------------------------------------- Description: Finishes re-rendering of impostor billboards. Should be called before any EndImpostorUpdate. Copies updated impostor images to the atlas. Arguments: renderContext - Current render context --------------------------------------------------------------------------------------
| 412 | // renderContext - Current render context |
| 413 | // -------------------------------------------------------------------------------------- |
| 414 | void Tr2ImpostorManager::EndUpdateAtlas( Tr2RenderContext& renderContext ) |
| 415 | { |
| 416 | if( !m_rt || !m_rt->IsValid() || m_renderQueue.empty() ) |
| 417 | { |
| 418 | return; |
| 419 | } |
| 420 | |
| 421 | renderContext.m_esm.PopDepthStencilBuffer(); |
| 422 | renderContext.m_esm.PopRenderTarget(); |
| 423 | |
| 424 | for( size_t i = 0; i < m_renderQueue.size(); ++i ) |
| 425 | { |
| 426 | auto impostor = m_objects.find( m_renderQueue[i] ); |
| 427 | |
| 428 | impostor->second.oldHash = impostor->second.hash; |
| 429 | |
| 430 | auto x = uint32_t( float( impostor->second.texcoord.x ) * m_width ); |
| 431 | auto y = uint32_t( float( impostor->second.texcoord.y ) * m_height ); |
| 432 | Tr2TextureSubresource dst( 0 ); |
| 433 | dst.SetRect( x, y, x + m_itemWidth, y + m_itemHeight ); |
| 434 | Tr2TextureSubresource src( 0 ); |
| 435 | src.SetRect( uint32_t( i ) * m_itemWidth, 0, uint32_t( i + 1 ) * m_itemWidth, m_itemHeight ); |
| 436 | |
| 437 | m_rt->GetRenderTarget().CopySubresourceRegion( dst, *m_itemRt, src, renderContext ); |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | // -------------------------------------------------------------------------------------- |
| 442 | // Description: |
no test coverage detected