protected static bool ParseAlphaRejection( string parameters, MaterialScriptContext context )
{
string[] values = parameters.Split( new char[] { ' ', '\t' } );
if ( values.Length != 2 )
{
LogParseError( context, "Bad alpha_rejection attribute, wrong number of parameters (expected 2)." );
return false;
}
// lookup the real enum equivalent to the script value
object val = ScriptEnumAttribute.Lookup( values[ 0 ], typeof( CompareFunction ) );
// if a value was found, assign it
if ( val != null )
{
context.pass.SetAlphaRejectSettings( (CompareFunction)val, byte.Parse( values[ 1 ] ) );
}
else
{
string legalValues = ScriptEnumAttribute.GetLegalValues( typeof( CompareFunction ) );
LogParseError( context, "Bad alpha_rejection attribute, valid parameters are {0}.", legalValues );
}
return false;
}