Hi. I have 3d engine that compiled with emscripten. This engine take models 
from binary data and then render it. Render cycle looks like:

loadModels(uint8_t* data, size_t len);
eachFrame -> render();

I want to query data from web server. What is the best way to pass binary 
data to c++ code. For now i use FS api for that. It is look like:

$.ajax({
            url: "/raw/" + left + "/" + top + "/" + right + "/" + bottom,
            type: 'GET',
            beforeSend: function (xhr) {
              xhr.overrideMimeType("text/plain; charset=x-user-defined");
            },
            success: function( data ) {
              Module['FS_createDataFile']("/tmp", "memfile", data, true, 
true);
              Module.ccall('readModels', 'void', ['string'], 
["/tmp/memfile"]);
            }
          }); 

readModels(const char* file) {
    FILE *file = fopen(filePath, "rb");
    //... do parse stuff
    fclose(file);
    remove(filePath);
}

It this method effective?


-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to