You can add animations to move the camera’s position, or its zoom say, in exactly the same way and create a “fly past” but to make it look impressive you will need more than a single cube and this is the start of a very big project…
If you would like the code for this project then register and click on CodeBin or you can copy and paste the listing below.
Listing
The complete program is (omitting the usual using statements):
using System.Windows.Media.Media3D; using System.Windows.Media.Animation;namespace Cube1 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } MeshGeometry3D MCube() { MeshGeometry3D cube = new MeshGeometry3D(); Point3DCollection corners = new Point3DCollection(); corners.Add(new Point3D(0.5, 0.5, 0.5)); corners.Add(new Point3D(-0.5, 0.5, 0.5)); corners.Add(new Point3D(-0.5, -0.5, 0.5)); corners.Add(new Point3D(0.5, -0.5, 0.5)); corners.Add(new Point3D(0.5, 0.5, -0.5)); corners.Add(new Point3D(-0.5, 0.5, -0.5)); corners.Add(new Point3D(-0.5, -0.5, -0.5)); corners.Add(new Point3D(0.5, -0.5, -0.5)); cube.Positions = corners;
In the article Custom Bitmap Effects - Getting started we discovered how to work with HLSL in WPF. Now we are in a position to write more sophisticated shaders and this means learning some more [ ... ]
WPF bitmaps are immutable but that doesn't mean you can't transform them. Find out about rotation, scaling, changing pixel formatting and how to mangage color profiles.
WPF provides multiple ways to convert vector drawings to bitmaps. Find out how DrawingImage and DrawingVisual work and when to use which. On the way we look at how to create 2D vector drawings.
The simplest possible custom effects project is enough for you to see how it all works and to move on to building your own effects that do something useful. This is an introduction to using HLSL in WP [ ... ]
Having looked at working with raw pixel data we turn our attention to formattted image files and how to code and decode both the pixel data and the meta data they contain.