MaterialProcessor

class MaterialProcessor : Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor<MaterialContent, MaterialContent>, IContentProcessor

Provides methods and properties for maintaining a collection of named texture references.

Color ColorKeyColor

Gets or sets the color value to replace with transparent black.

Value:Color value of the material to replace with transparent black.
bool ColorKeyEnabled

Specifies whether color keying of a texture is enabled.

Value:true if color keying is enabled; false otherwise.
MaterialProcessorDefaultEffect DefaultEffect

The default effect type for this instance of MaterialProcessor.

Value:The default effect type.
bool GenerateMipmaps

Specifies if a full chain of mipmaps are generated from the source material. Existing mipmaps of the material are not replaced.

Value:true if mipmap generation is enabled; false otherwise.
bool PremultiplyTextureAlpha

Specifies whether alpha premultiply of textures is enabled.

Value:true if alpha premultiply is enabled; false otherwise.
bool ResizeTexturesToPowerOfTwo

Specifies whether resizing of a material is enabled. Typically used to maximize compatability with a graphics card because many graphics cards do not support a material size that is not a power of two. If ResizeTexturesToPowerOfTwo is enabled, the material is resized to the next largest power of two.

Value:true if resizing is enabled; false otherwise.
TextureProcessorOutputFormat TextureFormat

Specifies the texture format of output materials. Materials can either be left unchanged from the source asset, converted to a corresponding Color, or compressed using the appropriate DxtCompressed format.

Value:The texture format of the output.
public MaterialContent Process(MaterialContent input, ContentProcessorContext context)

Builds the texture and effect content for the material.

Parameters:
  • input (Microsoft.Xna.Framework.Content.Pipeline.Graphics.MaterialContent) – The material content to build.
  • context (Microsoft.Xna.Framework.Content.Pipeline.ContentProcessorContext) – Context for the specified processor.
Returns:

The built material.

public MaterialContent CreateDefaultMaterial(MaterialProcessorDefaultEffect effect)

Helper method which returns the material for a default effect.

Parameters:
  • effect (Microsoft.Xna.Framework.Content.Pipeline.Processors.MaterialProcessorDefaultEffect) –
Returns:

A material.

public MaterialProcessorDefaultEffect GetDefaultEffect(MaterialContent content)

Helper method which returns the default effect for a material.

Parameters:
  • content (Microsoft.Xna.Framework.Content.Pipeline.Graphics.MaterialContent) –
Returns:

The default effect.