【问题标题】:Load .obj models from client's local machine via THREE.js通过 THREE.js 从客户端本地机器加载 .obj 模型
【发布时间】:2014-11-29 18:56:23
【问题描述】:

我知道在 HTML5 中,有一个 FileReader API 可以根据用户的选择加载本地文件。但我想显示用户选择的 .obj 模型。由于 FileReader 只能将内容读入字符串,那么 THREE.js 中有没有 objloader 可以从字符串生成模型?

【问题讨论】:

    标签: javascript jquery three.js


    【解决方案1】:

    您需要对 Django 端点进行 AJAX 调用:

    $.ajax({
        url: "/process-model",
        success: function(result){
            ctl.load(result);
        },
        error: function(status, err){
            ui.error(err);
        }
    });
    

    这将调用ctl 对象的load() 方法并传入响应,除非调用失败。在这种情况下,ui.error() 将传递发生的错误。

    【讨论】:

      猜你喜欢
      • 2013-11-08
      • 1970-01-01
      • 2020-06-21
      • 1970-01-01
      • 2017-01-28
      • 1970-01-01
      • 2016-03-13
      • 2011-10-22
      • 1970-01-01
      相关资源
      最近更新 更多