protected static bool ParsePass( string parameters, MaterialScriptContext context )
{
// get the pass name
string[] values = parameters.Split( new char[] { ' ', '\t' } );
// if params is not empty then see if the pass name already exists
if ( values.Length > 0 && values[ 0 ].Length > 0 && context.technique.PassCount > 0 )
{
// find the pass with name = params
Pass foundPass = context.technique.GetPass( values[ 0 ] );
if ( foundPass != null )
context.passLev = foundPass.Index;
else
// name was not found so a new pass is needed
// position pass level to the end index
// a new pass will be created later on
context.passLev = context.technique.PassCount;
}
else
{
// increase the pass level depth;
context.passLev++;
}
if ( context.technique.PassCount > context.passLev )
{
context.pass = context.technique.GetPass( context.passLev );
}
else
{
// create a new pass
context.pass = context.technique.CreatePass();
if ( values.Length > 0 && values[ 0 ].Length > 0 )
context.pass.Name = values[ 0 ];
}
// update section
context.section = MaterialScriptSection.Pass;
// return true because this must be followed by a {
return true;
}