Playing around yesterday I started to port Pixi's Graphics code.
Pixi has a very decent Graphics API implementation for Webgl to triangulate the shapes.
So far, I was able to port most of the polygon stuffs, every drawing command gets processed and triangulated and ends up in Starling mesh.
I even got the "holes" functionality API, which is great to create negative shapes, using drawing API to cut pieces of other graphics commands... and seems to be working nicely.
I'm very happy that I was able to start seeing practical results so fast, I just started yesterday...
Although I have no idea about the performance of this port, neither I have a proper understanding of all the math behind it, not Starling Mesh internals...
yet, the results are cool.
Some early samples:
the "holes" API is pretty cool, uses my port of the JS earcut lib...
star = new Graphic(this);
star.drawStar(140 , 180, 15, 100, 70 );
// Graphic class methods can be chained...
circ = new Graphics(this);
circ.beginFill( 0xffcc00, 1 ).drawCircle(0, 0, 50)
.beginHole() // erase the previous polygon commands.
.drawRoundRect(0, -20, 40, 20, 12)
.drawCircle(0, 10, 4)
Same drawing commands using lineStyle()
Taking the points from this old as3 sample post.
Some cool tentacles drawing with low vertex count...
I will see what else I can implement in the near future, there're TONS of things missing still, like colors fills, textures mapping, proper cleanup of memory, and maybe some pool functionality for common geometry, instead of disposing.