Irrlicht 3D stuff

Things related to the Irrlicht 3D engine. Also check the IRC: #irrlicht on
H-Craft Championship, a game done with the Irrlicht engine:

Last edit: 30.September 2021

Examples and code-snippets with Irrlicht.
My playground repository for all kind of experiments with Irrlicht: irr-playground.
Source-code for H-Craft Championship, my free 3D Sci-Fi Racer: H-Craft Source.

Note: Most of the stuff below is a bit outdated and made long time ago. Newer code-snippets are generally in the irr-playground repository.

Stringtables with Irrlicht.
Both implementations need tinyXml to work.

First A simple stringtable implementation:

A more complex stringtable implementation that supports strings with parameters. It also needs tinyXml to work.
Additionally it needs a few more files, I hope I didn't forget any:

Multiple timers.
Sometimes you need more than one timer in your game. For example you have often one global timer which runs always, while you mostly also need a game-timer which must be paused while your game is in pause-mode. That's why i made a wrapper around the irrlicht timer. You can create several instances of this timer class. You need to call Tick() for each instance regularly.

Truetypefonts from zgock from this post.
NOTE: In newer projects I use the CGUITTFont in the above mentioned playground repository instead. I haven't tested this code here for a few years.
My version contains a few bugfixes (mostly for memory leaks, but also for font-height) and is adapted to a newer Irrlicht version.
To get it working you also need to link freetype ( to your project. I tested it with freetype 2.3.5.

For more comfort I have created two more classes. The simpler one is a fontmanager which you can just drop in your project and it will make the memory-management for the fonts easier.

If you also need serialization (loading and saving the gui-elements together with fonts) the fontmanager won't be enough. To do that we need a fontfactory. That is not supported so far in Irrlicht so you will have to patch Irrlicht itself when you need that (there are reasons why this patch isn't yet in Irrlicht). Once you have patched Irrlicht you can use the the factory, which looks and works rather similar to the fontmanager.
font_factory.patch(for svn 2407 older versions can be found in my older patch series)

COctTreeSceneNodeTriangleSelector does use the octree which is already available when creating an COctTreeSceneNode. Usually that octree is only used for rendering the scenenode, but with my class it can also be used for the triangle selector. The reason for this was that creating COctTreeTriangleSelector, which is usually used, takes a very long time for complex models. I had also to make some changes in COctTreeSceneNode so i put those files here also. Then engineversion i use myself is currently a mix of Irrlicht 0.14 to Irrlicht 1.2 and svn so i can't guarantee that this code will run. But chances are high that it will work if you copy those files in irrlicht svn or 1.1 sources and add the COctTreeSceneNodeTriangleSelector files to the irrlicht project. But you should backup of the old COctTreeSceneNode sources before!

Lightmaps from Maya to Irrlicht.
There are a few ways to create and import lightmaps in irrlicht, but none of those worked for us (btw. if you don't know what lightmaps are check it here). What we did was to create the lightmaps in the modeller and export the scene as .obj files once with the lightmap texture and once as the usual scene. I wrote a small tool to merge those two .obj files (resulting in a file called .lmo) and modified the .obj loader so it can work with those .lmo files.

Converter for obj to lmo:
Compile with g++ obj2lmo.cpp -o obj2lmo
Call it as follows: obj2lmo yourmap.obj yourlightmap.obj texture_lightmap.tga and it will create a file called yourmap.lmo

You can just add the lmo loader by adding the files to your project and calling sceneManager->addExternalMeshLoader for it. You will also need to add fast_atof.h to the project which can be found in the irrlicht sources.

b3d_export.patch is a patch for B3D_Exporter_2.06 from Gandalf. Unfortunately his website is gone. You still can get a patched script from me: (patched)
My patch adds 2 changes to the original script:
1. It allows animation export from first to last frame (before it always used the current settings of the timeline).
2. Export of specific b3d nodes can be enable/disabled. For example to export without animations "Animation Nodes" can be disabled. Or to export only animations disable "Texture Nodes", "Brush Nodes" and "Mesh Nodes". This allows to export base-mesh and animations separately.

This exporter no longer works with newer Blender versions (> 2.50). The best current b3d exporter I know of is developed by the SuperTuxKart developers. Last I checked it could be found here:

Free ugly models
I'm no modeler, but maybe good enough for some quick testing? No restrictions whatever for using them, thought I'd recommend finding nicer ones for any real projects :-)

Based on my own rooms. Textures are mostly based on and some small ones just from browsing google until I found something which looked good enough to use. The .zip should contain (hopefully) all Blender files as well as an .obj usable directly in Irrlicht.

My first ever human model. Everything is made from scratch. Unfortunately it sometimes shows, especially for the animations. Exported as b3d files. adam_base.b3d contains the mesh in a T-Pose and all adam_ani*.b3d files contain only animation data. adam_ani.blend contains the current blender file and adam_mirrormod.blend contains the last mesh which still has the mirror modifier applied.

Old patches
Patches I was using for Irrlicht (svn 2701 and later which is around the 1.6 release)
Patches I was using for Irrlicht (svn 2407 and later)
Patches I was using for Irrlicht (svn 1517 and later)
Patches used for Star Sonata (svn 808)