1
Support / Non-rectangular sprite clipping
« on: August 21, 2013, 04:46:36 am »
Hey guys,
I'm working on a tiled isometric game with 2D Toolkit and wanted to figure out if there was an easy way to do sprite clipping in a non-rectangular way. More specifically, I'd like to clip the sprite in the shape of a hexagon so that I can control the height of a vertically long isometric tile by clipping the bottom part off at the desired height. See the attached image for an example of a sprite with an example clipping geometry (red lines denote the section I want to target).
Seems like I could just derive from tk2dBaseSprite and then define my own geometry for the 6 vertices and their U/V coordinates, but I wanted to make sure there wasn't another (easier) way to do this before I went down this path. If I do go down this route, is there an optimal vertex ordering that I should use? (I know for rects you usually order them as 2 triangles but not sure how that would work for a hexagon).
Let me know if you need any further info. Thanks for taking the time to read this post!
David
I'm working on a tiled isometric game with 2D Toolkit and wanted to figure out if there was an easy way to do sprite clipping in a non-rectangular way. More specifically, I'd like to clip the sprite in the shape of a hexagon so that I can control the height of a vertically long isometric tile by clipping the bottom part off at the desired height. See the attached image for an example of a sprite with an example clipping geometry (red lines denote the section I want to target).
Seems like I could just derive from tk2dBaseSprite and then define my own geometry for the 6 vertices and their U/V coordinates, but I wanted to make sure there wasn't another (easier) way to do this before I went down this path. If I do go down this route, is there an optimal vertex ordering that I should use? (I know for rects you usually order them as 2 triangles but not sure how that would work for a hexagon).
Let me know if you need any further info. Thanks for taking the time to read this post!
David