bzt b15b6f839f More voxel stuff | 2 роки тому | |
---|---|---|
.. | ||
README.md | 2 роки тому | |
example.html | 5 роки тому | |
m3d.js | 2 роки тому | |
m3d.min.js | 2 роки тому |
This code was written in pure Javascript (no jQuery or other bloated libraries), it is totally dependency free. It is not a fully
featured loader, it can load vertices, meshes and vertex colors (same features as the 80 SLoC example on the repository's main
page, plus generating smooth normals). It is technically a polyfill which allows you to use .m3d files in IMG
tags on HTML pages.
When loaded, you can rotate the models by drag'n'drop. Should also work on mobile devices with touchscreens.
Note: this is a rape on Javascript. It was simply not designed to handle binary data efficiently, and WebGL itself is a hack as it needs binary input.
<img src="example_model.m3d" width="320" height="240">
<img src="another_model.m3d" width="320" height="240">
<script src="https://gitlab.com/bztsrc/model3d/raw/master/webgl-js/m3d.min.js"></script>
That's all. For inflating models, it uses pako (already included in the minified version).