-------------------------------------------------------------------------------------- Description: Render the background scene with all objects, and generate reflection map Returns: boolean indicating whether background distortion is required. --------------------------------------------------------------------------------------
| 1996 | // boolean indicating whether background distortion is required. |
| 1997 | // -------------------------------------------------------------------------------------- |
| 1998 | bool EveSpaceScene::RenderBackgroundPass( const Tr2TextureAL& depthMap, const Tr2TextureAL& distortionMap, const Tr2TextureAL& velocityMap, Tr2RenderContext& renderContext ) |
| 1999 | { |
| 2000 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 2001 | |
| 2002 | bool hasBackgroundDistortionBatches = false; |
| 2003 | |
| 2004 | // "background" rendering |
| 2005 | if( !m_backgroundRenderingEnabled ) |
| 2006 | { |
| 2007 | return hasBackgroundDistortionBatches; |
| 2008 | } |
| 2009 | |
| 2010 | if( !m_display ) |
| 2011 | { |
| 2012 | return hasBackgroundDistortionBatches; |
| 2013 | } |
| 2014 | |
| 2015 | renderContext.AddGpuMarker( __FUNCTION__ ); |
| 2016 | Matrix orgViewMatrix = Tr2Renderer::GetViewTransform(); |
| 2017 | Matrix planetView = CreatePlanetViewMatrix( orgViewMatrix ); |
| 2018 | Tr2Renderer::SetViewTransform( planetView ); |
| 2019 | // Update planet LODs and render planets |
| 2020 | TriFrustum frustum; |
| 2021 | Matrix planetProjection = EveCamera::ModifyClipPlanes( Tr2Renderer::GetProjectionTransform(), 0.01f, 1e5f ); |
| 2022 | frustum.DeriveFrustum( &Tr2Renderer::GetViewTransform(), &Tr2Renderer::GetViewPosition(), &planetProjection, renderContext.m_esm.GetViewport() ); |
| 2023 | |
| 2024 | auto normalFrustum = m_updateContext.GetFrustum(); |
| 2025 | |
| 2026 | m_updateContext.SetFrustum( frustum ); |
| 2027 | |
| 2028 | for( auto it = m_planets.begin(); it != m_planets.end(); ++it ) |
| 2029 | { |
| 2030 | EvePlanet* obj = *it; |
| 2031 | obj->SetRenderScale( m_planetScale ); |
| 2032 | obj->UpdateLOD(); |
| 2033 | } |
| 2034 | |
| 2035 | Tr2ParallelDo( m_planets.begin(), m_planets.end(), [&]( EvePlanet* obj ) { |
| 2036 | obj->UpdatePlanetVisibility( m_updateContext, m_planetScale ); |
| 2037 | } ); |
| 2038 | |
| 2039 | m_updateContext.SetFrustum( normalFrustum ); |
| 2040 | |
| 2041 | Tr2Renderer::SetViewTransform( orgViewMatrix ); |
| 2042 | |
| 2043 | { |
| 2044 | GPU_REGION( renderContext, "Background" ); |
| 2045 | |
| 2046 | if( velocityMap.IsValid() ) |
| 2047 | { |
| 2048 | Tr2PushPopRT rt( velocityMap, renderContext, 1 ); |
| 2049 | renderContext.RenderPassHint( { Tr2LoadAction::LOAD, Tr2StoreAction::STORE }, { m_velocityMapDirty ? Tr2LoadAction::LOAD : Tr2LoadAction::CLEAR, Tr2StoreAction::STORE }, { Tr2LoadAction::LOAD, Tr2StoreAction::STORE } ); |
| 2050 | renderContext.Clear( CLEARFLAGS_TARGET, 0x00000000, 1.f, 0, 1 ); |
| 2051 | hasBackgroundDistortionBatches = RenderBackgroundPassObjects( depthMap, distortionMap, renderContext, BACKGROUND_RENDER_COLOR ); |
| 2052 | m_velocityMapDirty = true; |
| 2053 | } |
| 2054 | else |
| 2055 | { |
no test coverage detected