"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end."
- Henry Spencer

Updated the particle trimmer
Sunday, May 24, 2009 | Permalink

I've made the particle trimmer a bit more robust, a bit faster, and added a few extra features. I also made it handle some cases with a perfect circle better where you get a lot of edges in the convex hull. Before attempting to find the optimal polygon it'll reduce the hull size to at most a provided number of edges (default is 50), which should make it complete in a relatively short amount of time even for 8 vertices. The reduction in efficiency of doing this is either zero or in the worst case a tiny fraction of a percentage point in my tests.
The tool can now also scale and bias the result to put the coordinate in the range you want it or perhaps just to flip the y coordinate.
I've also added a dilate filter option so that the texture can initially be dilated a specified number of times. This could be useful if there's a sharp edge rather than a smooth gradient towards the threshold value and the texture is filtered and/or mipmapped, in which case you might need a more conservative trimming to not get a visible cut.
The tool should now also handle non-square textures better and the computations are now done in texel units rather than in normalized coordinates. Normalization is instead done on the final results, which are then scaled and biased with the provided values.

Update 2009-05-27:
I've updated the tool again because the last release was kind of broken with atlases. It should now work properly.

[ 5 comments | Last comment by Remage (2009-07-07 17:13:03) ]