Render raytraced images at requested size

This commit is contained in:
John Lewin 2018-05-21 13:02:45 -07:00
parent e934bb40ff
commit 732186a512

View file

@ -47,7 +47,6 @@ namespace MatterHackers.MatterControl
public class MeshContentProvider : ISceneContentProvider
{
private static readonly bool Is32Bit = IntPtr.Size == 4;
private static readonly Point2D BigRenderSize = new Point2D(460, 460);
// For 32 bit max size to ray trace is 8 MB mesh for 64 bit the max size is 40 MB.
private long MaxFileSizeForTracing => Is32Bit ? 8 * 1000 * 1000 : 40 * 1000 * 1000;
@ -137,8 +136,8 @@ namespace MatterHackers.MatterControl
var thumbnail = ThumbnailEngine.Generate(
object3D,
RenderOrthographic ? RenderType.ORTHOGROPHIC : RenderType.RAY_TRACE,
BigRenderSize.x,
BigRenderSize.y,
width,
height,
allowMultiThreading: !ApplicationController.Instance.ActivePrinter.Connection.PrinterIsPrinting);
if (thumbnail != null)
@ -149,7 +148,13 @@ namespace MatterHackers.MatterControl
// Cache at requested size
cachePath = ApplicationController.Instance.ThumbnailCachePath(item, width, height);
thumbnail = LibraryProviderHelpers.ResizeImage(thumbnail, width, height);
// TODO: Lookup best large image and downscale if required
if (false)
{
thumbnail = LibraryProviderHelpers.ResizeImage(thumbnail, width, height);
}
AggContext.ImageIO.SaveImageData(cachePath, thumbnail);
if (ApplicationController.Instance.Library.ActiveContainer is ILibraryWritableContainer writableContainer)