Pure Javascript demo code for parsing and rendering STL (ascii and binary) files.
The code is currently tightly coupled between the STL parsing and three.js geometry creation for the sake of initial rendering speed. That said, it would be relatively trivial to make the parseStl()
and parseStlBinary()
functions be renderer-agnostic. Feel free to cannibalize the code as you see fit.
Dump this repo on a web server and open up index.html in a browser. Voila, octocat!
- three.js for the ability to render the 3D models in WebGL/Canvas via Javascript
- Mozilla Devloper Network for the tremendously well-written docs on Javascript typed arrays
Do whatever you want with this code. I offer it without expectation or warranty. No need to credit me in your project or source code. A digital high five would be nice, but is not required.