Friday, December 11, 2009

Shear Transformations in cocos2d

To properly map a 2d texture onto a cube, I needed a shear transformation to properly transform the texture. Cocos2d does not support shears out of the box but this piece of code suggested by codem01 does the trick very nicely.

Keep in mind that the default shear values should be 0.0 (= no shear) and values used can be both, positive and negative and are restricted in magnitude only by your application.

You can find some more background on shear transformations on Wolfram MathWorld and on Wikipedia.

No comments:

Post a Comment