XNA Creators Club Online

sample details

Custom Model Class
Sample
submitted
9/27/2007

Description:

This sample shows how to go beyond the limits of the Model class that comes built in to the XNA Framework, 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 in to the XNA Framework provides a convenient way to load and display graphics, but it is not especially 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 or Picking with Triangle-Accuracy do just that), but beyond a certain point, trying to cajole Model into handling scenarios it was never really designed for can become more trouble than it is 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 is 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
Framework

GS 2.0

Vertex Shader Version

VS 1.1

Pixel Shader Version

PS 1.1

var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG