diff options
author | Ferenc Arn <tagcup@yahoo.com> | 2017-11-16 21:09:00 -0500 |
---|---|---|
committer | Ferenc Arn <tagcup@yahoo.com> | 2017-11-17 11:01:41 -0500 |
commit | d28763a4c1792dc00fde3d151eaea54f9cf2b8a9 (patch) | |
tree | 7abd311b6e672829bd751fbf4d9135b60f2f9913 /modules/mono | |
parent | b44cb4e3b9b573a3cbbd6f71aff81e6c3465d84b (diff) |
Rename Rect3 to AABB.
Fixes #12973.
Diffstat (limited to 'modules/mono')
-rw-r--r-- | modules/mono/csharp_script.cpp | 2 | ||||
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 4 | ||||
-rw-r--r-- | modules/mono/glue/cs_files/AABB.cs (renamed from modules/mono/glue/cs_files/Rect3.cs) | 44 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_field.cpp | 6 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_marshal.cpp | 16 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_marshal.h | 8 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_utils.cpp | 6 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_utils.h | 4 |
8 files changed, 45 insertions, 45 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 161e130a07..dfa5e720ae 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -346,7 +346,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { Variant::TRANSFORM2D, Variant::PLANE, Variant::QUAT, - Variant::RECT3, + Variant::AABB, Variant::BASIS, Variant::TRANSFORM, Variant::COLOR, diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index a293cc2c50..59a2b73dbc 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -1721,7 +1721,7 @@ void BindingsGenerator::_default_argument_from_variant(const Variant &p_val, Arg r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL; break; case Variant::PLANE: - case Variant::RECT3: + case Variant::AABB: case Variant::COLOR: r_iarg.default_argument = "new Color(1, 1, 1, 1)"; r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL; @@ -1793,7 +1793,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { INSERT_STRUCT_TYPE(Basis, "real_t*") INSERT_STRUCT_TYPE(Quat, "real_t*") INSERT_STRUCT_TYPE(Transform, "real_t*") - INSERT_STRUCT_TYPE(Rect3, "real_t*") + INSERT_STRUCT_TYPE(AABB, "real_t*") INSERT_STRUCT_TYPE(Color, "real_t*") INSERT_STRUCT_TYPE(Plane, "real_t*") diff --git a/modules/mono/glue/cs_files/Rect3.cs b/modules/mono/glue/cs_files/AABB.cs index 617d33e7fd..6ee3bbe53a 100644 --- a/modules/mono/glue/cs_files/Rect3.cs +++ b/modules/mono/glue/cs_files/AABB.cs @@ -1,15 +1,15 @@ using System; -// file: core/math/rect3.h +// file: core/math/aabb.h // commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451 -// file: core/math/rect3.cpp +// file: core/math/aabb.cpp // commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0 // file: core/variant_call.cpp // commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685 namespace Godot { - public struct Rect3 : IEquatable<Rect3> + public struct AABB : IEquatable<AABB> { private Vector3 position; private Vector3 size; @@ -38,7 +38,7 @@ namespace Godot } } - public bool encloses(Rect3 with) + public bool encloses(AABB with) { Vector3 src_min = position; Vector3 src_max = position + size; @@ -53,7 +53,7 @@ namespace Godot (src_max.z > dst_max.z)); } - public Rect3 expand(Vector3 to_point) + public AABB expand(Vector3 to_point) { Vector3 begin = position; Vector3 end = position + size; @@ -72,7 +72,7 @@ namespace Godot if (to_point.z > end.z) end.z = to_point.z; - return new Rect3(begin, end - begin); + return new AABB(begin, end - begin); } public float get_area() @@ -222,9 +222,9 @@ namespace Godot (dir.z > 0f) ? -half_extents.z : half_extents.z); } - public Rect3 grow(float by) + public AABB grow(float by) { - Rect3 res = this; + AABB res = this; res.position.x -= by; res.position.y -= by; @@ -264,7 +264,7 @@ namespace Godot return true; } - public Rect3 intersection(Rect3 with) + public AABB intersection(AABB with) { Vector3 src_min = position; Vector3 src_max = position + size; @@ -275,7 +275,7 @@ namespace Godot if (src_min.x > dst_max.x || src_max.x < dst_min.x) { - return new Rect3(); + return new AABB(); } else { @@ -285,7 +285,7 @@ namespace Godot if (src_min.y > dst_max.y || src_max.y < dst_min.y) { - return new Rect3(); + return new AABB(); } else { @@ -295,7 +295,7 @@ namespace Godot if (src_min.z > dst_max.z || src_max.z < dst_min.z) { - return new Rect3(); + return new AABB(); } else { @@ -303,10 +303,10 @@ namespace Godot max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z; } - return new Rect3(min, max - min); + return new AABB(min, max - min); } - public bool intersects(Rect3 with) + public bool intersects(AABB with) { if (position.x >= (with.position.x + with.size.x)) return false; @@ -398,7 +398,7 @@ namespace Godot return true; } - public Rect3 merge(Rect3 with) + public AABB merge(AABB with) { Vector3 beg_1 = position; Vector3 beg_2 = with.position; @@ -417,36 +417,36 @@ namespace Godot (end_1.z > end_2.z) ? end_1.z : end_2.z ); - return new Rect3(min, max - min); + return new AABB(min, max - min); } - public Rect3(Vector3 position, Vector3 size) + public AABB(Vector3 position, Vector3 size) { this.position = position; this.size = size; } - public static bool operator ==(Rect3 left, Rect3 right) + public static bool operator ==(AABB left, AABB right) { return left.Equals(right); } - public static bool operator !=(Rect3 left, Rect3 right) + public static bool operator !=(AABB left, AABB right) { return !left.Equals(right); } public override bool Equals(object obj) { - if (obj is Rect3) + if (obj is AABB) { - return Equals((Rect3)obj); + return Equals((AABB)obj); } return false; } - public bool Equals(Rect3 other) + public bool Equals(AABB other) { return position == other.position && size == other.size; } diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 1643f8cfc5..1bee1115a6 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -129,8 +129,8 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { if (tclass == CACHED_CLASS(Transform)) SET_FROM_STRUCT_AND_BREAK(Transform); - if (tclass == CACHED_CLASS(Rect3)) - SET_FROM_STRUCT_AND_BREAK(Rect3); + if (tclass == CACHED_CLASS(AABB)) + SET_FROM_STRUCT_AND_BREAK(AABB); if (tclass == CACHED_CLASS(Color)) SET_FROM_STRUCT_AND_BREAK(Color); @@ -229,7 +229,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { case Variant::TRANSFORM2D: SET_FROM_STRUCT_AND_BREAK(Transform2D); case Variant::PLANE: SET_FROM_STRUCT_AND_BREAK(Plane); case Variant::QUAT: SET_FROM_STRUCT_AND_BREAK(Quat); - case Variant::RECT3: SET_FROM_STRUCT_AND_BREAK(Rect3); + case Variant::AABB: SET_FROM_STRUCT_AND_BREAK(AABB); case Variant::BASIS: SET_FROM_STRUCT_AND_BREAK(Basis); case Variant::TRANSFORM: SET_FROM_STRUCT_AND_BREAK(Transform); case Variant::COLOR: SET_FROM_STRUCT_AND_BREAK(Color); diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 01392447f3..9c415951bb 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -104,8 +104,8 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { if (tclass == CACHED_CLASS(Transform)) return Variant::TRANSFORM; - if (tclass == CACHED_CLASS(Rect3)) - return Variant::RECT3; + if (tclass == CACHED_CLASS(AABB)) + return Variant::AABB; if (tclass == CACHED_CLASS(Color)) return Variant::COLOR; @@ -297,8 +297,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty if (tclass == CACHED_CLASS(Transform)) RETURN_BOXED_STRUCT(Transform, p_var); - if (tclass == CACHED_CLASS(Rect3)) - RETURN_BOXED_STRUCT(Rect3, p_var); + if (tclass == CACHED_CLASS(AABB)) + RETURN_BOXED_STRUCT(AABB, p_var); if (tclass == CACHED_CLASS(Color)) RETURN_BOXED_STRUCT(Color, p_var); @@ -394,8 +394,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty RETURN_BOXED_STRUCT(Plane, p_var); case Variant::QUAT: RETURN_BOXED_STRUCT(Quat, p_var); - case Variant::RECT3: - RETURN_BOXED_STRUCT(Rect3, p_var); + case Variant::AABB: + RETURN_BOXED_STRUCT(AABB, p_var); case Variant::BASIS: RETURN_BOXED_STRUCT(Basis, p_var); case Variant::TRANSFORM: @@ -518,8 +518,8 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) { if (tclass == CACHED_CLASS(Transform)) RETURN_UNBOXED_STRUCT(Transform, p_obj); - if (tclass == CACHED_CLASS(Rect3)) - RETURN_UNBOXED_STRUCT(Rect3, p_obj); + if (tclass == CACHED_CLASS(AABB)) + RETURN_UNBOXED_STRUCT(AABB, p_obj); if (tclass == CACHED_CLASS(Color)) RETURN_UNBOXED_STRUCT(Color, p_obj); diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index 9f403b787f..443e947fb5 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -197,10 +197,10 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict); Basis(m_in[0], m_in[1], m_in[2], m_in[3], m_in[4], m_in[5], m_in[6], m_in[7], m_in[8]), \ Vector3(m_in[9], m_in[10], m_in[11])); -// Rect3 +// AABB -#define MARSHALLED_OUT_Rect3(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z }; -#define MARSHALLED_IN_Rect3(m_in, m_out) Rect3 m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5])); +#define MARSHALLED_OUT_AABB(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z }; +#define MARSHALLED_IN_AABB(m_in, m_out) AABB m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5])); // Color @@ -214,6 +214,6 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict); #endif -} // GDMonoMarshal +} // namespace GDMonoMarshal #endif // GDMONOMARSHAL_H diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp index 53e45002c4..1cccd0ad9d 100644 --- a/modules/mono/mono_gd/gd_mono_utils.cpp +++ b/modules/mono/mono_gd/gd_mono_utils.cpp @@ -80,7 +80,7 @@ void MonoCache::clear_members() { class_Basis = NULL; class_Quat = NULL; class_Transform = NULL; - class_Rect3 = NULL; + class_AABB = NULL; class_Color = NULL; class_Plane = NULL; class_NodePath = NULL; @@ -147,7 +147,7 @@ void update_godot_api_cache() { CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis)); CACHE_CLASS_AND_CHECK(Quat, GODOT_API_CLASS(Quat)); CACHE_CLASS_AND_CHECK(Transform, GODOT_API_CLASS(Transform)); - CACHE_CLASS_AND_CHECK(Rect3, GODOT_API_CLASS(Rect3)); + CACHE_CLASS_AND_CHECK(AABB, GODOT_API_CLASS(AABB)); CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color)); CACHE_CLASS_AND_CHECK(Plane, GODOT_API_CLASS(Plane)); CACHE_CLASS_AND_CHECK(NodePath, GODOT_API_CLASS(NodePath)); @@ -364,4 +364,4 @@ String get_exception_name_and_message(MonoObject *p_ex) { return res; } -} +} // namespace GDMonoUtils diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h index ebb5d28e4d..c38f8c5af5 100644 --- a/modules/mono/mono_gd/gd_mono_utils.h +++ b/modules/mono/mono_gd/gd_mono_utils.h @@ -82,7 +82,7 @@ struct MonoCache { GDMonoClass *class_Basis; GDMonoClass *class_Quat; GDMonoClass *class_Transform; - GDMonoClass *class_Rect3; + GDMonoClass *class_AABB; GDMonoClass *class_Color; GDMonoClass *class_Plane; GDMonoClass *class_NodePath; @@ -166,7 +166,7 @@ MonoDomain *create_domain(const String &p_friendly_name); String get_exception_name_and_message(MonoObject *p_ex); -} // GDMonoUtils +} // namespace GDMonoUtils #define NATIVE_GDMONOCLASS_NAME(m_class) (GDMonoMarshal::mono_string_to_godot((MonoString *)m_class->get_field(BINDINGS_NATIVE_NAME_FIELD)->get_value(NULL))) |