Jump to content

Load Scene using Ajax Request from a secured application server?


TardigradeX
 Share

Recommended Posts

Hi,

I'm working on a medical application where anatomical 3d Models are shown in the Browser.
At the moment I am working with Threejs, but I am looking for alternatives and Babylon.js looks very good, especially from a documentation perspective.

But I cant find much information about loading Scenes/STLs using XHR Requests. In most tutorials they are loaded as assets directly from the webserver the app is hosted on.
So my Questions are:

Is it possible to load a scene from an application server which is not the webserver using http GET, including an x-auth-token in the header ?

Is it possible to load the file as a binary stream, or in a small format? (Because the models often have a high poly-count)

Thanks in advance :-)
 

 

Link to comment
Share on other sites

Hey and welcome to the forum,

you can load your scenes from any url. Internally SceneLoader.Load uses an XHR: https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/babylon.tools.ts#L459

But you can also load the data on your own and provide the loaded buffer to the STL plugin (which has a load method https://github.com/BabylonJS/Babylon.js/blob/master/loaders/src/STL/babylon.stlFileLoader.ts#L76)

For performance, I would highly recommend using glb (gltf binary) as a vehicule for your data. Belnder has a gltf exporter: https://github.com/KhronosGroup/glTF-Blender-Exporter

 

Hope this helps:)

Link to comment
Share on other sites

Thanks for the fast response.

The glb format seems like a great option for data transfer. I will look into it.

As far as I can see it is not possible to add header data (Security Token) to the request when using the Scene Loader.

I will look into loading the raw-data using my own loader and then parsing it using Babylon and share my findings. Maybe an additional header option can be added to the SceneLoader at some point.

 

Greets

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...