| 834 | } |
| 835 | |
| 836 | void Tr2DebugRenderer::EndRender( Tr2RenderContext& renderContext ) |
| 837 | { |
| 838 | GetDebugTextRenderer().Render( renderContext ); |
| 839 | GetDebugTextRenderer().Clear(); |
| 840 | |
| 841 | auto shader = m_effect->GetShaderStateInterface(); |
| 842 | if( !shader ) |
| 843 | { |
| 844 | return; |
| 845 | } |
| 846 | if( m_lines.empty() && m_triangles.empty() ) |
| 847 | { |
| 848 | return; |
| 849 | } |
| 850 | |
| 851 | renderContext.m_esm.ApplyStandardStates( Tr2EffectStateManager::RM_ALPHA ); |
| 852 | |
| 853 | auto handle = GetVertexDeclarationHandle( renderContext ); |
| 854 | if( !m_lines.empty() ) |
| 855 | { |
| 856 | renderContext.m_esm.ApplyVertexDeclaration( handle ); |
| 857 | renderContext.SetTopology( Tr2RenderContextEnum::TOP_LINES ); |
| 858 | |
| 859 | uint32_t passCount = shader->GetPassCount( 0 ); |
| 860 | |
| 861 | for( uint32_t passIx = 0; passIx < passCount; ++passIx ) |
| 862 | { |
| 863 | shader->ApplyAllStateForPass( 0, passIx, renderContext ); |
| 864 | m_effect->ApplyMaterialDataForPass( 0, passIx, renderContext ); |
| 865 | renderContext.DrawPrimitiveUP( uint32_t( m_lines.size() / 2 ), &m_lines[0], uint32_t( sizeof( Vertex ) ) ); |
| 866 | } |
| 867 | } |
| 868 | if( !m_triangles.empty() ) |
| 869 | { |
| 870 | renderContext.m_esm.ApplyVertexDeclaration( handle ); |
| 871 | renderContext.SetTopology( Tr2RenderContextEnum::TOP_TRIANGLES ); |
| 872 | |
| 873 | uint32_t passCount = shader->GetPassCount( 0 ); |
| 874 | |
| 875 | for( uint32_t passIx = 0; passIx < passCount; ++passIx ) |
| 876 | { |
| 877 | shader->ApplyAllStateForPass( 0, passIx, renderContext ); |
| 878 | m_effect->ApplyMaterialDataForPass( 0, passIx, renderContext ); |
| 879 | renderContext.DrawPrimitiveUP( uint32_t( m_triangles.size() / 3 ), &m_triangles[0], uint32_t( sizeof( Vertex ) ) ); |
| 880 | } |
| 881 | } |
| 882 | } |
| 883 | |
| 884 | |
| 885 | void Tr2DebugRenderer::SetSelectedObjects( const std::vector<std::pair<IRoot*, uint32_t>>& objects ) |
nothing calls this directly
no test coverage detected