Why Not Share the Vertices?
The three XAML files that display a square cuboid all define the six faces of the image independently. This results in a Positions collection that has 24 points rather than just 8 points for the 8 vertices of the figure. Why not just put 8 points in the Positions collection and share the vertices among the faces?
Don't fall into the trap of thinking you'll get better performance with 8 points in the Positions collection rather than 24. The rendering of 3D objects is triangle-driven and not vertex-driven. But let's try it. The following XAML file has only eight points in the Positions collection and defines the TriangleVertices collection appropriately.
Example 1-9. SharedVerticesSquareCuboid.xaml
<!-- ============================================================= ...
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.