summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
Diffstat (limited to 'servers')
-rw-r--r--servers/physics/collision_solver_sat.cpp18
-rw-r--r--servers/physics_2d/space_2d_sw.cpp5
-rw-r--r--servers/physics_2d_server.cpp2
-rw-r--r--servers/physics_server.cpp2
-rw-r--r--servers/visual/shader_language.cpp14
5 files changed, 24 insertions, 17 deletions
diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics/collision_solver_sat.cpp
index eefb0f0396..e587485fcb 100644
--- a/servers/physics/collision_solver_sat.cpp
+++ b/servers/physics/collision_solver_sat.cpp
@@ -341,26 +341,26 @@ public:
min_B -= (max_A - min_A) * 0.5;
max_B += (max_A - min_A) * 0.5;
- real_t dmin = min_B - (min_A + max_A) * 0.5;
- real_t dmax = max_B - (min_A + max_A) * 0.5;
+ min_B -= (min_A + max_A) * 0.5;
+ max_B -= (min_A + max_A) * 0.5;
- if (dmin > 0.0 || dmax < 0.0) {
+ if (min_B > 0.0 || max_B < 0.0) {
separator_axis = axis;
return false; // doesn't contain 0
}
//use the smallest depth
- dmin = Math::abs(dmin);
+ min_B = -min_B;
- if (dmax < dmin) {
- if (dmax < best_depth) {
- best_depth = dmax;
+ if (max_B < min_B) {
+ if (max_B < best_depth) {
+ best_depth = max_B;
best_axis = axis;
}
} else {
- if (dmin < best_depth) {
- best_depth = dmin;
+ if (min_B < best_depth) {
+ best_depth = min_B;
best_axis = -axis; // keep it as A axis
}
}
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index 503ca0af4a..0e1f74d8d0 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -181,12 +181,15 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Trans
Rect2 aabb = p_xform.xform(shape->get_aabb());
aabb = aabb.grow(p_margin);
- int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, p_result_max, space->intersection_query_subindex_results);
+ int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
int cc = 0;
for (int i = 0; i < amount; i++) {
+ if (cc >= p_result_max)
+ break;
+
if (!_can_collide_with(space->intersection_query_results[i], p_collision_mask))
continue;
diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp
index fafc239c7f..cb7669ec24 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_2d_server.cpp
@@ -540,6 +540,8 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("area_get_object_instance_id", "area"), &Physics2DServer::area_get_object_instance_id);
ClassDB::bind_method(D_METHOD("area_set_monitor_callback", "area", "receiver", "method"), &Physics2DServer::area_set_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_area_monitor_callback", "area", "receiver", "method"), &Physics2DServer::area_set_area_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_monitorable", "area", "monitorable"), &Physics2DServer::area_set_monitorable);
ClassDB::bind_method(D_METHOD("body_create"), &Physics2DServer::body_create);
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp
index 08af26c24b..82c4eb2e13 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server.cpp
@@ -444,6 +444,8 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("area_get_object_instance_id", "area"), &PhysicsServer::area_get_object_instance_id);
ClassDB::bind_method(D_METHOD("area_set_monitor_callback", "area", "receiver", "method"), &PhysicsServer::area_set_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_area_monitor_callback", "area", "receiver", "method"), &PhysicsServer::area_set_area_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_monitorable", "area", "monitorable"), &PhysicsServer::area_set_monitorable);
ClassDB::bind_method(D_METHOD("area_set_ray_pickable", "area", "enable"), &PhysicsServer::area_set_ray_pickable);
ClassDB::bind_method(D_METHOD("area_is_ray_pickable", "area"), &PhysicsServer::area_is_ray_pickable);
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index d399c548f3..2069e64c43 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -1625,14 +1625,14 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "smoothstep", TYPE_VEC4, { TYPE_FLOAT, TYPE_FLOAT, TYPE_VEC4, TYPE_VOID } },
{ "isnan", TYPE_BOOL, { TYPE_FLOAT, TYPE_VOID } },
- { "isnan", TYPE_BOOL, { TYPE_VEC2, TYPE_VOID } },
- { "isnan", TYPE_BOOL, { TYPE_VEC3, TYPE_VOID } },
- { "isnan", TYPE_BOOL, { TYPE_VEC4, TYPE_VOID } },
+ { "isnan", TYPE_BVEC2, { TYPE_VEC2, TYPE_VOID } },
+ { "isnan", TYPE_BVEC3, { TYPE_VEC3, TYPE_VOID } },
+ { "isnan", TYPE_BVEC4, { TYPE_VEC4, TYPE_VOID } },
{ "isinf", TYPE_BOOL, { TYPE_FLOAT, TYPE_VOID } },
- { "isinf", TYPE_BOOL, { TYPE_VEC2, TYPE_VOID } },
- { "isinf", TYPE_BOOL, { TYPE_VEC3, TYPE_VOID } },
- { "isinf", TYPE_BOOL, { TYPE_VEC4, TYPE_VOID } },
+ { "isinf", TYPE_BVEC2, { TYPE_VEC2, TYPE_VOID } },
+ { "isinf", TYPE_BVEC3, { TYPE_VEC3, TYPE_VOID } },
+ { "isinf", TYPE_BVEC4, { TYPE_VEC4, TYPE_VOID } },
{ "floatBitsToInt", TYPE_INT, { TYPE_FLOAT, TYPE_VOID } },
{ "floatBitsToInt", TYPE_IVEC2, { TYPE_VEC2, TYPE_VOID } },
@@ -2300,7 +2300,7 @@ bool ShaderLanguage::_validate_assign(Node *p_node, const Map<StringName, BuiltI
if (p_node->type == Node::TYPE_OPERATOR) {
OperatorNode *op = static_cast<OperatorNode *>(p_node);
- if (op->type == OP_INDEX) {
+ if (op->op == OP_INDEX) {
return _validate_assign(op->arguments[0], p_builtin_types);
}
}