I have looked into the Lightmapping a few weeks ago,
generating lightmaps seems to be not too hard if you have converted the UV's to world positions.
I came accross these two sites:
Lightmapping 1 Lightmapping 2 I haven't tried them, but at least the first covers the complete lightmapping.
while these are tutorials, implementing the code can take some time.
A while ago Ventilator wrote a lightmapping dll.
It seems to be not downloadable anymore, but perhaps he still has the source code?
here is the forum post:
post would be nice if you get it to work again!
In thief they might just be changing pointers to the lightmap's texture, don't know.
Perhaps I just talk rubbish.