Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedding MeshLabJS + Default mesh in a webpage #113

Open
mankoff opened this issue Apr 18, 2016 · 11 comments
Open

Embedding MeshLabJS + Default mesh in a webpage #113

mankoff opened this issue Apr 18, 2016 · 11 comments

Comments

@mankoff
Copy link

mankoff commented Apr 18, 2016

I'd like to have a web-page where visitors see a mesh when they arrive. It isn't clear if MeshLabeJS supports this. For example, could the Bunny mesh be loaded by default when visiting http://www.meshlabjs.net/ ?

I've skimmed the docs but I don't see mention of this feature mentioned there.

@cignoni
Copy link
Member

cignoni commented Apr 18, 2016

Initially we planned to include a "open from web feature" but actually it is not possible in a pure client based solution due to Same-origin_policy; in short a web browser permits scripts contained in a first web page to access data in a second web page, but only if both web pages have the same origin, so it is not possible for a script on www.meshlabjs.net to load a mesh that reside on https://graphics.stanford.edu/data/3Dscanrep/.

There are workarounds, but they are a bit cumbersome: either they require non pure-client solutions or they need that the servers providing the files to open implements certain protocols...

@cignoni cignoni closed this as completed Apr 18, 2016
@mankoff
Copy link
Author

mankoff commented Apr 18, 2016

But... could I host the MeshLabJS code on http://example.com/ and the data on http://example.com/ ? In my example above, I assumed the bunny would be hosted on http://meshlabjs.net/

@mrweix
Copy link

mrweix commented Apr 22, 2016

Did you find a solution to load a mesh directly at startup?

@mankoff
Copy link
Author

mankoff commented Apr 22, 2016

No. I think it has this ability, but may not be answered now that this ticket was marked as "closed". I'll re-open a new ticket where I phrase the question better if there is no reply here.

@cignoni cignoni reopened this Apr 23, 2016
@cignoni
Copy link
Member

cignoni commented Apr 23, 2016

I re-opened the issue given the interest in the topic.
Give a look at these commits:

fd9245d
7b87cca

Re adding this load-from-web support should be not too complicated. I am willing to add it again if you are able to find some public servers (at least one :) ) that support cross site download of meshes.

@mankoff
Copy link
Author

mankoff commented Apr 24, 2016

Hi. Perhaps a misunderstanding. I'm not trying to do cross-site loading, which seems to be a security issue. I'd just like to have a default mesh, hosted on the same server as MeshLabeJS, loaded when the users accesses the site. The docs are fairly low-level and technical, and I couldn't find an example of how to set up this type of installation, hence this ticket.

@cignoni
Copy link
Member

cignoni commented Apr 29, 2016

Ok, that can be done. We already have a rudimental "run at startup" api that will hopefully expanded.
The following url show an example of this api.
http://www.meshlabjs.net/?filterName=Create%20Noisy%20Isosurface

@mrweix
Copy link

mrweix commented Apr 29, 2016

Thats very interesting. Is the Noisy Isosurface stored as stl file somewhere or is it generated? How to access it with this API?

@cignoni
Copy link
Member

cignoni commented Apr 29, 2016

Create Noisy Isosurface is a filter

@mrweix
Copy link

mrweix commented Nov 25, 2016

Hello folks,

has there been any solution to this? Meaning could I host the MeshLabJS code on http://example.com/ and an mesh.stl file on http://example.com/ and could this mesh.stl file be loaded on startup of the page? Please let me know if anybody has managed to implement this

@benellefi
Copy link

benellefi commented Oct 1, 2018

Hi all,

Any solutions yet for the startup loading file API ?

Since in the current index.html, the following code allows only to create filter by filterName :
Module['onRuntimeInitialized'] = function() {
filterName = MLJ.util.getURLParam("filterName");
if(filterName)
MLJ.core.plugin.Manager.executeCreateFilter(filterName);*/
};

I tried the following:

Module['onRuntimeInitialized'] = function() {
var filePath= MLJ.util.getURLParam("filePath");
if(filePath)
{
fileName = new File(filePath);
if (fileName instanceof File) {
MLJ.core.file.openMeshFile(fileName);
//MLJ.util.loadFile(fileName);
//MLJ.load(fileName);
}
}
};

Any HELPS ? :)

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants