In the second developer preview release of Longhorn, distributed in May at WinHEC (build 4074), the Avalon team included a whole bunch of new 3D functionality. For the first time, Avalon surfaces could contain not just 2D shapes and brushes, but also 3D meshes that could be rotated, transformed and animated, with custom camera and lighting options.
In the new Community Technology Preview we’ve just released, a number of the 3D classes have been refactored, which of course means breaking changes to anything developed for the WinHEC build. That’s the price you pay for being a “bleeding-edge” adopter, of course, but I wanted to at least highlight the major changes to hopefully help people sed their way through. This isn’t exhaustive, but I’ll update it if someone hits another change they need help with.
- The namespace has moved from System.Windows.Media3D to System.Windows.Media.Media3D;
- The ViewPort3D class has now changed to Viewport3D (notice the change in capitalization);
- PerspectiveCamera and other cameras have now become immutable by default: add StatusOfNextUse=”ChangeableReference” to the element if you want to modify it programmatically after instantiation. The same is true of Viewport.Models;
- The MeshPrimitive3D class has now become GeometryModel3D, and MeshPrimitive3D.Mesh is now GeometryModel3D.Geometry;
- The Mesh3D class is now MeshGeometry3D;
- Model3DCollection has now become Model3DGroup.
Many of these changes seem arbitrary in isolation, but they improve FxCop correctness and consistency with the 2D namespace. Now is the time to make these changes before we hit a public beta: usually nobody finds out about this kind of thing, but the more technical preview and CTP releases we deliver, the more you’re able to see our dirty laundry 🙂
Thanks to Daniel Lehenbauer, one of the SDEs on the Avalon 3D team who helped me migrate my own samples across and was the source for most of this knowledge. He’s also written some nice samples that are far better than my own attempts so far.