153. Custom Model Class



Description:

This sample shows how to go beyond the limits of the Model class that comes built in to the XNA Framework, by loading geometry data into a custom class that can be extended more easily to cope with specialized requirements.


Sample Overview

The Model class that comes built into the XNA Framework provides a convenient way to load and display graphics, but it's not very flexible. Model can be extended in a limited manner by attaching custom data to the Tag property (in fact, many other samples such as the Skinned Model Sample and Picking with Triangle-Accuracy do just that), but beyond a certain point, trying to cajole Model into handling scenarios that it was never designed for can become more trouble than it's worth.


Fortunately, the layered design of the Content Pipeline makes it easy to replace Model with a custom (and hence more easily extensible) alternative. There's no need to alter the importer behavior, so our custom model replacement can still import data from standard file formats such as .X or .FBX. This sample implements a CustomModel class, along with a CustomModelProcessor that extracts the necessary geometry data from the NodeContent format that was output by the importer.


Downloads


No comments:

Post a Comment