Some patches to fix or enhance Irrlicht 0.10
Irrlicht is an open-source
3D engine. Since there is no CVS support, yet, enhancements and bug fixes
have to be maintained by other means while the next release is prepared by
the Irrlicht developer. This web page provides a number of patches which allow
to easily change the source code of Irrlicht. If there are reasons to revert
these changes, it is usually possible by reverse application of the patch. Thus,
new features can be safely applied and tested.
What's a patch?
Patches contain code changes in such a way that these changes can be
automatically applied to a source tree. Thus, if you want to add some fix
available as a patch you just apply this patch to your sources. You don't have
to edit every file on your own and copy-and-apste from some website.
In order to apply a patch you need a source tree similar to that one of the
patch's author. This usually means you should have the same release, but in some
cases it might be the case that patches depend on others. The patches on this
page are created upon Irrlicht version 0.10.
To apply a patch follow these steps.
- Download the patch
- Change into the Irrlicht source tree, i.e. the directory called Irrlicht
where lots of *.cpp files are located.
- Execute the following command patch -p1 < patchfile
The patch command reads the patchfile and applies the changes to all files
mentioned within. Since the name of the source directory might be different
from that of the patch's author the patch is applied from within the source
directory and the first element of each file path is removed by the command
line option -p1. If you want to remove the patch again you may add
the option -R to the command line.
If some errors are encountered during patching a backup file with extension
.orig is created. This is also the case if only some warning has
been issued due to a different location of the changes. In cases where the
patch programme could not determine the correct location to apply the changes
an error is issued and another file with extension .rej is created.
This file contains all changes which could not be applied to the file.
To create a new patch based on your own modification you should do the
following. Please note that you have to keep another source tree containing
the original sources.
- Edit the code and check that it is compilable
- Change to the parent directory
- Execute diff -Naur originalSourceDir changedSourceDir > newPatchFile
Since the patch would contain all changes from all files already contained in
previous patches you have to keep your original sources on the same patch level
like your working directory. If you want to remove some parts of the patch
you should only remove complete blocks which begin with @@ otherwise
your patch might be broken.
The patch tool is also available for Windows command line. Check out
The Gnuwin32 project.
Please note the warning on that page that patches need the additonal
command line parameter --binary. This is due to the different line
end marker used on the different platforms. You may as well use
Cygwin which will bring a lot of other
useful tools, too ;-) Though, you also have to use --binary there.
Origins of the patches
Some of the changes have been extracted from the latest release of
Irrlicht-Spintz which contains some
of the bug fixes posted in the Irrlicht forums. I diff'ed the sources against
Irrlicht 0.8 and ported all patches to Irrlicht 0.10.
Some of the larger patches were developed by myself. Previous versions were
also posted to the forums or send directly to Niko. I removed the stuff which
is now part of Irrlicht 0.10 such that all patches should work again.
Another source of patches is the enhanced Irrlicht engine of
IrrlichtNX. Unfortunately, this
engine already changed lots of basic things which makes extracting working
patches rather difficult.
The patches
Here are the patch files and a short description for each of them.
Forum patches
- my3d-16.patch Bring My3D Loader to latest version 3.16 (by ZDimitor)
- my3d-material.patch Additional material changes by ZDimitor, no D3D9 yet
- parallaxmapping.patch Fix orientation of parallax effect (by jox, from afecelis files)
- HLSLmemfault.patch Check before accessing memory in HLSL (by ypanda, from afecelis files)
- d3dAntialias.patch Enable antialiasing for D3Dx (by Chips, from afecelis files)
- collision.patch Small optimization for SceneCollisionManager
- GUICloseHandler.patch Allows to enable or disable the default handling of the GUI window close button
- particle.patch Particle animation enhanced
- renaming.patch Renaming of variables fixed in 0.10, however two comments are fixed now
- WallWarnings.patch Fix reorder warnings of gcc in order to be able to compile Irrlicht with -Wall without thousands of useless warnings
- LinuxDevice.patch Adds support for XShmem under Linux which should improve performance of the software renderer. Also adds support for 24bit and 32bit visuals. Support for XDBE extension is included but disabled (Double buffer support under X). A new compilation options lets you disable the XF86 extensions if compiling on a system without XFree86.
- LinuxMipMaps.patch Enables MipMaps under Linux
- OpenGLExtension.patch Changes the way availability of OpenGL extensions is checked. Second version to honor the need for whitespace after the string to avoid wrong recognition.
- SoftwareRenderer.patch Moves some redundant code from the software renderer modules into the main class
- loopOpt2.patch Adds support for memset and memcpy to some loops and propagates already existing optimizations to other loops where also applicable.
Version two removed a not properly working byte copy replacement. Did not swap bytes.
- SColor.patch Optimized some bit shifting in SColor and some more loop optimizations in conjunction with SColor enhancements
- Loader.patch Minor enhancement of loader routines for Jpeg and 3DS
- rdtarga.patch An enhancement to libjpeg which becomes necessary if libjpeg is used for Targa support
- Makefile.patch not yet updated to 0.10 Make the Makefile much more structured (Linux only yet)
IrrlichtNX(++) patches
Here is a first round of patches from IrrlichtNX. Please note that these are
patches for original Irrlicht files, NOT to patch IrrlichtNX. They
rather add IrrlichtNX features to Irrlicht. I did not check whether the patches
are really needed, or if they do what they should do. Please send in comments.
Preliminary and untested patches
The following patches are still in testing phase
- 32bitIndex.patch
triangleFan.patch These two patches have to be applied together (I could not seperate them without breaking compilation). Change vertex indices to 32bit and add triangleFan support.
- LinuxKeyboard.patchFixed some problems of the Linux keyboard events. Now many keys are working, some strange garbage characters are not printed anymore. Tested with GUIEditBox. No real Unicode support yet, although some parts have been included already.
- LinuxDeviceUpdate.patchSome additions to the Linux Device, primarily on creating the XWindow, and fixing some problems from my earlier patches which have to be installed. Includes also some ideas from NX.
- arrayOps.patchAllows to access an array as a matrix. Simple helper function needed by Katoun's water node.
- TrueTypeFont.patchAdds support for TrueType fonts posted by zgock.
- OpenGLLightmapAlpha.patchFix for OpenGL driver where Lightmap materials disappear in conjunction with transparent vertices, posted by ZDimitor.
- SetParticleSpeed.patchAdds method SetParticlesPerSecond to Particle emitters. This method allows to stop particle emitters, or set the min and max speed of them.
- getWindowsID.patchAdds ExposedData for Linux to access the windows ID of the main Irrlicht window.
- OpenGLARB2.patch Untested patch to fix the Linux OpenGL_ARB problem and add shader program support. First version had some ifdef's unchanged, fixed in version 2.
Currently not working patches
- KatounWater.patchUpdates the WaterSceneNode to new one posted by katoun.
- floatFPS.patch Changes frames per second interface to using floats
- newTGA.patch Adds a new possibility to load TGA files using libjpeg. Seems to have some problems with 0.10!
Removed patches
- matrixRotate.patch from IrrSpintz for matrix4::rotateVect removed. According to jox Irrlicht 0.9 is doing it correctly.
- CameraFPS.patch. Patch CameraFPSSceneNode to avoid jitter. Included in 0.10
- XMLReader.patch. Adds single quotes support to XML reader (by Murphy). Not
really integrated, but 0.10 accepts both quote signs (and even arbitary mix of
the two which is usually not allowd in XML, though!)
- irrHeader.patch. Version changed to 0.10 in 0.10 ;-)
- D3DAlpaOP.patch. Don't disable ALPHAOP for first texture in CD3D8MaterialRenderer.
- getcwdLinux.patch. Fix getWorkingDirectory for Linux, returned always 0 before.
- irrList.patch. Fix insert at list start.
[Back to ParSys]
Christian Stehno (hybrid)
E-Mail
(last updated: June 3rd, 2005)