summaryrefslogtreecommitdiff
path: root/servers/physics
diff options
context:
space:
mode:
Diffstat (limited to 'servers/physics')
-rw-r--r--servers/physics/broad_phase_basic.cpp10
-rw-r--r--servers/physics/broad_phase_basic.h6
-rw-r--r--servers/physics/broad_phase_octree.cpp6
-rw-r--r--servers/physics/broad_phase_octree.h4
-rw-r--r--servers/physics/broad_phase_sw.h6
-rw-r--r--servers/physics/collision_object_sw.cpp6
-rw-r--r--servers/physics/collision_object_sw.h4
-rw-r--r--servers/physics/collision_solver_sw.cpp10
-rw-r--r--servers/physics/collision_solver_sw.h2
-rw-r--r--servers/physics/shape_sw.cpp36
-rw-r--r--servers/physics/shape_sw.h18
-rw-r--r--servers/physics/space_sw.cpp16
-rw-r--r--servers/physics/space_sw.h2
13 files changed, 63 insertions, 63 deletions
diff --git a/servers/physics/broad_phase_basic.cpp b/servers/physics/broad_phase_basic.cpp
index c6565ac2e9..e4eae09c61 100644
--- a/servers/physics/broad_phase_basic.cpp
+++ b/servers/physics/broad_phase_basic.cpp
@@ -46,7 +46,7 @@ BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object, int p_subi
return current;
}
-void BroadPhaseBasic::move(ID p_id, const Rect3 &p_aabb) {
+void BroadPhaseBasic::move(ID p_id, const AABB &p_aabb) {
Map<ID, Element>::Element *E = element_map.find(p_id);
ERR_FAIL_COND(!E);
@@ -109,7 +109,7 @@ int BroadPhaseBasic::cull_point(const Vector3 &p_point, CollisionObjectSW **p_re
for (Map<ID, Element>::Element *E = element_map.front(); E; E = E->next()) {
- const Rect3 aabb = E->get().aabb;
+ const AABB aabb = E->get().aabb;
if (aabb.has_point(p_point)) {
p_results[rc] = E->get().owner;
@@ -129,7 +129,7 @@ int BroadPhaseBasic::cull_segment(const Vector3 &p_from, const Vector3 &p_to, Co
for (Map<ID, Element>::Element *E = element_map.front(); E; E = E->next()) {
- const Rect3 aabb = E->get().aabb;
+ const AABB aabb = E->get().aabb;
if (aabb.intersects_segment(p_from, p_to)) {
p_results[rc] = E->get().owner;
@@ -142,13 +142,13 @@ int BroadPhaseBasic::cull_segment(const Vector3 &p_from, const Vector3 &p_to, Co
return rc;
}
-int BroadPhaseBasic::cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
+int BroadPhaseBasic::cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
int rc = 0;
for (Map<ID, Element>::Element *E = element_map.front(); E; E = E->next()) {
- const Rect3 aabb = E->get().aabb;
+ const AABB aabb = E->get().aabb;
if (aabb.intersects(p_aabb)) {
p_results[rc] = E->get().owner;
diff --git a/servers/physics/broad_phase_basic.h b/servers/physics/broad_phase_basic.h
index 5c124c1792..ee683ed840 100644
--- a/servers/physics/broad_phase_basic.h
+++ b/servers/physics/broad_phase_basic.h
@@ -39,7 +39,7 @@ class BroadPhaseBasic : public BroadPhaseSW {
CollisionObjectSW *owner;
bool _static;
- Rect3 aabb;
+ AABB aabb;
int subindex;
};
@@ -83,7 +83,7 @@ class BroadPhaseBasic : public BroadPhaseSW {
public:
// 0 is an invalid ID
virtual ID create(CollisionObjectSW *p_object, int p_subindex = 0);
- virtual void move(ID p_id, const Rect3 &p_aabb);
+ virtual void move(ID p_id, const AABB &p_aabb);
virtual void set_static(ID p_id, bool p_static);
virtual void remove(ID p_id);
@@ -93,7 +93,7 @@ public:
virtual int cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata);
diff --git a/servers/physics/broad_phase_octree.cpp b/servers/physics/broad_phase_octree.cpp
index e7111d9580..3b18a270f0 100644
--- a/servers/physics/broad_phase_octree.cpp
+++ b/servers/physics/broad_phase_octree.cpp
@@ -32,11 +32,11 @@
BroadPhaseSW::ID BroadPhaseOctree::create(CollisionObjectSW *p_object, int p_subindex) {
- ID oid = octree.create(p_object, Rect3(), p_subindex, false, 1 << p_object->get_type(), 0);
+ ID oid = octree.create(p_object, AABB(), p_subindex, false, 1 << p_object->get_type(), 0);
return oid;
}
-void BroadPhaseOctree::move(ID p_id, const Rect3 &p_aabb) {
+void BroadPhaseOctree::move(ID p_id, const AABB &p_aabb) {
octree.move(p_id, p_aabb);
}
@@ -76,7 +76,7 @@ int BroadPhaseOctree::cull_segment(const Vector3 &p_from, const Vector3 &p_to, C
return octree.cull_segment(p_from, p_to, p_results, p_max_results, p_result_indices);
}
-int BroadPhaseOctree::cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
+int BroadPhaseOctree::cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
return octree.cull_aabb(p_aabb, p_results, p_max_results, p_result_indices);
}
diff --git a/servers/physics/broad_phase_octree.h b/servers/physics/broad_phase_octree.h
index d28f2da13f..f894d6ca5a 100644
--- a/servers/physics/broad_phase_octree.h
+++ b/servers/physics/broad_phase_octree.h
@@ -48,7 +48,7 @@ class BroadPhaseOctree : public BroadPhaseSW {
public:
// 0 is an invalid ID
virtual ID create(CollisionObjectSW *p_object, int p_subindex = 0);
- virtual void move(ID p_id, const Rect3 &p_aabb);
+ virtual void move(ID p_id, const AABB &p_aabb);
virtual void set_static(ID p_id, bool p_static);
virtual void remove(ID p_id);
@@ -58,7 +58,7 @@ public:
virtual int cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata);
diff --git a/servers/physics/broad_phase_sw.h b/servers/physics/broad_phase_sw.h
index 2b5ed629fe..5ad3f9a261 100644
--- a/servers/physics/broad_phase_sw.h
+++ b/servers/physics/broad_phase_sw.h
@@ -30,8 +30,8 @@
#ifndef BROAD_PHASE_SW_H
#define BROAD_PHASE_SW_H
+#include "aabb.h"
#include "math_funcs.h"
-#include "rect3.h"
class CollisionObjectSW;
@@ -49,7 +49,7 @@ public:
// 0 is an invalid ID
virtual ID create(CollisionObjectSW *p_object_, int p_subindex = 0) = 0;
- virtual void move(ID p_id, const Rect3 &p_aabb) = 0;
+ virtual void move(ID p_id, const AABB &p_aabb) = 0;
virtual void set_static(ID p_id, bool p_static) = 0;
virtual void remove(ID p_id) = 0;
@@ -59,7 +59,7 @@ public:
virtual int cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
- virtual int cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
+ virtual int cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata) = 0;
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) = 0;
diff --git a/servers/physics/collision_object_sw.cpp b/servers/physics/collision_object_sw.cpp
index 3af8b542fa..126f8141ff 100644
--- a/servers/physics/collision_object_sw.cpp
+++ b/servers/physics/collision_object_sw.cpp
@@ -149,7 +149,7 @@ void CollisionObjectSW::_update_shapes() {
}
//not quite correct, should compute the next matrix..
- Rect3 shape_aabb = s.shape->get_aabb();
+ AABB shape_aabb = s.shape->get_aabb();
Transform xform = transform * s.xform;
shape_aabb = xform.xform(shape_aabb);
s.aabb_cache = shape_aabb;
@@ -176,10 +176,10 @@ void CollisionObjectSW::_update_shapes_with_motion(const Vector3 &p_motion) {
}
//not quite correct, should compute the next matrix..
- Rect3 shape_aabb = s.shape->get_aabb();
+ AABB shape_aabb = s.shape->get_aabb();
Transform xform = transform * s.xform;
shape_aabb = xform.xform(shape_aabb);
- shape_aabb = shape_aabb.merge(Rect3(shape_aabb.position + p_motion, shape_aabb.size)); //use motion
+ shape_aabb = shape_aabb.merge(AABB(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/collision_object_sw.h b/servers/physics/collision_object_sw.h
index 67a8a44944..254947060b 100644
--- a/servers/physics/collision_object_sw.h
+++ b/servers/physics/collision_object_sw.h
@@ -61,7 +61,7 @@ private:
Transform xform;
Transform xform_inv;
BroadPhaseSW::ID bpid;
- Rect3 aabb_cache; //for rayqueries
+ AABB aabb_cache; //for rayqueries
real_t area_cache;
ShapeSW *shape;
bool disabled;
@@ -123,7 +123,7 @@ public:
_FORCE_INLINE_ ShapeSW *get_shape(int p_index) const { return shapes[p_index].shape; }
_FORCE_INLINE_ const Transform &get_shape_transform(int p_index) const { return shapes[p_index].xform; }
_FORCE_INLINE_ const Transform &get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; }
- _FORCE_INLINE_ const Rect3 &get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; }
+ _FORCE_INLINE_ const AABB &get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; }
_FORCE_INLINE_ const real_t get_shape_area(int p_index) const { return shapes[p_index].area_cache; }
_FORCE_INLINE_ Transform get_transform() const { return transform; }
diff --git a/servers/physics/collision_solver_sw.cpp b/servers/physics/collision_solver_sw.cpp
index 7bef208237..a9431dc6d8 100644
--- a/servers/physics/collision_solver_sw.cpp
+++ b/servers/physics/collision_solver_sw.cpp
@@ -152,7 +152,7 @@ bool CollisionSolverSW::solve_concave(const ShapeSW *p_shape_A, const Transform
//quickly compute a local AABB
- Rect3 local_aabb;
+ AABB local_aabb;
for (int i = 0; i < 3; i++) {
Vector3 axis(p_transform_B.basis.get_axis(i));
@@ -291,7 +291,7 @@ bool CollisionSolverSW::solve_distance_plane(const ShapeSW *p_shape_A, const Tra
return collided;
}
-bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const Rect3 &p_concave_hint, Vector3 *r_sep_axis) {
+bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis) {
if (p_shape_A->is_concave())
return false;
@@ -328,14 +328,14 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform
//quickly compute a local AABB
- bool use_cc_hint = p_concave_hint != Rect3();
- Rect3 cc_hint_aabb;
+ bool use_cc_hint = p_concave_hint != AABB();
+ AABB cc_hint_aabb;
if (use_cc_hint) {
cc_hint_aabb = p_concave_hint;
cc_hint_aabb.position -= p_transform_B.origin;
}
- Rect3 local_aabb;
+ AABB local_aabb;
for (int i = 0; i < 3; i++) {
Vector3 axis(p_transform_B.basis.get_axis(i));
diff --git a/servers/physics/collision_solver_sw.h b/servers/physics/collision_solver_sw.h
index 1e38b1b54e..a40b665ff0 100644
--- a/servers/physics/collision_solver_sw.h
+++ b/servers/physics/collision_solver_sw.h
@@ -46,7 +46,7 @@ private:
public:
static bool solve_static(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, Vector3 *r_sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0);
- static bool solve_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const Rect3 &p_concave_hint, Vector3 *r_sep_axis = NULL);
+ static bool solve_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis = NULL);
};
#endif // COLLISION_SOLVER__SW_H
diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp
index 6dafaac115..b204ff7a33 100644
--- a/servers/physics/shape_sw.cpp
+++ b/servers/physics/shape_sw.cpp
@@ -37,7 +37,7 @@
#define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.0002
#define _FACE_IS_VALID_SUPPORT_THRESHOLD 0.9998
-void ShapeSW::configure(const Rect3 &p_aabb) {
+void ShapeSW::configure(const AABB &p_aabb) {
aabb = p_aabb;
configured = true;
for (Map<ShapeOwnerSW *, int>::Element *E = owners.front(); E; E = E->next()) {
@@ -141,7 +141,7 @@ Vector3 PlaneShapeSW::get_moment_of_inertia(real_t p_mass) const {
void PlaneShapeSW::_setup(const Plane &p_plane) {
plane = p_plane;
- configure(Rect3(Vector3(-1e4, -1e4, -1e4), Vector3(1e4 * 2, 1e4 * 2, 1e4 * 2)));
+ configure(AABB(Vector3(-1e4, -1e4, -1e4), Vector3(1e4 * 2, 1e4 * 2, 1e4 * 2)));
}
void PlaneShapeSW::set_data(const Variant &p_data) {
@@ -223,7 +223,7 @@ Vector3 RayShapeSW::get_moment_of_inertia(real_t p_mass) const {
void RayShapeSW::_setup(real_t p_length) {
length = p_length;
- configure(Rect3(Vector3(0, 0, 0), Vector3(0.1, 0.1, length)));
+ configure(AABB(Vector3(0, 0, 0), Vector3(0.1, 0.1, length)));
}
void RayShapeSW::set_data(const Variant &p_data) {
@@ -299,7 +299,7 @@ Vector3 SphereShapeSW::get_moment_of_inertia(real_t p_mass) const {
void SphereShapeSW::_setup(real_t p_radius) {
radius = p_radius;
- configure(Rect3(Vector3(-radius, -radius, -radius), Vector3(radius * 2.0, radius * 2.0, radius * 2.0)));
+ configure(AABB(Vector3(-radius, -radius, -radius), Vector3(radius * 2.0, radius * 2.0, radius * 2.0)));
}
void SphereShapeSW::set_data(const Variant &p_data) {
@@ -430,7 +430,7 @@ void BoxShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_sup
bool BoxShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
- Rect3 aabb(-half_extents, half_extents * 2.0);
+ AABB aabb(-half_extents, half_extents * 2.0);
return aabb.intersects_segment(p_begin, p_end, &r_result, &r_normal);
}
@@ -504,7 +504,7 @@ void BoxShapeSW::_setup(const Vector3 &p_half_extents) {
half_extents = p_half_extents.abs();
- configure(Rect3(-half_extents, half_extents * 2));
+ configure(AABB(-half_extents, half_extents * 2));
}
void BoxShapeSW::set_data(const Variant &p_data) {
@@ -684,7 +684,7 @@ void CapsuleShapeSW::_setup(real_t p_height, real_t p_radius) {
height = p_height;
radius = p_radius;
- configure(Rect3(Vector3(-radius, -radius, -height * 0.5 - radius), Vector3(radius * 2, radius * 2, height + radius * 2.0)));
+ configure(AABB(Vector3(-radius, -radius, -height * 0.5 - radius), Vector3(radius * 2, radius * 2, height + radius * 2.0)));
}
void CapsuleShapeSW::set_data(const Variant &p_data) {
@@ -957,7 +957,7 @@ void ConvexPolygonShapeSW::_setup(const Vector<Vector3> &p_vertices) {
if (err != OK)
ERR_PRINT("Failed to build QuickHull");
- Rect3 _aabb;
+ AABB _aabb;
for (int i = 0; i < mesh.vertices.size(); i++) {
@@ -1102,7 +1102,7 @@ Vector3 FaceShapeSW::get_moment_of_inertia(real_t p_mass) const {
FaceShapeSW::FaceShapeSW() {
- configure(Rect3());
+ configure(AABB());
}
PoolVector<Vector3> ConcavePolygonShapeSW::get_faces() const {
@@ -1300,13 +1300,13 @@ void ConcavePolygonShapeSW::_cull(int p_idx, _CullParams *p_params) const {
}
}
-void ConcavePolygonShapeSW::cull(const Rect3 &p_local_aabb, Callback p_callback, void *p_userdata) const {
+void ConcavePolygonShapeSW::cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const {
// make matrix local to concave
if (faces.size() == 0)
return;
- Rect3 local_aabb = p_local_aabb;
+ AABB local_aabb = p_local_aabb;
// unlock data
PoolVector<Face>::Read fr = faces.read();
@@ -1341,7 +1341,7 @@ Vector3 ConcavePolygonShapeSW::get_moment_of_inertia(real_t p_mass) const {
struct _VolumeSW_BVH_Element {
- Rect3 aabb;
+ AABB aabb;
Vector3 center;
int face_index;
};
@@ -1372,7 +1372,7 @@ struct _VolumeSW_BVH_CompareZ {
struct _VolumeSW_BVH {
- Rect3 aabb;
+ AABB aabb;
_VolumeSW_BVH *left;
_VolumeSW_BVH *right;
@@ -1396,7 +1396,7 @@ _VolumeSW_BVH *_volume_sw_build_bvh(_VolumeSW_BVH_Element *p_elements, int p_siz
bvh->face_index = -1;
}
- Rect3 aabb;
+ AABB aabb;
for (int i = 0; i < p_size; i++) {
if (i == 0)
@@ -1467,7 +1467,7 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) {
int src_face_count = p_faces.size();
if (src_face_count == 0) {
- configure(Rect3());
+ configure(AABB());
return;
}
ERR_FAIL_COND(src_face_count % 3);
@@ -1491,7 +1491,7 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) {
PoolVector<Vector3>::Write vw = vertices.write();
Vector3 *verticesw = vw.ptr();
- Rect3 _aabb;
+ AABB _aabb;
for (int i = 0; i < src_face_count; i++) {
@@ -1588,7 +1588,7 @@ Vector3 HeightMapShapeSW::get_closest_point_to(const Vector3 &p_point) const {
return Vector3();
}
-void HeightMapShapeSW::cull(const Rect3 &p_local_aabb, Callback p_callback, void *p_userdata) const {
+void HeightMapShapeSW::cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const {
}
Vector3 HeightMapShapeSW::get_moment_of_inertia(real_t p_mass) const {
@@ -1611,7 +1611,7 @@ void HeightMapShapeSW::_setup(PoolVector<real_t> p_heights, int p_width, int p_d
PoolVector<real_t>::Read r = heights.read();
- Rect3 aabb;
+ AABB aabb;
for (int i = 0; i < depth; i++) {
diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h
index 151b84c054..48832affc9 100644
--- a/servers/physics/shape_sw.h
+++ b/servers/physics/shape_sw.h
@@ -58,14 +58,14 @@ public:
class ShapeSW : public RID_Data {
RID self;
- Rect3 aabb;
+ AABB aabb;
bool configured;
real_t custom_bias;
Map<ShapeOwnerSW *, int> owners;
protected:
- void configure(const Rect3 &p_aabb);
+ void configure(const AABB &p_aabb);
public:
enum {
@@ -79,7 +79,7 @@ public:
virtual PhysicsServer::ShapeType get_type() const = 0;
- _FORCE_INLINE_ Rect3 get_aabb() const { return aabb; }
+ _FORCE_INLINE_ AABB get_aabb() const { return aabb; }
_FORCE_INLINE_ bool is_configured() const { return configured; }
virtual bool is_concave() const { return false; }
@@ -114,7 +114,7 @@ public:
typedef void (*Callback)(void *p_userdata, ShapeSW *p_convex);
virtual void get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const { r_amount = 0; }
- virtual void cull(const Rect3 &p_local_aabb, Callback p_callback, void *p_userdata) const = 0;
+ virtual void cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const = 0;
ConcaveShapeSW() {}
};
@@ -299,7 +299,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW {
struct BVH {
- Rect3 aabb;
+ AABB aabb;
int left;
int right;
@@ -310,7 +310,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW {
struct _CullParams {
- Rect3 aabb;
+ AABB aabb;
Callback callback;
void *userdata;
const Face *faces;
@@ -353,7 +353,7 @@ public:
virtual bool intersect_point(const Vector3 &p_point) const;
virtual Vector3 get_closest_point_to(const Vector3 &p_point) const;
- virtual void cull(const Rect3 &p_local_aabb, Callback p_callback, void *p_userdata) const;
+ virtual void cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const;
virtual Vector3 get_moment_of_inertia(real_t p_mass) const;
@@ -389,7 +389,7 @@ public:
virtual bool intersect_point(const Vector3 &p_point) const;
virtual Vector3 get_closest_point_to(const Vector3 &p_point) const;
- virtual void cull(const Rect3 &p_local_aabb, Callback p_callback, void *p_userdata) const;
+ virtual void cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const;
virtual Vector3 get_moment_of_inertia(real_t p_mass) const;
@@ -462,7 +462,7 @@ struct MotionShapeSW : public ShapeSW {
virtual void set_data(const Variant &p_data) {}
virtual Variant get_data() const { return Variant(); }
- MotionShapeSW() { configure(Rect3()); }
+ MotionShapeSW() { configure(AABB()); }
};
struct _ShapeTestConvexBSPSW {
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index 7fac56f3d7..a6426b7ee0 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -176,7 +176,7 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transfo
ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape, 0);
- Rect3 aabb = p_xform.xform(shape->get_aabb());
+ AABB aabb = p_xform.xform(shape->get_aabb());
int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
@@ -224,8 +224,8 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape, false);
- Rect3 aabb = p_xform.xform(shape->get_aabb());
- aabb = aabb.merge(Rect3(aabb.position + p_motion, aabb.size)); //motion
+ AABB aabb = p_xform.xform(shape->get_aabb());
+ aabb = aabb.merge(AABB(aabb.position + p_motion, aabb.size)); //motion
aabb = aabb.grow(p_margin);
/*
@@ -341,7 +341,7 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_sh
ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape, 0);
- Rect3 aabb = p_shape_xform.xform(shape->get_aabb());
+ AABB aabb = p_shape_xform.xform(shape->get_aabb());
aabb = aabb.grow(p_margin);
int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
@@ -417,7 +417,7 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_
ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape, 0);
- Rect3 aabb = p_shape_xform.xform(shape->get_aabb());
+ AABB aabb = p_shape_xform.xform(shape->get_aabb());
aabb = aabb.grow(p_margin);
int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
@@ -514,7 +514,7 @@ PhysicsDirectSpaceStateSW::PhysicsDirectSpaceStateSW() {
////////////////////////////////////////////////////////////////////////////////////////////////////////////
-int SpaceSW::_cull_aabb_for_body(BodySW *p_body, const Rect3 &p_aabb) {
+int SpaceSW::_cull_aabb_for_body(BodySW *p_body, const AABB &p_aabb) {
int amount = broadphase->cull_aabb(p_aabb, intersection_query_results, INTERSECTION_QUERY_MAX, intersection_query_subindex_results);
@@ -561,7 +561,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
r_result->collider_id = 0;
r_result->collider_shape = 0;
}
- Rect3 body_aabb;
+ AABB body_aabb;
for (int i = 0; i < p_body->get_shape_count(); i++) {
@@ -648,7 +648,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
{
// STEP 2 ATTEMPT MOTION
- Rect3 motion_aabb = body_aabb;
+ AABB motion_aabb = body_aabb;
motion_aabb.position += p_motion;
motion_aabb = motion_aabb.merge(body_aabb);
diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h
index 270e4ef1bd..fd7e6d16a9 100644
--- a/servers/physics/space_sw.h
+++ b/servers/physics/space_sw.h
@@ -122,7 +122,7 @@ private:
friend class PhysicsDirectSpaceStateSW;
- int _cull_aabb_for_body(BodySW *p_body, const Rect3 &p_aabb);
+ int _cull_aabb_for_body(BodySW *p_body, const AABB &p_aabb);
public:
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }