コード例 #1
0
	void SetStencilState( CMatRenderContextPtr &pRenderContext  )
	{
		pRenderContext->SetStencilEnable( m_bEnable );
		pRenderContext->SetStencilFailOperation( m_FailOp );
		pRenderContext->SetStencilZFailOperation( m_ZFailOp );
		pRenderContext->SetStencilPassOperation( m_PassOp );
		pRenderContext->SetStencilCompareFunction( m_CompareFunc );
		pRenderContext->SetStencilReferenceValue( m_nReferenceValue );
		pRenderContext->SetStencilTestMask( m_nTestMask );
		pRenderContext->SetStencilWriteMask( m_nWriteMask );
	}
コード例 #2
0
void CGodRaysView::SetupStencilBuffer( CMatRenderContextPtr & pRenderContext )
{
	// Enable the stencil buffer.
	pRenderContext->SetStencilEnable( true );

	// Any time we pass, write the reference value to that location.
	pRenderContext->SetStencilPassOperation( STENCILOPERATION_REPLACE );

	// Always pass the test and run the pass operation.
	pRenderContext->SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_ALWAYS );

	// This is the value to write.
	pRenderContext->SetStencilReferenceValue( 1 );

	// Which bits of the reference value to write. We want all of the bits.
	pRenderContext->SetStencilWriteMask( 1 );

	// Any time we fail, keep whatever is there. This should never happen
	// but just in case..
	pRenderContext->SetStencilFailOperation( STENCILOPERATION_KEEP );
	pRenderContext->SetStencilZFailOperation( STENCILOPERATION_KEEP );
}