共用方式為


Parameterized Processors

Describes how parameterized processors work in XNA Game Studio. Many of the standard Content Pipeline content processors shipped with XNA Game Studio support parameter usage. Parameterization makes any standard or custom processor more flexible and better able to meet the needs of your XNA Framework application. In addition to specifying values for standard parameters, you can easily implement parameter support for a new or an existing custom processor. For more information, see Developing with Parameterized Processors.

When you select a game asset, the Properties window displays the parameters for the related asset processor. Use the Properties window at any time to modify these parameter values.

Note

If you change the processor for a game asset to a different processor, all parameter values are reset to their default values. This means that if you modify the Generate Mipmaps parameter value for the TextureProcessor and then switch to a different processor (for example, FontTextureProcessor Class), the parameters switch to the default values for that processor. If you then swith back again, the modified values are reset to the default values of the original processor. The values do not revert to the modified values you set originally.

Standard Parameterized Processors

The following describes only standard processors that accept parameters, the parameter types, and their default value. For more information about all standard processors, see Standard Importers and Processors.

Friendly name Type name Input type Output type Description
Model ModelProcessor NodeContent Class ModelContent Class

A parameterized processor that outputs models as a ModelContent Class object.

Available parameters:

  • Color Key Color–Any valid Color. Magenta is the default value.
  • Color Key Enabled–A Boolean value indicating if color keying is enabled. The default value is true.
  • Generate Mipmaps–A Boolean value indicating if mipmaps are generated. The default value is false.
  • Generate Tangent Frames–A Boolean value indicating if tangent frames are generated. The default value is false.
  • Resize Textures to Power of Two–A Boolean value indicating if a texture is resized to the next largest power of 2. The default value is false.
  • Scale–Any valid float value. The default value is 1.0.
  • Swap Winding Order–A Boolean value indicating if the winding order is swapped. This is useful for models that appear to be drawn inside out. The default value is false.
  • Texture Format–Any valid value from TextureProcessorOutputFormat. Textures are either unchanged, converted to the Color format, or DXT Compressed.
  • X Axis Rotation–Number, in degrees of rotation. The default value is 0.
  • Y Axis Rotation–Number, in degrees of rotation. The default value is 0.
  • Z Axis Rotation–Number, in degrees of rotation. The default value is 0.
Sprite Font Texture FontTextureProcessor TextureContent Class SpriteFontContent

A parameterized processor that outputs a sprite font texture as a SpriteFontContent object.

Available parameters:

  • First Character–Any valid character. The space character is the default value.
Texture TextureProcessor TextureContent Class TextureContent Class

A parameterized processor that outputs textures as a TextureContent Class object.

Available parameters:

  • Color Key Color–Any valid Color. Magenta is the default value.
  • Color Key Enabled–A Boolean value indicating if color keying is enabled. The default value is true.
  • Generate Mipmaps–A Boolean value indicating if mipmaps are generated. The default value is false.
  • Resize to Power of Two–A Boolean value indicating if a texture is resized to the next largest power of 2. The default value is false.
  • Texture Format–Any valid value from TextureProcessorOutputFormat. Textures are unchanged, converted to the Color format, or DxtCompressed.

Texture Processing with XNA Game Studio

In XNA Game Studio 2.0 or earlier, the following standard processors were used for texture processing.

  • TextureProcessor
  • ModelTextureProcessor
  • SpriteTextureProcessor

In XNA Game Studio, the Texture - XNA Framework processor replaces the functionality of this entire group. For new XNA Game Studio projects and for projects converted by the Project Upgrade Wizard for XNA Game Studio 2.0, the correct processor is selected automatically. For existing custom processors that make calls to any processor from the list above, however, the code must be modified to use the new TextureProcessor with the proper parameters. The following describes the parameter values required for emulating each previous texture processor.

Processor type name Required parameters and values
TextureProcessor

Call the Texture (TextureProcessor) with the following parameter values:

  • GenerateMipmaps: false
  • Destination format: NoChange
  • Colorkey Enabled: false
  • Colorkey Value: Magenta
  • Resize: false
ModelTextureProcessor

Call the Texture (TextureProcessor) with the following parameter values:

SpriteTextureProcessor

Call the Texture (TextureProcessor) with the following parameter values:

  • Destination format: Color
  • Colorkey Enabled: true
  • Colorkey Value: Magenta

For more information about modifying and declaring parameter values programmatically, see Developing with Parameterized Processors.

See Also

Adding Content to a Game