wasabi2d
wasabi2d copied to clipboard
Nine-patch primitive
A very useful primitive in games and UIs is a "nine-patch", which is a rectangle styled with a non-repeating texture.
See for example:
- https://github.com/libgdx/libgdx/wiki/Ninepatches
- https://github.com/adamlwgriffiths/Pyglet/blob/master/experimental/ninepatch.py
The vertex/UV creation could be implemented entirely in a geometry shader, but this would require a rewrite of the Transformable class to pass pos/angle/scale as attributes rather than building a matrix. The planned ability to group primitives would also have a bearing.
Therefore the simplest way is to stick with the existing CPU-side transformations and optimise later.