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

Function ApplyBloom

trinity/PostProcess/Tr2PostProcessRenderer.cpp:323–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323void ApplyBloom( const Tr2PPBloomEffect* bloom, Tr2Effect* tonemappingEffect, bool newBloom, Tr2PostProcessRenderer::BloomDebugMode debugMode )
324{
325 if( bloom != nullptr )
326 {
327 tonemappingEffect->SetParameter( MEMOIZED_STRING( "GrimeWeight" ), bloom->m_grimeWeight );
328 tonemappingEffect->SetParameter( MEMOIZED_STRING( "BloomBrightness" ), newBloom ? 1.0f : bloom->m_bloomBrightness );
329 tonemappingEffect->SetResourceTexture2D( MEMOIZED_STRING( "Grime" ), bloom->m_grimePath.c_str() );
330
331 if( debugMode != Tr2PostProcessRenderer::BloomDebugMode::BLOOM_DEBUG_NONE )
332 {
333 // when rendering bloom debug we render it into the blit current,
334 // so to not have tonemapping applied on top of it we need to set the blit original to the bloom result
335 if( auto blitCurrent = tonemappingEffect->GetResourceByName( "BlitOriginal" ) )
336 {
337 if( TriTextureParameterPtr resource = BlueCastPtr( blitCurrent ) )
338 {
339 tonemappingEffect->SetParameter( MEMOIZED_STRING( "BlitOriginal" ), resource->GetResource() );
340 }
341 }
342 }
343 }
344 else
345 {
346 tonemappingEffect->SetResourceTexture2D( MEMOIZED_STRING( "Grime" ), "res:/texture/global/black.dds" );
347 }
348}
349
350void ApplyDynamicExposure( const Tr2PPDynamicExposureEffect* dynamicExposure, Tr2Effect* tonemappingEffect, float postprocessExposureAmount )
351{

Callers 1

RenderTonemappingMethod · 0.85

Calls 4

SetResourceTexture2DMethod · 0.80
GetResourceByNameMethod · 0.80
SetParameterMethod · 0.45
GetResourceMethod · 0.45

Tested by

no test coverage detected