Hi!
I'm developing a game that includes a terrain that consists of a number of polygons. Each polygon may contain a large number of points, and can be complex in shape (including concave polygons). I would like to use a texture to draw this terrain.
Does anyone have a good working example (preferably in CocosSharp 1.5) of drawing such polygons?
I assume I need to use the CCGeometryNode (the artist formerly known as CCGeometryBatch), but find very little examples and documentation around this.
Can CCGeometryNode work directly with such shapes, or does it need to be converted into triangles first? (as discussed here)
Posts
Jon
You will need to create your own triangles for this to work.
Thanks Kenneth, then I have better picture of what needs to be done.
I did try the LibTessDotNet that you suggested and that one can create triangles for my polygons.
Still quite a bit of hassle, and I'm not sure about performance though.
I might try out using a bitmap that I mask out bits from instead, when my terrain gets destroyed.
I'll post here again when I decided on solution to go for.
(But please ship in with ideas anyway if possible)
jonjarn
Not sure about the performance but the Spine rendering seems to work ok. Of course if you try to render a large amount of the spine characters it will degrade performance. From what I have seen though it is not the rendering but all the code for the skinning and triangulation code that is in there.
For reference, I'm currently going with CCGeometryNode, drawing my triangulated polygons. This is working great (and also gives me the added benefit of texture mapping). I'm doing updates to my terrain during the gameplay, but I still get good performance. So, seems like the way to go.
I also read that there is currently an issue with the ClippingNode on iOS (which was my other solution to the problem: One big bitmap that I "punch" holes in).
Still have a few things to figure out:
Will post here again when my game is downloaded a trillion times and I'm inviting you all to join me on my private pacific island.