/// <summary>Load a binary STL file.</summary> /// <seealso href="https://en.wikipedia.org/wiki/STL_%28file_format%29" /> public static Task <IndexedMesh> loadStlAsync(this IRenderDevice device, Stream stream, float?minCosAngle, string name = null) { if (null == Dispatcher.currentDispatcher) { throw new ApplicationException("You must call loadStlAsync on the GUI thread."); // CPU-bound heavy lifting is offloaded to the pool, however once it all done we have to resume on the thread which can create GPU resources. // To resume on the correct thread, the calling code, here, need to be on the thread with the dispatcher. } return(MeshLoader.loadStlAsync(device, stream, minCosAngle, name)); }