通过 webgl 中的 bin 文件加载模型?
我看到一个示例,其中数据位于数组内的文本中,我看到另一个示例,其中有人通过 ajax 使用 json 加载模型。
有没有办法通过二进制加载文件?我不想通过 4mb json 加载 1mb 模型
I see an example where the data was in text inside an array, i seen another where someone loads the model through ajax with json.
Is there a way to load the files via binary? i dont feel like loading a 1mb model via 4mb json
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当然可以加载二进制文件。
http://blog.nihilogic.dk/2008/05 /reading-exif-data-with-javascript.html
但问题在那之后。您需要知道它的格式。并从那里提取所有内容。
It is certainly possible to load binary files.
http://blog.nihilogic.dk/2008/05/reading-exif-data-with-javascript.html
But the problem is after that. That you need to know what format it is in. And extract everything from there.
您可以使用jQuery Binary Ajax,或者对于新浏览器,< a href="https://developer.mozilla.org/en/using_xmlhttprequest#Receiving_binary_data" rel="nofollow">ArrayBuffer
You can use jQuery Binary Ajax, or for new browsers, ArrayBuffer
如果文件使用 gzip 压缩,则 json 大小几乎与二进制文件大小相同。
无论如何,您可以使用 二进制加载器 Three.js 如果你确实需要的话。
If file is compressed with gzip then json size is almoast same as binary file size.
Anyway you can use binary loader from three.js if you really need it.