Open the local STL file and create the geometry used by WebGL

Source: Internet
Author: User
Demand
  1. Open the local STL file
  2. An independent WebGL-based viewer that will be reused by other sites
  3. Data transfer of the open file to the viewer, and the progress bar is displayed when the file is loaded
Solution Solutions

#1可以使用传统的html5 API to open,

#2来说, an IFRAME can be used to provide a separate viewer,

#3来说需要用web worker to implement.

Implementation Details

The flow of data is the main page-of the Web site, the main page-of the viewer in the iframe "Web worker-" iframe, which is the home page

The data type you just opened is the buffer array, which can be passed directly to the main page of the IFRAME Viewer via post message and then to the Web worker of the viewer via post message, which is parsed by the worker. During parsing, the worker is sent a message to the viewer main page to update the progress bar

Attention

When using post message, because data copy is easy to get out of memory when the file is large, the solution is to use transferable parameters to avoid copy of the big data being transferred.

Results

The file opened in 300MB is approximately 6 seconds in length.

Open the local STL file and create the geometry used by WebGL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.