About two weeks ago, shortly after finishing part 3 I got in contact with Cygon from the Mogre forums. As far as I could tell he is the only person who has sucessfully wrapped the Terrain and Paging component into Mogre. With his help, I’ve managed to integrate his changes into the MogreBuilder to finally bring Mogre up to date with the latest stable version of Ogre (v1.7.4). This is great news for the Mogre community who have been longing for Terrain and Paging in the official build for many months.
Terrain and Paging
My first attempt at getting Terrain and Paging into Mogre was to try and figure out how Cygon had done it from the scattered bits of information floating around the forums. This worked up to a point but I ran into a wall when the AutoWrap tool failed to pickup the files. A little more digging around and I got a little closer followed by one failure after another. Cygon kindly offered to give me a copy of his entire codebase from when he manually wrapped Terrain and Paging with Ogre 1.7.3.
I was very excited when the email arrived with a link to download his code. Eager and try it out I quickly dumped the code into the MogreBuilder and ran it. After a little tweaking it spat out some binaries. I threw together a really quick test using the Mogre Terrain and Paging sample on the wiki combined with the samples code found in the last installer. It worked like a charm and I went to bed with a grin
The following weekend I sat down to clean up the code and get it loaded into the bitbucket repository. This turned into a bit of a chore because the code that I had was a few months old and I had to merge the changes with more recent changes in the repository. Added to that was updating the patching tool in MogreBuilder because Cygon’s patch wasn’t compatible with hg. I also added an extra patch to improve the size and the resulting DLL’s and remove some code not used in C#. Thanks again to Cygon for providing these changes.
I’m pleased to say that in the end it all went well and the Terrain and Paging components are now included in the official MogreBuilder. This should make it easier to maintain future builds of Mogre and might lead the way to getting other plugins wrapped.
Automatic version updating
Another small but important change I made during this iteration is automatic versioning of the Mogre DLL. Thanks to Ümit YILDIZ for pointing out that the previous lot of binaries indicated a version of 1.7.1 even though it was built against Ogre 1.7.4. To correct this issue I added a task into the MogreBuilder to automatically detect the version of Ogre and update Mogre’s assembly information to match.
Here’s a snippet from Ogre’s OgrePrerequisites.h
// Define ogre version #define OGRE_VERSION_MAJOR 1 #define OGRE_VERSION_MINOR 7 #define OGRE_VERSION_PATCH 4 #define OGRE_VERSION_SUFFIX "" #define OGRE_VERSION_NAME "Cthugha"
And the resulting code in Mogre’s AssemblyInfo.cpp
Using this approach we could also add the Ogre version name or add an additional digit into Mogre’s version using the MogreBuilder config. I’ve left this task for another time.
I’ve also added a new Terrain and Paging sample to the Mogre samples found in the installer. Unfortunately, there is still nowhere to load my changes on bitbucket so instead you can download them directly including the binaries, source code and media.
The end result
I really couldn’t have asked for a better couple of weeks on this project. All of the important chips fell into place at the right time and delivered some great improvements for the Mogre community. I’ve learned a lot about the Mogre build process and I feel more confident that I can help maintain it in the future. Thanks to everyone who provided feedback, it makes all the difference.
And of course, the source code is available in the bitbucket repositories.