Content Pipeline . Overview


Introduction

Content pipeline is process to convert any native content format like .png and .obj to general content format .bin, or steadfastly use native content format. Content building should be carried out when development phase. So loading and reading content get best performance on runtime.

Project structure

Usually, project file name is YourProjectName.Content.xml in under YourProjectName folder.

<?xml version="1.0" encoding="utf-8"?>
<ContentProject>
  <Name>YourProjectName.Content</Name>
  <InputDirectory>YourProjectName.Content</InputDirectory>
  <OutputDirectory>bin</OutputDirectory>
  <ContentRootDirectory></ContentRootDirectory>
  <Configuration>Release</Configuration>
  <TargetPlatform>Windows</TargetPlatform>
  <References>
  </References>
  <Items>
  </Items>
</ContentProject>

Add content

All content like meshes, images, audio, font, and effects is done on Items markup.

<Item Include="\Textures\Impression.png">
  <Name>Impression</Name>
  <BuildAction>Compile</BuildAction>
  <Importer Name="TextureImporter">
  </Importer>
  <Processor Name="TextureProcessor">
  </Processor>
</Item>

Include path is relative by content project folder and detail of Importer and Processor see next section. We recommend naming convention of filename on Include and Name is equal. BuildAction can be None, Compile, or Copy.

  1. Compile, content will be compiled as .bin and copy it to OutputDirectory
  2. Copy, content will not be compiled as .bin, but steadfastly use native content format. Actually only copy the content to OutputDirectory
  3. None, content will not be Compiled or Copy

Add custom content pipeline importer or processor

Add your library .dll path to References markup. See code below.

....
<References>
  <Reference>{path-to}\LevelImporter.dll</Reference>
</References>
....

Reference path must be absolute.