I load a 3D scene in Three.js using the ColladaLoader. I try to create mipmaps images from a mesh object texture image. The problem is that the image isn't completely loaded when I access the image width and height. Both width and height is zero until fully loaded.
When loading the dae file the ColladaLoader trigger the "done" function. I then search the scene for the individual scene objects. One of the mesh object with an image texture needs mipmaps created. The problem is that when I access the image, it's properties are not set. When the scene is rendered, all objects, including the images textures, are rendered perfectly (albeit without the mipmaps). Is there a way for me to add an event handler to the texture/image that is triggered when the image is done loading? If there is such an event (in the Three.js objects), can I then add the mipmaps while the scene is/objects are potentially already rendering? What action must I take to alert the rendering pipeline that the mipmaps are changed?
Example code anybody? Can I precalculate the mipmaps in Blender and save those to the dae file? How do I do that? I'm going to search the Blender docs... Hints are welcome though...