This is *not* a project but I couldn't think of where else to post this.
<rant>Since there is a special forum for bug-reports, maybe there should be one for patches too?</rant>
Anyway...
This patch adds texture atlas (a.k.a. sprite-sheet) support in particle systems. Here's the code documentation:
Code: Select all
//! Sets if the material's texture is to be used as a texture atlas.
//! A texture atlas is a texture that contains more than one texture inside.
//! You could call it a sprite-sheet too.
//! Imagine the texture divided into an imaginary grid of cells of the specified
//! size.
//! If the particle system is set in texture atlas mode, each particle will have
//! a different part (cell) of the atlas as its texture. This allows for more interesting
//! and variant particle systems.
//! @param use: If true, the texture will be used as a texture atlas. If false,
//! it is used in the normal Irrlicht way.
//! @param gridCell: The grid cell count for the atlas. For example, if your texture is
//! size of 512x64 and you have 8 sub-textures of size 64x64 in it, then the grid
//! cell size would be 8x1.
//! @param randomPick: Decides how to pick which cell to use for the next particle.
//! If this is true, the next cell is picked randomly. If it is false, the order
//! is sequential: the next cell in the horizontal direction is picked. When the
//! last cell is picked, it then starts again with the first cell of the next row.
//! When all cells are used, it starts again from cell (1,1).
Take this texture as an example:

It is a 512x64 texture containing 8 64x64 sub-textures. To make the particle system use it (with this patch), all you have to do is add this line of code any time after particle system's creation:
Code: Select all
ps->setUseTextureAtlas(true, core::dimension2d<u32>(8,1), true);
I hope you enjoy this.
Download link.