// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using Microsoft.Xna.Framework.Graphics;
namespace Microsoft.Xna.Framework.Content.Pipeline
{
///
/// Provides access to custom processor parameters, methods for converting member data, and triggering nested builds.
///
public abstract class ContentProcessorContext
{
///
/// Gets the name of the current content build configuration.
///
public abstract string BuildConfiguration { get; }
///
/// Gets the path of the directory that will contain any intermediate files generated by the content processor.
///
public abstract string IntermediateDirectory { get; }
///
/// Gets the logger interface used for status messages or warnings.
///
public abstract ContentBuildLogger Logger { get; }
///
/// Gets the ContentIdentity representing the source asset imported.
///
public abstract ContentIdentity SourceIdentity { get; }
///
/// Gets the output path of the content processor.
///
public abstract string OutputDirectory { get; }
///
/// Gets the output file name of the content processor.
///
public abstract string OutputFilename { get; }
///
/// Gets the collection of parameters used by the content processor.
///
public abstract OpaqueDataDictionary Parameters { get; }
///
/// Gets the current content build target platform.
///
public abstract TargetPlatform TargetPlatform { get; }
///
/// Gets the current content build target profile.
///
public abstract GraphicsProfile TargetProfile { get; }
///
/// Initializes a new instance of ContentProcessorContext.
///
public ContentProcessorContext()
{
}
///
/// Adds a dependency to the specified file. This causes a rebuild of the file, when modified, on subsequent incremental builds.
///
/// Name of an asset file.
public abstract void AddDependency(string filename);
///
/// Add a file name to the list of related output files maintained by the build item. This allows tracking build items that build multiple output files.
///
/// The name of the file.
public abstract void AddOutputFile(string filename);
///
/// Initiates a nested build of the specified asset and then loads the result into memory.
///
/// Type of the input.
/// Type of the converted output.
/// Reference to the source asset.
/// Optional processor for this content.
/// Copy of the final converted content.
/// An example of usage would be a mesh processor calling BuildAndLoadAsset to build any associated textures and replace the original .tga file references with an embedded copy of the converted texture.
public TOutput BuildAndLoadAsset(
ExternalReference sourceAsset,
string processorName
)
{
return BuildAndLoadAsset(sourceAsset, processorName, null, null);
}
///
/// Initiates a nested build of the specified asset and then loads the result into memory.
///
/// Type of the input.
/// Type of the converted output.
/// Reference to the source asset.
/// Optional processor for this content.
/// Optional collection of named values available as input to the content processor.
/// Optional importer for this content.
/// Copy of the final converted content.
/// An example of usage would be a mesh processor calling BuildAndLoadAsset to build any associated textures and replace the original .tga file references with an embedded copy of the converted texture.
public abstract TOutput BuildAndLoadAsset(
ExternalReference sourceAsset,
string processorName,
OpaqueDataDictionary processorParameters,
string importerName
);
///
/// Initiates a nested build of an additional asset.
///
/// Type of the input.
/// Type of the output.
/// Reference to the source asset.
/// Optional processor for this content.
/// Reference to the final compiled content. The build work is not required to complete before returning. Therefore, this file may not be up to date when BuildAsset returns but it will be available for loading by the game at runtime.
/// An example of usage for BuildAsset is being called by a mesh processor to request that any related textures used are also built, replacing the original TGA file references with new references to the converted texture files.
public ExternalReference BuildAsset(
ExternalReference sourceAsset,
string processorName
)
{
return BuildAsset(sourceAsset, processorName, null, null, null);
}
///
/// Initiates a nested build of an additional asset.
///
/// Type of the input.
/// Type of the output.
/// Reference to the source asset.
/// Optional processor for this content.
/// Optional collection of named values available as input to the content processor.
/// Optional importer for this content.
/// Optional name of the final compiled content.
/// Reference to the final compiled content. The build work is not required to complete before returning. Therefore, this file may not be up to date when BuildAsset returns but it will be available for loading by the game at runtime.
/// An example of usage for BuildAsset is being called by a mesh processor to request that any related textures used are also built, replacing the original TGA file references with new references to the converted texture files.
public abstract ExternalReference BuildAsset(
ExternalReference sourceAsset,
string processorName,
OpaqueDataDictionary processorParameters,
string importerName,
string assetName
);
///
/// Converts a content item object using the specified content processor.
///
/// Type of the input content.
/// Type of the converted output.
/// Source content to be converted.
/// Optional processor for this content.
/// Reference of the final converted content.
public TOutput Convert(
TInput input,
string processorName
)
{
return Convert(input, processorName, new OpaqueDataDictionary());
}
///
/// Converts a content item object using the specified content processor.
///
/// Type of the input content.
/// Type of the converted output.
/// Source content to be converted.
/// Optional processor for this content.
/// Optional parameters for the processor.
/// Reference of the final converted content.
public abstract TOutput Convert(
TInput input,
string processorName,
OpaqueDataDictionary processorParameters
);
}
}