Pryme8 Posted August 9, 2016 Share Posted August 9, 2016 When you go to import a model and you call the import constructor, Ive noticed you have to have the location of the file, is it possible to just reference the memory instance of a file? IE I upload a .obj to a input DOM element it holds the actual file not the location. Ive tried to do a URI convert but to no avail, i feel like that would be the simplest process. But I was mainly wondering is it possible to call an import constructor with the file and not the location. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 9, 2016 Share Posted August 9, 2016 I think you talking about browser restrictions to load a file directly from disk. The Problem here is, that at somepoint to user has to insight, agains loading any file, the programmer just put in his code. I can vistit a website, and you start deleting my window folder etc. A Filereader is necessary here. babylonjs BABYLON.Tools.LoadFile javascript var reader = new FileReader(); Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 9, 2016 Author Share Posted August 9, 2016 Ive tried that, and it does not work, I have tried passing it as binary, as text blah blah blah... its been annoying... I understand the whole premise of loading from the DOM, and have done COR loaders in BJS that are able to import a model as raw text and turn it into a URI component that is then referable to the object loader. Im about to say screw it and just make my own fbx importer, Im starting to think the obj importer breaks normals anyways. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 9, 2016 Share Posted August 9, 2016 You can provide a stringified version of your data: http://doc.babylonjs.com/classes/2.4/SceneLoader#static-importmesh-meshesnames-rooturl-scenefilename-scene-onsuccess-progresscallback-onerror-rarr-void (check sceneFilename parameter) Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 11, 2016 Author Share Posted August 11, 2016 This is perfect thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.