Axiom.Graphics.CompositorScriptLoader.ParseTextureLine C# (CSharp) Method

ParseTextureLine() static private method

static private ParseTextureLine ( Axiom.Graphics.CompositorScriptContext context, string args ) : void
context Axiom.Graphics.CompositorScriptContext
args string
return void
		static void ParseTextureLine( CompositorScriptContext context, string[] args )
		{
			int widthPos = 1, heightPos = 2, formatPos = 3;
			if ( args.Length == 4 || args.Length == 6 )
			{
				if ( args.Length == 6 )
				{
					heightPos += 1;
					formatPos += 2;
				}

				CompositionTechnique.TextureDefinition textureDef = context.technique.CreateTextureDefinition( args[ 0 ] );
				if ( args[ widthPos ] == "target_width" )
				{
					textureDef.Width = 0;
					textureDef.WidthFactor = 1.0f;
				}
				else if ( args[ widthPos ] == "target_width_scaled" )
				{
					textureDef.Width = 0;
					textureDef.WidthFactor = ParseFloat( context, args[ widthPos + 1 ] );
				}
				else
				{
					textureDef.Width = ParseInt( context, args[ widthPos ] );
					textureDef.WidthFactor = 1.0f;
				}

				if ( args[ heightPos ] == "target_height" )
				{
					textureDef.Height = 0;
					textureDef.HeightFactor = 1.0f;
				}
				else if ( args[ heightPos ] == "target_height_scaled" )
				{
					textureDef.Height = 0;
					textureDef.HeightFactor = ParseFloat( context, args[ heightPos + 1 ] );
				}
				else
				{
					textureDef.Height = ParseInt( context, args[ heightPos ] );
					textureDef.HeightFactor = 1.0f;
				}

				switch ( args[ formatPos ] )
				{
					case "PF_A8R8G8B8":
						textureDef.PixelFormats.Add( PixelFormat.A8R8G8B8 );
						break;
					case "PF_R8G8B8A8":
						textureDef.PixelFormats.Add( Axiom.Media.PixelFormat.R8G8B8A8 );
						break;
					case "PF_R8G8B8":
						textureDef.PixelFormats.Add( Axiom.Media.PixelFormat.R8G8B8 );
						break;
					case "PF_FLOAT16_RGBA":
						textureDef.PixelFormats.Add( Axiom.Media.PixelFormat.FLOAT16_RGBA );
						break;
					case "PF_FLOAT16_RGB":
						textureDef.PixelFormats.Add( Axiom.Media.PixelFormat.FLOAT16_RGB );
						break;
					case "PF_FLOAT32_RGBA":
						textureDef.PixelFormats.Add( Axiom.Media.PixelFormat.FLOAT32_RGBA );
						break;
					case "PF_FLOAT16_R":
						textureDef.PixelFormats.Add( Axiom.Media.PixelFormat.FLOAT16_R );
						break;
					case "PF_FLOAT32_R":
						textureDef.PixelFormats.Add( Axiom.Media.PixelFormat.FLOAT32_R );
						break;
					default:
						LogError( context, "Unsupported texture pixel format '{0}'", args[ formatPos ] );
						break;
				}
			}
		}