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

Method PushDepthRange

trinity/Sprite2d/Tr2Sprite2dScene.cpp:445–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443}
444
445void Tr2Sprite2dScene::PushDepthRange( float depthMin, float depthMax )
446{
447 //CCP_STATS_ZONE( __FUNCTION__ );
448
449 if( m_is2dRenderContext )
450 {
451 return;
452 }
453
454 CCP_ASSERT( depthMin >= -1.0f );
455 CCP_ASSERT( depthMin <= 1.0f );
456 CCP_ASSERT( depthMax >= -1.0f );
457 CCP_ASSERT( depthMax <= 1.0f );
458
459 // To simplify the code below the stack is primed with scene values for depth range
460 CCP_ASSERT( !m_depthStack->empty() );
461
462 // Relative range is from -1 to 1
463 float normDepthMin = 0.5f * ( depthMin + 1.0f );
464 float normDepthMax = 0.5f * ( depthMax + 1.0f );
465
466 const Vector2& currentDepthValues = m_depthStack->back();
467 float depthRange = currentDepthValues.y - currentDepthValues.x;
468 Vector2 range( currentDepthValues.x + depthRange * normDepthMin, currentDepthValues.x + depthRange * normDepthMax );
469 m_depthStack->push_back( range );
470}
471
472void Tr2Sprite2dScene::PopDepthRange()
473{

Callers 1

GatherSpritesHelperMethod · 0.80

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected