| 19 | } |
| 20 | |
| 21 | TriStepResult TriStepClear::Execute( Be::Time realTime, Be::Time simTime, Tr2RenderContext& renderContext ) |
| 22 | { |
| 23 | unsigned int flags = 0; |
| 24 | |
| 25 | using namespace Tr2RenderContextEnum; |
| 26 | if( m_isColorCleared ) |
| 27 | { |
| 28 | flags |= CLEARFLAGS_TARGET; |
| 29 | } |
| 30 | |
| 31 | if( m_isDepthCleared ) |
| 32 | { |
| 33 | flags |= CLEARFLAGS_ZBUFFER; |
| 34 | } |
| 35 | |
| 36 | if( m_isStencilCleared ) |
| 37 | { |
| 38 | flags |= CLEARFLAGS_STENCIL; |
| 39 | } |
| 40 | |
| 41 | uint32_t c = Color( |
| 42 | max( min( m_color.r, 1.0f ), 0.0f ), |
| 43 | max( min( m_color.g, 1.0f ), 0.0f ), |
| 44 | max( min( m_color.b, 1.0f ), 0.0f ), |
| 45 | max( min( m_color.a, 1.0f ), 0.0f ) ); |
| 46 | |
| 47 | HRESULT hr = renderContext.Clear( flags, c, m_depth, m_stencil ); |
| 48 | if( !SUCCEEDED( hr ) ) |
| 49 | { |
| 50 | CCP_LOGERR( "Clear failed" ); |
| 51 | } |
| 52 | return RS_OK; |
| 53 | } |