Reputation: 627
I know in HTML5, there is a FileReader API to load local files under user's selection. But I wanna display the .obj model selected by users. Since FileReader can only read things into string, so is there any objloader in THREE.js that can generate models from strings?
Upvotes: 0
Views: 138
Reputation: 537
You'll want to make AJAX calls to your Django endpoint:
$.ajax({
url: "/process-model",
success: function(result){
ctl.load(result);
},
error: function(status, err){
ui.error(err);
}
});
This will call the load()
method of your ctl
object and pass the response in, unless the call fails. In that case, ui.error()
will be passed the error that occurred.
Upvotes: 0