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

Method EndUpdateAtlas

trinity/Tr2ImpostorManager.cpp:414–439  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- 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 --------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

412// renderContext - Current render context
413// --------------------------------------------------------------------------------------
414void 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:

Callers 1

UpdateImpostorsMethod · 0.80

Calls 8

emptyMethod · 0.80
PopDepthStencilBufferMethod · 0.80
sizeMethod · 0.80
SetRectMethod · 0.80
GetRenderTargetMethod · 0.80
IsValidMethod · 0.45
PopRenderTargetMethod · 0.45
CopySubresourceRegionMethod · 0.45

Tested by

no test coverage detected