This fixes bugs related to the case that several instances of the same mesh but with different rotation in their transformation matrix was present in the Collada file, which previously caused distorted objects except for those having the same rotation as the first instance.
A caveat is that now, as the incoming transform matrix is not used when creating the vertices and as the ModelPrim only stores rotation, scale and translation files which have transforms containing shear etc. not encodable by these three vectors will produce erroneous output even if there is only one instance of each mesh.
At the same time save some time and space during conversion by sharing the Positions and Faces members of all prims and not redoing the AddPositions and AddFacesFromPolyList calls for each instace (as results are identical). Applications that change the vertices or faces in situ in individual prim instances may suffer.
Imagine a track with many poles, each pole being the same geometry; the LL viewer requires a geometry element for every single pole! This patch makes libomv able to parse Collada files where instances reuse geometries, allowing for much more concise Collada files.
(1) handle hierarchical nodes in the visual scene
(2) handle the <triangle> element of geometries. This was done the lazy way: convert <triangles> to <polylist> and call the function that was already there for handling <polylist>
Sample code:
var parser = new OpenMetaverse.ImportExport.ColladaLoader();
var prims = parser.Load(o.FileName);
if (prims != null && prims.Count > 0)
{
var uploader = new OpenMetaverse.ImportExport.ModelUploader(client, prims);
uploader.PrepareUpload();
}
Note that PrepareUpload performs the upload as well in this initial stage.
TODO:
* Image upload
* Support for quads in addition to triangles