-------------------------------------------------------------------------------------- Description: Set up rendering states, frustum and gather all batches. --------------------------------------------------------------------------------------
| 1293 | // Set up rendering states, frustum and gather all batches. |
| 1294 | // -------------------------------------------------------------------------------------- |
| 1295 | void EveSpaceScene::BeginRender( bool enableDistortion, Tr2RenderContext& renderContext ) |
| 1296 | { |
| 1297 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 1298 | |
| 1299 | if( !m_display ) |
| 1300 | { |
| 1301 | return; |
| 1302 | } |
| 1303 | |
| 1304 | renderContext.AddGpuMarker( __FUNCTION__ ); |
| 1305 | |
| 1306 | if( m_visualizeMethod != VM_NONE ) |
| 1307 | { |
| 1308 | if( !m_visualizerEffects[m_visualizeMethod].effect ) |
| 1309 | { |
| 1310 | m_visualizerEffects[m_visualizeMethod].effect.CreateInstance(); |
| 1311 | const char* path = VISUALIZER_EFFECT_PATH[m_visualizeMethod]; |
| 1312 | m_visualizerEffects[m_visualizeMethod].effect->SetEffectPathName( path ); |
| 1313 | } |
| 1314 | } |
| 1315 | |
| 1316 | if( m_shLightingManager ) |
| 1317 | { |
| 1318 | m_shLightingManager->UpdateWithDirectionalLight( m_sunData.DirWorld, Vector3( 1.f, 1.f, 1.f ) ); |
| 1319 | } |
| 1320 | |
| 1321 | if( m_dataTextureMgr ) |
| 1322 | { |
| 1323 | m_dataTextureMgr->SetVariables(); |
| 1324 | } |
| 1325 | |
| 1326 | Jitter( renderContext ); |
| 1327 | |
| 1328 | Tr2Renderer::SetProjectionTransform( m_jitteredProjection ); |
| 1329 | m_reprojectionMatrix = Inverse( m_projection ) * Inverse( Tr2Renderer::GetViewTransform() ) * m_viewLast * m_projectionLast; |
| 1330 | |
| 1331 | m_velocityMapDirty = false; |
| 1332 | |
| 1333 | { |
| 1334 | std::vector<IEveLightingOverride::OverrideInfo> overrides; |
| 1335 | m_componentRegistry->ProcessComponents<IEveLightingOverride>( [&overrides]( IEveLightingOverride* component ) -> void { |
| 1336 | overrides.push_back( component->GetOverrides() ); |
| 1337 | } ); |
| 1338 | sort( begin( overrides ), end( overrides ), []( const auto& a, const auto& b ) { |
| 1339 | return a.priority > b.priority; |
| 1340 | } ); |
| 1341 | |
| 1342 | IEveLightingOverride::OverrideInfo baseline; |
| 1343 | baseline.priority = (PostProcessEnums::Priority)-1; |
| 1344 | baseline.intensity = 1; |
| 1345 | auto sunColor = m_useSunColorWithDynamicLights && g_eveSpaceSceneDynamicLighting ? m_sunColorWithDynamicLights : m_sunColor; |
| 1346 | baseline.value.sunIntensity = std::max( { sunColor.r, sunColor.g, sunColor.b } ); |
| 1347 | if( baseline.value.sunIntensity != 0 ) |
| 1348 | { |
| 1349 | baseline.value.sunColor = sunColor * ( 1.f / baseline.value.sunIntensity ); |
| 1350 | } |
| 1351 | else |
| 1352 | { |
no test coverage detected