Last week I made some progress with irrEdit
, and also improved some parts of Irrlicht
during this process. I enhanced the light map generator a bit, but the coolest new feature is that irrEdit is now able to save and of course reload scenes which have been created or modified by the lightmapper. Which makes it usable, finally. It was a lot of work, more than I had thought. This is a screen shot of the first created, saved and then realoaded lightmapped scene, made in irrEdit:
So what did I have to do to make all this work? First, I needed a way to write out modified meshes. I thought a bit about what file format to use, and decided to go for COLLADA, because it is quite popular currently. Irrlicht already is able to load COLLADA files and it was also easily possible to squeeze Irrlicht's materials and vertex formats into there. After some programming it worked, and the result was ok for me. Here's the proof :)
The nice side effect is now that irrEdit can export every mesh into COLLADA, which means .3ds, .obj, .b3d, ogre .mesh, .dmf, .oct, .x, .ms3d, .my3d, .csm, .lmts, .md2 and .bsp files. Cool. I also had to extend the Irrlicht COLLADA importer, to handle more than one texture coordinate set per mesh. The mesh writer isn't included in Irrlicht and will not ever, because IMO, a mesh writer has no place in a 3D rendering engine, and in this way, I can also include irrEdit specific meta data in the written meshes.
But writing COLLADA files wasn't everything I had to do, the hardest thing was the mesh file management. As you know, irrEdit is primary a scene graph editor. And the problem now is that a single mesh can be referenced more than once in a scene. Just like this:
Here, a file named 'room.3ds' has been imported, light mapped, then cloned twice and the clones again light mapped differently. As you can see on the right, irrEdit correctly created new mesh copies for every modified mesh and manages the serialization state of every file and its textures separetely and automagically if needed. This was a bit complicated to implement because I also had to track unmodified meshes and had to be aware to add the possibility of adding undo/redo functionality in irrEdit some day, but it works now.
Some features are still missing for the light mapper, but I think I'll finish them soon and release irrEdit 0.4 with the complete lightmapping tool included in about 3-4 weeks.