Note This is one example where the separation between the importer and the processor proves useful. in Word

Encoder DataMatrix in Word Note This is one example where the separation between the importer and the processor proves useful.

Note This is one example where the separation between the importer and the processor proves useful.
Data Matrix 2d Barcode Creator In None
Using Barcode creator for Microsoft Word Control to generate, create Data Matrix 2d barcode image in Word applications.
www.OnBarcode.com
UPC - 13 Generation In None
Using Barcode generator for Office Word Control to generate, create EAN-13 Supplement 5 image in Microsoft Word applications.
www.OnBarcode.com
Both XImporter and FbxImporter load data from disk and format the data into a simple NodeContent object, which is in both cases passed to ModelProcessor, which does the heavy work.
USS Code 128 Generation In None
Using Barcode maker for Office Word Control to generate, create Code 128 Code Set C image in Microsoft Word applications.
www.OnBarcode.com
Printing Barcode In None
Using Barcode creation for Office Word Control to generate, create Barcode image in Microsoft Word applications.
www.OnBarcode.com
Table 3-1. The Default Content Importers and Processors in the XNA Framework
Painting Data Matrix 2d Barcode In None
Using Barcode creator for Microsoft Word Control to generate, create Data Matrix 2d barcode image in Word applications.
www.OnBarcode.com
Generate Code39 In None
Using Barcode creator for Microsoft Word Control to generate, create Code 39 image in Office Word applications.
www.OnBarcode.com
Content Importer
QR Printer In None
Using Barcode maker for Office Word Control to generate, create QR Code image in Office Word applications.
www.OnBarcode.com
Postnet Creation In None
Using Barcode encoder for Office Word Control to generate, create Postnet 3 of 5 image in Office Word applications.
www.OnBarcode.com
TextureImporter XImporter
Data Matrix ECC200 Generation In None
Using Barcode drawer for Online Control to generate, create DataMatrix image in Online applications.
www.OnBarcode.com
Data Matrix ECC200 Maker In Java
Using Barcode maker for Java Control to generate, create DataMatrix image in Java applications.
www.OnBarcode.com
Input (File)
EAN128 Generator In None
Using Barcode creator for Software Control to generate, create EAN / UCC - 13 image in Software applications.
www.OnBarcode.com
UPC-A Supplement 2 Drawer In None
Using Barcode creation for Font Control to generate, create UPCA image in Font applications.
www.OnBarcode.com
.bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, .tga .x
Generate UPCA In None
Using Barcode drawer for Software Control to generate, create UPC Symbol image in Software applications.
www.OnBarcode.com
EAN / UCC - 14 Maker In .NET Framework
Using Barcode encoder for Reporting Service Control to generate, create USS-128 image in Reporting Service applications.
www.OnBarcode.com
Output (DOM Object)
ANSI/AIM Code 39 Recognizer In Java
Using Barcode decoder for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
PDF-417 2d Barcode Encoder In Java
Using Barcode encoder for Java Control to generate, create PDF417 image in Java applications.
www.OnBarcode.com
TextureContent NodeContent
Matrix Maker In Java
Using Barcode printer for Java Control to generate, create Matrix 2D Barcode image in Java applications.
www.OnBarcode.com
Quick Response Code Creator In Objective-C
Using Barcode printer for iPhone Control to generate, create QR Code image in iPhone applications.
www.OnBarcode.com
C HA PTER 3 WORKING WITH 2D IMA GES/TEXTU RES IN XN A 2.0
Data Matrix Scanner In VB.NET
Using Barcode scanner for .NET framework Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Generate Code 128 In .NET Framework
Using Barcode creator for Reporting Service Control to generate, create Code128 image in Reporting Service applications.
www.OnBarcode.com
Table 3-1. The Default Content Importers and Processors in the XNA Framework
Content Importer
FbxImporter EffectImporter FontDescriptionImporter XmlImporter XACT Project
Input (File)
.fbx .fx .spritefont .xml .xap
Output (DOM Object)
NodeContent EffectContent FontDescription User-defined Audio project
Content Processor
TextureProcessor ModelProcessor EffectProcessor PassThroughProcessor FontDescriptionProcessor FontTextureProcessor FontTextureProcessor
Input (DOM Object)
TextureContent NodeContent EffectContent Any FontDescription TextureContent Texture2DContent
Output (Game OM)
TextureContent ModelContent CompiledEffect Any SpriteFontContent SpriteFontContent SpriteFontContent
The XNA content pipeline comes with default serializers that can write those objects into a binary file at compile time and with default deserializers that can re-create your objects from such a binary file at runtime.
Using the Default Content Pipeline Framework Components
The key to writing/extending a content processor is in using the default objects as much as possible so you can reuse the components already in the content pipeline. In this recipe, you will extend the default TextureProcessor so you can perform some changes on the image data before it is loaded into your XNA project. During compile time, you want the image to be read from file and its contents to be shaped in a 2D array so it becomes an image, and you want to change some pixels and save the resulting image to an .xnb file. When it comes to running your project, the .xnb file will be read from file, containing the changes you made. For the first part, reading the file from disk and transforming it into a 2D array of colors (whatever the format of the image file might be), you should use the default importer for textures. Next, however, you will need to extend TextureProcessor. Because this recipe focuses on setting up a custom content pipeline, you will simply switch all black colors to white. For a more realistic texture processor, see the next recipe. You will want to make sure the final product of your processor is a TextureContent object so you can use the default serializer to save it as an .xnb file and use the default deserializer to load that .xnb file into the game during game startup. Figure 3-6 shows this whole process. Locate the processor you re going to extend, as well as the components you ll borrow from XNA.
CHAPTER 3 WORKING WITH 2D IMAGES /TEXTURES IN XNA 2.0
C O M P I L E
Image File T I M E
Default Image Importer Texture Content Object ExtendedTextureProcessor TextureContent Object
Binary file (.xnb) R U N T I M E
TypeWriter (Serializer)
TypeReader (Deserializer) Texture2D Object XNA Game Project
Figure 3-6. The location in the content pipeline of the processor you ll overwrite I ll show images like Figure 3-6 throughout this book each time you ll be working on a content pipeline so you can easily visualize on which parts you ll be working.
Extending an Existing Content Processor
To extend an already existing content processor, a few short initialization steps are required. Although the steps will be straightforward for the experienced .NET programmer, I will list them here so you can refer to this section from all other recipes that involve extending a content processor. If you follow this list, you shouldn t have any trouble getting your custom content pipeline to work. Each step in the list will be explained in the following sections. 1. Add a new content pipeline project to your solution. 2. In the new project, add a reference to Microsoft.XNA.Framework.Content.Pipeline. 3. Add the pipeline namespaces to the using block. 4. Indicate which part you re going to extend (which method you re going to override). 5. Compile the new content pipeline project. 6. Add the newly created assembly to your main project. 7. Select the newly created processor to process an asset. 8. Set the project dependencies. 9. And after everything has been initialized, code the method you ve created in step 4.
C HA PTER 3 WORKING WITH 2D IMA GES/TEXTU RES IN XN A 2.0
Adding a New Content Pipeline Project to Your Solution To extend or create a new content importer/processor, you need to add a new project to your solution. To do this, find your Solution Explorer at the top-right of the screen, right-click your solution (the top entry in the list), and select Add New Project, as shown in Figure 3-7. In the dialog box that appears, select Content Pipeline Extension Library, and give your project a name that suits the purpose of your processor, as shown in Figure 3-8.
Copyright © OnBarcode.com . All rights reserved.