MCPcopy Create free account
hub / github.com/carbonengine/trinity / RenderGodRays

Method RenderGodRays

trinity/PostProcess/Tr2PostProcessRenderer.cpp:1146–1171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1144}
1145
1146void 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
1173void Tr2PostProcessRenderer::RenderSignalLoss( const Tr2TextureAL& dest, Tr2RenderContext& renderContext, Tr2PPSignalLossEffect* signalLoss )
1174{

Callers

nothing calls this directly

Calls 11

TextureSize2DClass · 0.85
DrawIntoFunction · 0.85
ApplyStandardStatesMethod · 0.80
GetTempTextureMethod · 0.80
SetResourceTexture2DMethod · 0.80
Vector4Class · 0.50
GetFormatMethod · 0.45
PushRenderTargetMethod · 0.45
ClearMethod · 0.45
SetParameterMethod · 0.45
PopRenderTargetMethod · 0.45

Tested by

no test coverage detected