Hi,
I've committed some improvements to the terrain manager in "Rei". If there are no objections, I can push them into the main line.
Take a look at my changes here:
I have found that terrain management is very slow, because of the bitmap saving/loading. In particular, the managed bitmap had serious performance problems with the setPixel method, as it would lock/unlock the bitmap before/after each pixel operation. This was improved by adding an unmanaged bitmap class that would do the lock/unlock once before/after the whole batch of pixel operations and it improved performance about 30% for the terrain generation code. Now I've got rid of the bitmaps altogether and load the heightmap directly into Irrlicht. This eliminates the inaccuracies when using int-valued color information (and therefore we don't need the u32->f32 luminance hack anymore) and in my findings it improves login and teleport performance up to 50%. I've done a test teleporting 10 times with the original codes and my improved codes and the results are very convincing, with 30% gained right in GenerateTerrain and another 20% gained by fewer locks and more cpu power for other tasks.
Zaki