private static GeometryModel3D CreateVoxelModel3D(Voxel v)
 {
     const double size = 0.98;
     var m = new GeometryModel3D();
     var mb = new MeshBuilder();
     mb.AddBox(new Point3D(0, 0, 0), size, size, size);
     m.Geometry = mb.ToMesh();
     m.Material = MaterialHelper.CreateMaterial(v.Colour);
     m.Transform = new TranslateTransform3D(v.Position.X, v.Position.Y, v.Position.Z);
     return m;
 }
 /// <summary>
 /// Shows a preview voxel adjacent to the specified model (source).
 /// If source is null, hide the preview.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="normal">The normal.</param>
 public void PreviewVoxel(Model3D source, Vector3D normal = default(Vector3D))
 {
     if (PreviewModel != null)
         Model.Children.Remove(PreviewModel);
     PreviewModel = null;
     if (source == null)
         return;
     if (!ModelToVoxel.ContainsKey(source))
         return;
     var v = ModelToVoxel[source];
     var previewColor = Color.FromArgb(0x80, CurrentColor.R, CurrentColor.G, CurrentColor.B);
     var pv = new Voxel(v.Position + normal, previewColor);
     PreviewModel = CreateVoxelModel3D(pv);
     Model.Children.Add(PreviewModel);
 }