summaryrefslogtreecommitdiff
path: root/servers/physics_2d
diff options
context:
space:
mode:
authoralexholly <alexander.holland@live.de>2017-06-04 00:25:13 +0200
committeralexholly <alexander.holland@live.de>2017-06-04 02:09:17 +0200
commita3c90b029308eb46b7fd83a0cf7b502ecbd79d55 (patch)
tree37aaaa84b53d962b441de0683a502e189cb371bb /servers/physics_2d
parent69bec86028f87307e549d7a2f49bbb7e2b1f3771 (diff)
renamed all Rect2.pos to Rect2.position
Diffstat (limited to 'servers/physics_2d')
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.cpp12
-rw-r--r--servers/physics_2d/collision_object_2d_sw.cpp2
-rw-r--r--servers/physics_2d/collision_solver_2d_sw.cpp2
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp16
-rw-r--r--servers/physics_2d/shape_2d_sw.h4
-rw-r--r--servers/physics_2d/space_2d_sw.cpp14
6 files changed, 25 insertions, 25 deletions
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
index e39a5b6df1..438cd416f6 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
@@ -116,8 +116,8 @@ void BroadPhase2DHashGrid::_enter_grid(Element *p_elem, const Rect2 &p_rect, boo
return;
}
- Point2i from = (p_rect.pos / cell_size).floor();
- Point2i to = ((p_rect.pos + p_rect.size) / cell_size).floor();
+ Point2i from = (p_rect.position / cell_size).floor();
+ Point2i to = ((p_rect.position + p_rect.size) / cell_size).floor();
for (int i = from.x; i <= to.x; i++) {
@@ -214,8 +214,8 @@ void BroadPhase2DHashGrid::_exit_grid(Element *p_elem, const Rect2 &p_rect, bool
return;
}
- Point2i from = (p_rect.pos / cell_size).floor();
- Point2i to = ((p_rect.pos + p_rect.size) / cell_size).floor();
+ Point2i from = (p_rect.position / cell_size).floor();
+ Point2i to = ((p_rect.position + p_rect.size) / cell_size).floor();
for (int i = from.x; i <= to.x; i++) {
@@ -574,8 +574,8 @@ int BroadPhase2DHashGrid::cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p
pass++;
- Point2i from = (p_aabb.pos / cell_size).floor();
- Point2i to = ((p_aabb.pos + p_aabb.size) / cell_size).floor();
+ Point2i from = (p_aabb.position / cell_size).floor();
+ Point2i to = ((p_aabb.position + p_aabb.size) / cell_size).floor();
int cullcount = 0;
for (int i = from.x; i <= to.x; i++) {
diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp
index 265b5bb836..b6c1d145df 100644
--- a/servers/physics_2d/collision_object_2d_sw.cpp
+++ b/servers/physics_2d/collision_object_2d_sw.cpp
@@ -169,7 +169,7 @@ void CollisionObject2DSW::_update_shapes_with_motion(const Vector2 &p_motion) {
Rect2 shape_aabb = s.shape->get_aabb();
Transform2D xform = transform * s.xform;
shape_aabb = xform.xform(shape_aabb);
- shape_aabb = shape_aabb.merge(Rect2(shape_aabb.pos + p_motion, shape_aabb.size)); //use motion
+ shape_aabb = shape_aabb.merge(Rect2(shape_aabb.position + p_motion, shape_aabb.size)); //use motion
s.aabb_cache = shape_aabb;
space->get_broadphase()->move(s.bpid, shape_aabb);
diff --git a/servers/physics_2d/collision_solver_2d_sw.cpp b/servers/physics_2d/collision_solver_2d_sw.cpp
index e57d1b7044..b482f826c2 100644
--- a/servers/physics_2d/collision_solver_2d_sw.cpp
+++ b/servers/physics_2d/collision_solver_2d_sw.cpp
@@ -203,7 +203,7 @@ bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A, const Transf
smin *= axis_scale;
smax *= axis_scale;
- local_aabb.pos[i] = smin;
+ local_aabb.position[i] = smin;
local_aabb.size[i] = smax - smin;
}
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index 203a1052b2..245b4e15bc 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -246,12 +246,12 @@ void SegmentShape2DSW::set_data(const Variant &p_data) {
ERR_FAIL_COND(p_data.get_type() != Variant::RECT2);
Rect2 r = p_data;
- a = r.pos;
+ a = r.position;
b = r.size;
n = (b - a).tangent();
Rect2 aabb;
- aabb.pos = a;
+ aabb.position = a;
aabb.expand_to(b);
if (aabb.size.x == 0)
aabb.size.x = 0.001;
@@ -263,7 +263,7 @@ void SegmentShape2DSW::set_data(const Variant &p_data) {
Variant SegmentShape2DSW::get_data() const {
Rect2 r;
- r.pos = a;
+ r.position = a;
r.size = b;
return r;
}
@@ -621,13 +621,13 @@ bool ConvexPolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Vec
real_t ConvexPolygonShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const {
Rect2 aabb;
- aabb.pos = points[0].pos * p_scale;
+ aabb.position = points[0].pos * p_scale;
for (int i = 0; i < point_count; i++) {
aabb.expand_to(points[i].pos * p_scale);
}
- return p_mass * aabb.size.dot(aabb.size) / 12.0 + p_mass * (aabb.pos + aabb.size * 0.5).length_squared();
+ return p_mass * aabb.size.dot(aabb.size) / 12.0 + p_mass * (aabb.position + aabb.size * 0.5).length_squared();
}
void ConvexPolygonShape2DSW::set_data(const Variant &p_data) {
@@ -677,7 +677,7 @@ void ConvexPolygonShape2DSW::set_data(const Variant &p_data) {
ERR_FAIL_COND(point_count == 0);
Rect2 aabb;
- aabb.pos = points[0].pos;
+ aabb.position = points[0].pos;
for (int i = 1; i < point_count; i++)
aabb.expand_to(points[i].pos);
@@ -942,7 +942,7 @@ void ConcavePolygonShape2DSW::set_data(const Variant &p_data) {
}
points.resize(pointmap.size());
- aabb.pos = pointmap.front()->key();
+ aabb.position = pointmap.front()->key();
for (Map<Point2, int>::Element *E = pointmap.front(); E; E = E->next()) {
aabb.expand_to(E->key());
@@ -953,7 +953,7 @@ void ConcavePolygonShape2DSW::set_data(const Variant &p_data) {
main_vbh.resize(segments.size());
for (int i = 0; i < main_vbh.size(); i++) {
- main_vbh[i].aabb.pos = points[segments[i].points[0]];
+ main_vbh[i].aabb.position = points[segments[i].points[0]];
main_vbh[i].aabb.expand_to(points[segments[i].points[1]]);
main_vbh[i].left = -1;
main_vbh[i].right = i;
diff --git a/servers/physics_2d/shape_2d_sw.h b/servers/physics_2d/shape_2d_sw.h
index 547ecdcd11..4cc98b7f1e 100644
--- a/servers/physics_2d/shape_2d_sw.h
+++ b/servers/physics_2d/shape_2d_sw.h
@@ -513,7 +513,7 @@ class ConcavePolygonShape2DSW : public ConcaveShape2DSW {
_FORCE_INLINE_ bool operator()(const BVH &a, const BVH &b) const {
- return (a.aabb.pos.x + a.aabb.size.x * 0.5) < (b.aabb.pos.x + b.aabb.size.x * 0.5);
+ return (a.aabb.position.x + a.aabb.size.x * 0.5) < (b.aabb.position.x + b.aabb.size.x * 0.5);
}
};
@@ -521,7 +521,7 @@ class ConcavePolygonShape2DSW : public ConcaveShape2DSW {
_FORCE_INLINE_ bool operator()(const BVH &a, const BVH &b) const {
- return (a.aabb.pos.y + a.aabb.size.y * 0.5) < (b.aabb.pos.y + b.aabb.size.y * 0.5);
+ return (a.aabb.position.y + a.aabb.size.y * 0.5) < (b.aabb.position.y + b.aabb.size.y * 0.5);
}
};
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index ac479aab7a..78b1e84734 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -50,7 +50,7 @@ int Physics2DDirectSpaceStateSW::intersect_point(const Vector2 &p_point, ShapeRe
return 0;
Rect2 aabb;
- aabb.pos = p_point - Vector2(0.00001, 0.00001);
+ aabb.position = p_point - Vector2(0.00001, 0.00001);
aabb.size = Vector2(0.00002, 0.00002);
int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
@@ -223,7 +223,7 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transfor
ERR_FAIL_COND_V(!shape, false);
Rect2 aabb = p_xform.xform(shape->get_aabb());
- aabb = aabb.merge(Rect2(aabb.pos + p_motion, aabb.size)); //motion
+ aabb = aabb.merge(Rect2(aabb.position + p_motion, aabb.size)); //motion
aabb = aabb.grow(p_margin);
/*
@@ -339,7 +339,7 @@ bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &
ERR_FAIL_COND_V(!shape, 0);
Rect2 aabb = p_shape_xform.xform(shape->get_aabb());
- aabb = aabb.merge(Rect2(aabb.pos + p_motion, aabb.size)); //motion
+ aabb = aabb.merge(Rect2(aabb.position + p_motion, aabb.size)); //motion
aabb = aabb.grow(p_margin);
int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
@@ -434,7 +434,7 @@ bool Physics2DDirectSpaceStateSW::rest_info(RID p_shape, const Transform2D &p_sh
ERR_FAIL_COND_V(!shape, 0);
Rect2 aabb = p_shape_xform.xform(shape->get_aabb());
- aabb = aabb.merge(Rect2(aabb.pos + p_motion, aabb.size)); //motion
+ aabb = aabb.merge(Rect2(aabb.position + p_motion, aabb.size)); //motion
aabb = aabb.grow(p_margin);
int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
@@ -656,7 +656,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
}
body_transform.elements[2] += recover_motion;
- body_aabb.pos += recover_motion;
+ body_aabb.position += recover_motion;
recover_attempts--;
@@ -671,7 +671,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
// STEP 2 ATTEMPT MOTION
Rect2 motion_aabb = body_aabb;
- motion_aabb.pos += p_motion;
+ motion_aabb.position += p_motion;
motion_aabb = motion_aabb.merge(body_aabb);
int amount = _cull_aabb_for_body(p_body, motion_aabb);
@@ -807,7 +807,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
Transform2D body_shape_xform = ugt * p_body->get_shape_transform(best_shape);
Shape2DSW *body_shape = p_body->get_shape(best_shape);
- body_aabb.pos += p_motion * unsafe;
+ body_aabb.position += p_motion * unsafe;
int amount = _cull_aabb_for_body(p_body, body_aabb);