Home > Software design >  Best way to store and recieve 3d files on webserver
Best way to store and recieve 3d files on webserver

Time:10-16

I am currently working on an online cake configurator. The problem I am having is that I am not really sure if what I am doing is state of the art.

The configurator uses THREE.js to display the 3d model of cakes. I have several 3d model of cakes, which can be uploaded by the user. Those models are stored on the webserver. Each cake consists of one .obj file and one .mtl file.

Now..what I am unsure about. What is the best way to retrieve those models from the webserver. I tried ajax, but as far as I can tell ajax is not able to return .obj or .mtr files.

So my question. Is ajax even the right solution for this or is there a completely different approach I should look into?

CodePudding user response:

So my question. Is ajax even the right solution for this or is there a completely different approach I should look into?

Yes, this is the correct approach. Nowadays, you usually load files from the server via the fetch API.

But if you need the OBJ/MTL files for rendering, you can just load them via OBJLoader and MTLLoader and don't have to bother about the internals. You probably want to use the respective official three.js example as a code template: https://threejs.org/examples/webgl_loader_obj_mtl

  • Related