diff options
| author | Juan Linietsky | 2014-10-03 00:10:51 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2014-10-03 00:10:51 -0300 |
| commit | b24fe3dd206ce391ec4c5f68d32fc2259f275563 (patch) | |
| tree | 5d05b14d21ba1c8a484f9b7f3739a63f42ca082d /core/bind/core_bind.cpp | |
| parent | 870c075ebf67749b21b6cc0c705088bbe273f1bb (diff) | |
| download | godot-b24fe3dd206ce391ec4c5f68d32fc2259f275563.tar.gz godot-b24fe3dd206ce391ec4c5f68d32fc2259f275563.tar.zst godot-b24fe3dd206ce391ec4c5f68d32fc2259f275563.zip | |
Diffstat (limited to 'core/bind/core_bind.cpp')
| -rw-r--r-- | core/bind/core_bind.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 570ed33a5..944bc531f 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -856,6 +856,36 @@ Vector<int> _Geometry::triangulate_polygon(const Vector<Vector2>& p_polygon) { return Geometry::triangulate_polygon(p_polygon); } +Dictionary _Geometry::make_atlas(const Vector<Size2>& p_rects) { + + Dictionary ret; + + Vector<Size2i> rects; + for (int i=0; i<p_rects.size(); i++) { + + rects.push_back(p_rects[i]); + }; + + Vector<Point2i> result; + Size2i size; + + Geometry::make_atlas(rects, result, size); + + Size2 r_size = size; + Vector<Point2> r_result; + for (int i=0; i<result.size(); i++) { + + r_result.push_back(result[i]); + }; + + + ret["points"] = r_result; + ret["size"] = r_size; + + return ret; +}; + + void _Geometry::_bind_methods() { @@ -878,6 +908,7 @@ void _Geometry::_bind_methods() { ObjectTypeDB::bind_method(_MD("triangulate_polygon","polygon"),&_Geometry::triangulate_polygon); + ObjectTypeDB::bind_method(_MD("make_atlas","sizes"),&_Geometry::make_atlas); } |
