| 1248 | } |
| 1249 | |
| 1250 | void EveSpaceScene::Jitter( Tr2RenderContext& renderContext ) |
| 1251 | { |
| 1252 | m_projection = Tr2Renderer::GetProjectionTransform(); |
| 1253 | |
| 1254 | auto upscalingInfo = renderContext.GetPrimaryRenderContext().GetUpscalingInfo( Tr2Renderer::GetUpscalingContextID() ); |
| 1255 | if( upscalingInfo.technique != Tr2UpscalingAL::NONE && upscalingInfo.temporal ) |
| 1256 | { |
| 1257 | m_jitter.x = upscalingInfo.jitterX; |
| 1258 | m_jitter.y = upscalingInfo.jitterY; |
| 1259 | m_jitterMatrix = TranslationMatrix( Vector3( m_jitter.x, m_jitter.y, 0 ) ); |
| 1260 | m_jitteredProjection = m_projection * m_jitterMatrix; |
| 1261 | } |
| 1262 | else if( m_sceneDefaultPostProcess && m_sceneDefaultPostProcess->GetTaaIfAvailable() != nullptr ) |
| 1263 | { |
| 1264 | auto rtWidth = renderContext.m_esm.GetRenderTargetWidth(); |
| 1265 | auto rtHeight = renderContext.m_esm.GetRenderTargetHeight(); |
| 1266 | const Vector2 samplingPatterns[] = { Vector2( .125f, -.375f ), |
| 1267 | Vector2( -.125f, .375f ), |
| 1268 | Vector2( .375f, .125f ), |
| 1269 | Vector2( -.375f, -.125f ) }; |
| 1270 | |
| 1271 | auto frame = renderContext.GetPrimaryRenderContext().GetRecordingFrameNumber(); |
| 1272 | auto samplingIndex = frame % ( sizeof( samplingPatterns ) / sizeof( samplingPatterns[0] ) ); |
| 1273 | |
| 1274 | m_jitter.x = 2.0f * samplingPatterns[samplingIndex].x / float( rtWidth ); |
| 1275 | m_jitter.y = 2.0f * samplingPatterns[samplingIndex].y / float( rtHeight ); |
| 1276 | |
| 1277 | auto currJitterOffset = Vector3( m_jitter.x, m_jitter.y, 0 ); |
| 1278 | |
| 1279 | m_jitterMatrix = TranslationMatrix( currJitterOffset ); |
| 1280 | m_jitteredProjection = m_projection * m_jitterMatrix; |
| 1281 | } |
| 1282 | else |
| 1283 | { |
| 1284 | m_jitterMatrix = IdentityMatrix(); |
| 1285 | m_jitteredProjection = m_projection; |
| 1286 | m_jitter.x = m_jitter.y = 0.0f; |
| 1287 | } |
| 1288 | } |
| 1289 | |
| 1290 | |
| 1291 | // -------------------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected