diff options
author | alexholly <alexander.holland@live.de> | 2017-06-04 00:25:13 +0200 |
---|---|---|
committer | alexholly <alexander.holland@live.de> | 2017-06-04 02:09:17 +0200 |
commit | a3c90b029308eb46b7fd83a0cf7b502ecbd79d55 (patch) | |
tree | 37aaaa84b53d962b441de0683a502e189cb371bb /core | |
parent | 69bec86028f87307e549d7a2f49bbb7e2b1f3771 (diff) |
renamed all Rect2.pos to Rect2.position
Diffstat (limited to 'core')
-rw-r--r-- | core/helper/math_fieldwise.cpp | 4 | ||||
-rw-r--r-- | core/image.cpp | 12 | ||||
-rw-r--r-- | core/io/marshalls.cpp | 8 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 8 | ||||
-rw-r--r-- | core/math/camera_matrix.cpp | 4 | ||||
-rw-r--r-- | core/math/math_2d.cpp | 2 | ||||
-rw-r--r-- | core/math/math_2d.h | 210 | ||||
-rw-r--r-- | core/variant.cpp | 6 | ||||
-rw-r--r-- | core/variant_op.cpp | 18 | ||||
-rw-r--r-- | core/variant_parser.cpp | 2 |
10 files changed, 137 insertions, 137 deletions
diff --git a/core/helper/math_fieldwise.cpp b/core/helper/math_fieldwise.cpp index 2f176fb9bf..cf45902bf9 100644 --- a/core/helper/math_fieldwise.cpp +++ b/core/helper/math_fieldwise.cpp @@ -63,8 +63,8 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const SETUP_TYPE(Rect2) - /**/ TRY_TRANSFER_FIELD("x", pos.x) - else TRY_TRANSFER_FIELD("y", pos.y) + /**/ TRY_TRANSFER_FIELD("x", position.x) + else TRY_TRANSFER_FIELD("y", position.y) else TRY_TRANSFER_FIELD("w", size.x) else TRY_TRANSFER_FIELD("h", size.y) diff --git a/core/image.cpp b/core/image.cpp index 2640c6be2a..2da91c7b13 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1612,11 +1612,11 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Po ERR_FAIL_COND(srcdsize == 0); ERR_FAIL_COND(format != p_src->format); - Rect2i local_src_rect = Rect2i(0, 0, width, height).clip(Rect2i(p_dest + p_src_rect.pos, p_src_rect.size)); + Rect2i local_src_rect = Rect2i(0, 0, width, height).clip(Rect2i(p_dest + p_src_rect.position, p_src_rect.size)); if (local_src_rect.size.x <= 0 || local_src_rect.size.y <= 0) return; - Rect2i src_rect(p_src_rect.pos + (local_src_rect.pos - p_dest), local_src_rect.size); + Rect2i src_rect(p_src_rect.position + (local_src_rect.position - p_dest), local_src_rect.size); PoolVector<uint8_t>::Write wp = data.write(); uint8_t *dst_data_ptr = wp.ptr(); @@ -1630,11 +1630,11 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Po for (int j = 0; j < src_rect.size.x; j++) { - int src_x = src_rect.pos.x + j; - int src_y = src_rect.pos.y + i; + int src_x = src_rect.position.x + j; + int src_y = src_rect.position.y + i; - int dst_x = local_src_rect.pos.x + j; - int dst_y = local_src_rect.pos.y + i; + int dst_x = local_src_rect.position.x + j; + int dst_y = local_src_rect.position.y + i; const uint8_t *src = &src_data_ptr[(src_y * p_src->width + src_x) * pixel_size]; uint8_t *dst = &dst_data_ptr[(dst_y * width + dst_x) * pixel_size]; diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index dccf70ad7a..ceae543ff9 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -139,8 +139,8 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int ERR_FAIL_COND_V(len < (int)4 * 4, ERR_INVALID_DATA); Rect2 val; - val.pos.x = decode_float(&buf[0]); - val.pos.y = decode_float(&buf[4]); + val.position.x = decode_float(&buf[0]); + val.position.y = decode_float(&buf[4]); val.size.x = decode_float(&buf[8]); val.size.y = decode_float(&buf[12]); r_variant = val; @@ -861,8 +861,8 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) { if (buf) { Rect2 r2 = p_variant; - encode_float(r2.pos.x, &buf[0]); - encode_float(r2.pos.y, &buf[4]); + encode_float(r2.position.x, &buf[0]); + encode_float(r2.position.y, &buf[4]); encode_float(r2.size.x, &buf[8]); encode_float(r2.size.y, &buf[12]); } diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 26b53c2a31..01cad9d525 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -155,8 +155,8 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { case VARIANT_RECT2: { Rect2 v; - v.pos.x = f->get_real(); - v.pos.y = f->get_real(); + v.position.x = f->get_real(); + v.position.y = f->get_real(); v.size.x = f->get_real(); v.size.y = f->get_real(); r_v = v; @@ -1288,8 +1288,8 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant &p_property, f->store_32(VARIANT_RECT2); Rect2 val = p_property; - f->store_real(val.pos.x); - f->store_real(val.pos.y); + f->store_real(val.position.x); + f->store_real(val.position.y); f->store_real(val.size.x); f->store_real(val.size.y); diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 5b072b7c53..c26b12b0f0 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -507,8 +507,8 @@ void CameraMatrix::set_light_atlas_rect(const Rect2 &p_rect) { m[9] = 0.0, m[10] = 1.0, m[11] = 0.0, - m[12] = p_rect.pos.x, - m[13] = p_rect.pos.y, + m[12] = p_rect.position.x, + m[13] = p_rect.position.y, m[14] = 0.0, m[15] = 1.0; } diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp index 962a42acb9..52e240ed47 100644 --- a/core/math/math_2d.cpp +++ b/core/math/math_2d.cpp @@ -308,7 +308,7 @@ bool Rect2::intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 for (int i = 0; i < 2; i++) { real_t seg_from = p_from[i]; real_t seg_to = p_to[i]; - real_t box_begin = pos[i]; + real_t box_begin = position[i]; real_t box_end = box_begin + size[i]; real_t cmin, cmax; real_t csign; diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 128b74baf6..dc4850eeed 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -207,24 +207,24 @@ struct Transform2D; struct Rect2 { - Point2 pos; + Point2 position; Size2 size; - const Vector2 &get_pos() const { return pos; } - void set_pos(const Vector2 &p_pos) { pos = p_pos; } + const Vector2 &get_position() const { return position; } + void set_position(const Vector2 &p_pos) { position = p_pos; } const Vector2 &get_size() const { return size; } void set_size(const Vector2 &p_size) { size = p_size; } real_t get_area() const { return size.width * size.height; } inline bool intersects(const Rect2 &p_rect) const { - if (pos.x >= (p_rect.pos.x + p_rect.size.width)) + if (position.x >= (p_rect.position.x + p_rect.size.width)) return false; - if ((pos.x + size.width) <= p_rect.pos.x) + if ((position.x + size.width) <= p_rect.position.x) return false; - if (pos.y >= (p_rect.pos.y + p_rect.size.height)) + if (position.y >= (p_rect.position.y + p_rect.size.height)) return false; - if ((pos.y + size.height) <= p_rect.pos.y) + if ((position.y + size.height) <= p_rect.position.y) return false; return true; @@ -234,17 +234,17 @@ struct Rect2 { real_t dist = 1e20; - if (p_point.x < pos.x) { - dist = MIN(dist, pos.x - p_point.x); + if (p_point.x < position.x) { + dist = MIN(dist, position.x - p_point.x); } - if (p_point.y < pos.y) { - dist = MIN(dist, pos.y - p_point.y); + if (p_point.y < position.y) { + dist = MIN(dist, position.y - p_point.y); } - if (p_point.x >= (pos.x + size.x)) { - dist = MIN(p_point.x - (pos.x + size.x), dist); + if (p_point.x >= (position.x + size.x)) { + dist = MIN(p_point.x - (position.x + size.x), dist); } - if (p_point.y >= (pos.y + size.y)) { - dist = MIN(p_point.y - (pos.y + size.y), dist); + if (p_point.y >= (position.y + size.y)) { + dist = MIN(p_point.y - (position.y + size.y), dist); } if (dist == 1e20) @@ -259,9 +259,9 @@ struct Rect2 { inline bool encloses(const Rect2 &p_rect) const { - return (p_rect.pos.x >= pos.x) && (p_rect.pos.y >= pos.y) && - ((p_rect.pos.x + p_rect.size.x) < (pos.x + size.x)) && - ((p_rect.pos.y + p_rect.size.y) < (pos.y + size.y)); + return (p_rect.position.x >= position.x) && (p_rect.position.y >= position.y) && + ((p_rect.position.x + p_rect.size.x) < (position.x + size.x)) && + ((p_rect.position.y + p_rect.size.y) < (position.y + size.y)); } inline bool has_no_area() const { @@ -275,14 +275,14 @@ struct Rect2 { if (!intersects(new_rect)) return Rect2(); - new_rect.pos.x = MAX(p_rect.pos.x, pos.x); - new_rect.pos.y = MAX(p_rect.pos.y, pos.y); + new_rect.position.x = MAX(p_rect.position.x, position.x); + new_rect.position.y = MAX(p_rect.position.y, position.y); - Point2 p_rect_end = p_rect.pos + p_rect.size; - Point2 end = pos + size; + Point2 p_rect_end = p_rect.position + p_rect.size; + Point2 end = position + size; - new_rect.size.x = MIN(p_rect_end.x, end.x) - new_rect.pos.x; - new_rect.size.y = MIN(p_rect_end.y, end.y) - new_rect.pos.y; + new_rect.size.x = MIN(p_rect_end.x, end.x) - new_rect.position.x; + new_rect.size.y = MIN(p_rect_end.y, end.y) - new_rect.position.y; return new_rect; } @@ -291,25 +291,25 @@ struct Rect2 { Rect2 new_rect; - new_rect.pos.x = MIN(p_rect.pos.x, pos.x); - new_rect.pos.y = MIN(p_rect.pos.y, pos.y); + new_rect.position.x = MIN(p_rect.position.x, position.x); + new_rect.position.y = MIN(p_rect.position.y, position.y); - new_rect.size.x = MAX(p_rect.pos.x + p_rect.size.x, pos.x + size.x); - new_rect.size.y = MAX(p_rect.pos.y + p_rect.size.y, pos.y + size.y); + new_rect.size.x = MAX(p_rect.position.x + p_rect.size.x, position.x + size.x); + new_rect.size.y = MAX(p_rect.position.y + p_rect.size.y, position.y + size.y); - new_rect.size = new_rect.size - new_rect.pos; //make relative again + new_rect.size = new_rect.size - new_rect.position; //make relative again return new_rect; }; inline bool has_point(const Point2 &p_point) const { - if (p_point.x < pos.x) + if (p_point.x < position.x) return false; - if (p_point.y < pos.y) + if (p_point.y < position.y) return false; - if (p_point.x >= (pos.x + size.x)) + if (p_point.x >= (position.x + size.x)) return false; - if (p_point.y >= (pos.y + size.y)) + if (p_point.y >= (position.y + size.y)) return false; return true; @@ -317,14 +317,14 @@ struct Rect2 { inline bool no_area() const { return (size.width <= 0 || size.height <= 0); } - bool operator==(const Rect2 &p_rect) const { return pos == p_rect.pos && size == p_rect.size; } - bool operator!=(const Rect2 &p_rect) const { return pos != p_rect.pos || size != p_rect.size; } + bool operator==(const Rect2 &p_rect) const { return position == p_rect.position && size == p_rect.size; } + bool operator!=(const Rect2 &p_rect) const { return position != p_rect.position || size != p_rect.size; } inline Rect2 grow(real_t p_by) const { Rect2 g = *this; - g.pos.x -= p_by; - g.pos.y -= p_by; + g.position.x -= p_by; + g.position.y -= p_by; g.size.width += p_by * 2; g.size.height += p_by * 2; return g; @@ -339,8 +339,8 @@ struct Rect2 { inline void expand_to(const Vector2 &p_vector) { //in place function for speed - Vector2 begin = pos; - Vector2 end = pos + size; + Vector2 begin = position; + Vector2 end = position + size; if (p_vector.x < begin.x) begin.x = p_vector.x; @@ -352,19 +352,19 @@ struct Rect2 { if (p_vector.y > end.y) end.y = p_vector.y; - pos = begin; + position = begin; size = end - begin; } - operator String() const { return String(pos) + ", " + String(size); } + operator String() const { return String(position) + ", " + String(size); } Rect2() {} Rect2(real_t p_x, real_t p_y, real_t p_width, real_t p_height) { - pos = Point2(p_x, p_y); + position = Point2(p_x, p_y); size = Size2(p_width, p_height); } Rect2(const Point2 &p_pos, const Size2 &p_size) { - pos = p_pos; + position = p_pos; size = p_size; } }; @@ -434,24 +434,24 @@ typedef Point2i Size2i; struct Rect2i { - Point2i pos; + Point2i position; Size2i size; - const Point2i &get_pos() const { return pos; } - void set_pos(const Point2i &p_pos) { pos = p_pos; } + const Point2i &get_position() const { return position; } + void set_position(const Point2i &p_pos) { position = p_pos; } const Point2i &get_size() const { return size; } void set_size(const Point2i &p_size) { size = p_size; } int get_area() const { return size.width * size.height; } inline bool intersects(const Rect2i &p_rect) const { - if (pos.x > (p_rect.pos.x + p_rect.size.width)) + if (position.x > (p_rect.position.x + p_rect.size.width)) return false; - if ((pos.x + size.width) < p_rect.pos.x) + if ((position.x + size.width) < p_rect.position.x) return false; - if (pos.y > (p_rect.pos.y + p_rect.size.height)) + if (position.y > (p_rect.position.y + p_rect.size.height)) return false; - if ((pos.y + size.height) < p_rect.pos.y) + if ((position.y + size.height) < p_rect.position.y) return false; return true; @@ -459,9 +459,9 @@ struct Rect2i { inline bool encloses(const Rect2i &p_rect) const { - return (p_rect.pos.x >= pos.x) && (p_rect.pos.y >= pos.y) && - ((p_rect.pos.x + p_rect.size.x) < (pos.x + size.x)) && - ((p_rect.pos.y + p_rect.size.y) < (pos.y + size.y)); + return (p_rect.position.x >= position.x) && (p_rect.position.y >= position.y) && + ((p_rect.position.x + p_rect.size.x) < (position.x + size.x)) && + ((p_rect.position.y + p_rect.size.y) < (position.y + size.y)); } inline bool has_no_area() const { @@ -475,14 +475,14 @@ struct Rect2i { if (!intersects(new_rect)) return Rect2i(); - new_rect.pos.x = MAX(p_rect.pos.x, pos.x); - new_rect.pos.y = MAX(p_rect.pos.y, pos.y); + new_rect.position.x = MAX(p_rect.position.x, position.x); + new_rect.position.y = MAX(p_rect.position.y, position.y); - Point2 p_rect_end = p_rect.pos + p_rect.size; - Point2 end = pos + size; + Point2 p_rect_end = p_rect.position + p_rect.size; + Point2 end = position + size; - new_rect.size.x = (int)(MIN(p_rect_end.x, end.x) - new_rect.pos.x); - new_rect.size.y = (int)(MIN(p_rect_end.y, end.y) - new_rect.pos.y); + new_rect.size.x = (int)(MIN(p_rect_end.x, end.x) - new_rect.position.x); + new_rect.size.y = (int)(MIN(p_rect_end.y, end.y) - new_rect.position.y); return new_rect; } @@ -491,25 +491,25 @@ struct Rect2i { Rect2i new_rect; - new_rect.pos.x = MIN(p_rect.pos.x, pos.x); - new_rect.pos.y = MIN(p_rect.pos.y, pos.y); + new_rect.position.x = MIN(p_rect.position.x, position.x); + new_rect.position.y = MIN(p_rect.position.y, position.y); - new_rect.size.x = MAX(p_rect.pos.x + p_rect.size.x, pos.x + size.x); - new_rect.size.y = MAX(p_rect.pos.y + p_rect.size.y, pos.y + size.y); + new_rect.size.x = MAX(p_rect.position.x + p_rect.size.x, position.x + size.x); + new_rect.size.y = MAX(p_rect.position.y + p_rect.size.y, position.y + size.y); - new_rect.size = new_rect.size - new_rect.pos; //make relative again + new_rect.size = new_rect.size - new_rect.position; //make relative again return new_rect; }; bool has_point(const Point2 &p_point) const { - if (p_point.x < pos.x) + if (p_point.x < position.x) return false; - if (p_point.y < pos.y) + if (p_point.y < position.y) return false; - if (p_point.x >= (pos.x + size.x)) + if (p_point.x >= (position.x + size.x)) return false; - if (p_point.y >= (pos.y + size.y)) + if (p_point.y >= (position.y + size.y)) return false; return true; @@ -517,14 +517,14 @@ struct Rect2i { bool no_area() { return (size.width <= 0 || size.height <= 0); } - bool operator==(const Rect2i &p_rect) const { return pos == p_rect.pos && size == p_rect.size; } - bool operator!=(const Rect2i &p_rect) const { return pos != p_rect.pos || size != p_rect.size; } + bool operator==(const Rect2i &p_rect) const { return position == p_rect.position && size == p_rect.size; } + bool operator!=(const Rect2i &p_rect) const { return position != p_rect.position || size != p_rect.size; } Rect2i grow(int p_by) const { Rect2i g = *this; - g.pos.x -= p_by; - g.pos.y -= p_by; + g.position.x -= p_by; + g.position.y -= p_by; g.size.width += p_by * 2; g.size.height += p_by * 2; return g; @@ -532,8 +532,8 @@ struct Rect2i { inline void expand_to(const Point2i &p_vector) { - Point2i begin = pos; - Point2i end = pos + size; + Point2i begin = position; + Point2i end = position + size; if (p_vector.x < begin.x) begin.x = p_vector.x; @@ -545,24 +545,24 @@ struct Rect2i { if (p_vector.y > end.y) end.y = p_vector.y; - pos = begin; + position = begin; size = end - begin; } - operator String() const { return String(pos) + ", " + String(size); } + operator String() const { return String(position) + ", " + String(size); } - operator Rect2() const { return Rect2(pos, size); } + operator Rect2() const { return Rect2(position, size); } Rect2i(const Rect2 &p_r2) { - pos = p_r2.pos; + position = p_r2.position; size = p_r2.size; } Rect2i() {} Rect2i(int p_x, int p_y, int p_width, int p_height) { - pos = Point2(p_x, p_y); + position = Point2(p_x, p_y); size = Size2(p_width, p_height); } Rect2i(const Point2 &p_pos, const Size2 &p_size) { - pos = p_pos; + position = p_pos; size = p_size; } }; @@ -668,30 +668,30 @@ bool Rect2::intersects_transformed(const Transform2D &p_xform, const Rect2 &p_re //SAT intersection between local and transformed rect2 Vector2 xf_points[4] = { - p_xform.xform(p_rect.pos), - p_xform.xform(Vector2(p_rect.pos.x + p_rect.size.x, p_rect.pos.y)), - p_xform.xform(Vector2(p_rect.pos.x, p_rect.pos.y + p_rect.size.y)), - p_xform.xform(Vector2(p_rect.pos.x + p_rect.size.x, p_rect.pos.y + p_rect.size.y)), + p_xform.xform(p_rect.position), + p_xform.xform(Vector2(p_rect.position.x + p_rect.size.x, p_rect.position.y)), + p_xform.xform(Vector2(p_rect.position.x, p_rect.position.y + p_rect.size.y)), + p_xform.xform(Vector2(p_rect.position.x + p_rect.size.x, p_rect.position.y + p_rect.size.y)), }; real_t low_limit; //base rect2 first (faster) - if (xf_points[0].y > pos.y) + if (xf_points[0].y > position.y) goto next1; - if (xf_points[1].y > pos.y) + if (xf_points[1].y > position.y) goto next1; - if (xf_points[2].y > pos.y) + if (xf_points[2].y > position.y) goto next1; - if (xf_points[3].y > pos.y) + if (xf_points[3].y > position.y) goto next1; return false; next1: - low_limit = pos.y + size.y; + low_limit = position.y + size.y; if (xf_points[0].y < low_limit) goto next2; @@ -706,20 +706,20 @@ next1: next2: - if (xf_points[0].x > pos.x) + if (xf_points[0].x > position.x) goto next3; - if (xf_points[1].x > pos.x) + if (xf_points[1].x > position.x) goto next3; - if (xf_points[2].x > pos.x) + if (xf_points[2].x > position.x) goto next3; - if (xf_points[3].x > pos.x) + if (xf_points[3].x > position.x) goto next3; return false; next3: - low_limit = pos.x + size.x; + low_limit = position.x + size.x; if (xf_points[0].x < low_limit) goto next4; @@ -735,10 +735,10 @@ next3: next4: Vector2 xf_points2[4] = { - pos, - Vector2(pos.x + size.x, pos.y), - Vector2(pos.x, pos.y + size.y), - Vector2(pos.x + size.x, pos.y + size.y), + position, + Vector2(position.x + size.x, position.y), + Vector2(position.x, position.y + size.y), + Vector2(position.x + size.x, position.y + size.y), }; real_t maxa = p_xform.elements[0].dot(xf_points2[0]); @@ -847,10 +847,10 @@ Rect2 Transform2D::xform(const Rect2 &p_rect) const { Vector2 x = elements[0] * p_rect.size.x; Vector2 y = elements[1] * p_rect.size.y; - Vector2 pos = xform(p_rect.pos); + Vector2 pos = xform(p_rect.position); Rect2 new_rect; - new_rect.pos = pos; + new_rect.position = pos; new_rect.expand_to(pos + x); new_rect.expand_to(pos + y); new_rect.expand_to(pos + x + y); @@ -868,14 +868,14 @@ void Transform2D::set_rotation_and_scale(real_t p_rot, const Size2 &p_scale) { Rect2 Transform2D::xform_inv(const Rect2 &p_rect) const { Vector2 ends[4] = { - xform_inv(p_rect.pos), - xform_inv(Vector2(p_rect.pos.x, p_rect.pos.y + p_rect.size.y)), - xform_inv(Vector2(p_rect.pos.x + p_rect.size.x, p_rect.pos.y + p_rect.size.y)), - xform_inv(Vector2(p_rect.pos.x + p_rect.size.x, p_rect.pos.y)) + xform_inv(p_rect.position), + xform_inv(Vector2(p_rect.position.x, p_rect.position.y + p_rect.size.y)), + xform_inv(Vector2(p_rect.position.x + p_rect.size.x, p_rect.position.y + p_rect.size.y)), + xform_inv(Vector2(p_rect.position.x + p_rect.size.x, p_rect.position.y)) }; Rect2 new_rect; - new_rect.pos = ends[0]; + new_rect.position = ends[0]; new_rect.expand_to(ends[1]); new_rect.expand_to(ends[2]); new_rect.expand_to(ends[3]); diff --git a/core/variant.cpp b/core/variant.cpp index ae5141b8bf..0543dd6b79 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -2549,8 +2549,8 @@ uint32_t Variant::hash() const { } break; case RECT2: { - uint32_t hash = hash_djb2_one_float(reinterpret_cast<const Rect2 *>(_data._mem)->pos.x); - hash = hash_djb2_one_float(reinterpret_cast<const Rect2 *>(_data._mem)->pos.y, hash); + uint32_t hash = hash_djb2_one_float(reinterpret_cast<const Rect2 *>(_data._mem)->position.x); + hash = hash_djb2_one_float(reinterpret_cast<const Rect2 *>(_data._mem)->position.y, hash); hash = hash_djb2_one_float(reinterpret_cast<const Rect2 *>(_data._mem)->size.x, hash); return hash_djb2_one_float(reinterpret_cast<const Rect2 *>(_data._mem)->size.y, hash); } break; @@ -2820,7 +2820,7 @@ bool Variant::hash_compare(const Variant &p_variant) const { const Rect2 *l = reinterpret_cast<const Rect2 *>(_data._mem); const Rect2 *r = reinterpret_cast<const Rect2 *>(p_variant._data._mem); - return (hash_compare_vector2(l->pos, r->pos)) && + return (hash_compare_vector2(l->position, r->position)) && (hash_compare_vector2(l->size, r->size)); } break; diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 7b9b7abd9e..4871df8918 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -1131,9 +1131,9 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) const String *str = reinterpret_cast<const String *>(p_index._data._mem); Rect2 *v = reinterpret_cast<Rect2 *>(_data._mem); - if (*str == "pos") { + if (*str == "position") { valid = true; - v->pos = p_value; + v->position = p_value; return; } else if (*str == "size") { valid = true; @@ -1141,7 +1141,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) return; } else if (*str == "end") { valid = true; - v->size = Vector2(p_value) - v->pos; + v->size = Vector2(p_value) - v->position; return; } } @@ -1589,15 +1589,15 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { const String *str = reinterpret_cast<const String *>(p_index._data._mem); const Rect2 *v = reinterpret_cast<const Rect2 *>(_data._mem); - if (*str == "pos") { + if (*str == "position") { valid = true; - return v->pos; + return v->position; } else if (*str == "size") { valid = true; return v->size; } else if (*str == "end") { valid = true; - return v->size + v->pos; + return v->size + v->position; } } } break; @@ -2111,7 +2111,7 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const { } break; // 5 case RECT2: { - p_list->push_back(PropertyInfo(Variant::VECTOR2, "pos")); + p_list->push_back(PropertyInfo(Variant::VECTOR2, "position")); p_list->push_back(PropertyInfo(Variant::VECTOR2, "size")); p_list->push_back(PropertyInfo(Variant::VECTOR2, "end")); @@ -2759,7 +2759,7 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst) case RECT2: { const Rect2 *ra = reinterpret_cast<const Rect2 *>(a._data._mem); const Rect2 *rb = reinterpret_cast<const Rect2 *>(b._data._mem); - r_dst = Rect2(ra->pos + rb->pos * c, ra->size + rb->size * c); + r_dst = Rect2(ra->position + rb->position * c, ra->size + rb->size * c); } return; case VECTOR3: { @@ -2879,7 +2879,7 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & } return; case RECT2: { - r_dst = Rect2(reinterpret_cast<const Rect2 *>(a._data._mem)->pos.linear_interpolate(reinterpret_cast<const Rect2 *>(b._data._mem)->pos, c), reinterpret_cast<const Rect2 *>(a._data._mem)->size.linear_interpolate(reinterpret_cast<const Rect2 *>(b._data._mem)->size, c)); + r_dst = Rect2(reinterpret_cast<const Rect2 *>(a._data._mem)->position.linear_interpolate(reinterpret_cast<const Rect2 *>(b._data._mem)->position, c), reinterpret_cast<const Rect2 *>(a._data._mem)->size.linear_interpolate(reinterpret_cast<const Rect2 *>(b._data._mem)->size, c)); } return; case VECTOR3: { diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 55e2bb42e3..0553ba4319 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -1616,7 +1616,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str case Variant::RECT2: { Rect2 aabb = p_variant; - p_store_string_func(p_store_string_ud, "Rect2( " + rtosfix(aabb.pos.x) + ", " + rtosfix(aabb.pos.y) + ", " + rtosfix(aabb.size.x) + ", " + rtosfix(aabb.size.y) + " )"); + p_store_string_func(p_store_string_ud, "Rect2( " + rtosfix(aabb.position.x) + ", " + rtosfix(aabb.position.y) + ", " + rtosfix(aabb.size.x) + ", " + rtosfix(aabb.size.y) + " )"); } break; case Variant::VECTOR3: { |