Deriving from ModelVisual3D

In the entire System.Windows.Media.Media3D namespace, only one class is neither abstract nor sealed. That class is ModelVisual3D, and you might be wondering: What happened? Did they just forget to add the sealed modifier?

No, ModelVisual3D was deliberately made available for inheritance. The problem is that it's not that easy to do so, and has a certain built-in hassle factor.

As you'll recall, ModelVisual3D defines three properties: Children, Content, and Transform. When you use ModelVisual3D for three-dimensional figures, you set the Content property to an object of type GeometryModel3D, which defines the Geometry, Material, and BackMaterial properties that define the figure.

The implication here is simple: If you derive ...

Get 3D Programming for Windows® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.