private void view_Render(object sender, EventArgs e)
 {
     if (preview != null)
     {
         view.Wireframe = false;
         preview.Render(view, 0, SharpDX.Matrix.RotationY(PreviewRotation));
         view.Wireframe = true;
         SceneRenderControl.WorldConstants ViewConstants = new SceneRenderControl.WorldConstants(SharpDX.Matrix.Transpose(view.Camera.ProjectionMatrix), SharpDX.Matrix.Transpose(view.Camera.ViewMatrix), SharpDX.Matrix.Transpose(SharpDX.Matrix.RotationY(PreviewRotation)));
         view.DefaultEffect.PrepDraw(view.ImmediateContext);
         view.DefaultEffect.RenderObject(view.ImmediateContext, ViewConstants, preview.LODs[0].Mesh, new SharpDX.Direct3D11.ShaderResourceView[] { null });
     }
 }
 private void view_Render(object sender, EventArgs e)
 {
     if (preview != null && preview.LODs.Count > 0) // For some reason, reading props calls DoEvents which means that this might be called *in the middle of* loading a preview
     {
         if (solidToolStripMenuItem.Checked && CurrentLOD < preview.LODs.Count)
         {
             view.Wireframe = false;
             preview.Render(view, CurrentLOD, SharpDX.Matrix.Scaling(globalscale) * SharpDX.Matrix.RotationY(PreviewRotation));
         }
         if (wireframeToolStripMenuItem.Checked)
         {
             view.Wireframe = true;
             SceneRenderControl.WorldConstants ViewConstants = new SceneRenderControl.WorldConstants(SharpDX.Matrix.Transpose(view.Camera.ProjectionMatrix), SharpDX.Matrix.Transpose(view.Camera.ViewMatrix), SharpDX.Matrix.Transpose(SharpDX.Matrix.Scaling(globalscale) * SharpDX.Matrix.RotationY(PreviewRotation)));
             view.DefaultEffect.PrepDraw(view.ImmediateContext);
             view.DefaultEffect.RenderObject(view.ImmediateContext, ViewConstants, preview.LODs[CurrentLOD].Mesh, new SharpDX.Direct3D11.ShaderResourceView[] { null });
         }
     }
 }