diff --git a/Library/ContentProviders/MeshContentProvider.cs b/Library/ContentProviders/MeshContentProvider.cs index 51433762c..9894a1fca 100644 --- a/Library/ContentProviders/MeshContentProvider.cs +++ b/Library/ContentProviders/MeshContentProvider.cs @@ -49,8 +49,10 @@ namespace MatterHackers.MatterControl private static readonly bool Is32Bit = IntPtr.Size == 4; private static readonly Point2D BigRenderSize = new Point2D(460, 460); - // TODO: Trying out an 8 MB mesh max for thumbnail generation - private long MaxFileSizeForTracing = 8 * 1000 * 1000; + // 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; + + private long MaxFileSizeForThumbnail => Is32Bit ? 16 * 1000 * 1000 : 100 * 1000 * 1000; public Task CreateItem(ILibraryItem item, Action progressReporter) { @@ -105,11 +107,13 @@ namespace MatterHackers.MatterControl { IObject3D object3D = null; + long fileSize = 0; if (item is ILibraryAssetStream contentModel // Only load the stream if it's available - prevents download of internet content simply for thumbnails && contentModel.LocalContentExists - && (!Is32Bit || contentModel.FileSize < MaxFileSizeForTracing)) + && contentModel.FileSize < MaxFileSizeForThumbnail) { + fileSize = contentModel.FileSize; // TODO: Wire up limits for thumbnail generation. If content is too big, return null allowing the thumbnail to fall back to content default object3D = await contentModel.CreateContent(); } @@ -122,6 +126,14 @@ namespace MatterHackers.MatterControl { bool RenderOrthographic = UserSettings.Instance.get(UserSettingsKey.ThumbnailRenderingMode) == "orthographic"; + // if we are tracing and the file is too big + if(!RenderOrthographic + && fileSize > MaxFileSizeForTracing) + { + // switch to orthographic + RenderOrthographic = true; + } + var thumbnail = ThumbnailEngine.Generate( object3D, RenderOrthographic ? RenderType.ORTHOGROPHIC : RenderType.RAY_TRACE, diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index b1de779ab..9d4a2ac1a 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit b1de779ab7eef1c5a29ec4bb5a2198ae7385197e +Subproject commit 9d4a2ac1a2a1fc44ecf5a551cde59db213c334de