protected static bool ParseAmbient( string parameters, MaterialScriptContext context )
{
string[] values = parameters.Split( new char[] { ' ', '\t' } );
// must be 1, 3 or 4 parameters
if ( values.Length == 1 )
{
if ( values[ 0 ].ToLower() == "vertexcolour" ||
values[ 0 ].ToLower() == "vertexcolor" )
{
context.pass.VertexColorTracking |= TrackVertexColor.Ambient;
}
else
{
LogParseError( context, "Bad ambient attribute, single parameter flag must be 'vertexcolour' or 'vertexcolor'." );
}
}
else if ( values.Length == 3 || values.Length == 4 )
{
context.pass.Ambient = StringConverter.ParseColor( values );
context.pass.VertexColorTracking &= ~TrackVertexColor.Ambient;
}
else
{
LogParseError( context, "Bad ambient attribute, wrong number of parameters (expected 1, 3 or 4)." );
}
return false;
}