I need to load many obj files into a scene, by means of a for loop.
The way I do this is as follows.
Array objFilePaths; //given
Array loaders = new Array();
for(var i:int =0; i < objFilePaths.length; ++i)
{
//getFilename is a given function that extracts filename from path
var fileNS : String = getFilename(objFilePaths[i]);
loaders[i] = new Loader3D(true, fileNS);
//attach LOAD_COMPLETE and ERROR handlers
//and ASSET_COMPLETE
}
for(var i:int =0; i < objFilePaths.length; ++i)
{
var fileNS: String = getFilename(objFilePaths[i]);
var urlReq: URLRequest = new URLRequest(objFilePaths[i]);
loader3d.load( urlReq null, fileNS, new OBJParser());
}
In my LOAD_COMPLETE handler, I add the correct loader3d object to the scene.
Each of my objfile has a uniquely named material reference and unique texture. In fact , my ASSET_COMPLETE handlers say that al of these are loaded.
Yet in the display, some of the meshes have materials which correspond to the material from the last obj file that I have loaded.
Does away 3d keep any kind of global state which may be leading to this problem? I can replicate this problem with .ac2 files as well.
Also, btw, does away3d uses s3tc textures internally?