Axiom.Serialization.MaterialSerializer.ParseFiltering C# (CSharp) Метод

ParseFiltering() приватный Метод

private ParseFiltering ( string parameters, MaterialScriptContext context ) : bool
parameters string
context MaterialScriptContext
Результат bool
		protected static bool ParseFiltering( string parameters, MaterialScriptContext context )
		{
			string[] values = parameters.ToLower().Split( new char[] { ' ', '\t' } );

			if ( values.Length == 1 )
			{
				// lookup the real enum equivalent to the script value
				object val = ScriptEnumAttribute.Lookup( values[ 0 ], typeof( TextureFiltering ) );

				// if a value was found, assign it
				if ( val != null )
				{
					context.textureUnit.SetTextureFiltering( (TextureFiltering)val );
				}
				else
				{
					string legalValues = ScriptEnumAttribute.GetLegalValues( typeof( TextureFiltering ) );
					LogParseError( context, "Bad filtering attribute, valid filtering values are {0}.", legalValues );
					return false;
				}
			}
			else if ( values.Length == 3 )
			{
				// complex format
				object val1 = ScriptEnumAttribute.Lookup( values[ 0 ], typeof( FilterOptions ) );
				object val2 = ScriptEnumAttribute.Lookup( values[ 1 ], typeof( FilterOptions ) );
				object val3 = ScriptEnumAttribute.Lookup( values[ 2 ], typeof( FilterOptions ) );

				if ( val1 == null || val2 == null || val3 == null )
				{
					string legalValues = ScriptEnumAttribute.GetLegalValues( typeof( FilterOptions ) );
					LogParseError( context, "Bad filtering attribute, valid values for filter options are {0}", legalValues );
					return false;
				}
				else
				{
					context.textureUnit.SetTextureFiltering( (FilterOptions)val1, (FilterOptions)val2, (FilterOptions)val3 );
				}
			}
			else
			{
				LogParseError( context, "Bad filtering attribute, wrong number of paramters (expected 1 or 3)." );
			}

			return false;
		}