Currently, I am faced with a challenge involving loading a Collada file along with textures from file inputs. Specifically, I have set up 2 inputs, one for the geometry (.dae) file, and another for textures (.png/.jpg). When these file inputs change, two separate functions are triggered:
- loadCollada(): This function utilizes THREE.ColladaLoader to load the geometry file and stores it in a global variable named loadedCollada
- loadTextures(): This function uses THREE.TextureLoader to load the textures and stores them in a global variable named loadedTextures
Once these functions have done their job, a third function, loadModel() is executed. While I have managed to get the model to display, the textures are not correctly applied and if the model's up axis is not Y_UP, it is displayed at the wrong angle. Here is an outline of what loadModel() entails:
- Geometries are extracted from the loadedCollada variable and stored in an array called geometries
- The geometries in the array are combined into a single geometry (THREE.Geometry) using the THREE.GeometryUtils.merge() function
- A final mesh is created from the single geometry and textures stored in loadedTextures
- The model is then placed into the scene
I would greatly appreciate any assistance on this matter as I have been struggling to find a solution for quite some time. While it would be easier if I didn't have to rely on loading Collada files from the user's machine, it is necessary for the project to work with file inputs. Thank you for any help provided :)