O'Reilly logo

3D Programming for Windows® by Charles Petzold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to Build a Chair

Suppose you need to populate a virtual auditorium with a bunch of chairs. These chairs are identical in size and color. The only difference between the chairs is their location on the auditorium floor—in other words, a TranslateTransform3D.

You'll probably want the entire chair to be defined as a resource so that you can simply set it to the Content property of a ModelVisual3D and then set the Transform property to move the chair to its proper location:

<ModelVisual3D Content="{StaticResource chair}">
    <ModelVisual3D.Transform>
        <TranslateTransform3D OffsetX="-3" OffsetZ="2" />
    </ModelVisual3D.Transform>
</ModelVisual3D>

That resource must be a type that descends from Model3D. You might assume it's a GeometryModel3D, where the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required