public override bool PreAddToRenderState( TargetRenderState targetRenderState, Pass srcPass, Pass dstPass )
{
//count the number of texture units we need to process
int validTexUnits = 0;
for ( int i = 0; i < srcPass.TextureUnitStatesCount; i++ )
{
if ( IsProcessingNeeded( srcPass.GetTextureUnitState( i ) ) )
{
validTexUnits++;
}
}
SetTextureUnitCount( validTexUnits );
//Build texture stage sub states
for ( int i = 0; i < srcPass.TextureUnitStatesCount; i++ )
{
TextureUnitState texUnitState = srcPass.GetTextureUnitState( i );
if ( IsProcessingNeeded( texUnitState ) )
{
SetTextureUnit( i, texUnitState );
}
}
return true;
}