AutoPolygon is a helper Object AutoPolygon's purpose is to process an image into 2d polygon mesh in runtime It has functions for each step in the process, from tracing all the points, to triangulation the result can be then passed to Sprite::create() to create a Polygon Sprite. More...
Public Member Functions | |
| AutoPolygon (const std::string &filename) | |
| create an AutoPolygon and initialize it with an image file the image must be a 32bit PNG for current version 3.7 More... | |
| ~AutoPolygon () | |
| Destructor of AutoPolygon. | |
| std::vector< Vec2 > | trace (const cocos2d::Rect &rect, const float &threshold=0.0) |
| trace all the points along the outline of the image, More... | |
| var | trace ( var rect, var 0) |
| trace all the points along the outline of the image, More... | |
| local | trace ( local rect, local 0) |
| trace all the points along the outline of the image, More... | |
| std::vector< Vec2 > | reduce (const std::vector< Vec2 > &points, const Rect &rect, const float &epsilon=2.0) |
| reduce the ammount of points so its faster for GPU to process and draw based on Ramer-Douglas-Puecker algorithm More... | |
| local | reduce ( local points, local rect, local 0) |
| reduce the ammount of points so its faster for GPU to process and draw based on Ramer-Douglas-Puecker algorithm More... | |
| std::vector< Vec2 > | expand (const std::vector< Vec2 > &points, const Rect &rect, const float &epsilon) |
| expand the points along their edge, useful after you reduce the points that cuts into the sprite using ClipperLib More... | |
| local | expand ( local points, local rect, local epsilon) |
| expand the points along their edge, useful after you reduce the points that cuts into the sprite using ClipperLib More... | |
| TrianglesCommand::Triangles | triangulate (const std::vector< Vec2 > &points) |
| Triangulate the input points into triangles for rendering using poly2tri. More... | |
| local | triangulate ( local points) |
| Triangulate the input points into triangles for rendering using poly2tri. More... | |
| void | calculateUV (const Rect &rect, V3F_C4B_T2F *verts, const ssize_t &count) |
| calculate the UV coordinates for each points based on a texture rect More... | |
| PolygonInfo | generateTriangles (const Rect &rect=Rect::ZERO, const float &epsilon=2.0, const float &threshold=0.05) |
| a helper function, packing trace, reduce, expand, triangulate and calculate uv in one function More... | |
| local | generateTriangles ( local ZERO, local 0, local 05) |
| a helper function, packing trace, reduce, expand, triangulate and calculate uv in one function More... | |
Static Public Member Functions | |
| static PolygonInfo | generatePolygon (const std::string &filename, const Rect &rect=Rect::ZERO, const float epsilon=2.0, const float threshold=0.05) |
| a helper function, packing autoPolygon creation, trace, reduce, expand, triangulate and calculate uv in one function More... | |
| local | generatePolygon ( local filename, local ZERO, local 0, local 05) |
| a helper function, packing autoPolygon creation, trace, reduce, expand, triangulate and calculate uv in one function More... | |
AutoPolygon is a helper Object AutoPolygon's purpose is to process an image into 2d polygon mesh in runtime It has functions for each step in the process, from tracing all the points, to triangulation the result can be then passed to Sprite::create() to create a Polygon Sprite.