| 443 | } |
| 444 | |
| 445 | void 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 | |
| 472 | void Tr2Sprite2dScene::PopDepthRange() |
| 473 | { |
no test coverage detected