I am facing a challenge with loading Collada and image data stored in a multipart file outputted from an application. My goal is to display the Collada object and its associated images using three.js on the Web. However, I'm unsure if three.js can interpret the multipart file directly or if the data within the file needs to be parsed into separate files. The Collada loader example references a .dae file (e.g., loader.load('models/monster.dae')) rather than the actual data. How can I achieve this task of loading and viewing the "box" represented by the multipart data?
Below is the structure of the multipart file received from the application:
MIME-Version:1.0
Content-Type:multipart/mixed;
boundary="----=_Part_4_153315749.1440434094461"
------=_Part_4_153315749.1440434094461
Content-Type: application/octet-stream; name=Texture_1.png
Content-ID: response-1
Content-Disposition: attachment; filename=Texture_1.png
‰PNG
"blob data here"
...
UPDATE:
After having the vendor split up the files, I was able to load the collada file directly into the viewer. However, I'm still unsure how to load the images along with it. Here is my current loading code snippet:
// instantiate a loader
var loader = new THREE.ColladaLoader();
loader.options.convertUpAxis = true;
loader.load('http://applicationvendorapi.com/dae', function (collada) {
// processing logic
});
The XML of the Collada file contains references to images in the same directory as the Collada file. Can these images be referenced via URLs like /endpoint/texture_0 and /endpoint/texture_1?
UPDATE 2:
Incorporating advice to first load the texture using ImageUtils, I have updated the code as follows:
// Load texture before loading and initializing 3D object
var texture0 = THREE.ImageUtils.loadTexture('http://vendorwebservice/texture_0', {}, function loaded() {
// Instantiate a Collada loader
var loader = new THREE.ColladaLoader();
loader.options.convertUpAxis = true;
loader.load('http://vendorwebservice/dae', function (collada) {
// processing logic
});
});
However, there seem to be issues with fetching the texture using URL endpoints specified in the DAE file. Any ideas on resolving this issue?