summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/animation.cpp2
-rw-r--r--scene/resources/bit_mask.cpp4
-rw-r--r--scene/resources/capsule_shape_2d.cpp2
-rw-r--r--scene/resources/circle_shape_2d.cpp2
-rw-r--r--scene/resources/concave_polygon_shape_2d.cpp2
-rw-r--r--scene/resources/convex_polygon_shape_2d.cpp2
-rw-r--r--scene/resources/default_theme/default_theme.cpp8
-rw-r--r--scene/resources/font.cpp8
-rw-r--r--scene/resources/material.cpp68
-rw-r--r--scene/resources/material.h5
-rw-r--r--scene/resources/polygon_path_finder.cpp2
-rw-r--r--scene/resources/segment_shape_2d.cpp6
-rw-r--r--scene/resources/shape_line_2d.cpp2
-rw-r--r--scene/resources/style_box.cpp26
-rw-r--r--scene/resources/texture.cpp38
-rw-r--r--scene/resources/world_2d.cpp8
16 files changed, 94 insertions, 91 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 545c700354..fe5e6e775a 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -1133,7 +1133,7 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
Rect2 pb = p_post_b;
return Rect2(
- a.pos.cubic_interpolate(b.pos, pa.pos, pb.pos, p_c),
+ a.position.cubic_interpolate(b.position, pa.position, pb.position, p_c),
a.size.cubic_interpolate(b.size, pa.size, pb.size, p_c));
} break;
diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp
index e512f8a968..a473067937 100644
--- a/scene/resources/bit_mask.cpp
+++ b/scene/resources/bit_mask.cpp
@@ -67,9 +67,9 @@ void BitMap::set_bit_rect(const Rect2 &p_rect, bool p_value) {
Rect2i current = Rect2i(0, 0, width, height).clip(p_rect);
uint8_t *data = bitmask.ptr();
- for (int i = current.pos.x; i < current.pos.x + current.size.x; i++) {
+ for (int i = current.position.x; i < current.position.x + current.size.x; i++) {
- for (int j = current.pos.y; j < current.pos.y + current.size.y; j++) {
+ for (int j = current.position.y; j < current.position.y + current.size.y; j++) {
int ofs = width * j + i;
int bbyte = ofs / 8;
diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp
index 3f41526bcb..20177692a1 100644
--- a/scene/resources/capsule_shape_2d.cpp
+++ b/scene/resources/capsule_shape_2d.cpp
@@ -80,7 +80,7 @@ Rect2 CapsuleShape2D::get_rect() const {
Vector2 he = Point2(get_radius(), get_radius() + get_height() * 0.5);
Rect2 rect;
- rect.pos = -he;
+ rect.position = -he;
rect.size = he * 2.0;
return rect;
}
diff --git a/scene/resources/circle_shape_2d.cpp b/scene/resources/circle_shape_2d.cpp
index 4512e1c4a9..1b7e09ddfb 100644
--- a/scene/resources/circle_shape_2d.cpp
+++ b/scene/resources/circle_shape_2d.cpp
@@ -58,7 +58,7 @@ void CircleShape2D::_bind_methods() {
Rect2 CircleShape2D::get_rect() const {
Rect2 rect;
- rect.pos = -Point2(get_radius(), get_radius());
+ rect.position = -Point2(get_radius(), get_radius());
rect.size = Point2(get_radius(), get_radius()) * 2.0;
return rect;
}
diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp
index 653540a663..b8c931421e 100644
--- a/scene/resources/concave_polygon_shape_2d.cpp
+++ b/scene/resources/concave_polygon_shape_2d.cpp
@@ -68,7 +68,7 @@ Rect2 ConcavePolygonShape2D::get_rect() const {
PoolVector<Vector2>::Read r = s.read();
for (int i = 0; i < len; i++) {
if (i == 0)
- rect.pos = r[i];
+ rect.position = r[i];
else
rect.expand_to(r[i]);
}
diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp
index fcbf66c8cd..e13f7faf70 100644
--- a/scene/resources/convex_polygon_shape_2d.cpp
+++ b/scene/resources/convex_polygon_shape_2d.cpp
@@ -78,7 +78,7 @@ Rect2 ConvexPolygonShape2D::get_rect() const {
Rect2 rect;
for (int i = 0; i < points.size(); i++) {
if (i == 0)
- rect.pos = points[i];
+ rect.position = points[i];
else
rect.expand_to(points[i]);
}
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 1af2e82a4f..668a8ff66f 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -138,8 +138,8 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p
int chr = c[0];
Rect2 frect;
- frect.pos.x = c[1];
- frect.pos.y = c[2];
+ frect.position.x = c[1];
+ frect.position.y = c[2];
frect.size.x = c[3];
frect.size.y = c[4];
Point2 align(c[5], c[6] + p_valign);
@@ -170,8 +170,8 @@ static Ref<BitmapFont> make_font2(int p_height, int p_ascent, int p_charcount, c
int chr = c[0];
Rect2 frect;
- frect.pos.x = c[1];
- frect.pos.y = c[2];
+ frect.position.x = c[1];
+ frect.position.y = c[2];
frect.size.x = c[3];
frect.size.y = c[4];
Point2 align(c[6], c[5]);
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 692dc47677..225a42f651 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -120,8 +120,8 @@ PoolVector<int> BitmapFont::_get_chars() const {
const Character *c = char_map.getptr(*key);
chars.push_back(*key);
chars.push_back(c->texture_idx);
- chars.push_back(c->rect.pos.x);
- chars.push_back(c->rect.pos.y);
+ chars.push_back(c->rect.position.x);
+ chars.push_back(c->rect.position.y);
chars.push_back(c->rect.size.x);
chars.push_back(c->rect.size.y);
@@ -272,9 +272,9 @@ Error BitmapFont::create_from_fnt(const String &p_string) {
Rect2 rect;
if (keys.has("x"))
- rect.pos.x = keys["x"].to_int();
+ rect.position.x = keys["x"].to_int();
if (keys.has("y"))
- rect.pos.y = keys["y"].to_int();
+ rect.position.y = keys["y"].to_int();
if (keys.has("width"))
rect.size.width = keys["width"].to_int();
if (keys.has("height"))
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index a9205fd571..ce88325539 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -193,7 +193,6 @@ void SpatialMaterial::init_shaders() {
shader_names->depth_scale = "depth_scale";
shader_names->subsurface_scattering_strength = "subsurface_scattering_strength";
shader_names->refraction = "refraction";
- shader_names->refraction_roughness = "refraction_roughness";
shader_names->point_size = "point_size";
shader_names->uv1_scale = "uv1_scale";
shader_names->uv1_offset = "uv1_offset";
@@ -268,7 +267,12 @@ void SpatialMaterial::_update_shader() {
case BLEND_MODE_MUL: code += "blend_mul"; break;
}
- switch (depth_draw_mode) {
+ DepthDrawMode ddm = depth_draw_mode;
+ if (features[FEATURE_REFRACTION]) {
+ ddm = DEPTH_DRAW_ALWAYS;
+ }
+
+ switch (ddm) {
case DEPTH_DRAW_OPAQUE_ONLY: code += ",depth_draw_opaque"; break;
case DEPTH_DRAW_ALWAYS: code += ",depth_draw_always"; break;
case DEPTH_DRAW_DISABLED: code += ",depth_draw_never"; break;
@@ -322,6 +326,11 @@ void SpatialMaterial::_update_shader() {
code += "uniform float emission_energy;\n";
}
+ if (features[FEATURE_REFRACTION]) {
+ code += "uniform sampler2D texture_refraction;\n";
+ code += "uniform float refraction : hint_range(-16,16);\n";
+ }
+
if (features[FEATURE_NORMAL_MAPPING]) {
code += "uniform sampler2D texture_normal : hint_normal;\n";
code += "uniform float normal_scale : hint_range(-16,16);\n";
@@ -489,17 +498,37 @@ void SpatialMaterial::_update_shader() {
}
code += "\tALBEDO = albedo.rgb * albedo_tex.rgb;\n";
- if (features[FEATURE_TRANSPARENT]) {
- code += "\tALPHA = albedo.a * albedo_tex.a;\n";
+ code += "\tfloat metallic_tex = texture(texture_metallic,base_uv).r;\n";
+ code += "\tMETALLIC = metallic_tex * metallic;\n";
+ code += "\tfloat roughness_tex = texture(texture_roughness,base_uv).r;\n";
+ code += "\tROUGHNESS = roughness_tex * roughness;\n";
+ code += "\tSPECULAR = specular;\n";
+
+ if (features[FEATURE_NORMAL_MAPPING]) {
+ code += "\tNORMALMAP = texture(texture_normal,base_uv).rgb;\n";
+ code += "\tNORMALMAP_DEPTH = normal_scale;\n";
}
if (features[FEATURE_EMISSION]) {
code += "\tEMISSION = (emission.rgb+texture(texture_emission,base_uv).rgb)*emission_energy;\n";
}
- if (features[FEATURE_NORMAL_MAPPING]) {
- code += "\tNORMALMAP = texture(texture_normal,base_uv).rgb;\n";
- code += "\tNORMALMAP_DEPTH = normal_scale;\n";
+ if (features[FEATURE_REFRACTION]) {
+
+ if (features[FEATURE_NORMAL_MAPPING]) {
+ code += "\tvec3 ref_normal = normalize( mix(NORMAL,TANGENT * NORMALMAP.x + BINORMAL * NORMALMAP.y + NORMAL * NORMALMAP.z,NORMALMAP_DEPTH) ) * SIDE;\n";
+ } else {
+ code += "\tvec3 ref_normal = NORMAL;\n";
+ }
+
+ code += "\tvec2 ref_ofs = SCREEN_UV - ref_normal.xy * texture(texture_refraction,base_uv).r * refraction;\n";
+ code += "\tfloat ref_amount = 1.0 - albedo.a * albedo_tex.a;\n";
+ code += "\tEMISSION += textureLod(SCREEN_TEXTURE,ref_ofs,ROUGHNESS * 8.0).rgb * ref_amount;\n";
+ code += "\tALBEDO *= 1.0 - ref_amount;\n";
+ code += "\tALPHA = 1.0;\n";
+
+ } else if (features[FEATURE_TRANSPARENT]) {
+ code += "\tALPHA = albedo.a * albedo_tex.a;\n";
}
if (features[FEATURE_RIM]) {
@@ -557,12 +586,6 @@ void SpatialMaterial::_update_shader() {
code += "\tALBEDO.rgb = mix(ALBEDO.rgb,detail,detail_mask_tex.r);\n";
}
- code += "\tfloat metallic_tex = texture(texture_metallic,base_uv).r;\n";
- code += "\tMETALLIC = metallic_tex * metallic;\n";
- code += "\tfloat roughness_tex = texture(texture_roughness,base_uv).r;\n";
- code += "\tROUGHNESS = roughness_tex * roughness;\n";
- code += "\tSPECULAR = specular;\n";
-
code += "}\n";
ShaderData shader_data;
@@ -777,16 +800,6 @@ float SpatialMaterial::get_refraction() const {
return refraction;
}
-void SpatialMaterial::set_refraction_roughness(float p_refraction_roughness) {
-
- refraction_roughness = p_refraction_roughness;
- VS::get_singleton()->material_set_param(_get_material(), shader_names->refraction_roughness, refraction_roughness);
-}
-float SpatialMaterial::get_refraction_roughness() const {
-
- return refraction_roughness;
-}
-
void SpatialMaterial::set_detail_uv(DetailUV p_detail_uv) {
if (detail_uv == p_detail_uv)
@@ -1125,9 +1138,6 @@ void SpatialMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_refraction", "refraction"), &SpatialMaterial::set_refraction);
ClassDB::bind_method(D_METHOD("get_refraction"), &SpatialMaterial::get_refraction);
- ClassDB::bind_method(D_METHOD("set_refraction_roughness", "refraction_roughness"), &SpatialMaterial::set_refraction_roughness);
- ClassDB::bind_method(D_METHOD("get_refraction_roughness"), &SpatialMaterial::get_refraction_roughness);
-
ClassDB::bind_method(D_METHOD("set_line_width", "line_width"), &SpatialMaterial::set_line_width);
ClassDB::bind_method(D_METHOD("get_line_width"), &SpatialMaterial::get_line_width);
@@ -1277,8 +1287,7 @@ void SpatialMaterial::_bind_methods() {
ADD_GROUP("Refraction", "refraction_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "refraction_enabled"), "set_feature", "get_feature", FEATURE_REFRACTION);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "refraction_displacement", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_refraction", "get_refraction");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "refraction_roughness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_refraction_roughness", "get_refraction_roughness");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "refraction_scale", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_refraction", "get_refraction");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "refraction_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_REFRACTION);
ADD_GROUP("Detail", "detail_");
@@ -1381,8 +1390,7 @@ SpatialMaterial::SpatialMaterial()
set_anisotropy(0);
set_depth_scale(0.05);
set_subsurface_scattering_strength(0);
- set_refraction(0);
- set_refraction_roughness(0);
+ set_refraction(0.05);
set_line_width(1);
set_point_size(1);
set_uv1_offset(Vector2(0, 0));
diff --git a/scene/resources/material.h b/scene/resources/material.h
index e72d3d455b..b6e85c8332 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -248,7 +248,6 @@ private:
StringName depth_scale;
StringName subsurface_scattering_strength;
StringName refraction;
- StringName refraction_roughness;
StringName point_size;
StringName uv1_scale;
StringName uv1_offset;
@@ -288,7 +287,6 @@ private:
float depth_scale;
float subsurface_scattering_strength;
float refraction;
- float refraction_roughness;
float line_width;
float point_size;
int particles_anim_h_frames;
@@ -380,9 +378,6 @@ public:
void set_refraction(float p_refraction);
float get_refraction() const;
- void set_refraction_roughness(float p_refraction_roughness);
- float get_refraction_roughness() const;
-
void set_line_width(float p_line_width);
float get_line_width() const;
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index 472031366f..80b413630a 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -71,7 +71,7 @@ void PolygonPathFinder::setup(const Vector<Vector2> &p_points, const Vector<int>
outside_point.y = i == 0 ? p_points[0].y : (MAX(p_points[i].y, outside_point.y));
if (i == 0) {
- bounds.pos = points[i].pos;
+ bounds.position = points[i].pos;
} else {
bounds.expand_to(points[i].pos);
}
diff --git a/scene/resources/segment_shape_2d.cpp b/scene/resources/segment_shape_2d.cpp
index 145374ff05..99062d693b 100644
--- a/scene/resources/segment_shape_2d.cpp
+++ b/scene/resources/segment_shape_2d.cpp
@@ -35,7 +35,7 @@
void SegmentShape2D::_update_shape() {
Rect2 r;
- r.pos = a;
+ r.position = a;
r.size = b;
Physics2DServer::get_singleton()->shape_set_data(get_rid(), r);
emit_changed();
@@ -69,7 +69,7 @@ void SegmentShape2D::draw(const RID &p_to_rid, const Color &p_color) {
Rect2 SegmentShape2D::get_rect() const {
Rect2 rect;
- rect.pos = a;
+ rect.position = a;
rect.expand_to(b);
return rect;
}
@@ -121,7 +121,7 @@ void RayShape2D::draw(const RID &p_to_rid, const Color &p_color) {
Rect2 RayShape2D::get_rect() const {
Rect2 rect;
- rect.pos = Vector2();
+ rect.position = Vector2();
rect.expand_to(Vector2(0, length));
rect = rect.grow(0.707 * 4);
return rect;
diff --git a/scene/resources/shape_line_2d.cpp b/scene/resources/shape_line_2d.cpp
index 89c1cea252..c38ae04eff 100644
--- a/scene/resources/shape_line_2d.cpp
+++ b/scene/resources/shape_line_2d.cpp
@@ -76,7 +76,7 @@ Rect2 LineShape2D::get_rect() const {
Vector2 l1[2] = { point - get_normal().tangent() * 100, point + get_normal().tangent() * 100 };
Vector2 l2[2] = { point, point + get_normal() * 30 };
Rect2 rect;
- rect.pos = l1[0];
+ rect.position = l1[0];
rect.expand_to(l1[1]);
rect.expand_to(l2[0]);
rect.expand_to(l2[1]);
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index b665de2de1..8874cbc102 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -138,8 +138,8 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const {
texture->get_rect_region(rect, src_rect, rect, src_rect);
- rect.pos.x -= expand_margin[MARGIN_LEFT];
- rect.pos.y -= expand_margin[MARGIN_TOP];
+ rect.position.x -= expand_margin[MARGIN_LEFT];
+ rect.position.y -= expand_margin[MARGIN_TOP];
rect.size.x += expand_margin[MARGIN_LEFT] + expand_margin[MARGIN_RIGHT];
rect.size.y += expand_margin[MARGIN_TOP] + expand_margin[MARGIN_BOTTOM];
@@ -352,26 +352,26 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const {
color_downright.b = (border_size - i) * color_downright.b / border_size + i * bg_color.b / border_size;
}
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r.pos.x, r.pos.y + r.size.y - 1), Size2(r.size.x, 1)), color_downright);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r.pos.x + r.size.x - 1, r.pos.y), Size2(1, r.size.y)), color_downright);
+ vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r.position.x, r.position.y + r.size.y - 1), Size2(r.size.x, 1)), color_downright);
+ vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r.position.x + r.size.x - 1, r.position.y), Size2(1, r.size.y)), color_downright);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(r.pos, Size2(r.size.x, 1)), color_upleft);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(r.pos, Size2(1, r.size.y)), color_upleft);
+ vs->canvas_item_add_rect(p_canvas_item, Rect2(r.position, Size2(r.size.x, 1)), color_upleft);
+ vs->canvas_item_add_rect(p_canvas_item, Rect2(r.position, Size2(1, r.size.y)), color_upleft);
- r.pos.x++;
- r.pos.y++;
+ r.position.x++;
+ r.position.y++;
r.size.x -= 2;
r.size.y -= 2;
}
if (draw_center)
- vs->canvas_item_add_rect(p_canvas_item, Rect2(r.pos, r.size), bg_color);
+ vs->canvas_item_add_rect(p_canvas_item, Rect2(r.position, r.size), bg_color);
Rect2i r_add = p_rect;
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.pos.x - additional_border_size[MARGIN_LEFT], r_add.pos.y - additional_border_size[MARGIN_TOP]), Size2(r_add.size.width + additional_border_size[MARGIN_LEFT] + additional_border_size[MARGIN_RIGHT], additional_border_size[MARGIN_TOP])), light_color);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.pos.x - additional_border_size[MARGIN_LEFT], r_add.pos.y), Size2(additional_border_size[MARGIN_LEFT], r_add.size.height)), light_color);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.pos.x + r_add.size.width, r_add.pos.y), Size2(additional_border_size[MARGIN_RIGHT], r_add.size.height)), dark_color);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.pos.x - additional_border_size[MARGIN_LEFT], r_add.pos.y + r_add.size.height), Size2(r_add.size.width + additional_border_size[MARGIN_LEFT] + additional_border_size[MARGIN_RIGHT], additional_border_size[MARGIN_BOTTOM])), dark_color);
+ vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x - additional_border_size[MARGIN_LEFT], r_add.position.y - additional_border_size[MARGIN_TOP]), Size2(r_add.size.width + additional_border_size[MARGIN_LEFT] + additional_border_size[MARGIN_RIGHT], additional_border_size[MARGIN_TOP])), light_color);
+ vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x - additional_border_size[MARGIN_LEFT], r_add.position.y), Size2(additional_border_size[MARGIN_LEFT], r_add.size.height)), light_color);
+ vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x + r_add.size.width, r_add.position.y), Size2(additional_border_size[MARGIN_RIGHT], r_add.size.height)), dark_color);
+ vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x - additional_border_size[MARGIN_LEFT], r_add.position.y + r_add.size.height), Size2(r_add.size.width + additional_border_size[MARGIN_LEFT] + additional_border_size[MARGIN_RIGHT], additional_border_size[MARGIN_BOTTOM])), dark_color);
}
float StyleBoxFlat::get_style_margin(Margin p_margin) const {
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 68a11b821d..a1e0c95dd9 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -860,7 +860,7 @@ void AtlasTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_m
rc.size.height = atlas->get_height();
}
- VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(p_pos + margin.pos, rc.size), atlas->get_rid(), rc, p_modulate, p_transpose);
+ VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(p_pos + margin.position, rc.size), atlas->get_rid(), rc, p_modulate, p_transpose);
}
void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose) const {
@@ -879,7 +879,7 @@ void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile
}
Vector2 scale = p_rect.size / (region.size + margin.size);
- Rect2 dr(p_rect.pos + margin.pos * scale, rc.size * scale);
+ Rect2 dr(p_rect.position + margin.position * scale, rc.size * scale);
VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), rc, p_modulate, p_transpose);
}
@@ -892,24 +892,24 @@ void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, cons
return;
Rect2 src = p_src_rect;
- src.pos += (rc.pos - margin.pos);
+ src.position += (rc.position - margin.position);
Rect2 src_c = rc.clip(src);
if (src_c.size == Size2())
return;
- Vector2 ofs = (src_c.pos - src.pos);
+ Vector2 ofs = (src_c.position - src.position);
Vector2 scale = p_rect.size / p_src_rect.size;
if (scale.x < 0) {
- float mx = (margin.size.width - margin.pos.x);
- mx -= margin.pos.x;
+ float mx = (margin.size.width - margin.position.x);
+ mx -= margin.position.x;
ofs.x = -(ofs.x + mx);
}
if (scale.y < 0) {
- float my = margin.size.height - margin.pos.y;
- my -= margin.pos.y;
+ float my = margin.size.height - margin.position.y;
+ my -= margin.position.y;
ofs.y = -(ofs.y + my);
}
- Rect2 dr(p_rect.pos + ofs * scale, src_c.size * scale);
+ Rect2 dr(p_rect.position + ofs * scale, src_c.size * scale);
VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), src_c, p_modulate, p_transpose);
}
@@ -922,24 +922,24 @@ bool AtlasTexture::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect,
return false;
Rect2 src = p_src_rect;
- src.pos += (rc.pos - margin.pos);
+ src.position += (rc.position - margin.position);
Rect2 src_c = rc.clip(src);
if (src_c.size == Size2())
return false;
- Vector2 ofs = (src_c.pos - src.pos);
+ Vector2 ofs = (src_c.position - src.position);
Vector2 scale = p_rect.size / p_src_rect.size;
if (scale.x < 0) {
- float mx = (margin.size.width - margin.pos.x);
- mx -= margin.pos.x;
+ float mx = (margin.size.width - margin.position.x);
+ mx -= margin.position.x;
ofs.x = -(ofs.x + mx);
}
if (scale.y < 0) {
- float my = margin.size.height - margin.pos.y;
- my -= margin.pos.y;
+ float my = margin.size.height - margin.position.y;
+ my -= margin.position.y;
ofs.y = -(ofs.y + my);
}
- Rect2 dr(p_rect.pos + ofs * scale, src_c.size * scale);
+ Rect2 dr(p_rect.position + ofs * scale, src_c.size * scale);
r_rect = dr;
r_src_rect = src_c;
@@ -1096,7 +1096,7 @@ void LargeTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile
for (int i = 0; i < pieces.size(); i++) {
// TODO
- pieces[i].texture->draw_rect(p_canvas_item, Rect2(pieces[i].offset * scale + p_rect.pos, pieces[i].texture->get_size() * scale), false, p_modulate, p_transpose);
+ pieces[i].texture->draw_rect(p_canvas_item, Rect2(pieces[i].offset * scale + p_rect.position, pieces[i].texture->get_size() * scale), false, p_modulate, p_transpose);
}
}
void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose) const {
@@ -1116,8 +1116,8 @@ void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, cons
Rect2 local = p_src_rect.clip(rect);
Rect2 target = local;
target.size *= scale;
- target.pos = p_rect.pos + (p_src_rect.pos + rect.pos) * scale;
- local.pos -= rect.pos;
+ target.position = p_rect.position + (p_src_rect.position + rect.position) * scale;
+ local.position -= rect.position;
pieces[i].texture->draw_rect_region(p_canvas_item, target, local, p_modulate, p_transpose);
}
}
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index db72ccd03c..ec9ec96e50 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -97,9 +97,9 @@ struct SpatialIndexer2D {
void _notifier_update_cells(VisibilityNotifier2D *p_notifier, const Rect2 &p_rect, bool p_add) {
- Point2i begin = p_rect.pos;
+ Point2i begin = p_rect.position;
begin /= cell_size;
- Point2i end = p_rect.pos + p_rect.size;
+ Point2i end = p_rect.position + p_rect.size;
end /= cell_size;
for (int i = begin.x; i <= end.x; i++) {
@@ -220,9 +220,9 @@ struct SpatialIndexer2D {
for (Map<Viewport *, ViewportData>::Element *E = viewports.front(); E; E = E->next()) {
- Point2i begin = E->get().rect.pos;
+ Point2i begin = E->get().rect.position;
begin /= cell_size;
- Point2i end = E->get().rect.pos + E->get().rect.size;
+ Point2i end = E->get().rect.position + E->get().rect.size;
end /= cell_size;
pass++;
List<VisibilityNotifier2D *> added;