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

Method AddLight

trinity/Tr2LightManager.cpp:334–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334void Tr2LightManager::AddLight( PerLightData& data )
335{
336 if( !AreLightFlagsValid( data.flags ) )
337 {
338 return;
339 }
340
341 float brightness = std::max( std::max( data.color.x, data.color.y ), data.color.z );
342 if( brightness <= 0 || data.radius <= 0 )
343 {
344 return;
345 }
346 if( !m_frustum.IsSphereVisible( reinterpret_cast<Vector4*>( &data.position ) ) )
347 {
348 return;
349 }
350
351 float size = m_frustum.GetPixelSizeAccross( reinterpret_cast<Vector4*>( &data.position ) );
352 if( size > m_adjustedCutoff )
353 {
354 float dimming = std::min( ( size - m_adjustedCutoff ) / FADE_SIZE, 1.f );
355 data.color.x *= data.radius * dimming;
356 data.color.y *= data.radius * dimming;
357 data.color.z *= data.radius * dimming;
358
359 bool usingShadowMap = m_currentSpaceSceneShadowQuality == ShadowQuality::SHADOW_LOW || m_currentSpaceSceneShadowQuality == ShadowQuality::SHADOW_HIGH;
360 if( m_currentSpaceSceneShadowQuality == ShadowQuality::SHADOW_DISABLED ||
361 ( usingShadowMap && m_ShadowMap.m_qualityUsedByAtlas == ShadowQuality::SHADOW_DISABLED ) ||
362 !g_useDynamicLightsShadows )
363 {
364 data.flags &= ~Tr2LightManager::FLAG_CASTS_SHADOWS;
365 }
366 m_tlsLightData.local().push_back( data );
367 }
368}
369
370ALResult Tr2LightManager::ClearLightIndices( Tr2RenderContext& renderContext )
371{

Callers

nothing calls this directly

Calls 2

IsSphereVisibleMethod · 0.80
GetPixelSizeAccrossMethod · 0.80

Tested by

no test coverage detected