summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp12
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/io/config_file.cpp10
-rw-r--r--core/io/config_file.h2
-rw-r--r--core/ordered_hash_map.h40
-rw-r--r--core/variant_call.cpp2
6 files changed, 33 insertions, 35 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 12b892d873..c369f4bffe 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -1316,6 +1316,16 @@ Vector<int> _Geometry::triangulate_polygon(const Vector<Vector2> &p_polygon) {
return Geometry::triangulate_polygon(p_polygon);
}
+Vector<Point2> _Geometry::convex_hull_2d(const Vector<Point2> &p_points) {
+
+ return Geometry::convex_hull_2d(p_points);
+}
+
+Vector<Vector3> _Geometry::clip_polygon(const Vector<Vector3> &p_points, const Plane &p_plane) {
+
+ return Geometry::clip_polygon(p_points, p_plane);
+}
+
Dictionary _Geometry::make_atlas(const Vector<Size2> &p_rects) {
Dictionary ret;
@@ -1376,6 +1386,8 @@ void _Geometry::_bind_methods() {
ClassDB::bind_method(D_METHOD("point_is_inside_triangle", "point", "a", "b", "c"), &_Geometry::point_is_inside_triangle);
ClassDB::bind_method(D_METHOD("triangulate_polygon", "polygon"), &_Geometry::triangulate_polygon);
+ ClassDB::bind_method(D_METHOD("convex_hull_2d", "points"), &_Geometry::convex_hull_2d);
+ ClassDB::bind_method(D_METHOD("clip_polygon", "points", "plane"), &_Geometry::clip_polygon);
ClassDB::bind_method(D_METHOD("make_atlas", "sizes"), &_Geometry::make_atlas);
}
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 7f8c734e36..bbbb40d926 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -363,6 +363,8 @@ public:
int get_uv84_normal_bit(const Vector3 &p_vector);
Vector<int> triangulate_polygon(const Vector<Vector2> &p_polygon);
+ Vector<Point2> convex_hull_2d(const Vector<Point2> &p_points);
+ Vector<Vector3> clip_polygon(const Vector<Vector3> &p_points, const Plane &p_plane);
Dictionary make_atlas(const Vector<Size2> &p_rects);
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index b5d41bacbb..2b60150832 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -106,8 +106,8 @@ bool ConfigFile::has_section_key(const String &p_section, const String &p_key) c
void ConfigFile::get_sections(List<String> *r_sections) const {
- for (const Map<String, OrderedHashMap<String, Variant> >::Element *E = values.front(); E; E = E->next()) {
- r_sections->push_back(E->key());
+ for (OrderedHashMap<String, OrderedHashMap<String, Variant> >::ConstElement E = values.front(); E; E = E.next()) {
+ r_sections->push_back(E.key());
}
}
void ConfigFile::get_section_keys(const String &p_section, List<String> *r_keys) const {
@@ -135,13 +135,13 @@ Error ConfigFile::save(const String &p_path) {
return err;
}
- for (Map<String, OrderedHashMap<String, Variant> >::Element *E = values.front(); E; E = E->next()) {
+ for (OrderedHashMap<String, OrderedHashMap<String, Variant> >::Element E = values.front(); E; E = E.next()) {
if (E != values.front())
file->store_string("\n");
- file->store_string("[" + E->key() + "]\n\n");
+ file->store_string("[" + E.key() + "]\n\n");
- for (OrderedHashMap<String, Variant>::Element F = E->get().front(); F; F = F.next()) {
+ for (OrderedHashMap<String, Variant>::Element F = E.get().front(); F; F = F.next()) {
String vstr;
VariantWriter::write_to_string(F.get(), vstr);
diff --git a/core/io/config_file.h b/core/io/config_file.h
index 2be196faa2..29bd369a24 100644
--- a/core/io/config_file.h
+++ b/core/io/config_file.h
@@ -37,7 +37,7 @@ class ConfigFile : public Reference {
GDCLASS(ConfigFile, Reference);
- Map<String, OrderedHashMap<String, Variant> > values;
+ OrderedHashMap<String, OrderedHashMap<String, Variant> > values;
PoolStringArray _get_sections() const;
PoolStringArray _get_section_keys(const String &p_section) const;
diff --git a/core/ordered_hash_map.h b/core/ordered_hash_map.h
index 62eeedb437..1ed5a5d369 100644
--- a/core/ordered_hash_map.h
+++ b/core/ordered_hash_map.h
@@ -93,8 +93,12 @@ public:
return *this;
}
- friend bool operator==(const Element &, const Element &);
- friend bool operator!=(const Element &, const Element &);
+ _FORCE_INLINE_ bool operator==(const Element &p_other) const {
+ return this->list_element == p_other.list_element;
+ }
+ _FORCE_INLINE_ bool operator!=(const Element &p_other) const {
+ return this->list_element != p_other.list_element;
+ }
operator bool() const {
return (list_element != NULL);
@@ -157,8 +161,12 @@ public:
return ConstElement(list_element ? list_element->prev() : NULL);
}
- friend bool operator==(const ConstElement &, const ConstElement &);
- friend bool operator!=(const ConstElement &, const ConstElement &);
+ _FORCE_INLINE_ bool operator==(const ConstElement &p_other) const {
+ return this->list_element == p_other.list_element;
+ }
+ _FORCE_INLINE_ bool operator!=(const ConstElement &p_other) const {
+ return this->list_element != p_other.list_element;
+ }
operator bool() const {
return (list_element != NULL);
@@ -288,28 +296,4 @@ public:
}
};
-template <class K, class V, class Hasher, class Comparator, uint8_t MIN_HASH_TABLE_POWER, uint8_t RELATIONSHIP>
-bool operator==(const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::Element &first,
- const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::Element &second) {
- return (first.list_element == second.list_element);
-}
-
-template <class K, class V, class Hasher, class Comparator, uint8_t MIN_HASH_TABLE_POWER, uint8_t RELATIONSHIP>
-bool operator!=(const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::Element &first,
- const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::Element &second) {
- return (first.list_element != second.list_element);
-}
-
-template <class K, class V, class Hasher, class Comparator, uint8_t MIN_HASH_TABLE_POWER, uint8_t RELATIONSHIP>
-bool operator==(const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::ConstElement &first,
- const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::ConstElement &second) {
- return (first.list_element == second.list_element);
-}
-
-template <class K, class V, class Hasher, class Comparator, uint8_t MIN_HASH_TABLE_POWER, uint8_t RELATIONSHIP>
-bool operator!=(const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::ConstElement &first,
- const typename OrderedHashMap<K, V, Hasher, Comparator, MIN_HASH_TABLE_POWER, RELATIONSHIP>::ConstElement &second) {
- return (first.list_element != second.list_element);
-}
-
#endif // ORDERED_HASH_MAP_H
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 1a29b92810..05f0478003 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1458,7 +1458,7 @@ void register_variant_methods() {
ADDFUNC0R(STRING, STRING, String, get_basename, varray());
ADDFUNC1R(STRING, STRING, String, plus_file, STRING, "file", varray());
ADDFUNC1R(STRING, INT, String, ord_at, INT, "at", varray());
- ADDFUNC0(STRING, STRING, String, dedent, varray());
+ ADDFUNC0R(STRING, STRING, String, dedent, varray());
ADDFUNC2(STRING, NIL, String, erase, INT, "position", INT, "chars", varray());
ADDFUNC0R(STRING, INT, String, hash, varray());
ADDFUNC0R(STRING, STRING, String, md5_text, varray());