-------------------------------------------------------------------------------------- Description: Render all background objects, nebula, stars, planets etc. Returns: boolean indicating whether background distortion is required. --------------------------------------------------------------------------------------
| 2073 | // boolean indicating whether background distortion is required. |
| 2074 | // -------------------------------------------------------------------------------------- |
| 2075 | bool EveSpaceScene::RenderBackgroundPassObjects( const Tr2TextureAL& depthMap, const Tr2TextureAL& distortionMap, Tr2RenderContext& renderContext, BackgroundRenderingReason reason ) |
| 2076 | { |
| 2077 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 2078 | |
| 2079 | std::vector<ITr2Renderable*> visible; |
| 2080 | Tr2RenderableSortList transparentObjects; |
| 2081 | |
| 2082 | bool hasBackgroundDistortionBatches = false; |
| 2083 | |
| 2084 | |
| 2085 | // nebula |
| 2086 | if( m_backgroundEffect ) |
| 2087 | { |
| 2088 | |
| 2089 | if( reason == BACKGROUND_RENDER_REFLECTION ) |
| 2090 | { |
| 2091 | // multiply the nebula intensity with the reflection multiplier so we can control the reflection intensity |
| 2092 | m_nebulaIntensityVar = m_backgroundReflectionIntensity; |
| 2093 | } |
| 2094 | |
| 2095 | renderContext.m_esm.ApplyStandardStates( Tr2EffectStateManager::RM_OPAQUE ); |
| 2096 | Tr2Renderer::DrawCameraSpaceScreenQuad( renderContext, m_backgroundEffect->GetShaderStateInterface(), m_backgroundEffect ); |
| 2097 | |
| 2098 | if( reason == BACKGROUND_RENDER_REFLECTION ) |
| 2099 | { |
| 2100 | // Reset the nebula intensity to the original one |
| 2101 | m_nebulaIntensityVar = m_currentNebulaIntensity; |
| 2102 | } |
| 2103 | } |
| 2104 | |
| 2105 | // stars |
| 2106 | if( m_starfield ) |
| 2107 | { |
| 2108 | m_starfield->GetBatches( m_secondaryBatches[TRIBATCHTYPE_ADDITIVE], 0 ); |
| 2109 | RenderBatch( m_secondaryBatches[TRIBATCHTYPE_ADDITIVE], |
| 2110 | Tr2EffectStateManager::RM_ALPHA_ADDITIVE, |
| 2111 | renderContext ); |
| 2112 | } |
| 2113 | |
| 2114 | // backgroundobjects |
| 2115 | if( !m_backgroundObjects.empty() ) |
| 2116 | { |
| 2117 | for( auto it = m_backgroundObjects.begin(); it != m_backgroundObjects.end(); ++it ) |
| 2118 | { |
| 2119 | auto obj = *it; |
| 2120 | obj->UpdateVisibility( m_updateContext, IdentityMatrix() ); |
| 2121 | obj->GetRenderables( visible, nullptr ); |
| 2122 | } |
| 2123 | if( !visible.empty() ) |
| 2124 | { |
| 2125 | GetAllBatchesFromRenderables( visible, transparentObjects, false, m_secondaryBatches ); |
| 2126 | PrepareTransparentBatch( transparentObjects, m_secondaryBatches ); |
| 2127 | FinalizeBatches( m_secondaryBatches ); |
| 2128 | |
| 2129 | renderContext.m_esm.ApplyStandardStates( Tr2EffectStateManager::RM_DEPTH_ONLY ); |
| 2130 | renderContext.RenderBatches( m_secondaryBatches[TRIBATCHTYPE_DEPTH], BlueSharedString( "Depth" ) ); |
| 2131 | |
| 2132 | RenderOpaqueBatches( m_secondaryBatches, renderContext ); |
nothing calls this directly
no test coverage detected