protected static bool ParseFogOverride( string parameters, MaterialScriptContext context )
{
string[] values = parameters.ToLower().Split( new char[] { ' ', '\t' } );
if ( values[ 0 ] == "true" )
{
// if true, we need to see if they supplied all arguments, or just the 1... if just the one,
// Assume they want to disable the default fog from effecting this material.
if ( values.Length == 8 )
{
// lookup the real enum equivalent to the script value
object val = ScriptEnumAttribute.Lookup( values[ 1 ], typeof( FogMode ) );
// if a value was found, assign it
if ( val != null )
{
FogMode mode = (FogMode)val;
context.pass.SetFog(
true,
mode,
new ColorEx( StringConverter.ParseFloat( values[ 2 ] ), StringConverter.ParseFloat( values[ 3 ] ), StringConverter.ParseFloat( values[ 4 ] ) ),
StringConverter.ParseFloat( values[ 5 ] ),
StringConverter.ParseFloat( values[ 6 ] ),
StringConverter.ParseFloat( values[ 7 ] ) );
}
else
{
string legalValues = ScriptEnumAttribute.GetLegalValues( typeof( FogMode ) );
LogParseError( context, "Bad fogging attribute, valid parameters are {0}.", legalValues );
}
}
else
{
context.pass.SetFog( true );
}
}
else if ( values[ 0 ] == "false" )
{
context.pass.SetFog( false );
}
else
{
LogParseError( context, "Bad fog_override attribute, valid parameters are 'true' and 'false'." );
}
return false;
}