| 1144 | } |
| 1145 | |
| 1146 | void Tr2PostProcessRenderer::RenderGodRays( const Tr2TextureAL& dest, const Tr2TextureAL& depth, Tr2GpuResourcePool& gpuResourcePool, Tr2RenderContext& renderContext, Tr2PPGodRaysEffect* godrays ) |
| 1147 | { |
| 1148 | GPU_REGION( renderContext, "Godrays" ); |
| 1149 | renderContext.m_esm.ApplyStandardStates( Tr2EffectStateManager::RM_FULLSCREEN ); |
| 1150 | |
| 1151 | // Downsample depth |
| 1152 | auto rt1 = DownSampleDepth( depth, gpuResourcePool, renderContext ); |
| 1153 | |
| 1154 | // God rays |
| 1155 | auto rt2 = gpuResourcePool.GetTempTexture( "God rays", TextureSize2D( dest.GetDesc() ) * 0.5f, dest.GetFormat(), RENDER_TARGET ); |
| 1156 | renderContext.m_esm.PushRenderTarget( rt2 ); |
| 1157 | renderContext.Clear( Tr2RenderContextEnum::CLEARFLAGS_TARGET, 0, 0 ); // clear is needed because godray vertex shader can opt out of rendering |
| 1158 | |
| 1159 | m_godrayEffect->SetParameter( MEMOIZED_STRING( "Color" ), Vector4( godrays->m_godRayColor ) ); |
| 1160 | m_godrayEffect->SetParameter( MEMOIZED_STRING( "Intensity" ), Vector4( godrays->m_intensity, 0.0f, 1.0f, 1.0f ) ); |
| 1161 | m_godrayEffect->SetParameter( MEMOIZED_STRING( "grFactors" ), godrays->grFactors ); |
| 1162 | m_godrayEffect->SetResourceTexture2D( MEMOIZED_STRING( "NoiseTexMap" ), godrays->m_noiseTexturePath.c_str() ); |
| 1163 | TEMP_PARAM( m_godrayEffect, "DepthMap", rt1 ); |
| 1164 | |
| 1165 | Tr2Renderer::DrawScreenQuad( renderContext, m_godrayEffect ); |
| 1166 | renderContext.m_esm.PopRenderTarget(); |
| 1167 | |
| 1168 | // Blit |
| 1169 | renderContext.m_esm.ApplyStandardStates( Tr2EffectStateManager::RM_ALPHA_ADDITIVE ); |
| 1170 | DrawInto( dest, Tr2LoadAction::LOAD, rt2, renderContext ); |
| 1171 | } |
| 1172 | |
| 1173 | void Tr2PostProcessRenderer::RenderSignalLoss( const Tr2TextureAL& dest, Tr2RenderContext& renderContext, Tr2PPSignalLossEffect* signalLoss ) |
| 1174 | { |
nothing calls this directly
no test coverage detected